Can you use autoregressive diffusion to generate market data?
TL;DR Highlight
Flow matching and atom smoothing helped diffusion handle spiky market data distributions
Who Should Read
An ML engineer building generative models for event data that mixes continuous and discrete values like timestamps and prices
Core Mechanics
- Market data is neither continuous nor discrete
- Order types are discrete actions, while price and arrival time look continuous.
- Distributions are spiky, so a normal-distribution assumption fails.
- DDPM blew up, flow matching worked
- A 1,000-step cosine schedule with DDIM was unstable, with 88-95% of values over 8 standard deviations from the mean on all 7 continuous targets.
- Flow matching worked well out of the box.
- Splitting classes handled zero time gaps
- Trades were only 8% of events, so the categorical head overpredicted trades.
- A 20-class head improved the distributions but took a lot of hand-engineering.
- Atom smoothing handles spikes
- It smooths the spiky distribution, then re-sculpts the spike to keep its probability mass.
- The variable representation matters because spikes look different under different representations.
- Evaluated with marginals and a classifier
- He conditioned on 10,240 real events, drew one next event, and compared marginals with TV divergence.
- A classifier also judged real versus generated events, and the atom-smoothing representation gave more realistic samples.
- Not yet a realistic generator
- Rollouts degrade further out, and the CME US spread widens.
- What to predict categorically versus with diffusion remains the key question.
Community Reactions
- Comment adding an explanation for the stability gap
- One commenter cited Heitz 2023: DDIM has a 1/α term that diverges at the start of denoising, while flow matching does not.
- Opinion that a decoder could be the fix
- One commenter said image latent diffusion needs a special GAN-trained decoder, and a similar one might have solved the problem.
- Pushback on the arrival-time distribution
- One commenter noted that arrivals boost the probability of others, Hawkes-like, so there was no reason to expect normality.
- Doubt about the evaluation metric
- One commenter questioned whether least squares is the right metric, since a delayed price model is worthless.
How to Apply
- Check your event data for spikes first
- Plot histograms of time gaps and price changes to see clumping at zero or whole-number seconds.
- If you see clumping, don't use a normal-distribution model as is.
- Switch to flow matching if diffusion training diverges
- If a DDPM parameterization diverges, predict velocity (data minus noise) instead of noise.
- Split targets into categorical and continuous
- Predict point-mass values like zero time gaps as categories and use diffusion only for the remaining magnitude.
- Try atom smoothing too, since classes explode as features grow.
- Evaluate generated data with a classifier
- Train a classifier on real context plus a candidate event to tell real from model output.
- Use it alongside per-feature marginal comparisons.
Try It
# Paste into Claude or ChatGPT (simplified version of the method: distribution diagnosis)
I'm building a generative model for event data. Based on the feature descriptions and sample below, diagnose the distributions.
Feature descriptions: {{feature list and meanings}}
Sample data: {{CSV excerpt}}
For each feature, answer:
1. Whether it likely has a point mass (spike) at zero or a specific value
2. Whether to treat it as continuous or categorical, and why
3. Alternative representations that might make the spike less sharp (e.g. differences, ratios, offset from the midpoint)
Next: plot histograms as recommended and check for yourself.Terminology
Related Papers
Gemini 4 Neon is the new #1 on the Models Engineering Index
Gemini 4 Neon ranks first on the Models Engineering Index with 68.0, combining multiple benchmarks.
LLMs can read and write executables byte by byte from a hex dump
Given only a hex dump and no tools, an LLM analyzed, patched and wrote working executables.
Claude was trained on protein sequences at scale
Next-amino-acid tests on obscure proteins show only the latest Claude models predict them
Remembered as Brief: Stored Preferences SilentlyRemove Decision-Critical Information
A stored 'keep it short' preference silently drops warnings; listing must-know points first restores content.
All AI-generated code should be Open Source
A blog argues AI-generated code should be open source; most HN commenters disagreed.
What thousands of conversations look like inside a language model
Mapping Qwen3-1.7B states showed Chinese sitting apart from English, while German and Croatian overlapped it.
AI, activity, and outcomes in software engineering
AI sped up writing code, but shipping speed did not rise as much, says a talk
LLMs Play Zachtronics' TIS-100
16 LLMs played TIS-100 and set 133 new Pareto frontier points across 18 puzzles