FoNE: Precise Single-Token Number Embeddings via Fourier Features
FoNE通过使用傅里叶特征直接将数字映射到嵌入空间,从而提高大语言模型在数值任务上的准确性和效率。
更新于 2025-02-17。作者:Tianyi Zhou、Deqing Fu、Mahdi Soltanolkotabi、Robin Jia、Vatsal Sharan。
中文摘要
大型语言模型(LLMs)通常使用多个标记来表示数字,这要求模型对这些标记进行聚合以解释数值。这种碎片化使得训练和推理都变得不那么高效,并会对模型在数字相关任务上的性能产生不利影响。受预先训练的LLMs在内部学习数字标记的傅里叶类特征的观察启发,我们提出了傅里叶数字嵌入(FoNE),这是一种新颖的方法,它直接将数字映射到嵌入空间,并使用其傅里叶特征。FoNE将每个数字编码为单个标记,每个数字只有两个嵌入维度,有效地捕捉数值而不产生碎片。这种紧凑的表示加快了训练和推理的速度。与传统子词和数字嵌入相比,FoNE不仅减少了计算开销,而且在各种数值任务(包括加法、减法和乘法)上实现了更高的精度。在6位十进制加法中,FoNE比子词和数字嵌入分别需要64倍和3倍、6倍更少的数据,才能达到99%的准确率。此外,FoNE是唯一一种在超过10万个测试示例中对加法、减法和乘法都能达到100%准确率的方法。代码和可视化工具可在https://fouriernumber.github.io/找到。
英文摘要
Large Language Models (LLMs) typically represent numbers using multiple tokens, which requires the model to aggregate these tokens to interpret numerical values. This fragmentation makes both training and inference less efficient and adversely affects the model's performance on number-related tasks. Inspired by the observation that pre-trained LLMs internally learn Fourier-like features for number tokens, we propose Fourier Number Embedding (FoNE), a novel method that directly maps numbers into the embedding space with their Fourier features. FoNE encodes each number as a single token with only two embedding dimensions per digit, effectively capturing numerical values without fragmentation. This compact representation accelerates both training and inference. Compared to traditional subword and digit-wise embeddings, FoNE not only reduces computational overhead but also achieves higher accuracy across various numerical tasks including addition, subtraction and multiplication. On 6-digit decimal addition, FoNE requires 64times less data to achieve 99% accuracy than subword and digit-wise embeddings while using 3times and 6times fewer tokens per number, respectively. Furthermore, FoNE is the only method that yields 100% accuracy on over 100,000 test examples for addition, subtraction, and multiplication. The codes and visualization are available at https://fouriernumber.github.io/.
解读
一句话总结
FoNE通过使用傅里叶特征直接将数字映射到嵌入空间,从而提高大语言模型在数值任务上的准确性和效率。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:大语言模型(LLMs)通常使用多个标记来表示数字,这要求模型聚合这些标记来解释数值,导致训练和推理效率低下,并影响模型在数值任务上的性能。
- 现有方案不足:传统的子词和数字级别嵌入方法需要聚合多个标记来理解数字,引入了不必要的不效率。
- 研究目标:提出一种新的方法,即傅里叶数字嵌入(FoNE),直接将数字映射到其傅里叶表示,以实现更精确和高效的数值表示。
问题2:论文的核心创新点是什么?
- 技术创新:FoNE使用傅里叶特征直接将数字映射到嵌入空间,每个数字仅用两个嵌入维度表示每个数字。
- 方法改进:通过避免数字的标记化,FoNE减少了计算开销,同时提高了数值任务的准确率。
- 优势:与传统的子词和数字级别嵌入相比,FoNE减少了计算开销,同时提高了准确率。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在包括加法、减法和乘法在内的各种数值任务上进行了广泛的实验。
- 性能提升:FoNE在6位十进制加法任务上,使用64倍更少的数据实现了99%的准确率,同时使用3倍和6倍更少的标记。
- 对比结果:FoNE是唯一能够在超过10万个测试示例上实现100%准确率的加法、减法和乘法方法。
问题4:这个研究的实际应用价值是什么?
- 应用场景:适用于需要精确数值表示的领域,如数学、物理和定量推理。
- 实施建议:将FoNE集成到预训练的大语言模型中,以提高其在数值任务上的性能。
- 局限与展望:目前FoNE主要针对较短数字序列,未来可以扩展到更长的数字序列,并与其他嵌入方法结合使用以进一步提高性能。
来源
机器可读索引:llms.txt