嵌入模型定价过高?面向小型与三值语言模型的 16 MB 冻结词表

·

研究论文 · 2026/10/19

本文探讨小型语言模型中词嵌入表过大的问题。以Gemma 3 270M为例,嵌入表占1.68亿/2.68亿参数,且量化后仍为16位,占据大部分文件。作者用512位编码的冻结表(16MB,无训练参数)替换原表,该表由预训练嵌入经主成分投影和符号二值化得到。在相同数据上训练相同模型,学习表以2.6倍可训练参数换取0.20纳特的验证损失优势,但在LAMBADA、HellaSwag和PIQA上冻结表模型表现更好或持平,仅ARC-Easy偏好学习表。结合三值BitNet b1.58主体,整个模型仅46MB,在LAMBADA和PIQA上与浮点模型持平,在笔记本CPU上以62MB内存实现615-740 tokens/秒的生成速度,是llama.cpp中8位GGUF浮点模型的5-6倍,内存仅为其七分之一。冻结表在稀有词上优势1.7-2.3纳特,训练后接受10000个新词仅3%代价,而学习表崩溃43%。所有内容(权重、数据、评估答案)均已发布。

该研究挑战了嵌入表必须可训练的传统观念,提供了一种极简的冻结嵌入方案,在几乎不损失性能的前提下大幅降低模型大小和计算需求,尤其适合边缘设备部署。其实验全面,开源彻底,对小型语言模型的设计具有启发意义。

In a small language model the vocabulary is the single largest part. In Gemma 3 270M the embedding table holds 168M of 268M parameters, and because quantisation methods leave the embedding in 16-bit, it is also most of the file once the rest of the model is compressed. We ask what that table actually buys. We replace it with one frozen table of 512-bit codes, 16 MB, with no trainable parameters, derived once from a pretrained embedding by principal-component projection and sign binarisation, and we train the same Gemma-shaped body from scratch on the same 2.05B tokens with and without it. The learned table buys 0.20 nats of validation loss for 2.6 times the trainable parameters, but on LAMBADA, HellaSwag and PIQA the frozen-table model is better or tied; only ARC-Easy favours the learned table. With a ternary BitNet b1.58 body the whole model is a 46 MB file, still ties the float model on LAMBADA and PIQA, and on a laptop CPU generates 615 to 740 tokens per second in 62 MB of memory, five to six times the speed of the float model's 8-bit GGUF in llama.cpp at a seventh of the memory. The frozen table wins by 1.7 to 2.3 nats on rare words, accepts 10,000 new words after training with a 3% cost where the learned table collapses by 43%, and all of it is released with the weights, the data and every evaluation answer.

阅读原文

参与讨论