MarS: a Financial Market Simulation Engine Powered by Generative Foundation Model

Junjie Li, Yang Liu, Weiqing Liu, Shikai Fang, Lewen Wang, Chang Xu, Jiang Bian · OpenReview

Abstract

Generative models aim to simulate realistic effects of various actions across different contexts, from text generation to visual effects. Despite significant efforts to build real-world simulators, the application of generative models to virtual worlds, like financial markets, remains under-explored. In financial markets, generative models can simulate complex market effects of participants with various behaviors, enabling interaction under different market conditions, and training strategies without financial risk. We propose Large Market Model (LMM), an order-level generative foundation model, for financial market simulation, akin to language modeling in the digital world. Our financial Market Simulation engine (MarS), powered by LMM, addresses the domain-specific need for realistic, interactive and controllable order generation. Key observations include LMM's strong scalability across data size and model complexity, and MarS's robust and practicable realism in controlled generation with market impact. We showcase MarS as a forecast tool, detection system, analysis platform, and agent training environment, thus demonstrating MarS's "paradigm shift" potential for a variety of financial applications.

Introduction

Simulating financial markets is notoriously difficult. Traditional approaches usually fall into two camps: statistical models, which often fail to capture the "black swan" complexities of real-world behavior, and agent-based models, which struggle with scale and realism.

The core challenge is that a financial market is a reactive "virtual world." Every action—like a large sell order—creates ripple effects (market impact) that change the environment for everyone else. To truly simulate this, researchers need a model that understands market microstructure: the fine-grained dance of individual orders and the Limit Order Book (LOB). The MarS engine aims to serve as a "world model" for finance, similar to how modern generative models simulate physical video or language.

Methodology: The Large Market Model (LMM)

The backbone of MarS is the Large Market Model (LMM), which uses a multi-pronged architecture to capture both the high-resolution "trees" and the macro-level "forest" of market data.

The MarS system architecture, showing the flow from historical data to the Large Market Model, simulated clearing house, and various downstream applications.

As shown in the architecture above, the system integrates several key components:

  1. The Order Model: A causal transformer that operates at the highest resolution. It tokenizes individual orders (type, price, volume, time) alongside the current state of the Limit Order Book to predict the next order in a sequence.
  2. The Order-Batch Model: To capture macro trends, the researchers treat batches of orders as RGB images. They map "Bid," "Ask," and "Cancel" actions to different color channels and use a VQ-VAE (Vector Quantized Variational Autoencoder) to compress these "market images" into discrete tokens.
  3. The Ensemble Model: This component bridges the two, balancing fine-grained individual order generation with the broader macro-trends predicted by the batch model.
  4. Simulated Clearing House: Unlike a static prediction model, MarS includes a rule-based engine that matches generated orders in real-time, updating the LOB and allowing for true interactivity.

To make the simulation controllable, MarS uses a "Fine-Grained Signal Generation Interface" where a user can provide a vague description (e.g., "simulate a sharp drop"). An LLM then translates this into specific data filters to guide the LMM’s generation.

Key Insights: Scaling and Visual Representation

A primary finding of the research is that financial market models follow the same scaling laws as Large Language Models (LLMs). As data size and parameter count increase, validation loss drops predictably, suggesting that foundation models are a viable path for quantitative finance.

A heatmap representing a 'Bid' order batch, illustrating how MarS encodes market activity into image-like structures for macro-trend analysis.

Furthermore, treating order flow as an image (as illustrated by the Bid heatmap above) allows the model to leverage computer vision techniques to capture spatial patterns in liquidity and price levels that standard time-series models might miss.

Experimental Results

The models were trained on a massive corpus of high-frequency order-level data from the top 500 liquidity stocks in the Chinese stock market (2017–2023), totaling over 32 billion tokens.

  • Realism: MarS successfully replicated 9 out of 11 "stylized facts" (statistical properties found in real markets), such as Volatility Clustering and Aggregational Gaussianity.
  • Forecasting: In trend prediction tasks, LMM-based simulations significantly outperformed DeepLOB, a well-known deep learning baseline for limit order books.
  • Anomaly Detection: The researchers identified a "realism gap" when MarS attempted to simulate periods where real-world market manipulation occurred. This drop in simulation realism can serve as a powerful new signal for regulators to detect fraud.
  • Agent Training: Reinforcement Learning (RL) agents trained within the MarS environment showed a "price advantage" improvement from -6 basis points (BP) to +2~6 BP, proving the engine's utility as a high-fidelity training "gym."

Conclusion

MarS represents a significant step toward high-fidelity financial simulation. By applying the foundation model paradigm to order-level data, it enables a variety of applications from risk analysis to strategy training. While currently focused on the Chinese market and requiring significant computational resources, the open-source release of the engine provides a new platform for the quantitative finance community to explore realistic, interactive market simulations.

Summary updated

BibTeX
@inproceedings{li2025mars,
  author = {Junjie Li and Yang Liu and Weiqing Liu and Shikai Fang and Lewen Wang and Chang Xu and Jiang Bian},
  title = {{MarS: a Financial Market Simulation Engine Powered by Generative Foundation Model}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=Yqk7EyT52H},
}
Figure