Agent Economics

FireFlash: An Open Recipe for Long-Horizon Agentic RL Achieving the Performance-Cost Pareto Frontier

Published
Model
FireFlash, RL trained from GLM-5.3-Flash

Introduction

We introduce FireFlash, a 300B-scale model tailored for long-horizon agentic tasks. FireFlash excels as a terminal and coding agent, achieving 46.2% on Terminal-Bench 4.01, putting it on par with Fable 5 and GPT-6 Sol, while costing over 30× less per task than Fable 5 at maximum effort (Figure 1). These gains also transfer to software engineering benchmarks, including DeepSWE v1.12 and SWE-Bench Pro Verified3 (Table 1).

While frontier labs scale reinforcement learning across thousands of GPUs, we reach the performance-cost Pareto frontier under 5 days using 64 NVIDIA B300 GPUs. Three key factors make this possible: (1) careful curation of agentic RL environments so that every task provides a reliable signal at the right difficulty; (2) an RL recipe built for long, stale, and low-precision rollouts; and (3) an optimized coding harness tailored to the model for both training and evaluation. Together, these components bring frontier efficiency to a hundred-GPU-scale cluster, and we are releasing the full recipe.

Scatter of Terminal-Bench 4.0 pass@1 against cost per task on a log scale for over forty models and effort settings. FireFlash, a flame at 46.2% and $0.72, is on the dashed Pareto frontier, 10.4 points above GLM-5.3-Flash
Figure 1. Pass@1 on Terminal-Bench 4.0 against average cost per task (log scale). Dashed: the Pareto frontier. The arrow is FireFlash's gain over GLM-5.3-Flash. FireFlash is priced at GLM-5.3-Flash's list rate, since we serve the model ourselves.
BenchmarkGLM-5.3-FlashFireFlashGain
Terminal-Bench 4.035.846.2+10.4
DeepSWE v1.163.468.8+5.4
SWE-Bench Pro Verified58.263.3+5.1

Table 1. Pass@1 score averaged over 5 trials. GLM-5.3-Flash is its official published entry on each benchmark; FireFlash runs in our harness.

Method

We perform full-parameter RL starting from GLM-5.3-Flash, training all 320B language parameters, including the MTP layer, while keeping the vision tower and DSA indexer frozen. We revisit and optimize five key components of the post-training pipeline, sharing our key lessons and findings in the following sections.

  1. Infrastructure

    No GPU waits on the slowest attempt. We pair dedicated trainer and rollout GPUs, train on rollouts up to 6 weight versions stale, and accelerate decoding by 1.38× via MTP. Isolating each attempt in its own microVM cuts rollout groups lost to infrastructure errors from 12% to 0.5%.

  2. Task selection

    Every rollout group carries signal. We retain tasks with a 15–85% initial pass rate—profiled across at least 4 attempts under exact training conditions—cutting zero-signal rollout groups from 48% to 10.2%.

  3. Rewards

    Credit only for genuine solutions. Every task must pass nine verification gates prior to training and uses calibrated terminal partial credit. An efficiency bonus for shorter solutions reduces tokens per solve to 0.84× with no drop in accuracy.

  4. Harness

    Long horizons fit in context, and training matches evaluation. Context compaction, file-redirected outputs, and background execution cut trial cost by ~33%. Using the identical harness across training and evaluation lifts GLM-5.3-Flash 4.4 points above Claude Code before any RL.

  5. RL Objective

    Stale FP8 samples drive learning without drift. We combine GRPO with truncated importance sampling, top-k score centering, a success offset, and a loss floor—maintaining stability without a KL penalty or entropy bonus while clipping only 1–3% of tokens.

Table 2. The recipe at a glance.

Infrastructure: Fully Asynchronous RL

Key lesson 1Idle GPUs cost more than stale rollouts: let sampling and training each run at full speed.

  • Dedicated trainer and rollout GPUs. Half of the GPUs train in BF16 using slime5, while the other half run SGLang6 engines with FP8 weights and an FP8 KV cache. Updated weights are synchronized to the rollout engines over NCCL after every step, so neither training nor sampling stalls on the other (Figure 2).
  • Training with stale rollouts. Because sampling proceeds continuously, a turn may be generated by weights several steps behind the trainer. A turn is discarded only if it was generated more than 6 weight versions ago. Policy staleness incurs minimal drift: the gap between trainer and rollout log-probabilities increases only from 0.065 at a staleness of one version to 0.08 at four to six.
  • Fast, isolated rollouts. Speculative decoding with the model's native multi-token prediction (MTP) head delivers a 1.38× decoding speedup. Every rollout and grading run executes in its own Firecracker microVM via AgentENV4, isolating attempts from one another and reducing the share of rollout groups lost to infrastructure errors from 12% to 0.5%.
new weights after every step · NCCLTask poolpass rate15–85%ROLLOUT GPUShalf the GPUs, FP8SGLang enginesMTP speculative decodingagent loop, our harnessFINISHED GROUPSby weight versionv−1v−4v−2v−6solvedfailedsame reward in all: droppedturns > 6 versions old: no gradientTRAINER GPUShalf the GPUs, BF16slime trainerGRPO + TIS + SCone update per steptasksattemptsbatchAGENTENV MICROVMSFirecrackerattempt VMsone per attemptparent VMone per taskgrader VMruns the testseach fork < 100 mstool callsoutputrewardnew weightsafter every stepNCCLTask poolpass rate15–85%tasksROLLOUT GPUShalf the GPUs, FP8SGLang enginesMTP speculative decodingagent loop, our harnesstool callsoutputAGENTENV MICROVMSFirecrackerattempt VMsone per attemptparent VMone per taskgrader VMruns the testseach fork < 100 msgraded attemptsFINISHED GROUPSby weight versionv−1v−4v−2v−6solvedfailedsame reward in all: droppedturns > 6 versions old: no gradientbatchTRAINER GPUShalf the GPUs, BF16slime trainerGRPO + TIS + SCone update per step
Figure 2. Fully asynchronous RL. Rollout and training each hold half of the GPUs and never wait for each other. The engines keep sampling, each attempt in its own microVM forked from its task's parent, and finished groups queue until the trainer takes a batch. A group whose attempts all scored the same is dropped, and a turn sampled more than 6 weight versions ago gets no gradient. After every update the trainer pushes new weights to the engines.

Task Selection: Train Where the Model Is Uncertain

Key lesson 2Spend rollouts only where the model is uncertain, and measure that uncertainty under the exact conditions it will train in.

GRPO learns from relative differences across attempts on the same task. A task the model always solves—or never solves—consumes a full group of rollouts while providing zero learning signal. We therefore profile each candidate task with at least 5 rollouts of the base model and retain those with an initial pass rate between 15% and 85%. Profiling runs under the exact training configuration—the same harness, reasoning effort, context window, turn budget, and sandbox—since a task's pass rate depends on each of them. This filtering cuts the share of zero-signal rollout groups from 48% to 10.2%. Figure 3 shows the resulting training mixture.

The training data mix

Long-horizon agentic tasks (ours): 30%Hard tier of long-horizon agentic tasks (ours): 11%Long-horizon coding skills (ours): 9%MiMo-TB (public): 1%Tasksmith (public): 1%MiMo-code (public): 18%SWE tasks (mostly Python) (ours): 18%SWE tasks (TypeScript, Go, Python, JavaScript, Rust) (ours): 12%
  1. Long-horizon agentic tasks (ours)30%
  2. Hard tier of long-horizon agentic tasks (ours)11%
  3. Long-horizon coding skills (ours)9%
  4. MiMo-TB (public)1%
  5. Tasksmith (public)1%
  6. MiMo-code (public)18%
  7. SWE tasks (mostly Python) (ours)18%
  8. SWE tasks (TypeScript, Go, Python, JavaScript, Rust) (ours)12%
Figure 3. Shares of our training data mix. Orange: long-horizon agentic work, 52%. Blue: software engineering, 48%.

Grader and Reward: Robust Grader and Prevent Reward Hacking

Key lesson 3A task the model never solves is often a broken task: verify every grader before its reward reaches the model.

When we audited never-solved tasks, nearly half were broken rather than hard: malformed, reliant on brittle tests that reject correct solutions, or containing protected-file traps. Other graders awarded partial credit for outputs that merely matched the expected format, or crashed on real agent outputs. To eliminate these failure modes, every new task must pass nine verification gates before entering the training pool (Figure 4).

Nine gates before a task trains

The task2

  1. 1Reference solves itThe reference solution passes in the training sandbox, through the exact training pipeline.
  2. 2Nothing unstatedEvery requirement the grader checks is stated in the prompt.

The sandbox3

  1. 3OfflineThe task runs with no network access.
  2. 4Boots every timeThe sandbox starts reliably and never hangs.
  3. 5No leaked answerNothing in the environment gives the answer away.

The grader4

  1. 6No free creditAn attempt that does nothing, or submits only boilerplate, scores 0.
  2. 7Robust testsThe tests are not brittle: any correct solution passes.
  3. 8Survives bad outputReal agent output, however malformed, is scored, never a crash.
  4. 9DeterministicThe same output always earns the same score.
Figure 4. The gates every new task passes before it enters the training pool. Blue: the task, solvable as asked. Green: the sandbox, sealed and stable. Orange: the grader, a score that means what it says.

Reward design. Each attempt is scored once upon completion with a terminal reward in [0, 1]. A full solve earns 1.0, while an incomplete attempt earns partial credit for the verification checks it passes—or, on software engineering tasks, for the failing tests it resolves. Successful attempts also earn a length bonus of up to 0.2, scaled by how many fewer tokens they use relative to the longest solve in the same group. This shaping reduces tokens per solve to 0.84× with no drop in evaluation accuracy.

Harness: Built for Long Attempts, Identical in Training and Evaluation

Key lesson 4The harness is part of the model: train in exactly the one you evaluate in.

Our harness adopts Claude Code conventions: four tools (Bash, Read, Write, Edit), native tool calls, retained reasoning history, and context compaction. Crucially, the exact same harness drives training rollouts and evaluation trials, and automated unit tests enforce code and prompt parity between the two. Prior to any RL, it lifts GLM-5.3-Flash 4.4 points above its official Claude Code entry on Terminal-Bench 4.0 (Table 3).

Agent, same model (GLM-5.3-Flash)Pass@1 (%)Cost per trialCost per solve
Claude Code (official leaderboard entry)35.8$0.36$1.01
Our harness40.2$0.46$1.11

Table 3. GLM-5.3-Flash with our harness on Terminal-Bench 4.0 under standard time limits at list rates.

Long-horizon attempts must also remain affordable. State-preserving context compaction triggers at 85% of the context window and preserves prefix caching by appending a sectioned summary prompt to the existing conversation history. Commands write stdout to files and return a truncated preview referencing the filename, while long-running commands continue asynchronously in the background rather than terminating at timeout. Together, these features cut per-trial cost by about a third. Agentic prompt guidelines that enforce efficient workflows (in-place edits, single-pass writes, no sleep polling) save a further 16%.

RL Objective: Learn from Stale Samples Without Drifting

Key lesson 5Correct stale, low-precision samples instead of discarding them, and treat rising entropy as the early warning.

Rollouts are sampled in FP8 on weights up to 6 versions old, so they come from a policy that differs slightly from the BF16 policy being trained. Rather than discarding these stale trajectories, our training objective directly corrects for them. The core algorithm is GRPO with 12 attempts per task and a single optimizer update per step; each attempt's advantage combines its reward and its length bonus:

A  = (R' − mean R') / std R'  +  (b − mean b) / 0.5     over the 12 attempts at one task
R' = 1.5                      if the attempt solved the task
R' = 0.5 × R                  otherwise (R = the terminal reward in [0, 1] above)
b  = 0.2 × (1 − tokens / max tokens among solves)   for a solve (≥ 2 solves in the group), else 0
  • Truncated importance sampling. Each token is weighted by the ratio of the BF16 trainer probability to the FP8 rollout probability, clipped to [0.5, 2.0] to bound the influence of any single token; only 1–3% of tokens hit the clip boundary.
  • Score centering. The rollout engine returns each token's top-32 log-probabilities, and the trainer centers each token's policy-gradient score by subtracting the sampler's expected score over those candidates7. This eliminates the residual drift toward the stale FP8 sampler that truncation alone leaves behind, at a cost of 7.6% in step time.
  • Success offset. A full solve (R = 1.0) enters the advantage as 1.5, whereas an unresolved attempt enters as half its partial credit8: the best near-miss (R = 0.5) counts as 0.25 against a solve's 1.5, so partial credit shapes learning without rivaling an actual solve.
  • Loss normalization floor. Each attempt's loss is normalized by its token count, with a minimum denominator of 2,048 tokens. This prevents a degenerate rollout of only a few tokens from receiving an outsized per-token weight and dominating the gradient.

With these corrections in place, we use no KL penalty and no entropy bonus. In a healthy run, policy entropy decreases slowly, from roughly 0.46 to 0.33; rising entropy serves as an early warning sign of instability.

Full configuration

PartSetting
ModelGLM-5.3-Flash: 321B parameters, 17.4B active per token. All 320B language parameters trained, the MTP layer included; vision tower and DSA indexer frozen
TrainerHalf of the hundred-level B300 GPUs (288 GB each): BF16, slime with EP32 and CP16
RolloutThe other half: SGLang engines at TP8 with FP8 weights and KV cache, MTP speculative decoding (3 draft steps); new weights over NCCL after every step; fully asynchronous, a turn sampled more than 6 weight versions ago gets no gradient
SandboxA Firecracker microVM per attempt (AgentENV), forked from its task's parent VM, graded in another; no network
HarnessOurs, following Claude Code's conventions (Bash, Read, Write, Edit), at maximum reasoning effort; identical in training and evaluation, checked by unit tests. Each attempt: 192K-token context, up to 200 turns and 3 hours, compaction at 85% of the context (up to 64K tokens of summary, the newest ~27K kept verbatim), up to 4 times; command output to files with a preview, long commands in the background
DataTasks the starting checkpoint solves 15–85% of the time, profiled with at least 4 samples; pool mean 0.3–0.5, with 10–20% hard but verified tasks; a never-solved task kept only if its reference solution passes or a human audits it; a task retired only when every attempt on every visit solves it. About half long-horizon agentic and half software engineering (Figure 3), each through nine gates
RewardTerminal reward in [0, 1]. Long-horizon tasks: 1.0 only if every check passes, at most 0.5 otherwise, at most 0.3 if a skill gate fails. SWE tasks: 1.0 for a full resolution, 0 if the patch breaks a passing test, otherwise half the fraction of fail-to-pass tests resolved. Success offset (a solve scores 1.5, any other attempt half its partial credit); a length bonus of up to 0.2 for solves shorter than the group's longest, added to the advantage as its own term
RL ObjectiveGRPO; truncated importance sampling clipped to [0.5, 2.0]; score centering over the sampler's top-32 log-probabilities; loss floor of 2,048 tokens per attempt; no KL penalty, entropy bonus or overlong masking
Step32 tasks × 12 attempts = 384 trajectories, groups with uniform rewards dropped and resampled, except up to 2 all-pass groups whose longest solve takes at least 1.2× the tokens of the shortest, kept for the length bonus; one optimizer update, LR 2.4e-6 with a 5-step warmup, gradient clip 0.5

Table 4. The full training configuration.

Results

We evaluate FireFlash in the same harness it was trained in, and compare it with the official GLM-5.3-Flash entry it starts from and with published scores of other models (Figure 5). FireFlash improves on its base on all three benchmarks: by 10.4 points on Terminal-Bench 4.0, where it passes Fable 5 and GLM-5.3, its full-size sibling; by 5.4 on DeepSWE v1.1, passing Fable 5.1; and by 5.1 on SWE-Bench Pro Verified, passing Kimi K3 and GPT-5.6 Sol.

FireFlash against published scores

Bar charts of Terminal-Bench 4.0, DeepSWE v1.1 and SWE-Bench Pro Verified scores; FireFlash at 46.2, 68.8 and 63.3, GLM-5.3-Flash at 35.8, 63.4 and 58.2
Figure 5. Pass@1 Score. Orange: FireFlash. Blue: the official GLM-5.3-Flash entry it starts from. Other rows are published scores.

Cost and performance

FireFlash sits on the cost-performance frontier of Terminal-Bench 4.0 (Figure 1): of the more than forty models and effort settings plotted, only four cost less per trial, and none of them scores above 35.8%. At GLM-5.3-Flash's list rate a trial costs $0.72, against $22.02 for Fable 5 at maximum effort and $1.49 for GPT-6.1 Terra, the next point on the frontier at 55.6%. Every model that scores higher than FireFlash costs at least twice as much per trial, and GLM-5.3, its full-size sibling, costs $8.27 per trial at maximum effort for a lower 41.8%.

Final Remarks

FireFlash demonstrates that targeted post-training can turn an open-weight model into a highly capable domain-specialized agent, reaching frontier-level performance at a fraction of the inference cost. We believe that jointly optimizing models, training environments, harnesses, and inference systems offers another path to building capable and efficient agents beyond scaling.

FireFlash is our first step in this direction. We will extend this approach beyond coding and terminal tasks to more complex, long-horizon, recurring work.

Authors

Wenbo Hu, Jesse Cai†, Po-nien Kung†, Yuxuan Lu†, Di Wu†, Huimin Zeng†, Nanyun Peng, Dakuo Wang, Kai-Wei Chang

†Listed in alphabetical order.

References

  1. Terminal-Bench 4.0 and its leaderboard. tbench.ai.
  2. DeepSWE v1.1 leaderboard. deepswe.datacurve.ai.
  3. SWE-Bench Pro Verified. arXiv:2609.08149.
  4. AgentENV: Firecracker microVM sandboxes behind an E2B-style API. github.com/kvcache-ai/AgentENV.
  5. slime, the RL framework our trainer forks. github.com/THUDM/slime.
  6. SGLang, the inference engine behind every rollout. github.com/sgl-project/sglang.
  7. Score centering on top of truncated importance sampling (the TIS + SC arm). arXiv:2609.20807.
  8. The success offset in the GRPO term. arXiv:2610.22192.

Citation

Please cite this work as:

@misc{fireflash2026,
  title  = {FireFlash: An Open Recipe for Long-Horizon Agentic RL Achieving the Performance-Cost Pareto Frontier},
  author = {Hu, Wenbo and Cai, Jesse and Kung, Po-nien and Lu, Yuxuan and Wu, Di and Zeng, Huimin and Peng, Nanyun and Wang, Dakuo and Chang, Kai-Wei},
  year   = {2026},
  month  = nov,
  note   = {Blog post}
}