Composer 2 is a frontier-level agentic software engineering model that achieves state-of-the-art performance on benchmarks like SWE-bench Multilingual and Terminal-Bench through a two-phase training process of continued pretraining and large-scale reinforcement learning within a real-world Cursor environment.
Original authors:Cursor Reseach, :, Aaron Chan, Ahmed Shalaby, Alexander Wettig, Aman Sanger, Andrew Zhai, Anurag Ajay, Ashvin Nair, Charlie Snell, Chen Lu, Chen Shen, Emily Jia, Federico Cassano, Hanpeng Liu, Haoyu Cursor Reseach, :, Aaron Chan, Ahmed Shalaby, Alexander Wettig, Aman Sanger, Andrew Zhai, Anurag Ajay, Ashvin Nair, Charlie Snell, Chen Lu, Chen Shen, Emily Jia, Federico Cassano, Hanpeng Liu, Haoyu Chen, Henry Wildermuth, Jacob Jackson, Janet Li, Jediah Katz, Jiajun Yao, Joey Hejna, Josh Warner, Julius Vering, Kevin Frans, Lee Danilek, Less Wright, Lujing Cen, Luke Melas-Kyriazi, Michael Truell, Michiel de Jong, Naman Jain, Nate Schmidt, Nathan Wang, Niklas Muennighoff, Oleg Rybkin, Paul Loh, Phillip Kravtsov, Rishabh Yadav, Sahil Shah, Sam Kottler, Alexander M Rush, Shengtong Zhang, Shomil Jain, Sriram Sankar, Stefan Heule, Stuart H. Sul, Sualeh Asif, Victor Rong, Wanqi Zhu, William Lin, Yuchen Wu, Yuri Volkov, Yury Zemlyanskiy, Zack Holbrook, Zhiyuan Zhang
Original authors: Cursor Reseach, :, Aaron Chan, Ahmed Shalaby, Alexander Wettig, Aman Sanger, Andrew Zhai, Anurag Ajay, Ashvin Nair, Charlie Snell, Chen Lu, Chen Shen, Emily Jia, Federico Cassano, Hanpeng Liu, Haoyu Chen, Henry Wildermuth, Jacob Jackson, Janet Li, Jediah Katz, Jiajun Yao, Joey Hejna, Josh Warner, Julius Vering, Kevin Frans, Lee Danilek, Less Wright, Lujing Cen, Luke Melas-Kyriazi, Michael Truell, Michiel de Jong, Naman Jain, Nate Schmidt, Nathan Wang, Niklas Muennighoff, Oleg Rybkin, Paul Loh, Phillip Kravtsov, Rishabh Yadav, Sahil Shah, Sam Kottler, Alexander M Rush, Shengtong Zhang, Shomil Jain, Sriram Sankar, Stefan Heule, Stuart H. Sul, Sualeh Asif, Victor Rong, Wanqi Zhu, William Lin, Yuchen Wu, Yuri Volkov, Yury Zemlyanskiy, Zack Holbrook, Zhiyuan Zhang
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
🚀 The Big Picture: From "Smart Assistant" to "Junior Developer"
Imagine you have a coding assistant.
Old Assistants (Composer 1) were like a very knowledgeable intern. They could answer questions, fix a typo if you pointed it out, and write a small function if you gave them a very specific recipe. But if you asked them to build a whole feature from scratch, they'd get confused, forget what they did five minutes ago, or give up.
Composer 2 is like a promising junior developer. It doesn't just wait for instructions; it can look at a messy project, figure out what's broken, write a plan, fix the code, test it, and even handle the boring stuff like updating documentation. It can work for hours without getting tired or losing its place.
The paper explains how they built this "Junior Developer" and why it's so good at it.
🏗️ Phase 1: The "Boot Camp" (Continued Pretraining)
Before teaching the model to be an agent, they had to make sure it knew its stuff.
The Analogy: Imagine taking a brilliant university graduate (the base model, Kimi K2.5) who knows a little bit about everything, and sending them to a specialized coding boot camp.
What happened: They didn't just teach them syntax; they fed them millions of lines of real-world code, bug reports, and technical documentation.
The Result: The model went from "knowing what a loop is" to "knowing how to debug a complex loop in a massive, messy codebase." This step was crucial because you can't teach someone to be a detective if they don't know what a crime scene looks like.
🧠 Phase 2: The "Gym" (Reinforcement Learning)
This is the magic sauce. Once the model knew the basics, they put it in a gym to learn how to think and act.
The Analogy: Think of this as training a dog to fetch, but the dog has to solve a puzzle to get the treat.
How it works:
The model is given a real-world problem (e.g., "Fix this bug that crashes the app").
It tries to solve it. It might open files, run commands, make mistakes, and try again.
The Reward System: If it fixes the bug, it gets a "treat" (a high score). If it breaks things or gets stuck in a loop, it gets a "time-out" (a penalty).
The Twist: They didn't just give it easy puzzles. They gave it real, messy problems from their own company. They even added a rule: "Don't waste time on easy tasks, but think hard on the scary ones." This taught the model to be efficient (don't overthink a simple typo) but persistent (don't give up on a hard bug).
🎯 The "Real-World" Test (CursorBench)
Most AI papers test models on "textbook" problems (like solving a math puzzle from a competition). The authors realized this is fake. Real coding is messy, vague, and huge.
The Analogy: Testing a car on a perfectly paved racetrack (public benchmarks) vs. testing it in heavy traffic with potholes and construction (CursorBench).
The Problem: Public benchmarks are like a racetrack. The instructions are perfect, the road is clear, and the destination is obvious.
The Solution (CursorBench): They built a benchmark using actual bugs and tasks their own engineers faced.
The Prompt: Instead of "Write a function to sort this list," the prompt is a vague Slack message: "Hey, the app crashed when I clicked the button. Here are some logs. Fix it."
The Challenge: The model has to read the logs, guess what went wrong, find the file, fix it, and make sure it doesn't break anything else.
The Result: Composer 2 crushed this test. It proved that by training on real chaos, the model became much better at handling real chaos.
🛠️ The Engine Room (Infrastructure)
To train this giant brain, they needed a massive, custom-built engine.
The Analogy: Imagine trying to train a choir of 1,000 singers. If they all sing at once without a conductor, it's noise. If they sing one by one, it takes forever.
The Innovation: They built a system where:
The Singers (Inference): Thousands of computers generate solutions simultaneously.
The Conductor (Training): A central system watches the results, picks the best ones, and instantly updates the singers' "sheet music" (the model weights).
The Secret Sauce: They made sure the "singers" and the "conductor" were perfectly synchronized so no one got confused about which version of the song they were singing. They also built a system to snapshot the work. If a computer crashes halfway through a 10-hour task, they can restart exactly where they left off without losing the progress.
🏆 The Scoreboard (Results)
Performance: Composer 2 is now competitive with the most expensive, powerful AI models on the market (like GPT-5 or Opus), but it's cheaper to run.
Efficiency: It doesn't just get the right answer; it gets it faster and with less "thinking" (tokens) than the giants.
The Takeaway: You don't need the biggest, most expensive model to be the best coder. You need a model that has been specialized and trained on real-world problems.
💡 Summary in One Sentence
Composer 2 is a coding AI that was trained not just by reading books, but by actually doing the job in a simulated real-world office, learning to be efficient, persistent, and smart enough to handle the messy, vague problems that humans actually face every day.
1. Problem Statement
The paper addresses the gap between current Large Language Model (LLM) coding assistants and the requirements of agentic software engineering. While existing models perform well on static, narrow benchmarks (e.g., competitive programming or isolated bug fixes), they often fail in real-world scenarios characterized by:
Long-horizon tasks: Requiring multi-step planning, debugging, and iterative refinement over extended periods.
Ambiguity: Real developer requests are often underspecified, lacking the precise constraints found in public benchmarks.
Train-Test Mismatch: Public benchmarks suffer from data contamination (models memorizing test sets) and fail to capture the complexity of navigating large codebases, reading production logs, and managing version control.
Efficiency vs. Capability: Frontier models are often prohibitively expensive for interactive use, while smaller models lack the reasoning depth required for complex engineering tasks.
2. Methodology
Composer 2 is trained using a two-phase approach designed to specialize a general-purpose model for agentic coding while maintaining cost efficiency.
A. Base Model Selection
The team selected Kimi K2.5, a Mixture-of-Experts (MoE) model with 1.04 trillion total parameters and 32 billion active parameters, as the foundation. This model was chosen for its strong base coding knowledge and state-tracking capabilities.
B. Phase 1: Continued Pretraining
To enhance domain-specific knowledge before reinforcement learning:
Data: A large, code-dominated data mix was used.
Stages:
Standard Pretraining: 32k token sequence length.
Long-Context Extension: Extended to 256k tokens.
Supervised Fine-Tuning (SFT): Targeted on specific coding tasks.
Multi-Token Prediction (MTP): MTP layers were trained from scratch using self-distillation to enable speculative decoding, significantly speeding up inference.
Key Finding: The report establishes a strong correlation between reduced perplexity on internal codebases during pretraining and improved downstream Reinforcement Learning (RL) performance.
C. Phase 2: Asynchronous Reinforcement Learning (RL)
The core of the training involves RL on a massive set of real-world coding tasks.
Environment: Training occurs in CursorBench, an internal harness that mirrors the production Cursor environment (tools, file systems, execution containers) to minimize train-test mismatch.
Algorithm:
Uses Policy Gradient with multiple samples per prompt.
Operates in a single-epoch regime (no prompt reuse).
Asynchronous Pipeline: Decoupled training and rollout generation workers.
Stability Techniques:
Router Replay: Ensures the inference engine and trainer agree on MoE expert routing to prevent gradient noise.
KL Divergence: Uses the standard k1=−logr estimator to avoid variance blow-up when distributions diverge.
Self-Summarization: Chains generations with summaries to handle long contexts, reducing error rates and token usage.
Reward Shaping:
Nonlinear Length Penalty: Encourages the model to be quick on easy tasks but allows deep thinking on hard tasks.
Behavioral Rewards: Penalties for poor tool usage (e.g., leaving unfinished to-do lists) and rewards for code quality and communication style.
D. Infrastructure Innovations
Parallelism: Introduced Context Parallelism (CP) as the primary scaling axis for long contexts, decoupled from Tensor Parallelism (TP). This improves efficiency over traditional TP for long sequences.
Quantization: Utilizes MXFP8 and NVFP4 (per-token scaling) for MoE layers on NVIDIA Blackwell GPUs. Per-token scaling was found critical for training stability compared to per-tensor scaling.
Anyrun: An internal compute platform using Firecracker VMs to run untrusted code at scale, supporting stateful environment forking and snapshotting for efficient RL rollouts.
3. Key Contributions
CursorBench: A new, rigorous internal benchmark derived from real engineering tasks. Unlike public benchmarks, it features:
High Ambiguity: Short, underspecified prompts (median 390 chars vs. >1000 in public sets).
Complexity: Requires significantly more code changes (median 181 lines vs. ~10 in SWE-bench).
No Contamination: Tasks are fresh and not present in training data.
Training Pipeline: A scalable, asynchronous RL framework that successfully trains a 1T-parameter MoE model on long-horizon coding tasks without the instability often seen in RLHF.
Self-Summarization: Demonstrated that chaining generations with summaries allows models to process information beyond their context window limits effectively.
Cost-Efficiency: Proved that a domain-specialized model can outperform general-purpose frontier models in coding while being significantly cheaper to serve.
4. Results
Composer 2 achieved state-of-the-art performance across multiple benchmarks:
Benchmark
Composer 2
Previous Composer (1.5)
Kimi K2.5 (Base)
Top Frontier Models (e.g., GPT-5, Opus)
CursorBench
61.3%
44.2%
36.0%
~58-64%
SWE-bench Multi.
73.7%
65.9%
65.1%
~74-77%
Terminal-Bench
61.7%
47.9%
47.3%
~58-66%
Improvement: Composer 2 shows a 37% relative improvement over Composer 1.5 on CursorBench.
Efficiency: On the Pareto frontier of Accuracy vs. Cost, Composer 2 outperforms larger models. It achieves frontier-level accuracy at an inference cost comparable to smaller, low-effort variants of other models.
Token Efficiency: The model generates trajectories of similar length to competitors but achieves higher success rates, indicating better reasoning efficiency.
5. Significance
Validation of Specialization: The paper demonstrates that specializing a general model via continued pretraining and RL on real-world data yields superior results compared to using general-purpose models for coding tasks.
Bridging the Gap: By aligning training environments and benchmarks with actual developer workflows (handling ambiguity, logs, and large codebases), Composer 2 moves beyond "toy" coding problems to genuine software engineering assistance.
Scalability of RL: The successful training of a 1T-parameter MoE model using asynchronous RL with router replay and advanced quantization provides a blueprint for scaling agentic AI.
Future of Agentic Work: The results suggest that future coding agents will move from interactive chat to autonomous agents capable of handling hours of human-level engineering work, provided the training infrastructure supports long-horizon coherence and realistic evaluation.