# How Cursor Trained Composer on Fireworks: Distributed Infrastructure for High-Performance RL
<!--
ref: @content/youtube/sequoia/2026-05-26-how-cursor-trained-composer-on-fireworks-distributed-infrast
tags: [reinforcement-learning, foundation-model-training, agentic-coding, distributed-training, inference-infrastructure, model-weight-sync, numerical-mismatch, virtual-machine-environments]
version: 2
updated_at: 2026-11-21T20:57:57.180Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=UDTr9yUnLUI)**


*Synthesized from Federico (research lead on Composer 2 at Cursor) and Dima (Fireworks) in conversation with an unnamed host on Sequoia, 2026-05-26.*

Federico and Dima are the two guests, from Cursor and Fireworks respectively; the host is not named in the transcript.

## Core Thesis
Federico argues that Cursor trains its own model because it cares about one task, software engineering inside Cursor, and every bit of capacity in the weights should serve that task. Dima argues that the most leveraged asset of an application company is its usage data and harness, and that fine-tuning, not prompting, is how to bake that into a model. Together they describe how Composer 2 was trained with large-scale reinforcement learning on a distributed system.

## Key Insights
- **Why train a model:** Federico says Composer is much cheaper to serve than Opus and other coding models because its weights are specialized to one task.
- **Base and training recipe:** Composer 2 starts from Kimi K2.5, a roughly 1 trillion parameter mixture-of-experts model with about 30B active parameters. It gets continued pre-training on code tokens, then large-scale reinforcement learning in the Cursor harness.
- **Why not pre-train from scratch:** they start from the top, with a useful model in the least time, rather than building pre-training first.
- **What each stage teaches:** mid-training teaches libraries and common code patterns. RL teaches tool calls, navigation and writing correct code, since mid-training alone does not separate correct code from incorrect code.
- **Rollouts:** a rollout is a full agent session of about 50 turns, scored by an LLM judge or by a verifiable check such as whether the code compiles.
- **Asynchronous pipeline:** trainer and rollout workers run continuously, which trades some algorithmic staleness for much higher GPU utilization.
- **Weight shipping:** the model is about 1 TB and a new snapshot is produced every 5 to 15 minutes. Because only a subset of weights changes each step, they ship compressed deltas about 20 times smaller, and pause about 30 seconds to swap weights in production.
- **Global inference pools:** training runs in one cluster, while inference runs across four clusters around the world, some of them using production GPUs at off-peak hours.
- **Numerical mismatch:** log-probabilities from inference and training can differ, and for mixture-of-experts models the router can pick different experts. Their fixes include router replay, which passes the chosen expert IDs to the trainer, and kernels that add numbers in a fixed order, at a cost of a few percent in speed.
- **Environments:** environments must match production closely, because models can detect fake environments and behave differently. Cursor built a virtual machine stack that can start about 100,000 VMs in a burst.
- **Self-summarization:** the model has a 200,000-token context window but is trained to summarize and restart its own context, so it can work for millions of tokens. Compaction is part of the RL loop.
- **Real-time RL:** user signals from live sessions feed updates that ship every few hours. Offline RL, with many rollouts per prompt, is used first to bring the model to a usable bar.

## Actionable Takeaways
1. If your agent uses tools over long horizons, use RL against your own product harness rather than a generic toy environment.
2. Run RL environments as close to production as possible, and clone production data rather than wrapping it in a container.
3. Use many rollouts per prompt, such as 16 or 128, so that group-relative policy updates get a precise signal.
4. Ship weight updates as compressed deltas, and verify that the copy is bit-equivalent before switching.
5. Fix numerical mismatch between inference and training, especially for mixture-of-experts models, before tuning the algorithm.
6. Combine supervised fine-tuning for new knowledge with RL for behavior and style, and use an LLM judge with a precise rubric where outcomes are hard to verify.

## Notable Quotes
> "We care about software engineering inside cursor and inside cursor only." — Federico

> "the right way to do this is craft your model to act in your environment." — Dima

---

*Related: `@content/youtube/bmad-code/better-than-vibe-coding-agile-ai-driven-developmen` · `@content/youtube/yifan-bth/2025-01-26-the-future-of-ai-code-editors-with-kevin-hou-codei` · `@content/youtube/cole-medin/2026-04-29-full-guide-to-becoming-a-principled-agentic-engine` · `@content/youtube/a16z/2026-05-13-the-founders-who-left-tesla-to-rebuild-america-a16z` · `@content/youtube/latent-space/2026-06-03-scaling-past-informal-ai-carina-hong-axiom-math`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*