Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language understanding and generation. However, their performance often falters when faced with tasks requiring basic arithmetic and numerical reasoning. This deficiency stems primarily from two sources: subword tokenization methods like Byte Pair Encoding (BPE), which fragment numbers inconsistently, and standard pretraining objectives that prioritize linguistic patterns over mathematical logic. This paper introduces Arithmetic-Based Pretraining (ABP), a novel approach designed to enhance the numeracy of existing models without altering their underlying architecture.
Methodology
ABP is an additional pretraining phase that can be integrated into standard LLM training pipelines. It consists of two core components:
- Contrastive Learning for Numerical Consistency: To mitigate the issues caused by tokenization, a contrastive loss is employed. This forces the model to align the vector representations of numbers when viewed as subword tokens with their character-level representations. This bridging mechanism ensures the model develops a more robust internal understanding of numerical values.
- Inferable Number Prediction (INP): This task modifies the standard masked language modeling objective. Instead of masking random tokens, the authors mask numbers that are mathematically derivable from the surrounding context, such as totals in a table or values mentioned in a paragraph. This forces the model to implicitly learn operations such as addition, subtraction, and comparison to successfully predict the missing values.
Experimental Setup
The effectiveness of ABP was evaluated across several benchmarks:
- Reading Comprehension: The DROP dataset, requiring discrete reasoning over paragraphs.
- Table Inference: The InfoTabs dataset, where models classify statements about tables as true, false, or neutral.
- Table-to-Text Generation: The SciGen and WikiBio datasets, focusing on scientific and biographical data respectively.
Results and Analysis
Reading Comprehension
On the DROP dataset, models pretrained with ABP showed substantial improvements. For instance, BART's Exact Match (EM) score increased from 36.00 to 45.60. The most significant gain was observed in Flan-T5, where the EM score rose from 46.34 to 72.18, demonstrating that even instruction-tuned models benefit significantly from specialized numerical pretraining.
Table Inference
In the InfoTabs task, ABP-trained models demonstrated superior performance across in-domain, cross-domain, and adversarial settings. Notably, BART's in-domain accuracy more than doubled, moving from 33.30 to 67.20. These results suggest that the model's improved numeracy is robust to variations in data distribution.
Factual Correctness in Generation
In table-to-text tasks, human evaluation revealed that ABP-trained models were significantly less likely to hallucinate incorrect numbers. The models were better at accurately describing the data provided in scientific and biographical tables, leading to higher precision and correctness scores compared to baselines.
Key Insights
- Transferability of Numeracy: Pretraining on specific numerical tasks (like scientific tables) enhances performance on general reasoning tasks, suggesting that numeracy is a fundamental, transferable skill.
- Architectural Simplicity: ABP improves numerical reasoning by refining existing model weights rather than adding complex external modules or calculators, making it highly compatible with current NLP workflows.
- Character-Level Awareness: Ablation studies highlighted that simply treating numbers as character sequences provides a significant baseline boost, which ABP further amplifies.
Limitations and Future Work
Despite these gains, hardware constraints limited the study to smaller model variants. Additionally, fixed sequence lengths in models like BART restrict their application to very large, complex tables. Future work will explore scaling these methods to larger models and investigating the specific internal arithmetic operations the models learn to perform.
Conclusion
Arithmetic-Based Pretraining offers a computationally efficient and effective way to address the numeracy gap in LLMs. By focusing on the underlying causes of poor numerical reasoning—tokenization and objective functions—ABP enables models to perform complex arithmetic operations while maintaining their general language processing capabilities.
Summary updated