logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·01.11.26
← Back to news

You Could Have Come Up with Kimi Delta Attention

Original article
blog.doubleword.ai|159 points|45 comments|by AnhTho_FR|Jul 28, 2026

Demystifying Kimi Delta Attention


Author: Jamie Dborin, Founder & Member of Technical Staff at Doubleword
Date: July 27, 2026
Topic: Inference API / Linear Attention

Jamie Dborin

📐 A Note on Mathematical Notation

To make the geometric shapes of this derivation intuitive, this article utilizes bra-ket notation (inspired by quantum mechanics).

Notation Reference Table

NotationRepresentationMathematical Type
∣q⟩\lvert q \rangle∣q⟩QueryColumn Vector
⟨k∣\langle k \rvert⟨k∣KeyRow Vector
⟨k∣q⟩\langle k \rvert q \rangle⟨k∣q⟩Inner ProductScalar (Number)
∣v⟩⟨k∣\lvert v \rangle \langle k \rvert∣v⟩⟨k∣Outer ProductMatrix

Key Convention: By default, vectors point right, but keys are written pointing left when they are integrated into the linear-attention state.

Assumptions for this derivation:

  • We are analyzing a single causal attention head.
  • All vectors are real-valued.
  • DeltaNet keys are normalized.
  • The state acts as a map from the key space to the value space.

The Complexity of Modern Linear Attention

At first glance, contemporary linear attention variants seem impenetrable. Their equations are dense, and the underlying intent is often obscured. To illustrate this, consider the state update logic for Kimi Delta Attention (KDA):

S~t=St−1Diag⁡(αt)∣v^t⟩=S~t∣kt⟩∣et⟩=βt(∣vt⟩−∣v^t⟩)St=S~t+∣et⟩⟨kt∣∣ot⟩=St(dk−1/2∣qt⟩)\begin{aligned} \widetilde S_t &= S_{t-1}\operatorname{Diag}(\alpha_t) \\ \lvert\widehat v_t\rangle &= \widetilde S_t\lvert k_t\rangle \\ \lvert e_t\rangle &= \beta_t \left( \lvert v_t\rangle-\lvert\widehat v_t\rangle \right) \\ S_t &= \widetilde S_t+\lvert e_t\rangle\langle k_t\rvert \\ \lvert o_t\rangle &= S_t\left(d_k^{-1/2}\lvert q_t\rangle\right) \end{aligned}St​∣vt​⟩∣et​⟩St​∣ot​⟩​=St−1​Diag(αt​)=St​∣kt​⟩=βt​(∣vt​⟩−∣vt​⟩)=St​+∣et​⟩⟨kt​∣=St​(dk−1/2​∣qt​⟩)​

This complexity is a result of "feature creep" within the DeltaNet family. Over several years, these models have evolved, and each iteration has added layers of sophistication, making the latest versions feel inaccessible to outsiders.

However, these equations aren't magic; they are the result of making simple assertions about how a hidden state should behave. We can derive KDA by following this evolutionary path:

Our Roadmap

  • Start with Quadratic Attention
  • Strip away the Softmax
  • Transition to DeltaNet
  • Implement Gating
  • Arrive at KDA
  • Explore Triton implementations (Recurrent & Chunkwise)

1. Starting with Quadratic Attention

In standard causal softmax attention, for a query at time ttt, the output is calculated as:

ati=exp⁡ ⁣(s⟨ki∣qt⟩)∑j≤texp⁡ ⁣(s⟨kj∣qt⟩),s=dk−1/2,∣ot⟩=∑i≤tati∣vi⟩.\begin{aligned} a_{ti} &= \frac{ \exp\!\left(s\langle k_i\rvert q_t\rangle\right) }{ \sum_{j\leq t} \exp\!\left(s\langle k_j\rvert q_t\rangle\right) }, \qquad s=d_k^{-1/2},\\ \lvert o_t\rangle &= \sum_{i\leq t}a_{ti}\lvert v_i\rangle. \end{aligned}ati​∣ot​⟩​=∑j≤t​exp(s⟨kj​∣qt​⟩)exp(s⟨ki​∣qt​⟩)​,s=dk−1/2​,=i≤t∑​ati​∣vi​⟩.​

How it works: It computes the similarity between a specific key and query, then uses the softmax function to normalize these scores into a probability distribution.

The Bottleneck:

  • For a sequence of length TTT, you must compute T2T^2T2 key-query pairs.
  • While we can cache keys and values during autoregressive inference, the cache grows linearly.
  • Every new query must still scan the entire history because the denominator is dependent on both the current query and all previous keys.

1.1 Removing the Softmax

To simplify, let's absorb the scaling factor sss into the query and remove the softmax. This gives us a "bare-bones" version of attention:

∣ot⟩=∑i≤t⟨ki∣qt⟩∣vi⟩\lvert o_t\rangle = \sum_{i\leq t} \langle k_i\rvert q_t\rangle \lvert v_i\rangle∣ot​⟩=∑i≤t​⟨ki​∣qt​⟩∣vi​⟩

Because the inner product ⟨ki∣qt⟩\langle k_i\rvert q_t\rangle⟨ki​∣qt​⟩ is just a scalar, we can shift it to the right side of the value vector:

∣ot⟩=∑i≤t∣vi⟩⟨ki∣qt⟩=(∑i≤t∣vi⟩⟨ki∣)∣qt⟩.\begin{aligned} \lvert o_t\rangle &= \sum_{i\leq t} \lvert v_i\rangle \langle k_i\rvert q_t\rangle\\ &= \left( \sum_{i\leq t} \lvert v_i\rangle\langle k_i\rvert \right) \lvert q_t\rangle. \end{aligned}∣ot​⟩​=i≤t∑​∣vi​⟩⟨ki​∣qt​⟩=(i≤t∑​∣vi​⟩⟨ki​∣)∣qt​⟩.​

Now, we can encapsulate everything from the past into a single matrix StS_tSt​ of fixed size V×KV \times KV×K:

St=∑i≤t∣vi⟩⟨ki∣\boxed{ S_t = \sum_{i\leq t} \lvert v_i\rangle\langle k_i\rvert }St​=i≤t∑​∣vi​⟩⟨ki​∣​

Attention is now transformed into a recurrent write followed by a read:

St=St−1+∣vt⟩⟨kt∣,∣ot⟩=St∣qt⟩.\boxed{ \begin{aligned} S_t = S_{t-1} + \lvert v_t\rangle\langle k_t\rvert,\\ \lvert o_t\rangle = S_t\lvert q_t\rangle. \end{aligned} }St​=St−1​+∣vt​⟩⟨kt​∣,∣ot​⟩=St​∣qt​⟩.​​

The Core Trick: The identity (|v><k>)|q> = <k|q>|v> allows us to store summed outer products in a fixed-size state StS_tSt​. This reduces the complexity from quadratic to linear relative to sequence length. We only scan the tokens once, updating the dv×dkd_v \times d_kdv​×dk​ state at each step.

The trade-off? We lose the selectivity and normalization provided by the softmax. While advanced linear attention uses feature maps to fix this, this basic form highlights the memory issue that DeltaNet aims to solve.

1.2 Addition is not Assignment

Consider what happens if we write a pair ∣vt⟩⟨kt∣\lvert v_t \rangle \langle k_t \rvert∣vt​⟩⟨kt​∣ and then immediately query the state using that same key:

St∣kt⟩=(St−1+∣vt⟩⟨kt∣)∣kt⟩S_t \lvert k_t \rangle = ( S_{t-1} + \lvert v_t \rangle \langle k_t \rvert ) \lvert k_t \rangleSt​∣kt​⟩=(St−1​+∣vt​⟩⟨kt​∣)∣kt​⟩