> For the complete documentation index, see [llms.txt](https://doc.longrise.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.longrise.ai/technology/twin-engine.md).

# Twin Engine

The Casino AI Engine and the HFT Quant Engine — a dual-computation structure that combines nanosecond-level market signals with behavioral pattern prediction through a single Closed-Loop Feedback System.

***

| Metric                           | Value        |
| -------------------------------- | ------------ |
| Tick Throughput                  | 2.1M ticks/s |
| Average Order Execution Latency  | 0.6ms        |
| Combined Model Inference Latency | 3.1ms        |
| Daily Trade Executions           | 50,000+      |

## Casino AI Engine (Behavioral Pattern Prediction Model)

**Purpose:** Generate personalized recommendation signals by vectorizing casino betting data and member transaction patterns from around the world in real time.

Data from LONGRISE AI's casino partners in Georgia, Vietnam, Cambodia, the Philippines, and other partner hub countries totals an average of **48 million** betting events per day. Multi-layered data spanning countries and game types — from VIP private clubs in the Caucasus to resort casinos across Southeast Asia — flows into the Casino AI Engine in real time via Kafka streams and is vectorized into **320 features** per member. A Transformer-based attention network learns sequential patterns and adapts immediately to dealer changes, rule changes, and market shifts, maintaining a recommendation accuracy of **87%** and an adoption rate of **73%**.

| Item                                    | Detail                                                                                                                                               |
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Data Sources                            | Betting data from casino partners in Georgia, Vietnam, Cambodia, the Philippines, and other partner hub countries + daily member transaction records |
| Daily Events Processed                  | \~48 million                                                                                                                                         |
| Model Architecture                      | Transformer-based attention network · \~47 million parameters                                                                                        |
| Feature Vector                          | 320-dimensional real-time features per member                                                                                                        |
| Inference Latency                       | 8ms average per request                                                                                                                              |
| Recommendation Accuracy / Adoption Rate | 87% / 73%                                                                                                                                            |
| Framework                               | TensorFlow + PyTorch hybrid                                                                                                                          |
| Streaming Infrastructure                | Apache Kafka real-time pipeline                                                                                                                      |
| Deployment                              | AWS SageMaker                                                                                                                                        |
| Core Role                               | Determines **when** to trade — behavioral sequence prediction                                                                                        |

## HFT Quant Engine (High-Frequency Execution Engine)

**Purpose:** Capture microsecond-level market signals and execute positions based on mathematical pattern optimization.

Because LONGRISE AI's Singapore servers are structurally at a physical latency disadvantage compared to co-located HFT firms operating inside exchange servers, the engine is designed around **mathematical pattern optimization** rather than pure speed competition. It processes Level 3 order book data (individual order granularity, 20-level depth) from 5 leading global exchanges — Binance, Bybit, OKX, Bitget, and Deribit — at up to **2.1 million ticks per second**, completing order generation through execution confirmation in an average of **0.6ms** via a hybrid FIX 4.4 / WebSocket protocol. Combined with the Casino AI Engine in a closed-loop structure, the engine executes **50,000+ trades daily** and runs portfolio optimization using IBM Qiskit quantum simulation.

| Item                            | Detail                                                                |
| ------------------------------- | --------------------------------------------------------------------- |
| Connected Exchanges             | Binance · Bybit · OKX · Bitget · Deribit (5 leading Tier-1 exchanges) |
| Tick Throughput                 | Up to 2,100,000 ticks/second                                          |
| Average Order Execution Latency | 0.6ms (generation to execution confirmation)                          |
| Order Book Depth                | Level 3, 20 levels                                                    |
| Execution Protocol              | FIX 4.4 / WebSocket hybrid                                            |
| Detection Resolution            | Nanosecond-level market movement detection                            |
| Daily Trade Count               | 50,000+                                                               |
| Quantum Simulation              | IBM Qiskit (portfolio optimization)                                   |
| Backtesting Throughput          | 10 years of tick data simulated within 6 hours                        |
| Risk Management                 | Real-time VaR (Value at Risk) monitoring                              |
| Core Role                       | Executes **how** to trade — mathematical market optimization          |

## Twin Engine Synergy

| Engine           | Strength                            | Limitation                               | Combined Effect                                                          |
| ---------------- | ----------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------ |
| Casino AI Engine | Human behavioral pattern prediction | Cannot use macro market data             | Closed-Loop Feedback System — each engine offsets the other's limitation |
| HFT Quant Engine | Mathematical market optimization    | Cannot predict human behavioral patterns | (as above)                                                               |

## Quant Engine Evolution — v1.0 → v4.0

Starting as a single model, the engine went through four generations of architectural changes to reach its current combined structure. Model architecture, inference latency, and accuracy were quantitatively updated with each generation.

| Version | Period  | Architecture Change                                                      | Accuracy | Inference Latency |
| ------- | ------- | ------------------------------------------------------------------------ | -------- | ----------------- |
| v1.0    | 2023 Q2 | Casino AI only · rule-based statistical model                            | 71.3%    | 340ms             |
| v2.0    | 2023 Q4 | First HFT engine integration · LSTM sequence model introduced            | 76.5%    | 12ms              |
| v3.0    | 2024 Q2 | Transitioned to Transformer attention mechanism · closed-loop connection | 83.7%    | 3.1ms             |
| v4.0    | 2025 Q3 | Fully automated reinforcement-learning-based Adaptive Retraining         | 87%      | 0.6–8ms           |

> **v1.0 → v4.0 performance improvement:** inference latency reduced from 340ms to 0.6ms (\~566x), accuracy improved from 71.3% to 87% (+15.7pp)

### Adaptive Retraining Pipeline

AI model accuracy inevitably degrades over time (model drift). During the v1.0-only period, accuracy dropped from 71.3% to 58.2% within three months. The Adaptive Retraining Pipeline was introduced to address this structurally. It automatically checks model performance every 6 hours and triggers retraining on the most recent 72 hours of data as soon as accuracy falls below a 68% threshold, completing recovery in an average of 4.2 hours. Since this pipeline was introduced, the model drift cycle has been extended from **3 months to up to 11 months**.

| Item                        | Detail                                  |
| --------------------------- | --------------------------------------- |
| Performance Check Interval  | Every 6 hours                           |
| Retraining Trigger          | Automatic when accuracy falls below 68% |
| Retraining Data Window      | Most recent 72 hours                    |
| Retraining Duration         | 4.2 hours average                       |
| Combined Algorithm Accuracy | 83.7% (exceeds 80% target)              |
| Model Drift Cycle Extension | 3 months → up to 11 months              |

## Dynamic Revenue System — How Revenue Is Generated and Distributed

LONGRISE AI's revenue is generated from **arbitrage and market-making spreads** in the crypto futures market. The HFT Quant Engine captures price inefficiencies and liquidity spreads across 5 connected global exchanges at up to 2.1 million ticks per second and converts them into realized gains. The decision of **when** to enter a position is based on behavioral signals the Casino AI Engine derives from real-time betting patterns at partner casino hubs, used as alternative data. In other words, casino data itself is not a source of revenue — it is a predictive signal that improves the accuracy of crypto market entry timing.

Realized daily gains and losses are aggregated into a single pool and automatically classified into one of three modes based on signal accuracy and reserve ratio.

| Mode                                   | Annual Share | AI Decision Criteria                              | Outcome                                                                                |
| -------------------------------------- | ------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------- |
| Standard Day (normal operation)        | 80%          | Signal accuracy ≥68% + reserve ratio ≥75%         | Full distribution of realized gains for the day                                        |
| Defensive Day (conservative operation) | 15%          | Reserve ratio <75% or declining signal accuracy   | Reduced distribution ratio, reserves prioritized · linked to Circuit Breaker Level 1–2 |
| Surplus Day (special distribution)     | 5%           | Cumulative realized gains exceed target threshold | Early distribution of surplus gains                                                    |

> The Pool Size Factor (6%+), Betting Performance (9%+), and Futures Return (3%+) figures on the Revenue System page break down how this realized-gains pool is composed each day.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.longrise.ai/technology/twin-engine.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
