Abstract
Large Language Models (LLMs) demonstrate a remarkable ability to recall factual numeric information, yet the internal structural representation of these values remains poorly understood. This paper investigates whether LLMs treat numbers as arbitrary strings or if they develop internal geometric structures reflecting mathematical order. By utilizing Partial Least Squares (PLS) regression, we identify low-dimensional "directions" in activation space that correspond to numeric attributes such as birth years and city populations. We demonstrate that these representations are causal: by "patching" activations along these directions, we can monotonically steer model outputs. Our findings suggest that monotonic numeric representations emerge consistently across various model architectures as a fundamental byproduct of pretraining.
Introduction
While existing research has extensively explored how LLMs represent categorical entity-entity relations (e.g., "Paris is the capital of France"), the representation of continuous or ordered numeric properties has received less attention. Numeric properties are distinct because they possess a natural, monotonic order. This study addresses whether LLMs internalize this order within their high-dimensional activation spaces. Specifically, we ask if there exists a "number line" hidden inside the model's geometry that can be manipulated to predictably alter factual outputs.
Methods
We propose a two-step framework for identifying and validating numeric representations:
- Direction Identification via PLS: Rather than using Principal Component Analysis (PCA), which maximizes variance, we employ Partial Least Squares (PLS) regression. PLS is specifically designed to find subspaces in model activations that covary with a target numeric variable.
- Activation Patching: To establish causality, we intervene on the model's internal state. We identify the representation of an entity (e.g., "Karl Popper") at an optimal layer (typically around 30% of the model depth) and shift it along the identified PLS direction.
- Monotonicity Evaluation: We test the functional nature of these directions by measuring if varying the intervention strength leads to a corresponding, predictable change in the model's textual output.
Datasets and Evaluation
We evaluated our approach using a dataset of 1,000 popular entities, selected based on Wikidata connectivity and Wikipedia article length. Six numeric properties were extracted from Wikidata: birth year, death year, population, elevation, and geographic coordinates (latitude and longitude). These were tested across several state-of-the-art open-weight models, including Llama 2 (7B and 13B), Mistral 7B, and Falcon 7B.
Results
Our experiments across Llama 2, Mistral, and Falcon models reveal several key insights:
High-Dimensional Efficiency
Numeric properties are encoded in surprisingly low-dimensional subspaces. For most attributes, just 2 to 6 dimensions capture over 95% of the predictive power. As shown in the figure below, PLS significantly outperforms PCA in identifying these task-relevant directions, achieving high goodness-of-fit ($R^2 \geq 0.79$) for most properties.
Causal Steerability and Monotonicity
The identified directions are not merely correlational but functional. Shifting an entity's representation along a "birthyear" direction causes the model to output different years in a monotonic fashion. We observed high Spearman correlations between intervention strength and output values (e.g., $\rho = 0.84$ for birthyear and $\rho = 0.90$ for work period start).
Emergent Structure and Side Effects
This monotonic structure emerges consistently across different model families, suggesting it is a core feature of language model learning. Interestingly, interventions often produce logical side effects; for instance, shifting a "birthyear" direction also tends to shift the predicted "death year," reflecting the model's internal capture of real-world constraints like human lifespan. Larger models, such as Llama 2 13B, showed more property-specific subspaces compared to smaller models, where numeric directions were more prone to affecting unrelated properties.
Discussion and Limitations
While these results demonstrate a sophisticated internal geometry for numbers, several limitations remain. The authors emphasize that these representations are likely artifacts of distributional patterns in training text rather than a grounded physical understanding; the model does not "know" what a meter is, but rather how the token relates to others. Furthermore, this study focused on high-frequency entities; the robustness of these "number lines" for rare or "long-tail" entities is yet to be determined. Future work should explore higher-dimensional editing techniques to achieve even finer control over the model's numeric knowledge.
Summary updated