2025-02-17 · 专家 · 自然语言处理 · 机器学习

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:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt