Cognition SWE-2 Beats Frontier Coding AI at 64% Lower Cost Using Single-Run RL Training
14 hour ago / Read about 55 minute
Source:TechTimes

Cognition.com

Cognition's SWE-2, launched September 10 inside Devin Desktop and CLI, does something its predecessor explicitly did not: it starts editing code. In the prior model — SWE-1.7, released in July — Cognition's own engineers documented a behavioral pattern where the agent read deeply through a codebase before touching a single file, making its first real code edit at a median of 48 steps. SWE-2 medium reaches that same first edit at step 18 — a 62.5% reduction driven not by hardware or parameter count, but by a training algorithm that docked the model points every time it spent money it did not need to spend.

The efficiency improvement translates into hard numbers. On Cognition's own FrontierCode 1.1 Main benchmark, SWE-2 medium scores higher than SWE-1.7 while completing tasks in 58% fewer turns and at 81% lower average cost per task. Against Anthropic's Fable 5.1 — the current benchmark leader at 50.9% on FrontierCode 1.1 Main — SWE-2 scores 50.0% while running 64% cheaper. Enterprise teams that committed to frontier-model pricing for their Devin workloads now have a model that reaches nearly identical benchmark scores at roughly a third of the line-item cost.

The behavioral reversal from SWE-1.7's wide codebase scans to SWE-2's direct edits is not an accident of model architecture. It is what happens when you train a reward function that explicitly penalizes inference spend.

Read more: Cognition SWE-1.7: RL on Top of RL Yields Near-Frontier Code at Low Cost

Focused Exploration: Efficiency as a Training Outcome

Cognition calls the result "focused exploration": the model has developed better judgment about which files actually matter for a given task, and it stops reading the ones that do not.

The practical consequences extend beyond the first-edit timing. Cognition reports that SWE-2 shows stronger test coverage — writing checks that catch regressions rather than just passing the immediately specified conditions. When a standard approach fails, the model searches for workarounds within the permissions it was given: in one internal example, when an MCP integration was unavailable, SWE-2 reconstructed the needed data from Slack channel history already in its context. And when challenged, it re-derives conclusions rather than re-asserting them — running artifacts to gather evidence rather than trusting surface-level text.

The three effort levels (medium, high, max) behave distinctly. Medium steps into action fastest, making it the cost-efficient choice for well-scoped, intermediate tasks. High and max plan more extensively, explore more of the codebase, and handle complex verification — at higher cost per task. The model's cost discipline at the medium tier does not mean it under-invests at higher tiers; it means each tier allocates effort commensurate with the task's actual complexity.

A Proof, Not Just a Method

The training approach behind this behavior is the article's most technically significant development, and it carries consequences that extend well beyond Cognition's own models. Most labs that train multi-effort-level models — including Moonshot AI, whose Kimi K3 provides SWE-2's foundation — handle effort tiers by training separate expert models for each domain-effort combination, then distilling those experts into a single model through multi-teacher on-policy distillation. The process is expensive, complex, and produces models whose effort-tier behavior is shaped by the distillation process rather than by a principled training objective.

Cognition's approach uses a single reinforcement learning run with a cost-penalized reward function of the form R = S − λ_e·C, where S denotes whether the rollout succeeded, C is its actual cost in dollars and time, and λ_e is a per-effort-level penalty coefficient. What makes this more than an engineering choice is that Cognition formally proved the linear cost penalty is the only functional form that guarantees the RL objective depends solely on average cost and average solve rate across the full range of possible rollout distributions. Any non-linear penalty creates a reward structure that is sensitive to the distribution of individual rollout costs — not just their average — meaning the model can inadvertently be rewarded for gaming the distribution rather than improving the actual cost-performance tradeoff.

The coefficient λ_e for each effort level is set to match the local slope of Kimi K3's Pareto frontier at that effort level. This is the geometric key: when the iso-reward line (slope λ_e) is tangent to the current Pareto frontier, any improvement in average reward corresponds exactly to pushing the frontier outward. Set λ_e too high for a given effort level, and the model learns that high-effort mode can save cost by behaving like medium-effort mode — gaining reward by reducing spend without improving performance. Set it correctly, and every reward improvement genuinely advances the frontier.

Because this result is derived from first principles and proved in Appendix B of Cognition's launch post, it is not a Cognition trade secret. It is a portable mathematical result that any lab training models with multiple effort tiers can apply directly.

Scale: Into the Multi-Trillion-Parameter RL Regime

SWE-2's base model, Kimi K3, comes from Moonshot AI in Beijing and carries 2.8 trillion parameters in a mixture-of-experts architecture. That is roughly three times the scale of the model Cognition started from for SWE-1.7. The infrastructure demands of running RL at this scale required four engineering advances beyond what the SWE-1.7 training infrastructure provided.

A prefill delayer batches nearby GPU prefill requests in the scheduler, improving throughput per GPU and tokens per second per request by 10–20%. Speculative decoding via DSpark — which has a draft model propose token sequences that the larger policy model verifies — accelerates rollout generation; but as the policy changes during training, the draft model's distribution drifts from the current policy, degrading acceptance rates. Cognition addressed this by training a new draft model with SpecForge, achieving 15% longer accepted sequences, and then integrating online draft-model training into the RL loop so the draft continuously tracks the evolving policy. Quantization-aware training using NVFP4 and FP8 kernels — applied to the multi-head latent attention layers' K, Q, V, and score computations — allows more rollouts to fit in GPU memory without the inference-training policy gap that uncalibrated low-precision inference would introduce at this scale.

The training data grew substantially as well. Cognition tripled the number of RL environments since SWE-1.7, expanded the repository distribution to generate more challenging tasks for a stronger base model, and built an iterative flywheel that uses earlier SWE-2 checkpoints to harden verifiers against reward hacking.

Together, these changes gave SWE-2 lower inference-training KL divergence and comparable compute throughput to SWE-1.7, despite the 3× parameter increase.

Where the Benchmarks Tell the Full Story

SWE-2's benchmark profile is strong across most evaluations but presents a notable gap on the hardest terminal-environment tasks — a gap practitioners should understand before deploying the model on complex infrastructure work.

On FrontierCode 1.1 Main, SWE-2 scores 50.0% against Fable 5.1's 50.9%, GPT-5.6 Sol's 47.5%, and Grok 4.6's 48.0%. On DeepSWE 1.1 — a long-horizon software engineering benchmark produced by Datacurve, an independent data company — SWE-2 scores 73.0%, outperforming Fable 5.1 (67.4%), GPT-5.6 Sol (72.7%), and Grok 4.6 (67.5%). On Terminal-Bench 2.1, SWE-2 scores 92.8% against Fable 5.1's 91.4%.

Terminal-Bench 4, however, tells a different story. SWE-2 scores 27.3% on what appears to be the hardest multi-step agentic terminal task set, against Fable 5.1's 55.8% and GPT-6 Astra's 57.9% — a gap of more than 28 percentage points against the two leading frontier models. This is not a rounding error; it suggests that the hardest categories of autonomous terminal-environment work, beyond the coding tasks in Cognition's training distribution, remain a genuine limitation of SWE-2's current capability. Teams doing complex shell scripting, multi-command infrastructure workflows, or intricate environment debugging should test on representative tasks before relying on the headline benchmark comparisons.

A mandatory caveat applies to all of these numbers: every score in the table is self-reported by the respective labs. FrontierCode 1.1 benchmark page is Cognition's own benchmark, produced by the company whose model tops it. No independent third-party audit of SWE-2's results exists as of publication, which is expected given yesterday's launch. DeepSWE 1.1 is produced by Datacurve rather than Cognition, making SWE-2's strong performance there the most independently meaningful result in the table. Practitioners evaluating these numbers should replicate them on their own representative workloads before making procurement decisions.

GPT-6 Astra leads the table overall — scoring 53.3% on FrontierCode, 74.1% on DeepSWE, 89.9% on Terminal-Bench 2.1, and 57.9% on Terminal-Bench 4 — and Cognition positions SWE-2's value proposition against it explicitly: near-Astra benchmark performance on most benchmarks at approximately a quarter of the cost.

Read more: AI Coding Agents: Cognition's $26B Raise Bets Agent-First Architecture Beats IDE Tools

Who Can Actually Use It — and the Ecosystem Constraint

SWE-2 is available in Devin Desktop and Devin CLI as of September 10. Rollout to Devin Web and Cognition's Fusion enterprise API product is underway. Cognition has launched a one-month free promotion giving all Pro, Max, and Teams subscribers unlimited SWE-2 access, with $20-per-month Pro plan pricing.

There is, however, a significant structural constraint for a portion of the developer market: SWE-2 has no standalone API and no open weights. Teams that want to call SWE-2 through OpenRouter, build a custom agent harness around it, or integrate it directly into CI/CD pipelines cannot do so — the model runs only inside Devin's managed environment. Community reaction to the launch reflected this directly; one widely cited post on the announcement thread was blunt: "I don't want to use your CLI. I already have my own harnesses." Whether Cognition publishes a standalone API for SWE-2 has not been announced.

For teams already on the Devin platform, the economics are more straightforward. The 81% per-task cost reduction relative to SWE-1.7 at higher performance accrues immediately. Teams running significant Devin workloads — Cognition reported $492 million in annualized revenue run-rate by May 2026, a 13-fold increase in 12 months — will see material differences in their monthly bills.

How to Read the Kimi K3 Origin

SWE-2's foundation model, Kimi K3, is the product of Moonshot AI, headquartered in Beijing. That fact has operational implications that are distinct in SWE-2's case from what they would be for direct users of the Kimi API.

Under Article 7 of China's National Intelligence Law (2017), all organizations and citizens in China must support, assist, and cooperate with national intelligence work on demand. China's Cybersecurity Law (2017) and Data Security Law (2021) layer additional obligations for data access and localization. These legal obligations apply to Moonshot AI as a Chinese entity, regardless of what its privacy policy states or where its servers are physically located.

When Devin users run SWE-2, their prompts travel to Cognition's US-based platform — not to Moonshot's servers. Cognition controls the inference stack; Moonshot AI provided the pre-trained base model during the training process, and Cognition's own post-training substantially modified that base. This is a materially different data-exposure path than calling the Kimi API directly, where prompts go to Moonshot's Beijing-controlled infrastructure. The runtime separation that Devin's architecture provides means that SWE-2 users are not, in practical terms, sending data to a server subject to Chinese law.

The residual concern is different: whether the base model's training data and internal representations carry any CCP-aligned behavioral patterns. Cognition's own trustworthiness evaluation addresses this directly. Using 145 questions about politically sensitive topics in China, submitted in English, Simplified Chinese, and Traditional Chinese, Cognition tested SWE-2 against a GPT 5.6 Luna judge that evaluated whether responses adopted official PRC positions. SWE-2 passed 98.0% of attempts — 99.8% in English, 95.2% in Simplified Chinese, and 99.1% in Traditional Chinese. Context-dependent vulnerability testing across Western, Pakistani, Chinese, Tibetan, and Falun Gong-affiliated customer framings found no statistically significant difference in unsafe behavior under any condition.

This evaluation was conducted by Cognition and has not been independently verified — a limitation worth noting. TechTimes' July 2026 coverage of SWE-1.7 documented that documented Kimi CCP-aligned patterns appeared in independent testing of earlier versions. Separately, Moonshot AI's Kimi API experienced a cross-user data isolation failure in April 2026 in which one user's resume — including name, phone number, and work history — was disclosed to an unrelated user during a PowerPoint translation session, logged by OECD Incidents Monitor. That breach involved the Kimi API directly, not Cognition's Devin platform, but it reflects on the organizational practices of the company that built the base model Devin now runs.

For enterprise teams deciding whether to deploy SWE-2, the decision framework is: the performance claims are real and benchmarked, the cost advantage at medium effort is substantial, the Devin-only ecosystem constraint is a hard lock-in for customization workflows, the runtime data path to China is structurally mitigated by Cognition's US architecture, and the base-model trustworthiness evaluation is promising but internally conducted. Teams with strict security mandates should request Cognition's independent audit roadmap before committing to production deployment.

Does SWE-2 Ask "What Does This Cost?"

The behavioral shift that separates SWE-2 from SWE-1.7 is, at its core, a question about what AI coding agents are optimizing for. SWE-1.7 was trained to solve tasks thoroughly. SWE-2 was trained to solve tasks both thoroughly and efficiently — where "efficiently" means actual dollars and time, not a proxy like token count or step count. The Pareto-informed penalty directly baked the inference bill into the reward signal.

The result, at the medium effort tier, is an agent whose behavior more closely resembles how a competent engineer approaches a well-scoped ticket: read what is relevant, edit it, verify the result. At higher effort tiers, SWE-2 still plans and explores — but now with calibrated judgment about when depth is worth the cost. Whether that calibration generalizes to production codebases beyond Cognition's training environments is what enterprise deployment data over the next quarter will reveal. The benchmark numbers say it generalizes well on average. The Terminal-Bench 4 gap says it has limits on the hardest tasks. Those two facts together are the only honest summary of where SWE-2 sits at launch.

How Does SWE-2 Compare to Fable 5.1 and GPT-6 Astra?

On FrontierCode 1.1 Main, SWE-2 trails Fable 5.1 by less than one benchmark point (50.0% vs. 50.9%) while running 64% cheaper. On DeepSWE 1.1 — a long-horizon engineering benchmark produced by Datacurve rather than Cognition — SWE-2 (73.0%) actually outperforms Fable 5.1 (67.4%). On Terminal-Bench 4, Fable 5.1 leads substantially (55.8% vs. SWE-2's 27.3%), making Fable 5.1 the better choice for the hardest multi-step agentic terminal tasks. GPT-6 Astra leads both on capability overall but costs approximately four times more per task than SWE-2. Cognition's positioning is that for the majority of real-world engineering tasks — not the absolute hardest agentic work — SWE-2 delivers equivalent or superior results at materially lower cost.

What Is Pareto-Informed Cost Penalty RL, and Why Does It Matter?

Standard RL post-training for coding models optimizes for task success. Multi-effort-level models typically train separate expert models for each effort tier and combine them through distillation. Cognition's approach instead uses a single RL run with a reward function R = S − λ_e·C, where S is success (0 or 1), C is actual rollout cost in dollars and time, and λ_e is set to match the slope of the base model's Pareto frontier at each effort level. The company proved in the launch post's Appendix B that linear cost penalty is the only functional form where the RL objective depends solely on average cost and average solve rate — not on the distribution of individual rollouts. This is a portable mathematical result that any lab training multi-effort models can apply; it is not a Cognition proprietary algorithm but a derived consequence of the optimization goal.

Is SWE-2 Available as a Standalone API?

No. As of launch, SWE-2 runs only inside Cognition's Devin platform — Devin Desktop, CLI, Web, and Fusion. Cognition has not announced a standalone API endpoint or open weights for SWE-2. Developers who want to call SWE-2 through OpenRouter, integrate it into custom agent harnesses, or use it in CI/CD pipelines outside Devin's managed environment cannot do so with the current release. Cognition's one-month free promotion applies to Devin Pro, Max, and Teams subscribers, with Pro plans starting at $20 per month.

Does SWE-2's Chinese Base Model Create Enterprise Security Risk?

The risk depends on how SWE-2 is accessed. Kimi K3 (the base model) is produced by Moonshot AI in Beijing, subject to China's National Intelligence Law, which requires organizations to cooperate with state intelligence requests. However, Devin users interact with Cognition's US-based infrastructure — prompts go to Cognition's servers, not Moonshot's. This is a structural mitigation: the runtime data path does not flow to Chinese-controlled servers. The residual concerns are the base model's training data origins (which Cognition's own trustworthiness evaluation, using 145 politically sensitive questions, found to pass at 98.0% overall) and the April 2026 cross-user data breach at Moonshot's Kimi API (which affected Kimi API users, not Devin users). Enterprises with strict security mandates should treat Cognition's trustworthiness evaluation as a starting signal, not a final clearance, and verify whether an independent audit is available.


Frequently Asked Questions

How does SWE-2 compare to Fable 5.1 and GPT-6 Astra?

On FrontierCode 1.1 Main, SWE-2 trails Fable 5.1 by less than one benchmark point (50.0% vs. 50.9%) while running 64% cheaper. On DeepSWE 1.1 — a long-horizon engineering benchmark produced by Datacurve rather than Cognition — SWE-2 (73.0%) actually outperforms Fable 5.1 (67.4%). On Terminal-Bench 4, Fable 5.1 leads substantially (55.8% vs. SWE-2's 27.3%), making Fable 5.1 the better choice for the hardest multi-step agentic terminal tasks. GPT-6 Astra leads both on capability overall but costs approximately four times more per task than SWE-2. For most real-world engineering tasks that are not the hardest agentic work, SWE-2 delivers equivalent or superior results at materially lower cost.

What is Pareto-informed cost penalty RL, and why does it matter beyond this product launch?

Standard RL post-training for coding models optimizes for task success. Multi-effort-level models typically train separate expert models for each effort tier and combine them through distillation. Cognition's approach uses a single RL run with a reward function R = S − λ_e·C, where S is success, C is actual rollout cost in dollars and time, and λ_e is set to match the slope of the base model's Pareto frontier at each effort level. Cognition proved this linear form is the only functional form where the RL objective depends solely on average cost and average solve rate — not on the distribution of individual rollouts. This result is portable: any lab training multi-effort-tier models can apply it, making it a contribution to the field's training methodology, not only a Cognition product feature.

Is SWE-2 available as a standalone API?

No. As of launch, SWE-2 runs only inside Cognition's Devin platform — Desktop, CLI, Web, and Fusion. Cognition has not announced a standalone API endpoint or open weights. Developers who want to call SWE-2 through OpenRouter, integrate it into custom agent harnesses, or use it in CI/CD pipelines outside Devin's managed environment cannot do so with the current release. Cognition's one-month free promotion applies to Pro, Max, and Teams subscribers, with Pro plans starting at $20 per month.

Does SWE-2's Chinese base model create enterprise security risk?

The risk depends on access path. Kimi K3 (the base model) is produced by Beijing-based Moonshot AI, subject to China's National Intelligence Law, which requires cooperation with state intelligence requests. Devin users interact with Cognition's US-based infrastructure, not Moonshot's — prompts go to Cognition's servers, not Beijing. This is a meaningful structural mitigation. Residual concerns include base-model training data origins (Cognition's own trustworthiness evaluation found 98.0% pass rates on politically sensitive probes) and the April 2026 cross-user data breach at Moonshot's Kimi API (which affected Kimi API users, not Devin users). Enterprises with strict security mandates should treat Cognition's internal evaluation as a starting signal and confirm whether an independent third-party audit has been conducted before committing to production use.