QuantCode Model: Specializing Language Models for Executable Algorithmic Trading Code
Alexey Chernysh, Orkhan Ekhtibarov, Dmitry Zmitrovich
Published September 30, 2026 · on the feed October 6, 2026 · ▲ 18 · arXiv 2609.39420
The abstract
Large language models are strong general-purpose code generators, but executable algorithmic trading remains a demanding specialization target: a model must translate a natural-language strategy specification into correct program logic for a specialized trading framework, execute on historical data, produce trades, and remain semantically faithful to the request. We study two complementary mechanisms for specializing language models for this setting: continued pretraining on algorithmic-trading framework code and supervised fine-tuning (SFT) on agent-validated request-to-code pairs. Evaluation is centered on QuantCode-Bench, our 400-task benchmark for Backtrader strategy generation, together with a repository-level SWE-bench-like track. Continued pretraining improves single-turn Judge Pass from 41.5% to 47.5% for Qwen3.5-397B-A17B and from 27.8% to 33.0% for Qwen3.6-35B-A3B. SFT applied after continued pretraining yields a larger gain for Qwen3.6-35B-A3B, reaching 58.2% Judge Pass and 83.5% successful backtests; in agentic evaluation it raises first-turn success from 22.3% to 58.3% and final success after up to 10 turns from 47.5% to 79.5%. Continued pretraining alone improves first-turn agentic success but lowers final success after repair from 47.5% to 32.5%, consistent with degraded instruction following, whereas SFT improves both. We also identify a capability-retention failure: domain specialization degrades parser-conformant structured tool calling, and targeted recovery SFT restores tool-call formatting but not the base checkpoint's repository-level agent performance. The results show that framework-oriented pretraining, validated SFT, and explicit capability-retention evaluation address distinct failure modes in domain-specific executable code generation.
The Brief
3:00A short podcast summary of the paper. Written and voiced by AI.
Transcript
QuantCode Model. Specializing Language Models for Executable Algorithmic Trading Code. By Alexey Chernysh and two others. Published on the thirtieth of September. No code repository is linked to it.
Large language models are strong general-purpose code generators, but executable algorithmic trading asks for more. A model must turn a strategy written in natural language into correct program logic for a specialised trading framework, run it on historical data, produce trades, and stay faithful to what was asked. Plausible-looking code is not the bar. The program has to run inside a particular framework, against historical data, and the trades it makes have to be the ones the request described. This study examines two ways of specialising a model for that job: continued pretraining on algorithmic-trading framework code, and supervised fine-tuning on request-to-code pairs that an agent has validated. Its claim is that these two, together with an explicit check on retained capabilities, address distinct failure modes rather than one.
Evaluation centres on QuantCode-Bench, the authors' own benchmark of four hundred tasks for Backtrader strategy generation, alongside a repository-level track in the style of SWE-bench. Continued pretraining alone helps single-turn Judge Pass. For Qwen3.5-397B-A17B it rises from forty-one point five percent to forty-seven point five. For Qwen3.6-35B-A3B it rises from twenty-seven point eight percent to thirty-three.
Adding supervised fine-tuning after continued pretraining gives the second of those models a larger gain: fifty-eight point two percent Judge Pass, and eighty-three point five percent of backtests successful. In agentic evaluation, first-turn success climbs from twenty-two point three percent to fifty-eight point three. Final success, after up to ten turns, climbs from forty-seven point five percent to seventy-nine point five.
The two mechanisms do not behave the same way. Continued pretraining by itself improves first-turn agentic success, yet it lowers final success after repair, from forty-seven point five percent to thirty-two point five. The authors note this is consistent with degraded instruction following. Supervised fine-tuning improves both. Put another way, a model that knows the framework better can become worse at taking the feedback it needs to fix its own code, and the validated pairs are what restore that.
A second limit concerns what specialisation costs. Domain training degrades structured tool calling that conforms to a parser. A targeted round of recovery fine-tuning restores the formatting of tool calls, but it does not bring back the base checkpoint's performance as a repository-level agent.
Three ingredients, three separate jobs. Framework-oriented pretraining, validated fine-tuning, and evaluation that explicitly checks what was retained each answer a different failure in domain-specific executable code generation. The recovery result is the cautionary note: a format can be repaired after the fact while the competence behind it stays lost. That is why retention gets its own evaluation in this work, rather than being assumed to come along for free with specialisation.
More with an account
Listen to every day’s papers
Daily playlists, deep dives, quests for the papers, and quizzes on their key terms.
Join free