Pre-trained Language Models Learn Remarkably Accurate Representations of Numbers

Marek Kadlčík, Michal Štefánik, Timothee Mickus, Michal Spiegel, Josef Kuchař
6/10/2025
cs.CLcs.LGcs.NE

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Pretrained language models (LMs) are prone to arithmetic errors. Existing work showed limited success in probing numeric values from models' representations, indicating that these errors can be attributed to the inherent unreliability of distributionally learned embeddings in representing exact quantities. However, we observe that previous probing methods are inadequate for the emergent structure of learned number embeddings with sinusoidal patterns. In response, we propose a novel probing technique that decodes numeric values from input embeddings with near-perfect accuracy across a range of open-source LMs. This proves that after the sole pre-training, LMs represent numbers with remarkable precision. Finally, we find that the embeddings' precision, judged by our probe's accuracy, explains a large portion of LM's errors in elementary arithmetic, and show that aligning the embeddings with the pattern our probes discover can mitigate these errors.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{kadlk2025pretrained,
  title  = {Pre-trained Language Models Learn Remarkably Accurate Representations of Numbers},
  author = {Marek Kadlčík and Michal Štefánik and Timothee Mickus and Michal Spiegel and Josef Kuchař},
  year   = {2025},
  eprint = {2506.08966},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.08966v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.08966.svg)](https://codeofpaper.com/paper/2506.08966)

Discussion