Kimi K2.5's Linear Attention: What It Means for Long-Context Coding Costs
By Eric Bush · July 21, 2026 · 8 min read
At GTC 2026 on July 18, Moonshot CEO Yang Zhilin laid out the technical roadmap for Kimi K2.5. Two claims matter for anyone watching their AI coding bill: the team replaced the Adam optimizer with MuonClip, said to nearly double data-utilization efficiency, and introduced "Kimi Linear," a linear-attention design they claim surpasses full attention at 1M-token context. Their Agent Swarm now runs 300 agents in parallel. The architecture headline is exciting, but the cost story is the one developers should read closely — because attention math is the reason long-context requests are so expensive in the first place.
Why Long Context Is Disproportionately Expensive
Standard (full) attention has every token attend to every other token. The compute for that step scales with the square of the sequence length — double the context and the attention cost roughly quadruples. On top of that, the model keeps a KV cache: a stored key/value vector for every token processed so far. That cache grows linearly with context length and has to sit in expensive GPU memory for the whole request. So two costs compound as prompts get longer: quadratic attention compute and a linearly ballooning memory footprint that limits how many requests a GPU can serve at once.
That is the real engine behind long-context surcharges and tiered pricing. When a provider charges more for requests above some context threshold, or throttles 1M-token windows, it is passing along the fact that those requests hog memory and compute far out of proportion to their token count. The KV cache, not the raw token total, is often the binding constraint on serving cost.
What Linear Attention Actually Changes
Linear attention approximates the same operation in roughly linear time instead of quadratic, and — critically — it shrinks the KV-cache burden by maintaining a compact fixed-size state rather than storing a growing vector per token. Attack both the quadratic compute term and the linearly growing memory footprint and you remove the two things that make long context blow up super-linearly. That is precisely why Moonshot frames Kimi Linear as a cost play as much as a capability one: the promise is that you can feed a whole repository or a full 1M-token window without the usual disproportionate cost curve.
Token Math: A 500K-Token Repo Analysis
Say you feed a 500K-token slice of a codebase and ask for a 5K-token architectural summary. Kimi K2.5 is priced at in $0.60 / out $3 per million tokens. The raw token bill is straightforward: 0.5 × $0.60 + 0.005 × $3 = $0.30 + $0.015 = about $0.315 per request. That is the sticker price. But the reason a price like $0.60 input is even possible at half-million-token scale is what happens underneath.
With full attention, the KV cache for 500K tokens dominates GPU memory, so the provider can pack far fewer concurrent requests onto each chip. Serving cost per request is driven up by that scarcity, and it is why some providers price long-context tiers at a premium or cap them. When linear attention keeps the state compact instead, the same GPU serves many more of these long requests in parallel, the per-request serving cost falls, and a low headline price at 500K tokens becomes sustainable rather than a loss leader. Kimi K2.5's low pricing — well under Kimi K3 (in $3 / out $15) and close to the earlier Kimi K2 (in $0.57 / out $2.30) — already reflects an efficiency-first design where the architecture is doing the cost-cutting.
Compare the alternative pattern: chunking that same repo and running many smaller full-attention requests. Chunking means re-sending overlapping context, re-establishing state on each call, and stitching results — more total input tokens billed and more orchestration overhead. If one long request stays cheap, the single-pass approach wins on both token count and engineering effort.
The Caveat: Recall Is Not Free
Linear attention buys its efficiency with an approximation, and approximations trade something away. The classic risk is long-range recall: a compact fixed-size state can blur or drop a detail that appeared 400K tokens earlier, where full attention would still attend to it exactly. For repo-wide reasoning that is exactly the failure mode that hurts — a function defined early in the context that the model forgets by the time it writes code depending on it. Moonshot's claim that Kimi Linear surpasses full attention at 1M tokens is promising, but it is their benchmark, not yours.
Before you trust a linear-attention model for whole-repo work, verify recall on your own codebase: plant a few facts early in a long context and check that the model still uses them correctly at the end. Cheap long context is only cheap if the answers are right — a wrong repo-wide analysis that you have to redo costs more than the tokens it saved.
What to Do With This
If your workflow leans on long context — feeding large repos, long logs, or extended agent histories — architectural efficiency like Kimi Linear is where the next round of cost savings comes from, and it is worth benchmarking against your current chunk-and-stitch setup. Treat the low price as an invitation to test, not a guarantee of quality, and measure recall before you commit repo-scale tasks to it. To compare a low-priced long-context model against premium options on your actual token volumes, run the numbers through the AI cost calculator.
Want to calculate exact costs for your project?
Frequently Asked Questions
What is linear attention and why does it cut costs?
Linear attention approximates the standard attention operation in roughly linear time instead of quadratic, and keeps a compact fixed-size state rather than a KV cache that grows with every token. Because quadratic compute and a ballooning KV cache are the two things that make long-context requests expensive to serve, shrinking both lets providers serve long prompts far more cheaply.
Why are long-context AI requests so expensive?
Full attention scales with the square of the sequence length, so doubling context roughly quadruples attention compute. Separately, the KV cache stores a vector per token and grows linearly, occupying expensive GPU memory for the whole request and limiting how many requests each chip can serve at once. Those compounding costs are what long-context surcharges and tier caps pass along.
How much does a 500K-token repo analysis cost on Kimi K2.5?
At Kimi K2.5's pricing of $0.60 per million input tokens and $3 per million output, a 500K-token input with a 5K-token output costs about $0.315 per request (0.5 x $0.60 + 0.005 x $3). The efficiency-first architecture is what makes a low price at that context length sustainable rather than a loss leader.
What is the downside of linear attention for coding?
The efficiency comes from an approximation, and the main risk is weaker long-range recall — a compact state can drop a detail that appeared very early in a long context. For repo-wide reasoning that can mean forgetting a function defined at the start of the context. Verify recall on your own codebase before trusting it for whole-repo tasks.
Is Kimi K2.5 cheaper than Kimi K3?
Yes, substantially. Kimi K2.5 is priced at $0.60 input and $3 output per million tokens, while Kimi K3 is $3 input and $15 output — roughly 5x higher on both. K2.5 sits close to the earlier Kimi K2 ($0.57 in / $2.30 out), reflecting an efficiency-first design rather than a frontier-capability price.
Related Articles
Kimi K3 Released: 2.8T Open Source Model with 1M Context — What Coding Teams Pay to Run It
Moonshot's Kimi K3 is a 2.8 trillion parameter open-source model with native vision and a 1M token context window. We break down the real self-hosting hardware costs, when it beats API pricing, and how it compares to today's cheapest coding APIs.
xAI Grok Build Open-Sourced: What the Apache 2.0 Rust Coding Agent Means for AI Development Costs
xAI open-sourced Grok Build, a Rust-based coding agent under Apache 2.0. We analyze cost implications vs Claude Code, Cursor, and Codex for developers seeking free AI coding tools.
A 27B Model on Your iPhone: What Bonsai Means for AI Coding Costs
Bonsai 27B fits a 27-billion-parameter model onto an iPhone with 1-bit quantization. Here is what on-device coding models mean for your API bill and the break-even math.