FlowLOB: Efficient and Controllable Limit Order Book Generation with Flow Matching

arXiv:2608.13096 · cs.LG, cs.CE, q-fin.CP, q-fin.TR · Submitted 2026-08-13 · Read on arXiv

Zhuohan Wang, Andreea Bacalum, Ollie Olby, Carmine Ventre, Namid Stillman

Simudyne · King's College London

cs.LG, cs.CE, q-fin.CP, q-fin.TR

Submitted: 2026-08-13

Updated: 2026-08-14

Comments: 8 pages, 3 figures, 2 tables

License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/

Importance score: 75/100

The gist: FlowLOB is a conditional flow-matching generative model for limit order book (LOB) trajectories.

Terminology

Summary

FlowLOB is a conditional flow-matching generative model for limit order book (LOB) trajectories. It is trained on multiple Hong Kong Exchange (HKEX) symbols at three sampling frequencies (0.1s, 1s, 10s) in a tick-relative representation that transfers to unseen instruments. The model combines a tick-relative LOB representation, scenario conditioning, and a level–time transformer backbone to train a single generator across multiple HKEX symbols.

The paper's contributions are fourfold:

  • Generality: For each sampling frequency, FlowLOB is trained as a shared simulator across eight HKEX symbols rather than one model per symbol. The tick-relative representation enables zero-shot transfer to a ninth held-out symbol without retraining, and the evaluation is repeated at 0.1s, 1s, and 10s to test this behavior across temporal resolutions.

  • Efficient sampling: Flow models and diffusion models are placed on equal footing: one dataset, one backbone, one training recipe, and one family of fixed-step ODE solvers. Under this matched setup, 10 Euler steps already put FlowLOB at its best or nearly best quality. At the same sampling compute, its marginal distributional error is 4–120× lower than diffusion across price and volume features.

  • Realism: The pooled price and volume distributions of generated books are compared against real data under four distance metrics, against two learned baselines (LOB-S5, LOB-GAN) and two agent-based baselines (Hawkes, Zero Intelligence traders). FlowLOB attains the smallest distance in 30 of the 32 resulting parameter combinations at the 0.1s and 1s frequencies, on both the in-distribution and the held-out symbol.

  • Controllability: Conditioning passes a distributional validity test, moving the generated statistic’s distribution toward the real tail regime in 42 of 48 cases considered, with liquidity and imbalance reliably steerable at every frequency.

The methodology uses a matched flow/diffusion training setup. Flow matching learns a velocity field along a prescribed path from Gaussian noise to data, trained with the loss LFM(θ) = E[∥vθ(xt, c, t) − (x0 − z)∥22]. The diffusion baseline is trained in the same conditional regression template but uses the variance-preserving noising path, predicting the injected noise. Both trained objectives are sampled through deterministic ODEs, giving a common way to measure generation cost. The shared sampler makes the flow-versus-diffusion comparison controlled, varying only the numerical method and step count applied to a fixed checkpoint.

The LOB representation converts raw order book data into fixed-length windows on a uniform time grid. Prices are represented in a tick-relative local representation: the first price coordinate records the mid-price change between consecutive states, while the remaining coordinates record adjacent level gaps within the book, all measured in ticks. Volumes are transformed level-wise as log(V + 1). The conditioning tensor contains the past-window price and volume representation, time of day, and four scenario channels: trend, volatility, liquidity, and order-book imbalance.

The architecture uses an adaLN-Zero transformer backbone with approximately 100M parameters. Each cell of the level–time grid is treated as one token, so a target window is represented as 20 × 32 tokens. The noisy state and conditioning tensor are concatenated channel-wise before projection, preserving the alignment between generated quantities and their controls.

In the inference quality vs. cost comparison, flow matching reaches its best quality with only 10 ODE-solver steps, whereas diffusion needs many more function evaluations to approach the same fidelity. With Euler sampling at 10 steps, FlowLOB obtains lower W1 than the matched diffusion sampler by 4–120× across price and volume marginals. Even when diffusion is allowed up to 200 NFEs, no diffusion configuration matches FlowLOB-Euler-10 in five of the six settings. The paper therefore uses flow matching with Euler sampling at N = 10 as the default operating point.

For realism, FlowLOB reproduces both the concentration of returns near zero and the small but important spread tail at the finer frequencies. The generated books also recover the main cross-level volume-correlation structure near the touch. At 0.1s and 1s, FlowLOB gives the closest marginal match across nearly all comparisons, achieving the best distance in 30 of the 32 price/volume metric cells. Relative to the strongest non-FlowLOB baseline, FlowLOB makes a median 4.5× smaller distance. The main limitation appears at the coarsest frequency (10s), where FlowLOB no longer dominates the marginal metrics.

For counterfactual controllability, the paper uses a distributional test that asks whether changing a scenario condition moves the generated statistic toward the corresponding real tail regime. Conditioning moves generated books toward the requested regime in 42 of 48 cells. The most reliable controls are the volume-related variables, liquidity and imbalance, which are valid for all symbols, frequencies, and directions. The less reliable cases are concentrated in trend and volatility, with failures occurring either when the target statistic is weakly expressed over the generated horizon or at the coarsest frequency.

The ablation study shows that the transformer backbone is important, especially out of distribution. A parameter-matched UNet trails the proposed model on most price and volume metrics, with the largest degradation on the held-out symbol. The learning-rate ablation shows that a higher learning rate degrades both price and volume realism, while a lower learning rate improves some price marginal distances but weakens volume fidelity.

The paper concludes that FlowLOB provides a controlled setting in which data scale, model size, sampling cost, symbol diversity, and controllability can be varied systematically. The current model is strongest at the finer sampling frequencies, while its advantage weakens at coarser resolution; trend control is also less reliable over short windows.

Improvements for AI systems

Improvements to AI systems based on FlowLOB:

  1. Unified multi-symbol generative modeling with zero-shot transfer: Build a single generative model that learns a shared, instrument-agnostic representation (e.g., tick-relative features) across diverse data sources, enabling it to generate realistic trajectories for unseen symbols without retraining. This improves generalization and reduces the need for per-domain model training.

  2. Efficient high-fidelity sampling via flow matching: Replace diffusion-based samplers with flow-matching objectives and fixed-step Euler ODE solvers, reducing the number of function evaluations from hundreds to 10 while achieving lower distributional error (4–120× improvement). This enables real-time or near-real-time generation in latency-sensitive applications.

  3. Controllable generation via explicit scenario conditioning: Integrate multi-channel conditioning (e.g., trend, volatility, liquidity, imbalance) into the generative model’s input, allowing users to steer synthetic outputs toward desired statistical regimes. This enables counterfactual simulation for stress testing, risk assessment, and what-if analysis.

  4. Cross-frequency robustness: Train the generator on multiple temporal resolutions (0.1s, 1s, 10s) simultaneously, ensuring the model maintains realism and controllability across time scales. This improves adaptability to varying data granularity in production systems.

  5. Level–time transformer backbone for structured sequential data: Use a transformer that treats each cell of a level–time grid as a token, with adaptive layer normalization (adaLN-Zero), to capture long-range dependencies and cross-level correlations. This improves fidelity for high-dimensional, structured time-series data (e.g., order books, sensor arrays).

  6. Matched training and evaluation protocol for fair model comparison: Adopt a standardized setup (same data, backbone, training recipe, and ODE solver family) when comparing generative models. This reduces confounding variables and accelerates model selection in research and deployment.

What the improved AI system can do:

  • Generate realistic, high-frequency financial order book data for multiple assets simultaneously, including for assets never seen during training, with minimal sampling cost.

  • Produce synthetic market data that closely matches real distributions (e.g., return tails, volume correlations) at fine time scales, useful for backtesting trading strategies or training reinforcement learning agents without data leakage.

  • Perform controllable counterfactual simulations—e.g., “what if liquidity drops 50%?” or “what if volatility spikes?”—to test system robustness under extreme but plausible market conditions.

  • Operate in real-time environments (e.g., algorithmic trading, risk monitoring) due to 10-step Euler sampling, enabling on-the-fly scenario generation.

  • Transfer to other structured sequence generation tasks (e.g., energy grid load, network traffic, biological signals) where multi-channel conditioning and cross-domain generalization are critical.

Sources

Related papers