In “Linearizing Softmax Attention into Gated DeltaNet”, we presented one possible route from Softmax Attention to Gated DeltaNet. It demonstrated how we can start from Softmax Attention, progressively introduce approximations, and eventually arrive at a linear model. The result may not be particularly useful in practice, but it helps us understand the approximations and costs behind Linear Attention.
Here we take a new route to linearization. Starting with a distributional generalization, we introduce three averaging steps to establish an approximate connection between Attention and TTT. Within this broader framework, DeltaNet and MesaNet emerge naturally as special cases.
Given vectors , Softmax Attention is defined as
Each must be paired with all the preceding for computation and summation. This is the source of its quadratic complexity, and also the main bottleneck during decoding: the KV cache. Most approaches to linearizing Attention essentially amount to different ways of compressing that cache.
Our starting point is also KV-cache compression, but first we move in the opposite direction and generalize Softmax Attention:
Rather than specifying directly, we rewrite it as the expectation of a conditional distribution . This is the first sense in which we take a “path of averaging.” Why is it a generalization? Choosing the Dirac distribution recovers the original Softmax Attention. The expression therefore encompasses a broader class of functions in theory.
Choosing amounts to memorizing all the pairs. Since our goal is compression, we cannot keep this memorization approach; we instead need a distribution that we can compute. For simplicity, we choose a conditional normal distribution:
Here, is a mean-prediction model with input and parameters , while is a preset hyperparameter. In principle, we could also replace the covariance matrix with a general prediction model . But tells us that we ultimately care only about the mean vector, so generalizing the covariance offers no additional benefit.
With this choice, we have
Assuming can be computed efficiently, we need not cache its result. We only need to cache K and compute on demand. This eliminates the V cache and halves the KV cache.
To estimate , we treat as training data arriving sequentially and update the model online using SGD. For a probabilistic model, the natural objective is maximum likelihood, or equivalently minimizing the negative log-likelihood:
Taking one gradient-descent step gives
This effectively creates an RNN whose state is . It continually adjusts using the current input, aiming to maximize its ability to predict V from K. We can therefore say that it compresses the additional information in V given K into the finite-dimensional parameter variable .
This recurrence is actually the same as TTT (Test-Time Training). Our starting point, however, is to compress the information in V given K to lighten the KV cache, rather than directly defining a complete write-and-read process as TTT does.
These transformations have eliminated V for now, but K remains. Equation still has the form of Softmax Attention, so its complexity has not decreased. We first apply a mean-field approximation:
This turns the core computation of the remaining part into , which is Softmax Attention with K=V. Furthermore, since , if we assume that are fairly isotropic—or, more precisely, that the weighted average of their components perpendicular to is approximately zero—then
We can thus replace the input to with , or simply absorb into , giving the clean expression
This is exactly the TTT readout. Together with Equation , it forms an RNN with input and state . The full K and V histories are no longer present; they are progressively compressed into the parameters .
Let us now retrace the derivation and see what we gave up, and what we gained, on the way from Attention to TTT.
First, we used the mean-vector model to predict and replace . From the Attention perspective, this removes the V cache. In terms of fitting capacity, certainly cannot match the hard-coded pairing in theory. But its streaming updates also strengthen interactions between tokens. I therefore see this as roughly an even trade: neither is necessarily better.
Second comes the mean-field approximation . Mathematically, its accuracy may be a concern. Viewed within the overall architecture, however, it merely moves Attention from the output to the input. With multiple layers composed together, this should not amount to a fundamental flaw, so I again regard it as a roughly even trade.
Third, the weighted-average approximation lets us replace the input to with , fully turning Attention into an RNN with linear complexity. Is K=V Attention always approximately ? Of course not. The most convincing examples are MLA and DSV4, which are essentially MQA with K=V. They clearly cannot amount merely to , or they would be unable to model interactions between tokens.
The biggest weakness in this “path of averaging,” then, may be the step that substitutes as the input. It is an overly idealized simplification whose assumptions are hard to satisfy fully in practice. Softmax Attention therefore needs to be reintroduced periodically to make up the difference, which is precisely the hybrid approach that is mainstream today.
In practice, we usually simplify TTT's to the linear model . Then
The corresponding streaming update rule is
Adding gives us DeltaNet. Simplifying to a linear function mainly makes the model parallelizable and lets it serve purely as a token mixer, leaving nonlinear processing to the MLP layers and the stacking of layers. Moreover, for a linear model, the mean-field relation is an exact identity, rather than merely an approximation.
In particular, we can solve linear regression analytically, without resorting to SGD:
Adding decay to and gives MesaNet. Assuming MesaNet and DeltaNet are models with the same capacity ceiling, MesaNet's iterations for and are simply conventional Vanilla Linear Attention (VaLA), which is simpler than the Delta Rule. The cost is a 50% increase in the state size. This suggests that VaLA needs a larger state to have a chance of catching up with or surpassing the Delta family.
This article has used various averaging approximations to connect Attention, TTT, DeltaNet, MesaNet, and related models. Following the derivation lets us see what each step gives up and gains as we move from Attention to TTT and other linear models, providing a relatively natural and more broadly applicable understanding of their relationships.