A useful first picture of a language model is linear algebra: given many inputs x and targets b, training finds the matrix A; inference then applies A to a new x. That picture is wrong in several specific ways. The model is a nonlinear function of its weights, there are far more weights than equations, and nobody wants the residual driven to zero on noisy data.
That raises a fair question. If training is not a linear solve, why is every optimizer in use built on linearization?
Because finding a zero of a nonlinear function is done by solving linear systems, one after another. What fails is the claim "training is one Ax = b". What holds is "training is a sequence of Ax = b problems, each with a different A, and each solved only roughly."
The loop
Training looks for weights θ where the gradient of the loss is zero: ∇L(θ) = 0. That is a nonlinear system of equations. Newton's method, from the 1600s, handles any such system the same way: replace the function by its tangent at the current point, solve the tangent system, step, and repeat.
With the true curvature, M is the Hessian H and step 3 is Newton's system H δ = −g. The optimizers people actually use keep the loop and swap in a cheaper matrix.
| Optimizer | Matrix M used in M δ = −g | Cost of the solve |
|---|---|---|
| Gradient descent | (1/η) × identity, η the learning rate | Free: a division |
| Adam | A diagonal matrix built from running squared gradients | Free: one division per weight |
| K-FAC, Shampoo | Kronecker products of small per-layer matrices | Small dense solves per layer |
| Muon | Per weight matrix, (GᵀG)^½ with G the momentum-averaged gradient, so the step is G with its singular values set to 1 | A few Newton-Schulz iterations: matrix products only |
| Gauss-Newton (Levenberg-Marquardt) | JᵀJ + λ × identity, J the Jacobian of the outputs | A full linear solve |
| Newton | The Hessian H | A full linear solve |
Read this way, the learning rate is not a separate idea. It is the crudest possible estimate of the curvature: one number for every direction.
Why linearization wins
- It is the only thing we can solve at scale. Linear systems have dependable algorithms with known cost and known error behaviour. Nonlinear systems have no general direct method, so every practical solver reduces to linear steps.
- Smooth functions are locally linear. The error of the tangent model shrinks with the square of the step length. Small steps make the linear model accurate enough, and the learning rate (or the damping λ) is the radius inside which the model is trusted.
- It is cheap. Backpropagation returns the gradient, a Jacobian-transpose times a vector, for about the cost of one forward pass. The matrix is never written down.
- The inner solve can be sloppy. Inexact Newton theory (Dembo, Eisenstat and Steihaug, 1982) shows the outer loop still converges when each linear system is only partly solved. Deep learning takes this to the limit: one step of a simple iteration per linearization, on a system sampled from a minibatch.
A measurement
To see the loop rather than assert it, here is a small problem solved five ways. A one-hidden-layer tanh network with 2 hidden units (6 unknowns) is fitted to 40 points produced by a second network of the same shape, so an exact fit exists. Each method runs from 20 random starts, and a run counts as solved when the loss ½‖r‖² falls below 10⁻¹⁰.

Left: one start (number 4 of the 20, chosen because it sits near the medians). Right: the error of the tangent model against step length at that start; the fitted slope is 2.00. All values measured on a laptop CPU, 2026-11-28.
| Method | Solved, of 20 starts | Median iterations when solved | Range | Budget |
|---|---|---|---|---|
| Gradient descent | 4 | about 12,100 | 10,644 to 17,342 | 20,000 |
| Adam | 14 | about 12,100 | 2,036 to 17,526 | 20,000 |
| Gauss-Newton, 3 conjugate-gradient steps per solve | 13 | 1,091 | 259 to 4,380 | 5,000 |
| Gauss-Newton, exact solve | 19 | 10 | 4 to 111 | 200 |
| Newton, damped | 15 | 19 | 13 to 118 | 200 |
Step sizes for gradient descent and Adam are the best of five tried per start. In the start shown, the iteration counts are 21 (Gauss-Newton, exact), 25 (Newton), 2,532 (Gauss-Newton with 3 conjugate-gradient steps) and 9,097 (Adam); gradient descent had a loss of 4 × 10⁻⁵ after 20,000.
Three things to read off:
- The better the matrix, the fewer passes. Moving from one number (gradient descent) to a diagonal (Adam) to the Jacobian's own curvature (Gauss-Newton) cuts the count by a factor of about a thousand.
- A rough solve still gets there. Three conjugate-gradient steps per linear system are far from an exact solve, yet that run converges in 13 of 20 starts, in about a tenth of the passes the diagonal methods need.
- The tangent is local. The right panel is a straight line of slope 2: halve the step and the linear model's error falls by four. At a step length between 1 and 2 the error is as large as the residual being reduced (0.8 at this start), which is what a diverging learning rate looks like.
What this small test does not show
- It has 6 unknowns. It shows the mechanism, not which optimizer to use on a real model.
- An exact fit exists, which favours Gauss-Newton.
- A pass is not a fixed amount of work. An exact solve costs on the order of n³ operations and needs the n × n matrix in memory. At a billion weights that is out of reach, which is exactly why practice uses the cheap matrices in the table and accepts many more passes.
- No method solved all 20 starts. The problem is nonconvex and badly conditioned for some starts (the condition number of JᵀJ at the start ranged from about 10³ to 10⁹).
What still does not carry over
The limits of the Ax = b picture are about the goal, not the method, and they stand:
- The system is underdetermined, so there is no true inverse to approximate. A modern network has more weights than equations and a whole set of exact solutions. For linear least squares the answer is known: gradient descent started from zero converges to the minimum-norm solution, which is the pseudo-inverse applied to b. Nobody asked for that solution; the method picked it. For a network the same thing happens without a formula: the starting point, the optimizer and the architecture choose among the solutions. This is called the implicit bias of the optimizer.
- A zero residual is not the aim. Fitting noisy data exactly is overfitting. The right frame is a regularized ill-posed inverse problem, and "how close are we to the inverse" is the wrong measure of quality: solving the system more exactly can make the model worse. The next section shows how stopping early does the regularizing.
- The loss is usually not least squares. Language models minimize cross-entropy through a softmax, and what is learned is a probability distribution, not a vector b. The curvature matrix changes; the loop does not.
- In attention the matrix depends on the input. An attention layer computes weights from x and then applies them to x: A(x) x, not A x. Even with the weights frozen, the layer is not a fixed matrix.
- Inference is not a solve. A forward pass is a fixed number of matrix products and nonlinear functions. Nothing iterates until a residual is small. The exception is the deep equilibrium model (Bai, Kolter and Koltun, 2019), whose output is defined as the fixed point z = f(z, x) and is found by an iterative solver.
- The tangent is only valid nearby. A step outside the trusted radius makes things worse, not better.
Where the picture is exact
In three settings the linear-solve picture is not an analogy. None of these is measured in this post; they are results from the papers cited.
1. The kernel regime. Train only the last layer of a network, with everything before it fixed at random values, and training is ordinary least squares on random features (Rahimi and Recht, 2007). More surprising: make every layer very wide, and the weights move so little during training that the tangent taken at the start stays valid for the whole run. Training then reduces to kernel regression, the single linear system K α = y, where K is the neural tangent kernel (Jacot, Gabriel and Hongler, 2018). Chizat, Oyallon and Bach (2019) call this lazy training and show that it comes from how the model is scaled, not from width as such. In this regime training really is one Ax = b. It is also the regime where the network learns no new features: the features are whatever the random start provided. The same paper reports that common convolutional networks do worse when trained this way. Feature learning, the thing that makes deep networks worth training, is exactly the departure from it.
2. Gradient descent on least squares is a named iterative solver, and stopping it early is a filter. For the loss ½‖Aθ − b‖², gradient descent with step η is the Landweber iteration (Richardson's iteration applied to the normal equations). Started from zero, after k steps it has recovered the fraction
1 − (1 − η σ²)ᵏ
of the solution along each singular direction of A with singular value σ. Directions with large σ are recovered within a few steps. Directions with small σ, which are the ones that amplify noise in b, have barely started. Stopping at step k therefore acts like a truncated SVD with a soft cutoff near σ² ≈ 1/(ηk). This is the best form of the "approximate inverse" idea: the approximation is not an error to be removed, it is the regularizer.
3. A trained transformer can run a solver in its forward pass. Von Oswald and co-authors (2023) construct weights for a linear self-attention layer so that one layer performs one step of gradient descent on a linear regression problem stated in the prompt, and they report that transformers trained on such tasks behave like that construction. In this setting each layer is one iteration of an iterative solver, and depth plays the role of the iteration count. This qualifies "inference is not a solve" above: the iteration count is fixed by the architecture, but an iteration it can be.
So the short version: training is not a linear solve. It is a nonlinear, regularized, underdetermined inverse problem attacked by the only tool that scales, a long run of rough linear solves, each one valid for a small step. Linear algebra carries over locally (Jacobians, curvature, the choice of matrix) and exactly in the kernel limit. It does not carry over as a measure of quality, because there is no true inverse to approach.
Reproduce
The script and its output are in the practice repository under
projects/20-linearize-and-solve. It needs only NumPy and Matplotlib and runs in about a
minute.
Sources
- R. S. Dembo, S. C. Eisenstat, T. Steihaug, "Inexact Newton Methods", SIAM Journal on Numerical Analysis 19(2), 1982.
- K. Levenberg, "A Method for the Solution of Certain Non-Linear Problems in Least Squares", Quarterly of Applied Mathematics 2, 1944; D. W. Marquardt, "An Algorithm for Least-Squares Estimation of Nonlinear Parameters", SIAM Journal 11(2), 1963.
- D. P. Kingma, J. Ba, "Adam: A Method for Stochastic Optimization", ICLR 2015.
- J. Martens, R. Grosse, "Optimizing Neural Networks with Kronecker-Factored Approximate Curvature", ICML 2015.
- V. Gupta, T. Koren, Y. Singer, "Shampoo: Preconditioned Stochastic Tensor Optimization", ICML 2018.
- K. Jordan, Y. Jin, V. Boza, J. You, F. Cesista, L. Newhouse, J. Bernstein, "Muon: An optimizer for hidden layers in neural networks", December 2024. A web write-up on the first author's site, not a refereed paper.
- L. Landweber, "An Iteration Formula for Fredholm Integral Equations of the First Kind", American Journal of Mathematics 73(3), 615-624, 1951.
- A. Rahimi, B. Recht, "Random Features for Large-Scale Kernel Machines", NeurIPS 2007.
- A. Jacot, F. Gabriel, C. Hongler, "Neural Tangent Kernel: Convergence and Generalization in Neural Networks", NeurIPS 2018.
- L. Chizat, E. Oyallon, F. Bach, "On Lazy Training in Differentiable Programming", NeurIPS 2019.
- S. Bai, J. Z. Kolter, V. Koltun, "Deep Equilibrium Models", NeurIPS 2019.
- J. von Oswald and co-authors, "Transformers Learn In-Context by Gradient Descent", ICML 2023.
Updated 2026-11-30: added Muon to the table, three more limits (no true inverse, attention, inference), and the section "Where the picture is exact". All sources checked against their publication records on the same day.