ALFFLLM·FINANCE

The List / Agents and Multi-Agent Systems / paper

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

2024International Conference on Learning Representationscites 26P1arXiv ↗DOI ↗Semantic Scholar ↗Source ↗

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. This simulation relies on the finest structured data in financial market like orders thus building the finest realistic simulation. 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. We release the code of MarS at https://github.com/microsoft/MarS/.

In one sentence

The paper introduces MarS, a financial market simulation engine powered by the Large Market Model (LMM), which generates realistic, interactive, and controllable order-level market trajectories to enable forecasting, risk detection, market impact analysis, and reinforcement learning agent training.

Summary

This paper addresses the lack of high-fidelity, interactive simulators for financial markets by proposing the Large Market Model (LMM), a generative foundation model for order-level simulation. Unlike traditional statistical or agent-based models, LMM treats market dynamics as a conditional generation task, leveraging the finest structured data available: individual trading orders and Limit Order Book (LOB) states. The architecture combines an Order Model, which uses causal transformers to tokenize and predict individual orders based on LOB features, with an Order-Batch Model that employs VQ-VAE to represent aggregated trading behaviors as image-like structures. These components are integrated into an ensemble framework that balances fine-grained control with macro-level market trends, enabling the simulation of complex market effects and participant behaviors in a risk-free virtual environment. The authors evaluate MarS using high-frequency order-level data from Chinese stock markets, validating its realism against eleven stylized facts including aggregational Gaussianity, volatility clustering, and heavy tails. Experiments demonstrate that LMM scales effectively with data size and model complexity, following established scaling laws. The system supports interactive simulations where user-injected orders are matched in a simulated clearing house, allowing for the assessment of market impact. Results show that synthetic market impact adheres to the Square-Root-Law and that MarS can replicate historical events with high correlation when provided with control signals. The model outperforms baselines like DeepLOB in trend prediction by aggregating multiple simulated trajectories, highlighting the advantage of simulation-based forecasting over direct sequence extrapolation. MarS is showcased in four key applications: forecasting market trends, detecting market manipulation via distribution similarity drops, analyzing market impact through symbolic regression on synthetic data, and training reinforcement learning agents for order execution. The paper identifies new factors influencing market impact, such as resiliency and LOB pressure, beyond traditional volume-based metrics. However, limitations include the current reliance on specific market microstructures and the need for comprehensive evaluation of detection systems. The work represents a paradigm shift by providing a unified, data-driven pipeline for diverse financial tasks, offering infinite synthetic data for strategy testing and risk management without the costs and risks of live trading.

Research problem

Current financial market simulators lack the resolution, interactivity, and realism needed to reflect the full complexity of order-level behaviors. There is a need for a generative foundation model that can simulate realistic market effects, enable interaction under different conditions, and train strategies without financial risk, leveraging the finest structured data available in financial markets.

Core contributions

  • Introduction of the Large Market Model (LMM), a generative foundation model for order-level financial market simulation.
  • Development of MarS, a high-fidelity simulation engine capable of realistic, interactive, and controllable order generation.
  • Demonstration of LMM's scalability across data size and model complexity, establishing scaling laws for financial simulation.
  • Showcasing MarS as a versatile platform for forecasting, risk detection, market impact analysis, and RL agent training.
  • Discovery of new factors influencing market impact (resiliency, LOB pressure, LOB depth) through symbolic regression on synthetic data.

Method

  • Order Model: Causal transformer tokenizing individual orders and LOB features.
  • Order-Batch Model: VQ-VAE converting order batches into image-like representations.
  • Ensemble Model: Combining order and order-batch modeling for balanced simulation.
  • Conditional Generation: Generating orders based on history, user inputs, and market rules.
  • Simulated Clearing House: Real-time matching of generated and interactive orders.
  • Fine-grained Signal Interface: LLM-based retrieval to map vague descriptions to control signals.
  • Symbolic Regression: Discovering new market impact factors from synthetic data.

Results & findings

  • LMM scales effectively with data and model size, reducing validation loss consistently.
  • MarS replicates 11 stylized facts with high distribution similarity (e.g., 0.97 for spread).
  • Forecasting accuracy improves with model size, outperforming DeepLOB.
  • Synthetic market impact follows the Square-Root-Law, validating realism.
  • Control signals significantly enhance correlation between simulated and replay price trajectories (0.23 to 0.47).
  • Detection of market manipulation via drop in distribution similarity during manipulation periods.
  • New factors (resiliency, LOB pressure) explain market impact beyond volume and volatility.

Data & experiments

  • High-frequency order-level data from Chinese stock markets.
  • Evaluation against eleven stylized facts of financial markets, including volatility clustering and heavy tails.
  • Scaling law evaluation across model sizes from 2M to 1.02B parameters and data scales up to 32B tokens.
  • Comparison with DeepLOB for trend prediction accuracy.
  • Validation of synthetic market impact against the Square-Root-Law.
  • Reinforcement learning agent training for TWAP execution strategies.

Limitations & caveats

  • Current implementation is limited by resource constraints, using only a fraction of available data.
  • Detection system requires comprehensive evaluation with multiple metrics for robust conclusions.
  • Simulation realism may vary across different market conditions and asset classes.
  • Control precision decreases when interactivity is introduced, balancing realism and user control.
  • New factors for market impact need further validation across different market regimes.

Curator notes

Discovery status: round2_promoted. Source links: FinTral: A Family of GPT-4 Level Multimodal Financial Large Language Models; InvestLM: A Large Language Model for Investment using Financial Domain Instruction Tuning; Open-FinLLMs: Open Multimodal Large Language Models for Financial Applications; Standard Benchmarks Fail -- Auditing LLM Agents in Finance Must Prioritize Risk; XuanYuan 2.0: A Large Chinese Financial Chat Model with Hundreds of Billions Parameters