Language Models Encode Numbers Using Digit Representations in Base 10

Amit A. Levy, Mor Geva

Introduction

Large Language Models (LLMs) demonstrate remarkable fluency in text but often struggle with basic arithmetic. A common observation is that their errors frequently resemble "typos"—changing a single digit—rather than "near misses" in numerical value. This paper investigates the internal mechanics of how models like Llama 3 and Mistral 7B represent numbers, proposing that they utilize discrete, circular digit representations in base 10 rather than a continuous linear value scale.

Conceptual overview of LLM numerical errors and circular probing.

Methodology

The researchers employed three primary techniques to analyze internal representations:

  1. Error Analysis: Examining the distribution of errors in multi-operand addition to see if they cluster around specific digit positions.
  2. Circular Probing: Training diagnostic models to extract numerical information. By mapping digits (0–9) onto a unit circle, the probes account for the periodic nature of digits and non-linearities in the model's internal space.
  3. Causal Intervention: Directly editing the hidden states of the model (e.g., flipping a "tens" digit) to observe if the final output changes by the corresponding magnitude, proving a causal link between representation and output.

The Base-10 Monopoly

A central finding of the study is the overwhelming preference for base-10 representations. When testing probes across various bases, the accuracy for base 10 was significantly higher than for any other system.

Probing accuracy across different bases for Llama 3 8B and Mistral 7B.

As shown in the table above, both Llama 3 and Mistral 7B exhibit high probing accuracy (~91-92%) specifically for base 10. Interestingly, base 5 also showed a minor signal, likely due to its relationship as a factor of 10, while other bases like 2, 8, or 16 showed negligible accuracy.

Key Insights

  • Digit Space vs. Value Space: LLM errors are localized. If the correct answer is 833, a model is more likely to output 633 (a single digit error) than 831 (a small value error). This suggests the internal logic operates on digits rather than magnitude.
  • Robustness through Discreteness: Representing numbers as discrete digits may make models more resilient to internal noise. A small shift in a continuous representation changes the value, but in a digit-based system, it requires a larger shift to flip a '2' to a '3', allowing for a form of internal error correction.
  • Generalization to Words: Probes trained on numeric tokens (e.g., "512") successfully decoded numbers written as words (e.g., "five hundred twelve"), suggesting a unified internal "number concept" that is fundamentally digit-based.

Results and Conclusion

Causal interventions confirmed these findings: editing the "hundreds" digit in the hidden state resulted in the model outputting the correctly edited number or a value off by only one digit in 62% of cases. Furthermore, 80% of errors in addition tasks were found to be localized to a single output digit, confirming that failures are typically position-specific.

While the study focuses on integers, it provides a foundational understanding of numerical representation in LLMs. Future work will explore whether this digit-wise logic extends to more complex numerical types like decimals and fractions, and the specific "circuitry" used for operations like carrying digits during addition.

Summary updated

BibTeX
@inproceedings{levy2025language,
  author = {Amit A. Levy and Mor Geva},
  title = {{Language Models Encode Numbers Using Digit Representations in Base 10}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-short.33},
}
Figure