Weber's Law in Transformer Magnitude Representations: Efficient Coding, Representational Geometry, and Psychophysical Laws in Language Models
Organizations: Independent Researcher, Melbourne Australia
Abstract
How do transformer language models represent magnitude? Recent work disagrees: some find logarithmic spacing, others linear encoding, others per-digit circular representations. We apply the formal tools of psychophysics to resolve this. Using four converging paradigms (representational similarity analysis, behavioural discrimination, precision gradients, causal intervention) across three magnitude domains in three 7-9B instruction-tuned models spanning three architecture families (Llama, Mistral, Qwen), we report three findings. First, representational geometry is consistently log-compressive: RSA correlations with a Weber-law dissimilarity matrix ranged from .68 to .96 across all 96 model-domain-layer cells, with linear geometry never preferred. Second, this geometry is dissociated from behaviour: one model produces a human-range Weber fraction (WF = 0.20) while the other does not, and both models perform at chance on temporal and spatial discrimination despite possessing logarithmic geometry. Third, causal intervention reveals a layer dissociation: early layers are functionally implicated in magnitude processing (4.1x specificity) while later layers where geometry is strongest are not causally engaged (1.2x). Corpus analysis confirms the efficient coding precondition (alpha = 0.77). These results suggest that training data statistics alone are sufficient to produce log-compressive magnitude geometry, but geometry alone does not guarantee behavioural competence.
Figures & tables
| Paradigm | Measures | Dependent variable | Falsification |
|---|---|---|---|
| A: Representational Geometry Probing | Hidden-state distances between magnitude encodings | Cosine/Euclidean distance in activation space | Linear geometry refutes Weber |
| B: Behavioural Discrimination | Forced-choice magnitude comparison accuracy | Proportion correct, Weber fraction | Accuracy predicted by absolute diff, not ratio |
| C: Precision Gradient | How representational density changes with magnitude | Local pairwise distance between adjacent magnitudes | Flat precision gradient refutes efficient coding |
| D: Causal Intervention | Whether magnitude subspace is functionally relevant | p after activation patching | No causal effect means geometry is epiphenomenal |
| Numerical | Temporal | Spatial | |
|---|---|---|---|
| Llama (cosine) | 16/16 | 16/16 | 16/16 |
| Llama (Euclidean) | 16/16 | 16/16 | 16/16 |
| Mistral (cosine) | 16/16 | 16/16 | 16/16 |
| Mistral (Euclidean) | 16/16 | 16/16 | 16/16 |
| Domain / Task | Llama accuracy | Mistral accuracy | Llama ratio effect | Mistral ratio effect |
|---|---|---|---|---|
| Numerical B1 (primary) | 78.5% | 74.8% | Weber-like | Weak (abs diff wins) |
| Numerical B2 | 57.9% | 69.0% | Chance | Chance |
| Numerical B3 | 90.6% | 86.3% | Strong | Yes |
| Symbolic control | 99.9% | 50.0% | Ceiling | Position bias |
| Temporal B1 | 47.9% | 47.1% | Chance | Chance |
| Spatial B1 | 49.7% | 50.0% | Chance | Chance |
| Hypothesis | Llama | Mistral | Programme level |
|---|---|---|---|
| H1 (log geometry) | PASS (16/16 layers, 3/3 domains) | PASS (16/16 layers, 3/3 domains) | SUPPORTED |
| H2 (behavioural Weber) | PASS ( dev=7.51, WF=0.201) | FAIL ( dev=–12.07, WF=0.529) | NOT SUPPORTED |
| H3 (precision gradient) | PASS (num, temp) | Marginal (temp only) | NOT SUPPORTED |
| H4 (cross-domain WF) | Non-evaluable (temp/spat at chance) | Non-evaluable | NON-EVALUABLE |
| H5 (layer transition) | PASS (num =–.47, spat =–.35) | PASS (num only) | NOT SUPPORTED |
| H6 (dist + ratio effects) | Partial (dist , ratio , inter. ) | Partial (dist , ratio , inter. ) | NOT SUPPORTED |
| Llama L5 (early) | Llama L23 (peak RSA) | Mistral L13 (early) | Mistral L22 (peak RSA) | |
|---|---|---|---|---|
| Baseline accuracy | 0.786 | 0.786 | 0.744 | 0.744 |
| Mag mean p | 0.028 | 0.001 | 0.011 | 0.001 |
| Specificity ratio | 4.07 | 1.22 | 2.85 | 2.29 |
| Dose-response | Monotonic | Flat | Monotonic | Flat |
Representation Geometry in Language Models
Representation geometry in language models studies how embeddings and hidden states organize concepts, computation, and behavior.
See all 417 papers