Full text not available for this paper
Neural Dimensional Analysis: Foundations of Dimensionless and Scale-Consistent Computation
Summary (Overview)
- Unified framework: Introduces Neural Dimensional Analysis (NDA), a framework based on dimensional consistency that unifies scale-control mechanisms in Transformers (normalization, residual scaling, attention temperatures, loss weighting, and adaptive updates) under one set of local typing rules.
- Key theoretical contribution: Defines neural units as transformation laws under a rescaling group, proving that forward unit declarations fix gradient transformation laws (Reverse-mode dual typing, Prop. 1), enabling unit-consistent diagnostics and network design.
- Novel diagnostics and architecture: Introduces dimensionless Unit Violation Indices (UVI) for diagnosing scale mismatches and the Gauge-Canonical Transformer (GCT), which computes every block on dimensionless coordinates with orthogonalized residual additions.
- Strong empirical results: GCT remains stable across a 16× learning-rate range (51M–1B parameters), achieves superior depth transfer (3.903 vs 4.243 nats for nGPT at L=48), and shows exceptional quantization robustness (only +0.009 nats loss increase under per-tensor int8 at 1B, vs up to +5.51 for baselines).
- Broad applicability: Validates NDA principles beyond language modeling via vision benchmarks and physics-informed neural networks (PINNs), where unit-aware loss aggregation preserves accuracy across a 10⁴ unit sweep.
Introduction and Theoretical Foundation
Background and Motivation
Modern Transformers rely on a broad family of scale-control mechanisms:
- Normalization: BatchNorm, LayerNorm, RMSNorm normalize activations
- Residual scaling: DeepNet, ReZero, LayerScale, Fixup control residual addition scales
- Attention regulation: Attention scaling and QK-Norm regulate softmax inputs
- Loss balancing: Loss-balancing methods and adaptive optimizers manage scale imbalances
The paper observes that all these mechanisms manage how quantities of different scales interact within a neural network, and interprets them through the lens of dimensional consistency—a fundamental principle from physics.
Theoretical Foundation: Neural Units
The core insight is to define neural units as transformation laws governing how internal tensors rescale when the computation graph is rescaled. Unlike physical units, neural units describe internal scaling behavior even when data have no physical units.
Rescaling group and representations:
Let be a rescaling group with one factor per independent internal scale degree of freedom. A neural unit of node is a representation:
A tensor is dimensionless if and only if . For scalar units, we use continuous characters:
Unit consistency for an operation requires the equivariance identity:
Key Theoretical Results
Proposition 1 (Reverse-mode dual typing): If the loss node is typed dimensionless and every primitive operation is unit-consistent, then every reverse-mode gradient node transforms by the dual law .
Under scalar rescaling , we get , meaning the primal–dual RMS product is comparable across rescalings.
Local Typing Rules
| Operation | Rule |
|---|---|
| Addition | requires |
| Normalization | removes units (nondimensionalization) |
| Softmax/Attention | Logit differences must be dimensionless; temperature converts units |
| Activations | Sigmoid, tanh, GELU, SiLU require dimensionless arguments |
| Gated MLPs | requires for gate |
| Loss aggregation | forces |
| Optimizer updates | needs |
Calibrated attention temperature:
where and are per-head coordinate scales, and the standard is the special case.
Loss weight factorization:
where converts each loss to dimensionless value and sets task preference.
Residual Scale Dynamics
For residual addition with step size :
For persistent positive alignment (), bounded scale requires , giving per layer. Orthogonalization removes the linear term, permitting with uniform steps.
Methodology
Unit Violation Indices (UVI)
UVI measures dimensionless log-deviations from target values or log-dispersion across depth:
where is the measured residual step size and is the batch-averaged row-centered logit variance.
Gauge-Canonical Transformer (GCT)
GCT computes every block on normalized, dimensionless coordinates via the factorization:
Canonicalizer (with numerical stability floor):
Orthogonalized residual update:
where the orthogonal projector is:
and learnable dimensionless scalars are initialized at .
Key components:
- Queries/keys canonicalized per head: ,
- Per-head dimensionless gain initialized at 1
- Normalized gate: for gated MLPs
- Dimensionless logits from with learnable logit gain
Experimental Setup
- Models: Decoder-only Transformers with 51M, 124M, 350M, and 1B parameters
- Baselines: Pre-LN, LLaMA-style, QK-Norm, nGPT
- Data: FineWeb-Edu with identical data order, token budget, and optimization recipe
- Tests: Learning-rate robustness, depth transfer, internal-rescaling invariance, PTQ robustness, PINN unit invariance
Empirical Validation / Results
Learning-Rate Robustness
GCT and nGPT remain stable across the full 16× learning-rate range and retain low validation loss at the highest rates. At rate :
- GCT and nGPT continue improving
- QK-Norm's loss is 0.197 nats above its best
- Pre-LN and LLaMA-style stopped early (~8% of budget) due to UVI threshold
Depth Transfer (Fixed Budget, 400M Tokens)
| Architecture | L=24 | L=48 |
|---|---|---|
| Pre-LN | 4.397 | 4.598 |
| LLaMA-style | 4.322 | 4.513 |
| QK-Norm | 4.206 | 4.322 |
| nGPT | 3.996 | 4.243 |
| GCT (ours) | 3.973 | 3.903 |
| GCT without | 3.983 | 3.938 |
| nGPT with | 4.005 | 3.968 |
Adding the GCT projection to nGPT reduces loss by 0.275 nats at L=48, demonstrating the NDA-derived component's broad applicability.
Post-Training Quantization (PTQ) at 1B
| Architecture | Base | W4 | W8A8 | Stream int8 (tensor) | Stream int8 (token) | Stream int4 (tensor) | Stream int4 (token) |
|---|---|---|---|---|---|---|---|
| Pre-LN | 2.759 | +0.045 | +0.028 | +3.018 | +0.049 | +6.390 | +7.101 |
| LLaMA-style | 2.744 | +0.032 | +0.348 | +5.513 | +0.030 | +7.117 | +5.474 |
| QK-Norm | 2.737 | +0.029 | +0.833 | +5.426 | +0.021 | +8.074 | +5.230 |
| nGPT | 2.751 | +0.038 | +0.075 | +0.032 | +0.008 | +19.083 | +4.661 |
| GCT (ours) | 2.756 | +0.028 | +0.079 | +0.009 | +0.001 | +9.517 | +0.739 |
Key finding: NDA predicts that cross-token scale variation consumes bits of effective resolution, where is the ratio of largest to smallest token RMS. The zero-floor GCT stream fixes .
Weight-Space Fingerprint
Prop. 6 predicts zero radial sensitivity when downstream computation cancels rescaling. All 54 of 54 architecture-by-role predictions match across eight trained 124M models; 34 of 34 cells match at 1B.
PINN Results
Across a unit sweep, NDA's scaled output head and loss weights keep worst relative error at 0.015, whereas equal or adaptive weights degrade for at least one rescaling.
Theoretical and Practical Implications
Theoretical Contributions
-
Unified unit calculus: Provides a graph-level unit calculus covering activations, objectives, gradients, and updates, linking forward computation and backpropagation through a single set of unit rules (Prop. 1).
-
Quantization theory: Establishes that worst-case downstream output error grows as where , formalizing how cross-token scale variation consumes bits of effective resolution.
-
Residual stability analysis: Proves that orthogonalized residual additions permit per-layer steps while maintaining bounded cumulative squared step size, as in depth-wise P.
Practical Implications
-
Diagnostic tool: UVI provides inexpensive, actionable diagnostics on small batches during training, locating scale mismatches at specific interfaces.
-
Architecture design: GCT demonstrates that explicit scale management grounded in dimensional analysis yields:
- More reliable learning-rate transfer across model sizes
- Better depth scaling without hyperparameter retuning
- Superior quantization robustness for deployment
- Unit-invariant loss aggregation for multi-task and physics-informed learning
-
General principle: The success of NDA across language modeling, vision, and PINNs suggests dimensional consistency as a fundamental neural network design principle, not merely a practical trick.
Conclusion
Neural Dimensional Analysis establishes dimensional consistency as a typing principle for scale management across the entire computation graph. The framework:
- Unifies existing scale-control mechanisms (normalization, residual scaling, attention temperature, loss weighting, optimizer updates) under one set of local typing rules
- Provides testable diagnostics (UVI) and a weight-space audit that locate scale mismatches
- Yields a practical architecture (GCT) that achieves competitive clean performance while providing superior learning-rate robustness, depth transfer, and quantization resilience
- Extends beyond language modeling to vision and physics-informed neural networks
Future directions suggested by this work include:
- Applying NDA to other architectures (CNNs, graph neural networks)
- Exploring unit-consistent objectives for multi-modal learning
- Extending the framework to structured state spaces and other sequence models
- Investigating connections with neural ODEs and other physics-grounded architectures
The results collectively establish dimensional consistency as a neural network design principle, offering a principled alternative to the ad-hoc scale-control mechanisms currently used in deep learning.
Related papers
- Enabling Dynamic Computation in Looped LMs
Ragged KV caching enables true early-exit in looped language models, cutting FLOPs and KV memory by up to 30% without retraining or performance loss.
- Compute-Optimal Scaling Laws for Spiking Language Models
Compute-optimal scaling for spiking language models matches dense Transformers (exponent 0.56 vs 0.50), with the apparent deviation explained by parameter-counting conventions.
- AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents
AutoCompact trains coding agents to decide when and how to compact context, improving SWE-bench Verified pass rates by 9.2% over the base model.