Microsoft's MarS Wants to Simulate Financial Markets With Language Models
If you've ever tried to model how a market actually behaves, you know the problem: real order flow is messy, adaptive, and driven by thousands of participants making decisions you can't easily script. Rule-based simulations tend to feel lifeless. MarS, an open-source project from Microsoft, takes a different approach—it treats market simulation as a language modeling problem and lets you generate orders with a transformer.
What It Does
MarS is a market simulation framework built around what the project calls an OrderModel. Rather than hand-coding agents with fixed strategies, MarS models the order-generation process itself. The OrderModel handles how orders are produced, while a separate OrderState component represents and updates the market state as the simulation runs. There's also a BackgroundAgent class in the architecture, though the truncated README only hints at its role.
The project ships with pretrained order models at several parameter scales. The README reports evaluations across sizes from 2M up to 1.02B parameters, with the 2M, 5M, and 10M versions currently released on Hugging Face. The larger models (19M, 44M, 107M, 221M, and 1.02B) are awaiting release approval from Microsoft's Corporate, External, and Legal Affairs team. The tech stack is Python 3.11 or 3.12, and the project targets Linux.
The README also points to a scaling-law curve from the accompanying paper, showing how validation loss drops as model size and training tokens increase. That's the core thesis: bigger order models, better market fidelity.
Why It's Cool
It reframes market simulation as a scaling problem. Most market simulators are built from the bottom up—define agent behaviors, tune parameters, hope the emergent dynamics look realistic. MarS borrows the language model playbook instead. Train on order data, scale up, and let the model learn the distribution of order flow. The scaling curve in the README suggests this actually works, at least in terms of validation loss.
The released artifacts are genuinely usable. You don't need a cluster to get started. The 2M parameter model is small enough to run on modest hardware, and the shared preprocessing assets (available at Don-Don/mars-order-assets) mean you're not rebuilding the data pipeline from scratch. Three model sizes are already out, which gives you room to experiment with the tradeoff between speed and fidelity.
The examples cover the questions people actually ask. The README lists four concrete entry points: a stylized facts report that evaluates 11 key market characteristics, a forecasting example that runs simulation as prediction, a market impact analysis, and an interactive demo built with what appears to be a home app. That last one matters—if you want to poke at the system without writing code first, there's a path for that.
The licensing is permissive. MIT license, version 0.1.0, pull requests welcome. For a research project from a large company, that's about as open as it gets.
The paper was accepted to ICLR 2025. That's a signal the underlying research held up to peer review, not just a blog post with a repo attached.
One honest caveat: the largest models—the ones the scaling curve suggests are most capable—aren't available yet. The README is upfront about this, and the approval process is a real constraint, not an oversight. But it does mean the published scaling results aren't fully reproducible with what's currently downloadable.
How to Try It
Start at the repository: github.com/microsoft/mars. The README is the canonical source for setup details, and it links out to the paper and project website for deeper context.
A practical path:
- Clone the repo and check the Python version requirement (3.11 or 3.12) and platform note (Linux).
- Download one of the released order models from Hugging Face—start with mars-order-2m if you want something lightweight, or step up to mars-order-5m or mars-order-10m for more capacity.
- Grab the shared preprocessing and simulation assets from Don-Don/mars-order-assets.
- Run one of the examples. The stylized facts report (
market_simulation/examples/report_stylized_facts.py) is a good first stop because it gives you a baseline read on whether the simulation produces plausible market behavior. The forecasting example (market_simulation/examples/forecast.py) and market impact analysis (market_simulation/examples/market_impact.py) go deeper. - If you'd rather click than code, the interactive demo lives at
market_simulation/examples/demo/home_app.py.
From there, the architecture files are worth reading: market_simulation/models/order_model.py for order generation and market_simulation/states/order_state.py for state representation.
Final Thoughts
MarS is best suited for researchers and quant-minded developers who want to experiment with generative approaches to market simulation—people comfortable reading a paper alongside the code. It's not a plug-and-play trading tool, and the full model family isn't out yet. But the combination of a peer-reviewed paper, released weights at multiple scales, and MIT licensing makes it a solid foundation to build on. If the larger models clear legal review, this could become a genuinely useful testbed for anyone studying market microstructure.
Follow @githubprojects for more developer tools and open source projects.