arXiv:2508.15229cs.CLcs.AI2025-08ACL被引 3

动态选词让小模型省99%内存,性能几乎不变

VocabTailor: Dynamic Vocabulary Selection for Downstream Tasks in Small Language Models

  • 分离嵌入与语言头,按需加载词汇组件
  • 内存占用减少99%,任务表现基本无损
  • 适合边缘设备部署的小模型优化

小型语言模型(SLMs)在资源受限环境中有计算优势,但内存限制仍是其在边缘设备部署的关键瓶颈。大量内存消耗源于词汇相关组件,尤其是嵌入层和语言建模头,因词汇量过大。现有静态词汇剪枝虽能降低内存使用,但设计僵化,导致预填充阶段信息丢失且缺乏灵活性。本文基于两个关键原则:词汇局部性(单次推理只需少量词)和组件间计算特性不对称,提出VocabTailor——一种解耦的动态词汇选择框架。通过将嵌入层卸载,并对语言建模头采用混合静态-动态策略,实现词汇组件的按需加载。跨多种下游任务的实验表明,该方法可使词汇相关组件内存减少高达99%,性能损失极小或无,显著优于现有静态剪枝方法。代码已开源。

原文摘要 · Abstract (English)

Small Language Models (SLMs) provide computational advantages in resource-constrained environments, yet memory limitations remain a critical bottleneck for edge device deployment. A substantial portion of SLMs' memory footprint stems from vocabulary-related components, particularly embeddings and language modeling (LM) heads, due to large vocabulary sizes. Existing static vocabulary pruning, while reducing memory usage, suffers from rigid, one-size-fits-all designs that cause information loss during the prefill stage and lack flexibility. In this work, we identify two key principles underlying the vocabulary reduction challenge: the lexical locality principle, the observation that only a small subset of tokens is required during any single inference, and the asymmetry in computational characteristics between vocabulary-related components of SLM. Based on these insights, we introduce VocabTailor, a novel decoupled dynamic vocabulary selection framework that addresses memory constraints through offloading embedding and implements a hybrid static-dynamic vocabulary selection strategy for LM Head, enabling on-demand loading of vocabulary components. Comprehensive experiments across diverse downstream tasks demonstrate that VocabTailor achieves a reduction of up to 99% in the memory usage of vocabulary-related components with minimal or no degradation in task performance, substantially outperforming existing static vocabulary pruning. Our code is available at https://github.com/AwakenedInsects/VocabTailor.

小模型动态选词内存优化边缘计算

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。