Prefix-LM:通过前缀不变性实现宽度维度的渐进式推理
Prefix-LM: Prefix-Invariant Transformers for Width-Adaptive Progressive Inference
推理成本高是很多人部署模型时的痛点,这篇论文的思路挺新:不是按层提前退出,而是让小模型的计算能被大模型直接接着用,按 token 难度分配算力。做推理优化或模型架构研究的可以看看。
一篇来自 arXiv 的新论文提出 Prefix-LM 架构,核心是把渐进式推理从传统的深度维度(early-exit)扩展到宽度维度,并在 1B 参数规模上验证了实际加速效果。
作者指出问题的关键在于前缀不变性(prefix invariance):小子模型的中间表示必须是大子模型表示的前缀。为了实现这一点,Prefix-LM 通过强制块三角映射(block-triangular maps)来构造 Transformer,使宽度可变的子模型输出能够被逐步细化,同时支持 KV cache 共享和中间计算的完全复用。相比此前沿宽度方向做弹性计算的网络——虽然能按输入难度分配不同算力,但输出无法渐进细化——Prefix-LM 补上了这一缺失属性。
论文将 Prefix-LM 应用于 1B 规模模型,展示了实用的推理加速,并把前缀不变性确立为自适应计算的一个可行基础。对关注推理成本优化的开发者来说,这条“按 token 预测难度动态分配算力”的路线提供了 early-exit 之外的新选择。
Prefix-LM: Prefix-Invariant Transformers for Width-Adaptive Progressive Inference
LLMs require a significant amount of resources during autoregressive generation, but not all tokens are equal. Token prediction is a task of varying difficulty, but monolithic architectures allocate the same compute regardless of the difficulty of prediction. Progressive inference, where representations are incrementally computed and refined as needed, can address this challenge. This has traditionally been achieved through early-exiting methods that operate along the depth dimension of the network. Elastic networks that operate along the width dimension can select a different computational budget per input, but the resulting outputs cannot be progressively refined. We identify the missing property as prefix invariance: the intermediate representations of smaller submodels are prefixes of larger ones. To this end, we propose Prefix-LM: an architectural design that achieves prefix invariance by enforcing block-triangular maps, enabling KV cache sharing and full reuse of intermediate computations. We apply Prefix-LM at the 1B scale, demonstrating practical speedups and establishing prefix invariance as a useful foundation for adaptive computation.
This report is categorized under AITOP's "Papers" desk. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include Prefix-LM, KV cache, Transformer architecture.
Source attribution: curated from arXiv cs.LG (@Riccardo Zaccone, Avi Trost, Martín Bravo, Xinyang Xu, Alexander Yun, Frederic Sala, Carlo Masone, Stefanos Laskaridis, Samuel Horváth).