NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Impact of Pretraining Term Frequencies on Few-Shot Numerical Reasoning

Yasaman Razeghi, Robert L. Logan Iv, Matt Gardner, Sameer SinghEMNLP 2022

Introduction

Large Language Models (LLMs) frequently demonstrate what appears to be sophisticated numerical reasoning. However, this performance often masks a significant dependency: the accuracy of these models is tightly coupled with the frequency of specific numbers within their pretraining data. This paper investigates whether few-shot numerical performance is a robust emergent skill or merely a reflection of statistical patterns learned from the pretraining corpus.

Problem Statement

When an LLM correctly calculates $24 \times 18$ but fails on $23 \times 18$, the assumption of underlying mathematical logic becomes questionable. The "black box" nature of pretraining data makes it difficult to distinguish between genuine reasoning and "data leakage"—where the model simply recalls specific instances seen millions of times during training. This study seeks to quantify the extent to which term frequency predicts performance on numerical tasks.

Methodology

The researchers analyzed the EleutherAI/GPT model family (GPT-J-6B and GPT-Neo) using The Pile, an 800GB public pretraining corpus. The experimental pipeline involved several key steps:

  1. Frequency Counting: Calculating occurrences of individual numbers, pairs, and full equations in the corpus.
  2. Task Design: Evaluating models on arithmetic, operation inference, and unit conversion.
  3. Performance Gap Analysis: Measuring the accuracy difference between the most and least frequent terms.
Experimental pipeline for analyzing the impact of pretraining term frequencies on reasoning tasks.

Key Insights

The study reveals that a model's ability to solve a math problem is largely a "popularity contest." If a number appears frequently in the training data, the model is significantly more likely to handle it correctly. Notably, even the frequency of a single operand (unigram frequency) is a strong predictor of success, suggesting that internal representations for common numbers are more refined. The performance gap between frequent and rare terms can reach up to 70%, indicating that LLMs may function more as sophisticated lookup tables than as logical reasoners.

Results

The primary finding is a massive correlation between term frequency and accuracy. As shown in the data, numbers that appear more often in the pretraining set consistently yield higher accuracy in reasoning tasks.

Correlation between a number's frequency in the pretraining corpus and the model's accuracy on tasks involving that number.

Furthermore, providing more few-shot examples often widened the performance gap. This suggests that prompts help the model retrieve existing patterns from pretraining rather than teaching new reasoning capabilities. In unit conversion tasks, the model excelled at common conversions (e.g., decades to years) but struggled with less frequent numerical inputs in similar patterns (e.g., weeks to days).

Conclusion and Future Work

The findings suggest that current benchmarks for numerical reasoning are heavily biased by pretraining data distributions. The authors argue that future evaluations must account for term frequencies to validly claim a model possesses reasoning skills. Future research should explore whether different training objectives or data balancing techniques can mitigate this "popularity bias" and foster more robust, frequency-independent numerical logic.

Summary updated

BibTeX
@inproceedings{razeghi2022impact,
  author = {Yasaman Razeghi and Robert L. Logan IV and Matt Gardner and Sameer Singh},
  title = {{Impact of Pretraining Term Frequencies on Few-Shot Numerical Reasoning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.59},
}
Figure