nGPT: Training a Transformer on the Sphere
The Problem: Lengths That Drift
A neural network manipulates vectors: the rows of its weight matrices, and the activations that flow from one layer to the next. Each has a direction and a length (its norm). During training, these lengths do not behave. Some activations grow as layers pile up, some weight rows lengthen, others shrink, and the optimiser has to cope with scales that keep changing.
The classic Transformer copes with several patches, each explained elsewhere in this course:
- normalisation layers (LayerNorm, RMSNorm) before each block, which bring activations back to a reasonable scale;
- weight decay (built into AdamW), which stops weights from growing indefinitely;
- a learning-rate warmup at the start of training (warmup), so the first steps do not blow those scales up.
One geometric remark sheds light on what follows. RMSNorm already brings each activation back to a fixed length, proportional to the square root of its dimension. In other words, after each normalisation, tokens already sit on a sphere. But the weights do not, and between two normalisations the activations leave it.
nGPT's Idea: Put Everything on the Sphere
In October 2024, Ilya Loshchilov, Cheng-Ping Hsieh, Simeng Sun and Boris Ginsburg at NVIDIA published the normalized Transformer, nGPT. The principle fits in one sentence: every vector in the model has a length of 1. Token embeddings, every row of the attention and MLP matrices, and the activations flowing between layers all live on the same unit sphere. After each optimiser step, the weights are renormalised to bring them back onto it.
Three consequences follow directly.
Dot products become cosine similarities. When two vectors have length 1, their dot product is the cosine of the angle between them: a number between -1 and 1. Every matrix-vector product in the model becomes a series of angle comparisons, which gives a simple reading: each row of a matrix is a landmark on the sphere, and the layer measures how much the activation resembles it.
The patches become unnecessary. No more LayerNorm or RMSNorm: everything is already normalised. No more weight decay: weight length is fixed by construction. The authors also drop the learning-rate warmup.
The model needs some freedom of scale back. Vectors all of length 1 are too constrained: non-linear functions such as SwiGLU in the MLPs need their inputs at the right scale, and the final softmax needs logits spread enough to express a sharp prediction. nGPT therefore adds a few learned scaling vectors: one for the attention queries and keys, one inside the MLPs, one for the output logits. In attention, the usual division by the square root of the key dimension becomes a multiplication by that same root, since dot products are now bounded.
Each Layer Takes a Step on the Sphere
The most elegant change concerns the residual connection, the heart of the Transformer (see FFN and residual connections). In a classic model, each block adds its contribution to the activation: . In nGPT, the block proposes a point on the sphere, and the activation takes a step towards that point, then returns to the sphere:
Here is the normalised output of the attention block, and a learned vector that sets the step length, coordinate by coordinate. The authors call it an "eigen learning rate". The same formula applies to the MLP block with its own .
The authors' reading is telling. To predict "beautiful" after "Life is", the token moves layer after layer across the sphere: attention suggests a point, the state takes a step towards it; the MLP suggests another, the state takes a second step. The forward pass becomes an optimisation: a series of small guided moves whose size is learned. It is the same geometry as an optimiser walking down a slope, applied inside the network.
What It Gives
On models of 0.5 and 1 billion parameters trained on OpenWebText, nGPT reaches the same validation loss as a classic GPT in 4 times fewer steps with 1,000-token sequences, 10 times fewer at 4,000 tokens and 20 times fewer at 8,000. At a 4,000-token context, the 1-billion-parameter model reaches in 20,000 iterations the loss the reference GPT reaches after 200,000.
The gain is counted in steps, not hours. In the paper's implementation, each nGPT step is about 80% slower at 4,000 tokens and 60% slower at 8,000, because the many normalisations are not yet fused into optimised kernels the way a classic GPT's are. The real gain in compute time remains significant, but well below the announced factors. The authors also note that their dataset is not of the highest quality, and that the public re-implementation reproduces their results only qualitatively. As always, the grid from how to read a benchmark score applies.
2026: The Recipe for Scaling Up
The open question was whether the idea held on real production models. In October 2026, Ilya Loshchilov and Boris Ginsburg published Training nGPT, which applies the normalized Transformer to the hybrid Mamba-2 and Transformer mixture-of-experts models of the Nemotron-3 family (see hybrid architectures and Mamba-2), from 1 to 30 billion total parameters.
The main result: with an identical architecture, the normalised model reaches a loss 2.5 to 3.5% lower at every size tested, and the 30-billion-parameter model (3.23 billion active per token) reaches the reference's validation loss with about half as many tokens. The measured per-step overhead falls to about 6% for the largest model, far from the 60 to 80% of the first paper.
To get there, the paper adds several ingredients to the optimiser. Three are worth understanding:
- Logit gradient preconditioning. The logit scaling vector grows slowly during training, and that growth multiplies, without anyone choosing it, the gradient flowing back to every layer. The fix removes this hidden factor from the gradient computation without changing the forward pass.
- Logarithmic learning-rate decay. Because weight length is fixed, the real step size depends directly on the learning rate, with no interaction with weight decay. The authors use this to front-load the budget: a fast drop after the start, then a long tail.
- GatedAdamW. In Adam, a small constant, epsilon, is there to avoid division by zero. But it has a quiet second effect: it dampens updates for coordinates whose gradients are very small. GatedAdamW separates the two roles, with a purely numerical epsilon and a tunable "gate" that decides from which scale a coordinate really receives its update. With certain settings, it recovers AdamW exactly.
On top of this comes an angular cap: since the weights live on the sphere, one can limit the angle by which each vector rotates at each step, a geometric safeguard against abrupt updates.
The authors stay careful about the scope of their results. The compute budget was limited, there is no systematic study of each ingredient, and the main comparison changes both the architecture and the optimiser, so it does not say what belongs to each. They also flag a common implementation bug: in distributed training, the parameters the optimiser works on must be normalised, not only their copy in the model.
Key Takeaways
- In nGPT, every vector has a length of 1: weights, embeddings and activations live on the same sphere, and weights are renormalised after each step.
- Dot products become cosines, between -1 and 1, which makes LayerNorm, RMSNorm and weight decay unnecessary. A few learned scaling factors give the model back the freedom it needs.
- Each layer takes a step on the sphere towards the attention or MLP proposal, with a learned step size: the forward pass reads as an optimisation.
- The gain is measured in steps: 4 to 20 times fewer on small models in 2024, but with more expensive steps. In 2026, on hybrid models up to 30 billion parameters, about half the tokens for the same loss, with 6% overhead.
- The recipe matters as much as the idea: logit preconditioning, logarithmic decay, a tunable Adam epsilon and an angular cap are what made scaling up possible.
1. Why can nGPT do without LayerNorm, RMSNorm and weight decay?
2. What happens at each attention or MLP block in nGPT, instead of the usual residual addition?
3. The first paper announces 4 to 20 times fewer training steps. Why is the real gain in time smaller?
4. What double role of Adam's epsilon does GatedAdamW separate?