← Latest papers
💬 NLP

BacktestBench: Benchmarking Large Language Models for Automated Quantitative Strategy Backtesting

This paper introduces BacktestBench, the first large-scale benchmark for automated quantitative backtesting comprising over 18,000 annotated tasks derived from 6 million market records, alongside AutoBacktest, a multi-agent framework designed to translate natural language strategies into reproducible backtests and evaluate the capabilities of 23 mainstream LLMs.

Original authors: Zhensheng Wang, Wenmian Yang, Qingtai Wu, Lequan Ma, Yiquan Zhang, Weijia Jia

Published 2026-05-19
📖 5 min read🧠 Deep dive

Original authors: Zhensheng Wang, Wenmian Yang, Qingtai Wu, Lequan Ma, Yiquan Zhang, Weijia Jia

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a chef who wants to create a new recipe for a dish that will make you rich. In the world of finance, this "dish" is a trading strategy. Before you serve it to the world (or invest your own money), you have to backtest it. This means you take your recipe and cook it using a massive pot of historical data (what happened in the stock market over the last few years) to see if it would have actually made money or if it would have burned the kitchen down.

Traditionally, doing this backtesting is like trying to build a complex robot from scratch every time you want to test a new recipe. You need to be a master mechanic (programmer), a data librarian (to find the right historical ingredients), and a financial wizard all at once. It's slow, expensive, and only a few experts can do it.

BacktestBench is a new project that asks: "Can Artificial Intelligence (AI) learn to be that master mechanic, librarian, and wizard all at once?"

Here is a simple breakdown of what the paper does:

1. The Problem: The "Black Box" of Finance

The authors argue that while AI (specifically Large Language Models or LLMs) is great at writing code and chatting, nobody has really tested if it can handle the specific, high-stakes job of automated quantitative backtesting.

  • The Challenge: It's not just about writing code. The AI has to understand a vague human request like, "Buy when the price goes up for 5 days," and then:
    1. Find the exact right stock data from a database.
    2. Write a program that calculates the "5-day up" rule without cheating (using future data).
    3. Run the simulation.
    4. Calculate the final score (like a "Sharpe Ratio," which is a fancy way of saying "how much profit did we get for the risk we took?").

If the AI makes a tiny mistake in step 2, the whole result is garbage.

2. The Solution: A Giant "Practice Exam" (BacktestBench)

To test if AI can do this, the researchers built BacktestBench. Think of this as a massive, standardized driver's license test for AI, but instead of driving a car, the AI is driving a trading strategy.

  • The Data: They used over 6 million real market records from Chinese stock markets (like a giant library of history).
  • The Questions: They created 18,246 specific test questions. These aren't simple math problems; they are complex scenarios like:
    • "Calculate the profit for this specific strategy on this specific stock."
    • "Which stock performed best with this strategy?"
    • "Which setting (parameter) works best?"
  • The Ground Truth: Because they built the questions from real code they wrote themselves, they know the exact correct answer. This allows them to grade the AI strictly: Right or Wrong.

3. The Test Subject: "AutoBacktest" (The AI Team)

The researchers didn't just ask one AI to do everything. They built a team of three specialized AI agents called AutoBacktest, working together like a kitchen crew:

  1. The Summarizer (The Translator): You give it a messy human sentence. It translates that into a precise list of financial "ingredients" (indicators) the system needs.
  2. The Retriever (The Librarian): It takes that list and goes to the database to fetch the exact raw data (like "Open Price" and "Volume") needed. It writes a query (SQL) to get the data.
  3. The Coder (The Chef): It takes the data and the instructions, writes the Python code to run the simulation, executes it, and gives the final number.

4. The Results: Who Passed the Test?

They tested 23 different AI models (both open-source and paid "closed-source" ones) on this exam.

  • The Winners: The top closed-source models (like Gemini 3 Pro) did the best, but even they only got about 67% correct. This means even the smartest AI currently struggles with the complex logic of finance.
  • The "Logic Gap": They found that many AIs are good at writing code that looks right (syntax) but fails the logic. For example, an AI might write code that calculates "Volatility" (a measure of risk) but gets the math wrong because it doesn't understand the financial definition.
  • The "Small Model" Struggle: Smaller AI models (with fewer "brain cells" or parameters) were terrible at the math-heavy parts. If the question required complex statistical reasoning, small models often failed completely, while larger models fared better.
  • The Secret Sauce: They found that giving the AI a "cheat sheet" of standardized short codes (like a dictionary that says "Volatility = this specific formula") helped the AI write much better code.

5. The Conclusion

The paper concludes that while AI is getting better at automating financial research, we are not there yet.

  • Current AI models are like brilliant students who can write a great essay but often fail the math exam.
  • The BacktestBench dataset is now available for everyone to use to train and test their own AI models, ensuring that future financial AI is actually reliable and not just "hallucinating" numbers.

In short: The paper built a rigorous "final exam" for AI to prove it can handle the complex, error-prone world of stock market backtesting. The results show that while AI is promising, it still needs to learn how to do the math perfectly before we trust it with real money.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →