Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Regress, Don't Guess -- A Regression-like Loss on Number Tokens for Language Models

About

While language models have exceptional capabilities at text generation, they lack a natural inductive bias for emitting numbers and thus struggle in tasks involving quantitative reasoning, especially arithmetic. One fundamental limitation is the nature of the cross-entropy (CE) loss, which assumes a nominal scale and thus cannot convey proximity between generated number tokens. In response, we here present a regression-like loss that operates purely on token level. Our proposed Number Token Loss (NTL) comes in two flavors and minimizes either the $L_p$ norm or the Wasserstein distance between the numerical values of the real and predicted number tokens. NTL can easily be added to any language model and extend the CE objective during training without runtime overhead. We evaluate the proposed scheme on various mathematical datasets and find that it consistently improves performance in math-related tasks. In a direct comparison on a regression task, we find that NTL can match the performance of a regression head, despite operating on token level. Finally, we scale NTL up to 3B parameter models and observe improved performance, demonstrating its potential for seamless integration into LLMs. We hope to inspire LLM developers to improve their pretraining objectives and distribute NTL as a minimalistic and lightweight PyPI package $ntloss$: https://github.com/ai4sd/number-token-loss. Development code for full paper reproduction is available separately.

Jonas Zausinger, Lars Pennig, Anamarija Kozina, Sean Sdahl, Julian Sikora, Adrian Dendorfer, Timofey Kuznetsov, Mohamad Hagog, Nina Wiedemann, Kacper Chlodny, Vincent Limbach, Anna Ketteler, Thorben Prein, Vishwa Mohan Singh, Michael Morris Danziger, Jannis Born• 2024

Related benchmarks

TaskDatasetResultRank
Chart Question AnsweringChartQA
Accuracy76.92
165
Mathematical ReasoningGSM8K (test)
Accuracy64.13
43
Mathematical ReasoningMathematical Reasoning Suite GSM8K, MATH, SVAMP, SimulEq, AQuA, SAT, MMLU
Accuracy (Aggregate)68.8
40
Clock-time recognitionClock-Time
Accuracy89.17
20
Arithmetic CalculationDeepMind-Math
Accuracy67.01
20
Mathematical ReasoningSVAMP (full set)
Exact Match Accuracy60.5
20
Mathematical ReasoningGSM8K
Task Accuracy55.1
9
Tabular RegressionTALENT 100 regression tasks
RMSE (Mean)0.5307
8
Numerical ReasoningGSM8K (test)
MAE (Scale 1)1.16
6
Numerical ReasoningGSM8K (test)
Accuracy (Error <= 1)68.9
6
Showing 10 of 15 rows

Other info

Follow for update