← Back to Library

Kimi k3, the manos, the mythos, the legendos

Dylan Patel's latest deep dive into the Kimi K3 model doesn't just explain a new AI release; it exposes a fundamental architectural pivot that could redefine how we build efficient, long-context systems. While the industry chases larger parameter counts, Patel reveals that Moonshot's breakthrough lies in a return to linear attention mechanisms, specifically a novel hybrid layer called Kimi Delta Attention (KDA). This is not merely an incremental tweak; it is a strategic recalibration of the trade-off between memory bandwidth and computational speed that has long plagued large language models.

The Return of Linear Attention

Patel traces the lineage of Kimi K3's performance back to a specific mathematical evolution: the shift from standard softmax attention to linear attention. He explains that traditional attention scales quadratically, meaning "removing the softmax operation... reduce[s] the computation complexity of attention from quadratic to linear." This is the critical differentiator. By treating the hidden state as an "associative memory that stores the associations between key vector k and value vector v," the model avoids the bottleneck of constantly re-accessing all past data.

Kimi k3, the manos, the mythos, the legendos

However, Patel is careful to note that early linear attention models suffered from instability, where "old and new information gets blurred together in S as the sequence grows." To solve this, he details how Kimi Delta Attention adapts the "Delta Rule" to regularize memory growth. The result is a system where the model can "perform targeted removal of those associations," ensuring that relevant context isn't lost to noise. This framing is compelling because it moves the conversation away from brute-force scaling and toward algorithmic elegance.

"We reinterpret the new equations as an online learning objective... continuously updating the matrix S at every position to perfect the retrieval."

This interpretation of the math as an "online learning objective" is a powerful conceptual hook. It suggests that the model isn't just recalling data; it is actively learning to manage its own memory in real-time. Critics might argue that linear attention has historically struggled with complex reasoning tasks compared to full softmax attention, but Patel's analysis of the "Gated DeltaNet" adaptation suggests this gap is closing. By introducing a diagonal matrix for "fine-grained per-channel memory decay," the architecture gains the precision previously reserved for more expensive models.

The Agentic Workload Problem

The most distinctive part of Patel's argument is his critique of the current industry favorite: Multi-Head Latent Attention (MLA). While many labs have adopted MLA to save memory, Patel argues it is ill-suited for the next generation of AI applications. He writes, "MLA doesn't suit agentic workloads," a claim that challenges the prevailing wisdom of the last year.

Patel breaks down why this matters. Agentic workloads—where AI tools call other tools and process long streams of data—often involve "append-prefill" scenarios. In these cases, a model must ingest a massive amount of new context while maintaining a long history. Patel points out that "neither mode of MLA suits append-prefill." The standard Multi-Head Attention mode is too memory-intensive, while the Multi-Query Attention mode incurs a "3.4x FLOPs per token" penalty that makes it computationally prohibitive for long sequences.

"DeepSeek and Zhipu opted for adapting MQA mode to sparse attention in order to reduce the FLOPs... We suspect Moonshot's future models such as Kimi K4 will feature attention mechanisms that replace MLA."

This observation is a sharp critique of the "one-size-fits-all" approach to model architecture. Patel suggests that the industry's rush to adopt MLA was a reaction to the specific needs of reasoning tasks, which favor short inputs and long outputs. However, as AI moves toward autonomous agents that must process vast amounts of tool output, the "append-prefill" bottleneck becomes a critical failure point. The reference to the "Delta rule" here is particularly apt; just as the mathematical rule allows for targeted memory updates, Patel's analysis suggests the industry needs a targeted architectural shift away from MLA for agentic use cases.

"KV cache size is not a standalone factor but a property of the model design... we propose considering both the model architecture system efficiency and the KV cache size to understand the KV cache efficiency."

Patel's redefinition of efficiency metrics is a necessary correction to the current hype cycle. By introducing "KV throughput" as a metric, he forces readers to look beyond simple cache size and consider the actual bandwidth required to serve models. This is a crucial distinction for anyone deploying these models at scale. The argument holds up well against the backdrop of recent hardware constraints, where memory bandwidth is often the true limiting factor, not just raw compute power.

The Bottom Line

Patel's analysis succeeds by stripping away the marketing hype to reveal the mechanical realities of the Kimi K3 architecture. The strongest part of his argument is the identification of the "append-prefill" bottleneck in current attention mechanisms, a vulnerability that could derail the deployment of complex AI agents if left unaddressed. His biggest vulnerability, however, is the reliance on Moonshot's internal benchmarks; without independent verification of the "FlashKDA" kernel performance, the theoretical gains remain just that—theoretical. As the industry watches, the real test will be whether this linear attention approach can maintain its efficiency when scaled to the massive, messy datasets of the real world.

"This concretely shows that the computational complexity of KDA: Prefill: Linear to sequence length for both computation and memory; Decode: Constant to sequence length for both computation and memory."

Deep Dives

Explore these related deep dives:

  • Attention Is All You Need

    Understanding the mathematical removal of the softmax operation explains how Kimi K3 achieves linear computational complexity instead of the quadratic bottleneck found in standard transformers.

Sources

Kimi k3, the manos, the mythos, the legendos

by Dylan Patel · SemiAnalysis · Read full article

Kimi K3 took the world by storm at its announcement, sweeping leaderboards and establishing itself as the open frontier model. While the community is eager to understand how Kimi K3 works, many have been surprised by the unconventional techniques driving its performance. This article serves as a primer to understanding the core techniques of the Kimi K3 model architecture.

Kimi Delta Attention.

Kimi Delta Attention (KDA) is the linear attention layer in Kimi K3’s hybrid attention mechanism. We trace the origins of KDA, starting from linear attention, DeltaNet, Gated DeltaNet (GDN), then to KDA.

Linear Attention.

The derivation of linear attention stems from removing the softmax operation in the standard softmax attention. Below we compare the iterative inference formulas, which show the computation of the output vector at token position t:

By removing the softmax operation, we can reorder the operations and reduce the computation complexity of attention from quadratic to linear:

The new equations are as follows:

Vectors q, k, v, have dimensions L by d. The computational complexity of both equations are O(Ld²), thereby making the computation linear. Comparing the new equations with softmax attention’s equation, we see that softmax attention requires accessing all past key and value vectors, whereas linear attention compresses all past key and value vectors into one hidden state S.

We reinterpret the new equations as an online learning objective. We view matrix S as an associative memory that stores the associations between key vector k and value vector v, and we retrieve v by multiplying S with k. We can then interpret the first equation as continuously updating the matrix S at every position to perfect the retrieval. Finally, we can interpret the vt @ kt.T term as the gradient of loss function -(S @ kt.T) @ vt with respect to S.

DeltaNet.

Under the online learning objective view, we see the values of matrix S will grow unboundedly: old and new information gets blurred together in S as the sequence grows, which destabilizes learning. Without softmax giving well-scaled and bounded outputs, linear attention typically lags behind softmax attention on long-range recall tasks.

DeltaNet improves upon linear attention by changing the loss function to minimizing the L2 norm of the value retrieval. Unlike linear attention’s loss function, DeltaNet’s loss function regularizes the growth of S. This creates a new matrix S update rule, the Delta Rule, as below:

Source: Linear Attention and Beyond ...