A new research loop uses only trusted code to test trading strategies

Henry Zhang, an independent researcher, details a new approach to automated trading strategy research designed to avoid the pitfalls of false discoveries. The work describes Autonomous Quant Researcher, an open-source loop where a language model proposes changes but only trusted code determines acceptance.

Acceptance requires a “conjunction of absolute gates”, positive edge after costs, positive net P&L, a positive weekly-cluster bootstrap lower bound, survival at elevated costs, per-year stability and sample floors, rather than relying on a single score. The system’s value, the paper argues, lies less in what it finds and more in “how hard it is to make it report something that is not there.”

Autonomous Quant Researcher: A Bounded LLM Loop

The Autonomous Quant Researcher system employs a declarative hypothesis boundary, limiting proposed trading strategies to data emissions rather than executable code. This design choice intends to constrain the search space and reduce potential vulnerabilities. This approach contrasts with more open-ended agentic systems where the agent can modify the training script itself, introducing a larger attack surface and a broader range of possible hypotheses. By restricting the model’s output to a fixed vocabulary of declarations, the system avoids the need to sandbox potentially malicious or unstable code, a common challenge in automated research environments.

The system’s design prioritizes rigorous evaluation, demonstrated by its use of immutable chronological data stores divided into discovery, validation and a final holdout period. This separation ensures that strategies are tested on unseen data, mitigating the risk of overfitting and look-ahead bias, common pitfalls in backtesting.

A key example from the research detailed a QQQ language-model survivor, a strategy that initially showed promising results with a net per trade of 5.69% and a Sharpe ratio of 2.94 during the discovery phase, progressing to 4.82% and 3.34% respectively in validation, before ultimately being rejected during the holdout phase with a Sharpe ratio of 0.26. This outcome illustrates the system’s conservative approach, where even seemingly robust strategies must pass stringent out-of-sample testing.

The researchers emphasize that the value of this loop lies not in the strategies it discovers, but in the difficulty of generating a false positive. This multi-faceted evaluation process is designed to filter out spurious results and ensure that only genuinely profitable and sustainable strategies are accepted.

Testing within the Autonomous Quant Researcher loop included campaigns focused on SPY and QQQ zero-days-to-expiry options, representing a deliberate focus on extremely short-term, high-frequency trading strategies. This choice is notable given the inherent noise and complexity of 0DTE options, making them a challenging test case for any automated backtesting system. The researchers acknowledge limitations, including the use of short sample periods in some campaigns, such as 46 days of Kalshi data and 60 weekends of ETF flow, which impacts the statistical power of the results.

They also note that option results from 2024 onward do not encompass a bear market comparable to 2022, and that some modeled prices were used when actual quotes were unavailable. To ensure transparency and auditability, every formulation, refusal, crash, and result is recorded in a hash-chained, append-only ledger.

This immutable record provides a complete and verifiable history of the research process, allowing for independent review and validation of the findings. The system’s author makes the full campaign records available upon request, further enhancing the transparency and reproducibility of the research. This level of documentation is a direct response to the challenges of data snooping and multiple comparisons in quantitative finance, where accounting for the number of tests performed is essential to avoid false discoveries.

Declarative Hypothesis Boundary Limits Model Proposals

This approach differs from earlier iterations of the system which relied on a Python-based candidate generation process requiring a sandbox environment to mitigate risks associated with untrusted code execution. The shift to a declarative model eliminates the need for complex sandboxing, as the evaluator operates solely on pre-defined parameters and structures, enhancing security and simplifying the validation process. The current schema, version three, mandates that proposals consist of two fields: a “hypothesis” detailing the trading logic and a “rationale” providing supporting information.

These hypotheses are strictly limited to a pre-approved vocabulary of causal observations, such as returns from the open or between specific times, and a defined set of risk parameters for options structures like call debit spreads or put credit spreads. Any deviation from this established framework, including invalid JSON formatting, unsupported vocabulary, or out-of-range parameters, results in immediate rejection before any scientific evaluation can begin.

This rigid structure is not intended to encourage creativity, but to create a system where the evaluator, not the proposing model, ultimately determines the validity of a strategy. The design philosophy centers on the premise that the system’s value resides in its ability to rigorously filter potential strategies, rather than in generating a high volume of candidates. The researchers acknowledge that a language model can propose a change, but emphasize the critical role of “trusted code” in the decision-making process.

Any OpenAI-compatible endpoint can submit proposals to the reference configuration, which uses a locally served 7B-parameter coding model; however, the evaluator remains independent of the proposing model, ensuring that changes to the model itself cannot artificially inflate performance metrics. This separation of proposal generation and evaluation is central to the system’s aim of minimizing false positives and ensuring the robustness of identified strategies.

Staged Evidence Lifecycle with One-Use Holdout

Campaign evidence is structured through staged stores, each built from a single historical source but accessible only for its designated purpose, discovery, validation, or a final, one-time-use holdout period. This separation is enforced by access capabilities and content/manifest hashes embedded within each store, ensuring data integrity and preventing cross-contamination between stages. Each campaign also freezes its own historical windows, establishing a fixed timeframe for analysis and preventing data drift from influencing results.

The reference SPY mission, for example, requires at least 120 trades and 40 effective weeks in the discovery phase, with minimum thresholds for trades and weeks maintained annually. Shorter-windowed campaigns, such as those using traded-bar 0DTE options, have adjusted minimums, 40 trades, 15 effective weeks, reflecting the system’s adaptability to different market dynamics and trading frequencies.

These floors are not arbitrary; they are frozen within each campaign’s contract, creating a pre-defined and immutable set of requirements for evidence acceptance. The design prioritizes a rigorous, standardized approach to backtesting, minimizing the potential for overfitting or cherry-picking favorable data. This contrasts with more flexible systems where parameters can be adjusted post-hoc, potentially biasing results. A tamper-evident ledger forms the backbone of the research process, recording every event, formulation of a hypothesis, admission decision, trial execution, crashes, stage transitions, and the final holdout receipt, with each record chained to its predecessor via cryptographic hashes.

This ensures that any attempt to alter or reorder events will invalidate the entire campaign, providing a robust audit trail and preventing retroactive manipulation of results. Surviving findings are exported as portable JSON, containing frozen aggregate evidence, limitations, invalidation conditions and an immutable authority stamp indicating whether execution is authorized.

The ledger’s design addresses a specific vulnerability in automated backtesting: look-ahead bias. One instance involved 138 Kalshi hypotheses conditioned on volume within the same window used for prediction, a clear violation of temporal independence. Cells exhibiting this behavior are now flagged as descriptive-only, preventing them from contributing to evidence.

The system also recognizes instances where evidence is effectively wasted, such as a TA holdout left unread when all premises were negative in validation, and prevents further expenditure of resources on fruitless endeavors. This demonstrates a commitment to efficient resource allocation and a pragmatic approach to research.

Tamper-Evident Ledger Tracks Campaign Provenance

Every event within the Autonomous Quant Researcher loop, from initial strategy formulation to final trial results, is permanently recorded in a tamper-evident ledger, ensuring a fully auditable research process. This system moves beyond simply recording results, instead capturing the complete history of a strategy’s development and evaluation, including rejections and crashes. The ledger’s design supports pre-registration of campaigns, binding a strategy’s specification and evaluation code with a SHA-256 hash before any data is processed.

This prevents data-dependent specification, requiring that the evaluation criteria are established and immutable before analysis begins. Once a campaign’s verdict is determined, a durable receipt is written, further solidifying the integrity of the process and preventing retroactive manipulation of results.

A recent SPY 0DTE campaign demonstrated the system’s rigor, revealing a strategy that passed all discovery and validation gates but experienced a 90% drop in expectancy and a significant decrease in its Sharpe ratio when subjected to a holdout test. While the rule remained net positive even under doubled costs and the removal of its most profitable day, the substantial performance decline highlighted the importance of a truly independent holdout period.

The paper reports this finding, indicating a near-successful strategy that still failed to maintain its initial promise under rigorous testing. Further investigation revealed a procedural error in the initial campaign setup, where the frozen specification was temporarily unavailable on disk during the holdout phase. To address this, the specification was reconstructed and verified against the discovery and validation stages before the holdout data was accessed, ensuring consistency and preventing potential discrepancies.

The campaign contract is now permanently stored alongside the ledger, preventing recurrence of this issue. The system’s commitment to transparency extends to detailed record-keeping. The paper outlines a list of failure modes not caught by the initial gates, alongside the changes implemented to address them. This iterative approach to refinement emphasises the system’s focus on identifying and mitigating potential vulnerabilities in automated trading research.

SPY & QQQ 0DTE Options: Campaign Results & Failures

The system, designed to prioritize robustness over immediate profit, has run over two dozen campaigns, including tests on overnight SPX verticals, daily ETF rules and even alternative data sources, with the majority ultimately failing to meet stringent acceptance criteria. This emphasis on identifying weaknesses, rather than solely pursuing successful strategies, is central to the system’s design philosophy. A particularly illustrative failure involved a language-model generated strategy that initially demonstrated promising Sharpe ratios near 3 during discovery and validation phases, only to fall to 0.26 during its single, pre-registered holdout period.

This outcome highlights the system’s ability to expose overfitting and other common pitfalls of backtesting, even when a strategy appears robust based on initial results. Evidence from parallel live trading fleets supports this, with research indicating that operating layer constraints, sizing, choices, and order mechanics, influence behavior more than the underlying language model itself.

The system’s approach differs from these fleets by declaring hypotheses as data, pre-registering them and reporting every campaign alongside its rejections. These thresholds, scaled to the campaign’s time windows, are frozen within each contract to ensure consistency and prevent manipulation.

“A research loop in quantitative finance should be judged first by how hard it is to fool and only second by what it finds,” reflects the core principle guiding this approach to automated strategy research.

👉 More information
🗞 Hard to Fool: A Bounded LLM Research Loop for Quantitative Finance, and What Two Dozen Campaigns Found
✍️ Henry Zhang
🧠 ArXiv: https://arxiv.org/abs/2611.06607

Stay current

See today’s quantum computing news on Quantum Zeitgeist for the latest breakthroughs in qubits, hardware, algorithms, and industry deals.

Avatar of Muhammad Rohail T.

Latest Posts by Muhammad Rohail T.: