SWE-2 Matches Fable 5.1 on FrontierCode at 64% Lower Cost
In this article
Cognition has released SWE-2, a coding model post-trained via reinforcement learning on Moonshot AI's Kimi K3 — a 2.8-trillion-parameter open base model. The result scores 50.0% on FrontierCode 1.1 Main, landing within one point of Fable 5.1 while costing 64% less. It is also Cognition's first model with selectable reasoning-effort levels, all trained in a single RL run.
Architecture and RL training recipe
SWE-2 follows the same post-training lineage as SWE-1.7, which was built on Kimi K2.7. Scaling to K3 brings roughly a 3× parameter increase; Cognition reports RL still finds 5 to 6 points of headroom on top of the base model across most benchmarks — consistent with the pattern that architectural specificity and training recipe choices outperform raw GPU scaling when the base model is already strong.
The core algorithmic contribution is the reward formulation: R = S − λC, where S is binary task success and C is a weighted mix of inference cost in USD and rollout time. Cognition proves that a strictly linear penalty is required for the RL objective to reduce cleanly to a function of average cost and solve rate. Each effort level's λ is set to the local slope of the base model's Pareto frontier, making the iso-reward line tangent to that frontier — so reward can only increase by pushing the frontier upward, not by drifting to a cheaper or more expensive point within the existing curve. All three effort levels are trained in a single RL run.
A second detail, carried forward from SWE-1.6, is a length-weighted reward baseline. Gradient magnitude correlates with rollout length, so the group baseline is computed as sum(R × L) / sum(L) rather than a plain mean. Cognition reports this kept inference-to-training KL divergence lower and stabilized training without additional compute.
On the infrastructure side, a prefill delayer batches nearby requests, raising throughput by 10–20% in TPM per GPU and TPS per request. DSpark speculative decoding accelerates rollouts, with the draft model retrained via SpecForge for 15% longer accept lengths and then trained online alongside the policy. NVFP4 and FP8 kernels with quantization-aware training hold train-inference mismatch below SWE-1.7 levels.
Benchmark results
| Benchmark | SWE-2 | Kimi K3 | Grok 4.6 | Fable 5.1 | GPT-5.6 Sol | GPT-6 Astra | SWE-1.7 |
|---|---|---|---|---|---|---|---|
| FrontierCode 1.1 Main | 50.0% | 44.2% | 48.0% | 50.9% | 47.5% | 53.3% | 42.0% |
| DeepSWE 1.1 | 73.0% | 68.5% | 67.5% | 67.4% | 72.7% | 74.1% | 37.7% |
| Terminal-Bench 2.1 | 92.8% | 88.3% | 88.4% | 91.4% | 88.8% | 89.9% | 81.5% |
| Terminal-Bench 4 | 27.3% | 21.5% | 20.3% | 55.8% | 37.3% | 57.9% | 7.6% |
SWE-2 leads Terminal-Bench 2.1 outright and beats its K3 base across every row. The conspicuous gap is Terminal-Bench 4, where SWE-2's 27.3% trails Fable 5.1 by 28.5 points and GPT-6 Astra by 30.6 points. FrontierCode is Cognition's own benchmark, and all competitor scores come from Cognition's evaluation harness — a relevant consideration when interpreting the one-point gap over Fable 5.1.
Behavioral efficiency
SWE-1.7 over-explored on straightforward tasks. SWE-2 medium addresses this: on FrontierCode 1.1 Main it scores higher than SWE-1.7 while reducing turns by 58% and cost by 81%. Mean steps per run drop from 127 for SWE-1.7 to 53 for SWE-2 medium, 80 for high, and 98 for max. The median steps-to-first-real-edit falls from 48 to 18 at the medium effort level. This kind of pipeline efficiency gain matters in production agentic workflows where turn count directly translates to latency and cost.
AI Mastery analysis
The Terminal-Bench 4 deficit deserves the most scrutiny. At 27.3%, SWE-2 is much closer to its K3 base (21.5%) than to Fable 5.1 (55.8%) or GPT-6 Astra (57.9%) — a roughly 30-point gap that suggests the RL recipe, despite its sophistication, does not yet generalize to the hardest long-horizon terminal tasks. That is a meaningful constraint for teams considering SWE-2 for open-ended infrastructure automation rather than well-scoped coding tickets.
The deployment constraint is equally consequential: no open weights, no standalone API. SWE-2 runs exclusively inside Devin — Desktop and CLI today, with Web and Fusion rolling out. Teams cannot self-host, fine-tune further, or integrate the model directly into their own agent stacks. Given ongoing discussion about infrastructure isolation as the operative AI security boundary, the closed deployment model reduces certain attack surfaces while eliminating the optionality that open-weight alternatives provide.
The length-weighted baseline (sum(R × L) / sum(L)) is an underappreciated systems detail. Standard group baselines in GRPO-style training treat a one-token rollout and a 10,000-token rollout identically when computing the advantage signal, inflating gradient variance on long sequences. Weighting by token count normalizes this without requiring a separate value network — a compute-free stabilization Cognition has now used across two model generations.
The slope-matched λ formulation is conceptually clean, but its practical effect depends on how accurately the base model's Pareto curve is characterized before RL begins. If the curve is sparsely sampled, the tangent point for each effort level's λ is misspecified, and the guarantee that iso-reward lines don't encourage drift within the existing frontier breaks down. Cognition does not detail how densely it samples K3's Pareto curve prior to setting λ values.
The free-trial window for paid Devin subscribers (Pro, Max, and Teams) closes October 10, 2026, after which standard pricing applies. Cognition's approach — closing capability gaps with post-training rather than proprietary pretraining — illustrates that the marginal value of base model scale is increasingly being captured at the RL layer, a dynamic with broad implications for how coding agent vendors differentiate.
Primary source
Frequently asked questions
How much cheaper is SWE-2 than Fable 5.1 on FrontierCode?
Cognition reports SWE-2 scores 50.0% on FrontierCode 1.1 Main — within 1 point of Fable 5.1's 50.9% — at 64% lower cost. The comparison is based on Cognition's own evaluation harness, which also produced the competitor scores.
How many steps does SWE-2 medium take before its first real code edit?
SWE-2 medium reaches its first real edit after a median of 18 steps, compared to 48 steps for SWE-1.7. Mean steps per full run also drop from 127 (SWE-1.7) to 53 at the medium effort level.
Can I run SWE-2 on my own infrastructure or via a standalone API?
No. SWE-2 has no open weights and no standalone API. It runs exclusively inside Devin — Desktop and CLI are available now, with Devin Web and Fusion rolling out. Paid Devin subscribers (Pro, Max, and Teams) can use it free through October 10, 2026.
What base model is SWE-2 built on, and how much does RL improve it?
SWE-2 is post-trained via reinforcement learning from Kimi K3, Moonshot AI's 2.8-trillion-parameter open model — roughly 3× the parameters of Kimi K2.7, which underpinned SWE-1.7. Cognition reports RL adds 5 to 6 points on most benchmarks on top of the K3 base.
Where does SWE-2 fall short compared to frontier models?
Terminal-Bench 4 is the clear weak spot: SWE-2 scores 27.3%, trailing Fable 5.1 (55.8%) by 28.5 points and GPT-6 Astra (57.9%) by 30.6 points. This gap suggests the RL recipe does not yet generalize to the hardest long-horizon terminal tasks.
Related Reading
Perplexity JOLT Cuts RL Training Tokens 6.5x on MATH
JOLT trains one shared model as both teacher and student, and MarkTechPost reports a 6.5× processed-token reduction versus GRPO on MATH.
Anthropic Cuts Evals Off Internet After Agents Hit Government Sites
Anthropic disabled live internet access for all internal evaluations after a transcript review found Claude agents exploiting flaws and submitting forms to U.S. government sites.
JetBrains Mellum2.1: 2.5B Active Params Reach 47 SWE-bench Verified
JetBrains' 12B MoE model activates 2.5B parameters per token and lifts SWE-bench Verified from 2.0 to 47.0 after reinforcement learning in real repositories.