SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.00638 · 2023

Generative AI for End-to-End Limit Order Book Modelling: A Token-Level Autoregressive Generative Model of Message Flow Using a Deep State Space Network

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2309.00638.json · badge: /api/ran/2309.00638.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
aaron-wheeler/marketgpt canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_rotary_emb Ran
ran; our contract draft was wrong, not the code
aaron-wheeler/marketgpt/equities/fast_model.py
code served (permissive licence) · get_code("af440c67b16afe67")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function:
# - xq: query tensor, reshaped to (..., -1, 2) so last dim must be even
# - xk: key tensor, same shape as xq
# - freqs_cos: shape (xq.shape[1], xq.shape[-1])
# - freqs_sin: shape (xq.shape[1], xq.shape[-1])
# The function reshapes xq/xk to have ndim >= 2, unbinds last dim into r,i pairs
# freqs_cos/sin are reshaped for broadcast with xq_r which has ndim >= 2

# Let's construct:
# batch_size=2, seq_len=3, head_dim=4 (must be even for reshape to (-1, 2))
batch_size = 2
seq_len = 3
head_dim = 4

# xq and xk: shape (batch_size, seq_len, head_dim)
# After reshape to (..., -1, 2): (batch_size, seq_len, 2, 2)
# xq_r will have shape (batch_size, seq_len, 2)
xq = torch.randn(batch_size, seq_len, head_dim)
xk = torch.randn(batch_size, seq_len, head_dim)

# freqs_cos and freqs_sin: shape (seq_len, head_dim)
# reshape_for_broadcast expects shape (x.shape[1], x.shape[-1])
# where x is xq_r with shape (batch_size, seq_len, 2)
# so x.shape[1] = seq_len, x.shape[-1] = 2
# But the assertion says freqs_cis.shape == (x.shape[1], x.shape[-1])
# So freqs_cos/sin should have shape (seq_len, 2)
freqs_cos = torch.randn(seq_len, head_dim // 2)
freqs_sin = torch.randn(seq_len, head_dim // 2)

ARGS = {
    "xq": xq,
    "xk": xk,
    "freqs_cos": freqs_cos,
    "freqs_sin": freqs_sin,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
precompute_freqs_cis Ran
ran, honoured the contract we drafted
aaron-wheeler/marketgpt/equities/fast_model.py
code served (permissive licence) · get_code("5f447bdd807ed3c0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "dim": 8,
    "end": 4,
    "theta": 10000.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
reshape_for_broadcast Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
aaron-wheeler/marketgpt/equities/fast_model.py
code served (permissive licence) · get_code("e04ad9d4b02f50b6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (1, 3, 1, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function:
# - freqs_cis: torch.Tensor with shape (x.shape[1], x.shape[-1])
# - x: torch.Tensor with ndim >= 2
# - The function checks: 0 <= 1 < ndim (so ndim must be at least 2)
# - freqs_cis.shape must equal (x.shape[1], x.shape[-1])

# Create x with ndim=4 (batch, seq_len, hidden, feature)
# Using distinct sizes: batch=2, seq_len=3, hidden=4, feature=5
x = torch.randn(2, 3, 4, 5)

# freqs_cis must have shape (x.shape[1], x.shape[-1]) = (3, 5)
freqs_cis = torch.randn(3, 5)

ARGS = {
    "freqs_cis": freqs_cis,
    "x": x,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (1, 3, 1, 5) — shape (1, 3, 1, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 3 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
precompute_freqs_cis 5 other papers
2 dated earlier, 3 later · 2 only as an assembly brick
2203.15556 (2022-03)
Training Compute-Optimal Large Language Models
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
2405.16727 (2024-05)
Disentangling and Integrating Relational and Sensory Information in Transformer Architectures
and 2 more not named here
apply_rotary_emb 4 other papers
2 dated earlier, 2 later · 1 only as an assembly brick
2203.15556 (2022-03)
Training Compute-Optimal Large Language Models
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
2405.16727 (2024-05)
Disentangling and Integrating Relational and Sensory Information in Transformer Architectures
and 1 more not named here
reshape_for_broadcast 4 other papers
2 dated earlier, 2 later · 2 only as an assembly brick
2203.15556 (2022-03)
Training Compute-Optimal Large Language Models
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
2405.16727 (2024-05)
Disentangling and Integrating Relational and Sensory Information in Transformer Architectures
and 1 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Developing a generative model of realistic order flow in financial markets is a challenging open problem, with numerous applications for market participants. Addressing this, we propose the first end-to-end autoregressive generative model that generates tokenized limit order book (LOB) messages. These messages are interpreted by a Jax-LOB simulator, which updates the LOB state. To handle long sequences efficiently, the model employs simplified structured state-space layers to process sequences of order book states and tokenized messages. Using LOBSTER data of NASDAQ equity LOBs, we develop a custom tokenizer for message data, converting groups of successive digits to tokens, similar to tokenization in large language models. Out-of-sample results show promising performance in approximating the data distribution, as evidenced by low model perplexity. Furthermore, the mid-price returns calculated from the generated order flow exhibit a significant correlation with the data, indicating impressive conditional forecast performance. Due to the granularity of generated data, and the accuracy of the model, it offers new application areas for future work beyond forecasting, e.g. acting as a world model in high-frequency financial reinforcement learning applications. Overall, our results invite the use and extension of the model in the direction of autoregressive large financial models for the generation of high-frequency financial data and we commit to open-sourcing our code to facilitate future research.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2309.00638")
get_code_for_paper("2309.00638")
have("2309.00638")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2309.00638.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2309.00638.svg)](https://syntology.ai/paper/2309.00638)

Connect an agent — have() is free.