Distill-then-Replace: Efficient Task-Specific Hybrid Attention Model Construction

Xiaojie Xia, Huigang Zhang, Chaoliang Zhong, Jun Sun, Yusuke Oishi
1/16/2026
cs.LGcs.AI
transformer-attention

No confident code implementation found for this paper.

Abstract

Transformer architectures deliver state-of-the-art accuracy via dense full-attention, but their quadratic time and memory complexity with respect to sequence length limits practical deployment. Linear attention mechanisms offer linear or near-linear scaling yet often incur performance degradation. Hybrid models that integrate full and linear attention layers promise a balance between efficiency and expressiveness, but face two major challenges: training such hybrid models from scratch is computationally expensive, and manually designing the optimal placement of attention types is highly nontrivial. We propose DtR (Distill-then-Replace), which first transfers weights from the pretrained full-attention modules to its linear attention counterparts through blockwise local distillation, and then applies a greedy layer replacement strategy that iteratively substitutes full attention blocks with linear ones while monitoring validation performance on the target task. DtR yields a task-specific hybrid model in a single efficient pass, without costly re-training or neural architecture search, and can be applied to any pretrained full-attention backbone for diverse downstream tasks.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{xia2026distillthenreplace,
  title  = {Distill-then-Replace: Efficient Task-Specific Hybrid Attention Model Construction},
  author = {Xiaojie Xia and Huigang Zhang and Chaoliang Zhong and Jun Sun and Yusuke Oishi},
  year   = {2026},
  eprint = {2601.11667},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.11667v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2601.11667.svg)](https://codeofpaper.com/paper/2601.11667)

Discussion