arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.10875cs.LGcs.CL
收藏

在需要的地方计算:自优化语言模型

Compute Where it Counts: Self Optimizing Language Models

Cornell University(康奈尔大学)

Yash Akhauri, Mohamed S. Abdelfattah

AI总结:

本文提出自优化语言模型(SOL),通过轻量策略网络动态分配计算预算,提升解码效率与生成质量,在不同模型和计算条件下优于静态分配和随机搜索。

摘要:

高效LLM推理研究主要集中在减少每个解码步骤的成本(如量化、剪枝或稀疏注意力),通常对每个生成的token应用统一的计算预算。实际上,token难度差异很大,因此静态压缩可能在简单步骤过度计算而在困难步骤下计算不足。我们研究了自回归解码中的动态预算分配:从单个模型内部学习每个token应花费多少计算。自优化语言模型(SOL)将冻结的LLM与轻量策略网络结合,该网络读取LLM隐藏状态并在每个解码步骤选择离散的效率动作。动作可以联合控制(i)token级别的注意力稀疏性,(ii)MLP中的结构化激活剪枝,以及(iii)激活量化位宽,同时不改变基础模型权重。我们使用教师强制的episode训练策略网络:token序列固定,而我们采样多个计算计划(即“反事实”计划,仅改变相同token路径的效率动作)。我们的奖励在语言模型质量与软惩罚之间进行权衡,鼓励episode平均预算使用匹配请求的目标。在不同模型变体和计算条件下,SOL在匹配预算下优于静态分配和强随机搜索,提供了一种补充的推理效率优化轴。SOL在所有实验中发现更好的质量-效率帕累托前沿,并在统一预算分配策略上将MMLU准确性提高高达7.3%。

英文摘要:

Efficient LLM inference research has largely focused on reducing the cost of each decoding step (e.g., using quantization, pruning, or sparse attention), typically applying a uniform computation budget to every generated token. In practice, token difficulty varies widely, so static compression can over-compute on easy steps and under-compute on hard ones. We study dynamic budget allocation for autoregressive decoding: learning how much computation to spend per token from within a single model. Self-Optimizing Language Models (SOL) pair a frozen LLM with a lightweight policy network that reads the LLM hidden state and selects a discrete efficiency action at each decode step. Actions can jointly control (i) token-level attention sparsity, (ii) structured activation pruning in the MLP, and (iii) activation quantization bit-width, while leaving the base model weights unchanged. We train the policy with group-relative policy optimization on teacher-forced episodes: the token sequence is fixed, while we sample multiple compute schedules (i.e., "counterfactual" schedules that vary only the efficiency actions for the same token path) and compare their likelihoods under the same supervision. Our reward trades off language-model quality against soft penalties that encourage episode-average budget usage to match a requested target. Across model variants and compute regimes, SOL improves quality at matched budget over static allocation and strong random schedule search, offering a complementary axis for inference-efficiency optimization. SOL discovers a better quality-efficiency pareto-front across all our experiments and improves MMLU accuracy by up to 7.3% over uniform budget allocation strategies.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑