Fine-Tuning an Order-Flow Foundation Model for Sub-Second Forecasting
Fedor Shabashev
arXiv:2611.14117v1Today’s paper is about a very practical question in high-frequency trading: can a generative model that learns the raw sequence of order-book events be turned into a useful short-horizon forecaster, rather than just a good simulator? That matters because in modern markets, especially crypto, the book is changing extremely fast. Orders arrive hundreds of times per second. If you are trying to decide whether to post liquidity, cancel, or cross the spread, you do not care about the next single event in isolation. You care about where the microprice is likely to be a few hundred milliseconds or a few seconds from now, because that is the time scale on which your own order actually reaches the exchange and starts interacting with the market. So the key problem is not just modeling order flow for realism. It is turning that representation into something that predicts future price pressure and short-term volatility well enough to matter for execution and market making. To put this in context, there are two broad traditions in this space. One tradition builds supervised predictors directly from book features: things like order-book imbalance, order-flow imbalance, DeepLOB-style neural networks, or gradient-boosted trees on handcrafted signals. Those models are trained from scratch on labeled targets such as future mid-price direction. The other tradition builds generative models of order flow. Those models try to reproduce the sequence of events itself, usually by predicting the next token or next message. They are good at distributional fidelity, but historically they have not been fine-tuned for downstream forecasting tasks. This paper is about bridging that gap. The authors start from a pretrained autoregressive foundation model for Level-3 order flow. Level-3 means they model the actual event stream: adds, cancels, changes, and trades at the order level. They collect data from two crypto exchanges, Bitstamp and Bitfinex, and convert the event stream into tokens. In their setup, one order usually becomes one token. If an order is modified on the exchange, they represent that as a cancel followed by an add. They train a decoder-only Transformer with about 300 million parameters on roughly 2.8 billion tokens, using next-token prediction. Then, instead of stopping there, they fine-tune the pretrained model with LoRA to predict the future microprice return and its realized volatility over several horizons: 200 milliseconds, 500 milliseconds, 1 second, 2 seconds, 5 seconds, 10 seconds, and 30 seconds. The microprice is an important target here. It is a high-frequency estimate of fair value that uses the book and trade information to reflect pressure on the bid and ask. The authors are not trying to forecast large moves. They are trying to forecast very small, very short-lived changes. That is exactly the kind of signal that can be useful for deciding whether to provide liquidity, how aggressively to quote, or whether adverse selection risk is rising. A key technical detail is how they tokenize the market. Crypto order flow has some unusual properties relative to equity feeds. It is often more continuous, more bursty at millisecond resolution, and the timestamps are coarser. In their tokenizer, each add or cancel token contains the action, side, price displacement relative to the current mid, log size, and time gap since the previous event. They use a shared binning scheme across both venues so the same token id means the same thing across exchanges and retraining runs. They also use a trade-based exponentially weighted VWAP mid rather than the raw book midpoint, because it is more robust when the book is thin or briefly one-sided. Before evaluating the forecasting task, they first ask whether the pretrained model is actually a good generative model of order flow. That matters because if the backbone cannot reproduce realistic market structure, then any downstream signal may be brittle. So they run autoregressive rollouts, decode the tokens back into events, and push them through a matching engine. They compare the simulated book dynamics against real continuations and against a zero-intelligence baseline that preserves individual marginals but destroys the temporal and joint structure. The pretrained model does a credible job reproducing emergent book features such as spread, depth imbalance, and resting-order counts, and generally beats the zero-intelligence baseline. In other words, the representation is not just learning isolated token frequencies; it is capturing meaningful structure in the market. The next step is the actual forecasting experiment. They fine-tune the pretrained backbone to predict the first and second moments of future microprice changes on BTC/USD. For direction, they compare against simple but strong baselines like order-book imbalance, order-flow imbalance, and gradient boosting on those features. For volatility, they compare against persistence and GARCH. The evaluation is done on a temporally later held-out split, and the same protocol is used across models. They also study how corpus size and recency affect performance, because in markets, newer data can matter as much as, or more than, more data from further in the past. The results are pretty clear at the shortest horizons. The fine-tuned model outperforms the classical baselines in predicting the direction of microprice change at 200 milliseconds and 500 milliseconds. On volatility, it outperforms GARCH in four out of five evaluation windows. That is important because it shows the pretrained order-flow representation is not only useful for generating realistic sequences, but can be repurposed into a competitive short-horizon predictor. They also find an interesting pattern about scale versus recency. In the generative pretraining stage, loss keeps improving as the corpus grows, but increasing model size alone gives only a very small gain when the data is fixed. More importantly, the data is time-ordered, so later corpora are also more recent corpora. A control analysis suggests that recency explains much of the improvement in the generative loss. Downstream, though, both recency and size help the fine-tuned directional correlation, and the authors emphasize that data still dominates model size in this regime. The takeaway is that for this kind of market data, freshness matters a lot, but so does having enough volume. One of the more interesting findings is zero-shot transfer. A model fine-tuned on BTC can be applied to other assets like SOL and ETH without additional fine-tuning, and it still beats simple baselines there. That suggests the backbone has learned some cross-asset structure in short-horizon order flow, which is consistent with the idea that many microstructure patterns are shared across crypto instruments. At the same time, the paper is careful about what the predictions are good for. The forecasted microprice moves are smaller than the bid-ask spread plus fees. So this is not a paper about a standalone directional alpha that you can trivially trade for large excess returns. The natural applications are execution and market making, where even a small improvement in adverse-selection forecasting can matter. In that sense, the model is more about improving decisions around quoting and liquidity provision than about predicting big price swings. There are also clear limitations. The strongest results are at sub-second horizons; beyond a few seconds, classical methods can match or beat the fine-tuned model. That tells us the current approach is mainly capturing very local dynamics, not longer-horizon market regime structure. The paper also focuses on crypto Level-3 data from two exchanges, so we should be cautious about how directly the findings transfer to equities or other venues with different market rules, latency profiles, and order behavior. And although the zero-shot transfer is promising, it is still tested against basic baselines, not a full suite of production-grade cross-asset models. So the big picture is this: the paper shows that a generative foundation model for raw order flow can be fine-tuned into a useful short-horizon forecaster. It retains the benefits of a pretrained representation, beats classical microstructure baselines at the shortest horizons, transfers across assets to some extent, and still preserves enough generative realism to make the representation credible. The main message is not that generative modeling replaces supervised forecasting, but that the two can be combined: pretrain on the market’s event stream, then fine-tune for the specific prediction task you actually care about.
Other candidates that day
Previous AI trading papers