Value-Aware Numerical Representations for Transformer Language Models

Andreea Dutulescu, Stefan Ruseti, Mihai DascaluarXiv 2026

TL;DR

Large Language Models (LLMs) frequently stumble on basic arithmetic because they treat numbers as text strings rather than actual quantities. This paper introduces a value-aware numerical representation that injects magnitude information directly into the model's input space using a special <num> prefix token. This simple architectural tweak significantly improves numerical robustness and arithmetic accuracy without breaking compatibility with standard tokenizers.

What Problem Does This Paper Address?

State-of-the-art LLMs can write complex code and reason through intricate word problems, yet they routinely fail at elementary math—famously insisting that $9.11 > 9.9$. This happens because standard subword tokenizers treat numbers as arbitrary text fragments or discrete symbols.

Because their embeddings are learned purely from text co-occurrence statistics, LLMs lack an intrinsic understanding of mathematical magnitude. They don't inherently "know" that 153 is close to 154, or that 9.9 represents a larger quantity than 9.11. While techniques like Chain-of-Thought prompting help mask this flaw by breaking down problems, they don't fix the underlying issue: the model lacks a grounded internal representation of numerical value.

Figure 1: Standard LLMs process numbers as symbolic tokens, which can lead to incorrect surface-form arith- metics. Our value-aware <num> token explicitly encodes numerical magnitude, enabling the model to reason over numbers as continuous measurements.

Methods

The authors propose a complementary approach that prepends a special <num> token before every numerical expression in the text (e.g., "they have <num> 14 apples").

  • Value-Conditioned Embeddings: Instead of using a static lookup table, the embedding for the <num> token is dynamically computed via a learnable function $f(x)$, where $x$ is the actual numerical value.
  • Two Encoder Variants: The authors designed two ways to compute $f(x)$: an MLP-based encoder (which uses fixed-length decimal vectors for integer and fractional parts) and an RNN-based encoder (which uses Gated Recurrent Units to sequentially process variable-length digit strings). Auxiliary features like sign, digit count, and decimal length are also concatenated to enrich the representation.
Figure 3: <num> embedding module variants. The MLP- based encoder represents integer and fractional parts as fixed-length decimal vectors projected through a feed- forward layer, while the RNN-based encoder processes variable-length digit sequences using separate GRUs for integer and fractional components. Auxiliary features (i.e., sign, digit count, decimal length) are concatenated in both cases.
  • Training vs. Inference Alignment: During training, the model has oracle access to the true value $x$. However, during text generation (inference), the true value isn't known beforehand. To fix this train-test mismatch, a projection head proj(h) learns to predict the value embedding from the model's hidden state $h$. The training objective minimizes a composite loss combining standard language modeling (using both true and projected embeddings) and a cosine-similarity reconstruction loss.
Figure 2: Training and inference overview of the proposed approach. A standard Transformer is augmented with a special <num> token inserted before surface-form number tokens to explicitly encode numerical value. During training (left), the true numeric value x is used by a trainable embedding module to compute the <num> embedding as f(x), and a projection head is trained to align the hidden state with this representation, enforcing proj(h1) ≈f(x). During inference (right), when x is unavailable, the projected hidden state proj(h1) replaces f(x) and conditions the generation of numeric tokens.

Datasets

The approach was evaluated using a subset of the NUPA (Numerical Understanding and Processing Assessment) benchmark. NUPA is specifically designed to isolate low-level numerical skills from high-level linguistic reasoning.

The authors focused on tasks covering four numerical formats—integers, floating-point numbers, fractions, and scientific notation—across elementary arithmetic, comparisons, and representation conversions. To keep computational overhead low, input operands were restricted to a maximum of 7 digits.

Key Insights and Ideas

  • Numbers are Signals, Not Words: Treating numbers as continuous measurements rather than discrete text tokens addresses the root cause of arithmetic failures, providing a lightweight alternative to token-heavy reasoning chains.
  • Recurrent Processing Mimics Human Cognition: The RNN-based embedding module slightly outperformed the MLP version. The authors attribute this to the RNN's ability to naturally process variable-length digit sequences sequentially, mirroring how humans read digits from left to right to gauge scale.
  • The "Anti-Cheating" Loss is Essential: Simply feeding the true value embedding during training allows the model to "cheat" when predicting numbers. Forcing the network to also learn via the projected hidden state ensures that the model can successfully generate accurate numbers at test time.

Key Results

The value-aware models consistently outperformed both a standard Transformer baseline and Numerologic (a baseline that generates textual descriptions of number lengths).

  • Exact Match Accuracy: The RNN variant (NumValue-RNN) achieved an overall Exact Match score of 0.724, compared to 0.687 for the standard Transformer—a solid 3.7 percentage point improvement.
  • Robustness to Scale: As operand lengths increased from 1 to 7 digits, the standard Transformer's performance degraded. The value-aware models proved much more robust; for 7-digit operands, NumValue-RNN maintained an Exact Match score of 0.642 versus the baseline's 0.613.

Limitations and Future Work

  • Higher Training Cost: Aligning the projected hidden states with the true value embeddings requires two forward passes per training example, effectively doubling the training cost (though inference speed remains unaffected).
  • Scale of Evaluation: The method was evaluated at a prototype level using a GPT-2 architecture trained from scratch. Future work is needed to test how this representation scales when integrated into multi-billion-parameter pretrained LLMs.
  • Exclusion of Symbolic Tasks: This method targets magnitude and quantitative value; consequently, tasks that require pure symbolic digit manipulation (like identifying a digit at a specific position) were excluded and remain a challenge.

Summary updated

BibTeX
@misc{dutulescu2026value,
  author = {Andreea Dutulescu and Stefan Ruseti and Mihai Dascalu},
  title = {{Value-Aware Numerical Representations for Transformer Language Models}},
  year = {2026},
  eprint = {2601.09706},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.09706},
}
Figure