NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Distilling to Hybrid Attention Models via KL-Guided Layer Selection

Yanhong Li, Songlin Yang, Shawn Tan, Mayank Mishra, Rameswar Panda, Jiawei Zhou, Yoon Kim

Distilling standard Transformers into "hybrid" models—architectures that mix standard softmax and efficient linear attention—is a highly effective way to speed up inference. However, deciding exactly which layers to keep as softmax is notoriously tricky. A new paper introduces a simple, highly effective method that scores layer importance based on KL-divergence during a brief distillation phase. The resulting hybrid models drastically outperform standard uniform-interleaving baselines on long-context tasks, especially when the budget for expensive softmax layers is tight.

The Quadratic Bottleneck and the Hybrid Solution

Standard Large Language Models (LLMs) rely on softmax attention, which suffers from a quadratic bottleneck: as the context gets longer, memory and compute costs explode due to the KV cache. "Linear attention" models solve this by compressing history into a fixed-size state, making inference incredibly fast and memory-efficient. However, pure linear attention models have a fatal flaw: they struggle with in-context recall—the ability to retrieve specific facts buried deep in a long prompt.

To get the best of both worlds, researchers are building hybrid models that interleave a few global softmax layers (for accurate recall) with many linear layers (for fast local processing). Because pretraining these from scratch is expensive, a popular shortcut is to distill an existing pretrained standard Transformer into a hybrid architecture.

But this raises a critical question: Which layers should you convert to linear attention, and which should remain softmax? Existing approaches usually just space the softmax layers out uniformly (e.g., every 4th layer) or rely on computationally massive search algorithms. This paper aims to find a smarter, data-driven, and compute-efficient way to select the optimal layers.

KL-Guided Layer Selection

The authors propose a "KL-guided layer selection" strategy. They use a two-stage distillation pipeline (hidden-state alignment followed by KL-based distribution matching) and apply a Greedy Addition approach:

  1. Start All-Linear: First, they distill the teacher model into a student model where every layer is converted to linear attention.
  2. The "One-Swap" Test: For each layer, they temporarily swap it back to softmax (leaving the rest linear). They run a brief distillation and measure how much the KL divergence (the difference in output distributions between the teacher and student) drops.
  3. Rank and Select: This KL reduction serves as the layer's "marginal utility" score. They rank all layers by this score and select the top-$K$ layers to permanently keep as softmax.
  4. Final Distillation: Finally, they instantiate the hybrid model with these chosen layers and run the full distillation pipeline.

Key Insights: Recall vs. Reasoning

One of the most fascinating findings is the dichotomy between different types of tasks. The authors found that commonsense reasoning tasks don't actually care about softmax layers—an almost entirely linear model performs just fine. However, long-context recall is highly sensitive to the number and placement of softmax layers.

Accuracy vs. Number of Full-Attention Layers

Furthermore, the selection process is highly sample-efficient. You don't need to train the model to convergence to figure out which layers are important. The top-$K$ layer ranking stabilizes after consuming just 25-40% of the training budget. Interestingly, unlike the standard practice of spacing softmax layers uniformly across the network, the KL-guided selector naturally clusters them in specific depth regions (e.g., the middle layers for Llama models). Forcing the model to spread these layers out artificially actually hurts performance.

Dominance in Low-Budget Regimes

The KL-guided method consistently outperforms heuristic task-based selectors, uniform interleaving, and complex search methods across Qwen2.5 and Llama-3.2 architectures. The method shines brightest when you can only afford a few softmax layers.

Performance vs. Softmax:Linear Ratio

On the Qwen2.5-3B model with only a 12.5% softmax ratio (just 5 layers), the KL-guided model scores ~0.70 on the RULER benchmark, while the standard uniform interleaving strategy scores <0.40. At a 50% softmax ratio, the distilled hybrid model recovers the vast majority of the teacher model's performance on challenging recall tasks.

Limitations and Future Work

While the hybrid models maintain near-perfect retrieval up to 65k tokens, their performance drops off faster than the pure-softmax teacher at extreme lengths (e.g., 128k tokens). Additionally, though much cheaper than training a SuperNet or pretraining from scratch, the selection phase still requires running a brief distillation pass for every layer.

Future directions include exploring even cheaper proxies for layer importance—perhaps deriving scores directly from the teacher model's zero-shot activations or gradients—and extending this framework from layer-level selection to finer-grained, head-level hybridization.

Summary updated

BibTeX
@inproceedings{li2026distilling,
  author = {Yanhong Li and Songlin Yang and Shawn Tan and Mayank Mishra and Rameswar Panda and Jiawei Zhou and Yoon Kim},
  title = {{Distilling to Hybrid Attention Models via KL-Guided Layer Selection}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=RzbsHcFqIf},
}
Figure