MetaPS: Adaptive Programmatic Strategy Selection for Market Agents

Jiaxiang Chen, Aotian Luo, Zhouyi Zheng, Weiyi Huang, Chi Zhang, Zenglin XuarXiv 2026

TL;DR

MetaPS introduces a simulation-guided framework that transforms Large Language Models (LLMs) into meta-routers for market trading. Instead of forcing LLMs to directly generate risky buy/sell actions, MetaPS trains them to select the optimal programmatic strategy (code module) for any given market state. By using counterfactual backtesting simulations to generate high-quality supervised fine-tuning data, MetaPS achieves superior returns and risk management across multiple model scales.

What Problem Does This Paper Address?

In financial and economic markets, no single strategy wins consistently. Momentum rules excel during steady trends but fail during reversals; mean-reversion strategies profit from overreactions but suffer during persistent news shocks. Therefore, successful trading requires accurately deciding when to deploy a specific strategy.

Recent attempts to build LLM-based trading systems typically treat this as a direct action prediction problem, mapping market observations directly to buy, sell, or hold decisions. However, this approach entangles strategy selection with execution logic. This coupling makes the agent's decisions incredibly difficult to audit, constrain, or reproduce. Furthermore, historical market data does not come with labels indicating the "best" strategy for a given moment, making supervised learning highly challenging.

Methods

MetaPS solves this by factorizing the decision process into two distinct layers: an LLM router that selects a strategy program, and a deterministic runtime that executes the chosen program's actions while enforcing risk and sizing constraints.

Figure 1: Overview of MetaPS. Market simulations supervise a meta-level router by rolling out executable strategy programs from the same as-of state. The resulting state–strategy winners are converted into supervised fine- tuning data. At inference time, MetaPS observes the current market state and a ranked candidate set, selects one programmatic strategy, and delegates final action generation to the selected executable program.

The core innovation lies in how the model is trained using Simulation-Guided Supervision:

  1. Counterfactual Rollouts: For any historical market state, a simulator rolls out every candidate strategy in the library over a future horizon to calculate its actual return.
  2. Training Views: These rollout outcomes are filtered through three distinct scoring lenses:
  3. V1 (Short-horizon): Selects immediate local winners.
  4. V2 (Medium-horizon): Factors in transaction costs, turnover penalties, and medium-term advantages.
  5. V3 (Balanced competence): Balances returns with risk and behavioral regularization to ensure a healthy training distribution.
  6. Supervised Fine-Tuning (SFT): These state-strategy pairs are converted into instruction-following data. Crucially, at inference time, the simulator is turned off; the fine-tuned LLM router relies solely on the current market state and a ranked list of candidate strategies to make its choice.

Datasets

The authors evaluate MetaPS across two distinct environments:

  • Multi-Stock Trading Environment (Primary Benchmark): A multi-asset universe consisting of AAPL, NVDA, SPY, QQQ, GLD, and USO. The models are trained on historical data from 2022–2024 and evaluated on a completely held-out 2025 dataset. The environment models realistic transaction costs, slippage, and position constraints.
  • Goods-Exchange Sandbox (Auxiliary Economy): A synthetic sandbox featuring cash, inventory, production capacities, and six distinct economic regimes (e.g., expansion, shortage, downturn). This environment tests whether the strategy-routing interface generalizes to non-financial execution spaces.

Key Insights and Ideas

  • Programmatic Factorization is Safer and More Effective: Forcing an LLM to choose a program rather than a raw action prevents the model from hallucinating invalid trades. The deterministic execution layer handles feasibility and risk checks safely.
  • Direct Action SFT Collapses Performance: When the authors tried to fine-tune the LLM to directly emit action fields without the intermediate strategy step, performance plummeted (dropping returns to just 3.14%). Strategy-level routing provides a much more stable and structured abstraction for learning.
  • Simulators as Label Factories: Since historical data lacks explicit strategy labels, counterfactual backtesting rollouts serve as an excellent automated pipeline for generating targeted, scalable supervision data.

Key Results

MetaPS consistently outperforms fixed-strategy baselines, direct decision-making agents, and general-purpose prompted API models across scales ranging from 0.8B to 9B parameters.

Comparison of 2025 stock market returns across different method families.
  • Stock Market Returns: On the held-out 2025 benchmark, MetaPS-9B achieved a 50.29% return, significantly outperforming the Qwen-9B Base model (32.69%) and GPT-5.4 prompting (32.03%).
  • Compact Model Superiority: The fine-tuned MetaPS-4B achieved a 45.72% return, outperforming much larger un-tuned base models and prompting-based API models.
  • Risk Mitigation: As shown in the risk-return scaling analysis, MetaPS variants consistently shift the base models toward both higher returns and lower maximum drawdowns.
Figure 5: Risk–return comparison across model scales. Hollow circles denote Qwen base models and filled cir- cles denote the best MetaPS variants at matched scales. Arrows show that MetaPS consistently shifts the base models toward higher returns, with annotations report- ing return gains in percentage points. Gray triangles indicate prompting-only API references.

Limitations and Future Work

While promising, the authors note several limitations:

  • Backtest vs. Live Market Gap: Historical backtests and synthetic sandboxes cannot fully simulate live-market risks such as sudden liquidity shocks, execution latency, market impact, or extreme regime shifts.
  • Library Boundedness: The router's performance is strictly capped by the quality and variety of the pre-implemented strategies in its library. If a market regime requires a strategy not present in the library, the router cannot invent it.
  • Future Directions: The authors suggest incorporating stronger stress testing, confidence intervals, and human oversight mechanisms before deploying such a framework in real-world trading environments.

Summary updated

BibTeX
@misc{chen2026metaps,
  author = {Jiaxiang Chen and Aotian Luo and Zhouyi Zheng and Weiyi Huang and Chi Zhang and Zenglin Xu},
  title = {{MetaPS: Adaptive Programmatic Strategy Selection for Market Agents}},
  year = {2026},
  eprint = {2606.22385},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.22385},
}
Figure