[KongchangAI]
· 2 min read· 1,305 words

DLA: An Efficient New Attention Solution for Looped Language Models

DLA: An Efficient New Attention Solution for Looped Language Models

DLA decomposes multi-loop KV in looped models into a mean and low-dimensional contrast codes, cutting memory and boosting performance.

Looped language models boost test-time compute by repeatedly calling shared Transformer layers, but each loop's KV states must all be cached, so inference memory grows linearly with loops. DLA proposes Decomposed Latent Attention: it splits multi-loop KV states into a full-dimensional mean vector and low-dimensional contrast codes, storing the mean once and reconstructing each loop's historical KV on demand. Its sliding window variant DLA-SW keeps exact KV for recent tokens and compressed codes for distant history. On Ouro-1.4B-Thinking and Huginn-3.5B, DLA cuts resident memory by 23.5% vs LLA and DLA-SW by 15.2% vs HLA, with task scores up 2.29 points on average.

DLA: An Efficient New Attention Solution for Looped Language Models

Looped Language Models enhance reasoning capabilities by repeatedly applying shared Transformer layers to increase test-time computation. However, this design also introduces significant memory overhead: the key-value (KV) states generated across multiple loop iterations must be stored, causing a substantial increase in memory usage during inference. The recently proposed Decomposed Latent Attention (DLA) method effectively reduces memory requirements while maintaining task performance by decomposing the latent attention mechanism.

DLA Paper Overview

The Bottleneck of Looped Models: KV Cache Expansion

The core idea of looped language models is to have the model pass through the same set of Transformer layers multiple times during inference, with each loop iteration equivalent to an additional computational step. This mechanism simulates a deeper network without increasing the number of parameters. However, each loop iteration generates new KV states that must be cached during autoregressive decoding for subsequent token computation. As the number of loops increases, the KV cache size grows linearly, becoming the primary burden on inference memory.

Traditional methods such as Layer-wise Latent Attention (LLA) and Hierarchical Latent Attention (HLA) attempt to alleviate this problem by compressing KV states. LLA shares latent representations across layers, while HLA introduces a hierarchical structure. But DLA takes a different approach: rather than directly compressing the KV of each layer, it decomposes the multiple sets of KV states produced by looping.

KV cache (Key-Value Cache) is a core mechanism in autoregressive Transformer inference—each time a new token is generated, the model needs the Key and Value vectors of all previous tokens. To avoid redundant computation, these vectors are cached. Its size is proportional to sequence length, number of layers, number of attention heads, and hidden dimension, and in long-context scenarios it often becomes the primary source of GPU memory usage. Looped language models further amplify the problem: because the same set of layers is called repeatedly, each loop iteration produces independent KV states, and the cache grows linearly with the number of loops. Understanding this is the prerequisite for grasping DLA's design motivation—it is essentially a cross-loop compression scheme targeting "multiple KV copies," rather than quantization or pruning of the KV from a single forward pass.

The Core of DLA: A Decomposition Strategy with Mean + Contrast Codes

The core idea of DLA is to decompose the KV states produced across multiple loop iterations into two parts: a full-dimensional mean vector and a set of low-dimensional contrast codes. The mean vector captures the shared information across loops, while the contrast codes encode the subtle variations of each loop relative to the mean. During inference, each loop iteration reconstructs its historical KV states on demand based on the mean vector and its own contrast code.

The advantage of this decomposition is that the mean vector only needs to be stored once, and the dimensionality of the contrast codes is far lower than that of the original KV states, so the total storage is significantly reduced. Moreover, DLA is trained using only the task loss, requiring no additional reconstruction supervision signal, which simplifies the training process.

"Latent Attention" refers to caching a low-dimensional latent vector instead of directly caching the full high-dimensional KV, then up-projecting it back to the Key and Value space during inference through learnable projection matrices. MLA (Multi-head Latent Attention) proposed by DeepSeekAd is a representative work of this approach, significantly reducing the KV cache through low-rank joint compression. DLA follows the framework of "caching latent representations and reconstructing on demand," but shifts the compression dimension from "inter-layer/inter-head" to "inter-loop": it treats the KV produced by the same layer across multiple loop iterations as a set and jointly encodes them using a mean plus residual codes. Therefore, DLA is not mutually exclusive with MLA or LLA, and in theory can be stacked with latent compression for a single forward pass.

DLA-SW: Sliding Window and Exact Caching

There is an inherent discrepancy between parallel sequence processing during training and token-by-token generation during inference. During parallel training, the model can see the KV states of the entire sequence at once, whereas during inference it can only rely on already-generated tokens. This discrepancy can lead to inconsistency between training and inference. To address this issue, the researchers proposed a sliding window variant of DLA called DLA-SW.

DLA-SW retains exact KV states for the most recent tokens while using complete compression codes for more distant history. When the training block size does not exceed the window size, block-parallel training can maintain the same cache dependencies as token-by-token decoding. This design ensures the precision of recent context while reducing memory usage through history compression.

Sliding Window Attention was popularized by models such as Longformer and Mistral. Its approach is for each token to attend only to the most recent W tokens, reducing attention computation and cache complexity from O(n) to O(W). DLA-SW borrows this idea of local exactness and global compression, but for a different purpose: the sliding window here is mainly used to align the cache dependencies between training and inference. During parallel training, tokens within a block are visible to each other. If the block size does not exceed the window, the history that each position within the block depends on falls exactly within the exact cache range, consistent with the dependency structure during token-by-token decoding, thereby avoiding the distribution shift of "seeing future compression codes during training but not during inference."

Experimental Validation: Reduced Memory and Improved Performance

The researchers evaluated DLA and DLA-SW on two looped language models, Ouro-1.4B-Thinking and Huginn-3.5B, with test tasks including MATH-500, MBPP+, and QASPER. Under fixed cache hyperparameters, DLA reduced resident memory by an average of 23.5% compared to LLA, and DLA-SW reduced it by 15.2% compared to HLA. More notably, across all twelve paired comparisons, the DLA variants achieved an average task score improvement of 2.29 points.

This means DLA not only reduces memory usage but also brings performance gains. This may be because the decomposed representation better preserves the information differences across loops, while the compression method avoids excessive information loss.

Implications for Deploying Looped Models

Looped language models are regarded as an important direction for enhancing reasoning capabilities, but memory overhead has always been an obstacle to their deployment. DLA achieves dual optimization of memory and performance by decomposing latent attention without adding extra training supervision. For scenarios requiring the deployment of large looped models in resource-constrained environments, DLA provides a practical solution.

In the future, DLA's approach may be extended to other model architectures that require caching multi-state sequences, such as multi-step reasoning or iterative refinement models. As the scale of looped models grows, efficient cache management will become increasingly critical.

One-line Summary

DLA decomposes multi-loop KV in looped models into a mean and low-dimensional contrast codes, reducing memory and improving performance.

Paragraph Summary

Looped language models enhance test-time computation by repeatedly calling shared Transformer layers, but the KV states generated by each loop iteration must all be cached, causing inference memory to grow linearly with the number of loops. DLA proposes Decomposed Latent Attention: it splits the KV states across multiple loop iterations into a full-dimensional mean vector and a set of low-dimensional contrast codes. The mean is stored only once, and each loop's historical KV is reconstructed on demand during inference, greatly compressing storage; moreover, it is trained using only the task loss with no reconstruction supervision. Its sliding window variant DLA-SW retains exact KV for recent tokens and uses compression codes for distant history, keeping the cache dependencies consistent between block-parallel training and token-by-token decoding. On Ouro-1.4B-Thinking and Huginn-3.5B, DLA reduces resident memory by an average of 23.5% compared to LLA, and DLA-SW reduces it by 15.2% compared to HLA, with task scores improving by an average of 2.29 points across twelve paired comparisons.

#Decomposed Latent Attention#DLA#looped language models#KV cache compression#latent attention
Share:

Related articles