大模型其实懂数字大小,只是说不清。
LLMs Know More About Numbers than They Can Say
- 用隐藏层投影提取数字的对数量级信息
- 可还原数值,误差约2.3%(合成数据)或19.06%(论文)
- 内部能判断大小关系,但口头回答准确率仅50%-70%
尽管顶级大模型能解数学题,但我们发现它们在混合符号的数值比较中仍会出错,如比较 $5.7 \times 10^2$ 与 $580$。这引发根本疑问:大模型是否真理解这些数字的大小?我们探测了多个小型开源 LLM 的隐藏状态。一个合适的隐藏层经线性投影后,能编码两类数字的对数量级,使我们能以约 2.3% 的相对误差(合成文本)或 19.06% 的误差(科学论文)恢复原始数值。此外,读取两个数字后的隐藏状态能编码其排名,线性分类器准确率超 90%。然而,当被明确要求排序时,这些模型仅达 50%-70% 准确率,且探针效果差的模型表现更差。最后,将分类器探针的对数损失作为微调中的辅助目标,使口头准确率相比基线提升 3.22%,表明改进内部量级表征可增强数值推理能力。代码已开源。
原文摘要 · Abstract (English)
Although state-of-the-art LLMs can solve math problems, we find that they make errors on numerical comparisons with mixed notation: "Which is larger, $5.7 \times 10^2$ or $580$?" This raises a fundamental question: Do LLMs even know how big these numbers are? We probe the hidden states of several smaller open-source LLMs. A single linear projection of an appropriate hidden layer encodes the log-magnitudes of both kinds of numerals, allowing us to recover the numbers with relative error of about 2.3% (on restricted synthetic text) or 19.06% (on scientific papers). Furthermore, the hidden state after reading a pair of numerals encodes their ranking, with a linear classifier achieving over 90% accuracy. Yet surprisingly, when explicitly asked to rank the same pairs of numerals, these LLMs achieve only 50-70% accuracy, with worse performance for models whose probes are less effective. Finally, we show that incorporating the classifier probe's log-loss as an auxiliary objective during finetuning brings an additional 3.22% improvement in verbalized accuracy over base models, demonstrating that improving models' internal magnitude representations can enhance their numerical reasoning capabilities. Our code is available at https://github.com/VCY019/Numeracy-Probing.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。