Key takeaways
- The Pareto Shift: Kimi Linear appears to be the first linear-attention–centric LLM that decisively outperforms a matched full-attention Transformer. Same data, same optimizer, same MoE backbone; only the token-mixing substrate changes.
- Memory as Online Learning: Its core primitive, Kimi Delta Attention (KDA), is effectively a fast-weight memory with a gated delta rule and channel-wise decay. Think of it less as “attention” and more as online learning in a small matrix, with learned forgetting replacing the static softmax kernel.
- The Virtue of Boredom: A remarkably standard architectural pattern (three KDA layers, then one full-attention layer, repeat) proves to be the sweet spot. You cut the KV cache by ~75% and increase decoding throughput by ~6× at 1M tokens, all while improving language-modeling quality.
- Empirical Validation: Scaling experiments and 48B MoE models at 1.4T and 5.7T tokens demonstrate that Kimi Linear’s compute–loss frontier is slightly superior to the full-attention baseline. This isn’t an “efficiency at the cost of quality” story; it is a straight Pareto improvement.
- Production Readiness: Crucially, this actually ships. Kernels live in the
flash-linear-attention(FLA) library; large checkpoints are on Hugging Face; vLLM has direct support. This matters because most “efficient attention” papers remain trapped in the land of academic toy benchmarks.
In what follows, I’ll attempt to do three things:
- Deconstruct what Kimi Delta Attention actually is, viewing it through the lens of fast weights and gradient descent.
- Walk through how Kimi Linear wraps KDA into a hybrid MoE architecture and what the empirical reality tells us.
- Argue for where this leaves the “linear attention vs. full attention vs. SSM” debate, and identify the remaining engineering hurdles.
The style here is deliberately digressive; we are less interested in reciting the paper than in asking why these architectural choices matter in the broader context of building intelligent systems.
1. The Quadratic Wall (Orientation)
It is not immediately obvious that we need more attention variants. FlashAttention has already rendered vanilla softmax attention remarkably efficient for reasonable sequence lengths. If your world is bounded by 8k–32k tokens, you can largely brute-force your way through with optimized kernels and tensor parallelism.
However, three structural trends are pushing us violently out of that comfort zone:
- The Million-Token Norm: We no longer deal in sentences; we deal in ecosystems. People want to stuff entire codebases, legal corpora, chat histories, or multi-day agent traces into a single context window.
- Test-Time Compute: Models like Kimi K1.5, DeepSeek-R1, and OpenAI’s o1 are shifting the FLOPs budget from training to inference. They generate vast trees of candidate thoughts, score them, and repeat. Under full attention, that cost scales quadratically.
- Agentic Entropy: Tool calls, browsing traces, chain-of-thought, scratchpads – they all live inside the context. You don’t just see a long prompt once; you see it as the base of many branching trajectories.
In this regime, quadratic attention isn’t just a mild inefficiency; it is a gravitational well. It becomes the dominant cost in both FLOPs and memory, with KV cache size becoming a hard bottleneck even on H100 clusters.
The question, therefore, isn’t “can we shave 20% off attention?” It is: can we fundamentally alter the asymptotics such that million-token contexts and RL-heavy training become economically viable?
Historically, the “linear attention” camp promised the best hardware story but always carried a quiet asterisk: does not quite match full attention on vanilla language modeling at scale. Kimi Linear is interesting precisely because it attempts to delete that asterisk.
2. Linear Attention as Online Learning
Let’s strip away the implementation details and look at the mechanism. We start from the canonical linear attention formulation and climb up to KDA.
2.1 The Fast-Weight Lens
Standard causal self-attention (ignoring softmax temperature and scaling) can be written as:
Linear attention replaces the softmax kernel with a factorization, allowing us to rewrite the operation:
where is a matrix-valued fast weight storing associations between keys and values.
If you squint, this is Hebbian learning: “fire together, wire together.” One can view as the parameters of a tiny linear model trying to map keys to values; every time the system sees a new pair
, it adds an outer product to its internal state.
Conceptually, this is beautiful. As a memory system, however, it is flawed:
- No Entropy Management:
accumulates indefinitely. Old associations never die, leading to saturation.
- Unstructured Interference: All keys share a single
matrix. Unless the embedding geometry is perfect, cross-talk is inevitable.
On short sequences, you can get away with this. On million-token real-world data, the signal-to-noise ratio collapses.
2.2 DeltaNet: Attention as Gradient Descent
DeltaNet makes the “tiny linear model” interpretation explicit. Suppose we define, at each time step, a reconstruction loss:
If we take a gradient step with learning rate :
we derive the update rule:
This is the delta rule: we attempt to adjust the memory so that applying to the key
actually reproduces the value
. The term
acts as a selective eraser; it removes components of
that conflict with the new association.
This is the critical shift: instead of just piling on outer products, we actively maintain the memory state.
The following diagram illustrates the conceptual evolution from vanilla linear attention to KDA:

2.3 Gated DeltaNet: The Scalar Forget
Gated DeltaNet (GDN) introduces an explicit forget gate :
Now the system does two things:
- Shrink the whole state by
(weight decay on the fast weights).
- Apply the delta correction towards
.
But notice the limitation: is a scalar per head. Every channel decays at exactly the same rate. This is computationally convenient but conceptually blunt. It assumes that all memories – whether they are global context or transient noise – should degrade at the same speed.
3. Kimi Delta Attention: Structured Forgetting
Kimi Delta Attention (KDA) takes the GDN concept and refines the resolution. It recognizes that memory is not monolithic.
3.1 Channel-Wise Decay
Instead of a scalar gate, KDA utilizes a diagonal matrix:
allowing each channel to possess its own decay factor.
Practically, is generated from the token representation via a low-rank MLP. This makes the decay pattern content-aware; the model can learn that “when I’m inside a Python function definition, keep these coordinates alive; when I hit the return statement, wipe them.”
3.2 DPLR Structure
The KDA update can be formulated as:
where
and denotes elementwise multiplication.
The transition matrix is “Diagonal Plus Low Rank” (DPLR). By tying the low-rank updates to the key vector, Kimi recovers flexibility without incurring the crushing cost of full DPLR.
This buys us two profound capabilities:
- Anisotropic Time: Different directions in the state space operate on different timescales via
.
- Content-Dependent Correction: The system can modulate its own plasticity based on what it is currently processing.
It is helpful to view KDA not just as “faster attention,” but as a specific type of Recurrent Neural Network (RNN) whose dynamics are learned jointly with the rest of the stack.
3.3 The Learned Position
There is an elegant algebraic consequence here. You can unroll the recurrence and write the output as:
Compare this to RoPE (Rotary Positional Embeddings), where we apply a fixed, orthogonal rotation based on distance. In KDA, the “positional transform” is learned, non-orthogonal, and data-dependent. The model doesn’t just know “how far away” a token is; it knows how relevant that distance is based on everything that happened in between.
4. The Engineering Reality: Chunking and Kernels
Architectural elegance is meaningless if the kernel is slow. The inherent problem with recurrence is its sequential nature:
Naively, this is an loop, which leaves GPUs starving. The Kimi implementation employs the standard trick of fast RNNs: chunking.
- Split the sequence into chunks of length
(typically 64).
- Within a chunk, compress the updates into a compact representation.
- Apply the chunk’s updates to the state via fused matmuls.
- Pass the state to the next chunk.
A simplified, conceptual view in PyTorch-like pseudocode:
import torch
from torch import Tensor
def kda_chunk(
q: Tensor,
k: Tensor,
v: Tensor,
alpha: Tensor,
beta: Tensor,
state: Tensor,
) -> tuple[Tensor, Tensor]:
"""Toy KDA-style chunk update.
Args:
q: Query tensor of shape [C, d].
k: Key tensor of shape [C, d].
v: Value tensor of shape [C, d].
alpha: Per-channel decay factors of shape [C, d], values in (0, 1).
beta: Per-step delta learning rates of shape [C], values in (0, 1).
state: Fast-weight state matrix of shape [d, d].
Returns:
Tuple of (output [C, d], updated_state [d, d]).
"""
C, d = q.shape
# Cumulative diagonal decay within the chunk
gamma = alpha.cumprod(dim=0) # [C, d]
# Apply the total decay of this chunk to the incoming state
state = state * gamma[-1][:, None]
# Sequential delta-rule updates (production kernel fuses this loop)
for t in range(C):
k_t = k[t]
v_t = v[t]
b_t = beta[t]
# Project state along k_t
proj = k_t @ state # [d]
# Low-rank correction: erase conflicting associations, write new one
state = state - b_t * torch.outer(k_t, proj)
state = state + b_t * torch.outer(k_t, v_t)
# Output for this chunk
o = q @ state # [C, d]
return o, stateThe production kernel avoids the Python loop entirely. The critical takeaway is the complexity profile:
- State size is fixed: a
matrix per head.
- Parallelism: Within-chunk work is highly parallelizable.
For head dimension and chunk size
, the per-head FLOP cost is roughly:
Contrast this with full attention:
Once dominates, KDA wins. Kimi’s kernels are roughly 2× faster than generic DPLR implementations for long sequences.
5. The Kimi Linear Hybrid Architecture
Armed with KDA, what does the actual system look like? It is a decoder-only MoE Transformer that swaps most multi-head attention (MLA) blocks for KDA blocks.

Key ingredients:
- MoE backbone: ~48B total parameters, ~3B active per token.
- Token mixing: KDA (most layers) or MLA (standard attention).
- Channel mixing: Standard MoE-style MLPs.
5.1 The 3:1 Pattern
The hybrid strategy is aggressively simple:
Use three consecutive KDA layers, then one MLA layer, and repeat.
Why not something more complex? Because systems engineering favors regularity. Inference stacks need predictable memory patterns. The authors found that a 3:1 ratio sits on the Pareto frontier: it captures the KV-cache savings of KDA without hitting the quality degradation seen at 15:1 ratios.
5.2 NoPE MLA
A subtle but profound choice: MLA layers use no positional encoding. No RoPE. No ALiBi.
All positional information is delegated to the KDA layers via channel-wise decays and short depthwise convolutions. KDA is the positional encoding. This simplifies inference (MLA becomes MQA without RoPE extrapolation headaches) and creates a robust mechanism for length extrapolation.
5.3 Neural Parameterization
Some implementation details worth noting:
generation includes a depthwise convolution (kernel size 4), injecting local context before the recurrence.
and
are L2-normalized to tame the spectral dynamics.
- The decay
comes from a low-rank MLP.
- The delta step
is a scalar per step.
- Output gating uses a Sigmoid, which ablations show beating Swish.
These aren’t revolutionary individually, but they constitute the “glue” that makes the fast-weight memory stable at scale.
6. Sanity Checks: Does it Remember?
Before trusting a 48B parameter model, one must verify the substrate. The authors tested KDA on toy tasks (Palindrome copying, Associative Recall, Stack tracking) against GDN and Mamba2.
The results were unambiguous:
- KDA consistently achieved the highest accuracy across all sequence lengths.
- Faster convergence than scalar-gated GDN.
- Mamba2 struggled in this specific configuration, likely due to less precise control over memory overwrites.
It appears that if you treat KDA as a trainable memory, it actually behaves like one.
7. Scaling Laws and Pre-training
The authors fit scaling laws on smaller models (650M–1.7B) before committing to the 48B run.
7.1 Compute–Loss Frontier
They trained two families: Pure MLA and Kimi Linear (3:1 hybrid). Fitting validation loss vs. compute:
Kimi Linear showed a 1.16× better computational efficiency at fixed loss. This is the crucial validation: KDA isn’t just “cheaper per token”; it is arguably better at turning FLOPs into intelligence.
7.2 48B MoE at 1.4T Tokens
Three 48B models were trained on 1.4T tokens: MLA, GDN-H, and Kimi Linear.
Evaluation on standard benchmarks (MMLU, GSM8K, CEval, etc.) showed a consistent pattern: Kimi Linear typically leads, occasionally trading blows with GDN-H, but generally outperforming the full MLA baseline.
7.3 Instruction Tuning
After SFT on a reasoning-heavy corpus, Kimi Linear maintained its dominance, winning or tying on MMLU, BBH, and GPQA-Diamond. The evidence suggests that Kimi Linear is “at least as good as” full attention on standard benchmarks, which is the gold standard for any efficiency-focused architecture.
8. The Regime That Matters: Long Context & RL
Linear attention is designed for the infinite horizon.
8.1 Long-Context Benchmarks
Evaluating on RULER, needles, and long-context reasoning, Kimi Linear (NoPE) achieved the best average score. It extrapolates better than the RoPE-equipped variants, supporting the thesis that learned decay is a superior positional prior for extreme lengths.
8.2 RL Fine-Tuning
In an RLVR-style math training setup, Kimi Linear’s accuracy rose faster and reached higher peaks than MLA’s. It appears that the fast-weight memory interacts favorably with “test-time scaling” – when a model must think for longer, efficient memory compression becomes a structural advantage.
8.3 The 5.7T Scale
Scaling up to 5.7T tokens (matching the Moonlight model recipe), Kimi Linear variants consistently outperformed their Moonlight counterparts. The instruct model supports context lengths up to 1M tokens, maintaining high fidelity.
9. The Economics of Intelligence
The theoretical FLOPs are interesting, but the memory bandwidth is the constraint.
9.1 Prefill vs. Decode
- Prefill: Kimi Linear is up to ~3× faster at 1M tokens.
- Decode: This is the kill shot. At 1M tokens, time-per-output-token is ~6× lower than MLA.
The logic is simple: KDA layers have a fixed state size. They do not grow. Only the sparse MLA layers carry a KV cache. The total footprint shrinks by ~75%.
9.2 Throughput
Because the KV cache is smaller, you can fit larger batches. This translates to a massive throughput gain for production systems. This is the difference between long-context RL being “prohibitively expensive” and merely “expensive.”
9.3 Complexity Summary
| Mechanism | FLOPs (rough) | State / Cache Size |
|---|---|---|
| Full Attention | KV cache: | |
| KDA (chunked) | Fixed |
10. Production Reality
This is not vaporware.
- Kernels: Available in
flash-linear-attention(FLA). - Weights: Released on Hugging Face (Moonshot/Kimi organization).
- Inference: Supported in vLLM.
A minimal vLLM example:
pip install vllmfrom vllm import LLM, SamplingParams
model = LLM("moonshotai/Kimi-Linear-48B-A3B-Instruct")
params = SamplingParams(temperature=0.7, max_tokens=512)
prompt = """You are a helpful assistant. Explain Kimi Delta Attention to a practitioner."""
outputs = model.generate([prompt], params)
print(outputs[0].outputs[0].text)11. The Landscape
11.1 vs. Mamba/SSM
Mamba and SSMs discard attention entirely for selective state spaces. Kimi Linear is more conservative: it keeps the semantics of attention (keys, values, associative memory) but alters the mechanism. It seems that retaining the “associative memory” inductive bias pays off at scale.
11.2 vs. Sparse Attention
Sparse attention prunes the matrix but still requires storing the full history of keys and values to decide what to prune. KDA is compressive. It collapses history into a fixed state.
11.3 vs. Hybrids
Kimi Linear is a “NoPE” hybrid. Its distinctiveness lies in the delta-rule framing and the rigorous empirical validation against a strong baseline.
12. Limitations
- Hybrid Dependence: The 3:1 ratio does a lot of heavy lifting. Pure KDA might struggle with “needle in a haystack” retrieval.
- Theory Lag: We lack training curricula explicitly designed to shape the eigenvalue distributions of the memory decay.
- Kernel Complexity: FLA kernels are complex beasts compared to standard FlashAttention.
13. Conclusion
If we strip away the noise, Kimi Linear represents a pivotal moment:
Kimi Linear moves the “linear vs. full attention” debate from the theoretical to the empirical.
For years, we have accepted the quadratic cost of attention as the price of admission for quality. Kimi Linear suggests this is a false dichotomy. By treating memory as an online learning problem with structured forgetting, and by accepting the “boring” engineering reality of hybrid architectures, we can cultivate systems that think longer, deeper, and cheaper.
The asterisk is gone. The era of the quadratic wall is ending.