Why linear mixing stalls, and what Newton's method fixes: Gutzwiller self-consistency as a worked example
Tag: computational physics. A side note from my earlier physics work; most of this blog is about LLM inference.
Most self-consistent methods in electronic structure (DFT, DFT+U, DFT+DMFT, the Gutzwiller approximation) end in the same loop: guess some parameters, compute new ones from them, repeat until input equals output. The default way to run that loop is linear mixing, and the default complaint is that it is slow near the interesting physics, or does not converge at all.
In 2017 my coauthors and I replaced linear mixing with Newton’s method in an LDA+Gutzwiller code (Chinese Physics B 26, 017103). This post explains the idea without the material-specific details: why linear mixing slows down, why it can miss solutions entirely, what Newton’s method changes, and what the Jacobian costs.
The loop
In the Gutzwiller approximation, each correlated orbital α gets two numbers: a quasiparticle weight R_α (between 0 and 1; it narrows the band) and an on-site energy shift E_α (it moves the band). The loop has two halves:
- Single-particle half. Given R and E, build the renormalized band Hamiltonian, diagonalize it at every k-point, and read off the orbital occupations n_α and the kinetic-energy derivatives ∂E_kin/∂R_α.
- Many-body half. Given n and ∂E_kin/∂R, build a small Hamiltonian on the local Fock states, find its ground state, and read off new values of R and E. Inside this half there is an inner loop: local Lagrange multipliers λ_α must be tuned until the local occupations match n_α.
Put the two halves together and you get a map x_out = g(x_in), where x collects all R_α and E_α. A solution is a fixed point, g(x) = x.
Nothing below depends on the Gutzwiller details. Any self-consistent loop fits the same picture.
Linear mixing and its speed limit
Linear mixing feeds back a fraction of the output:
x_{k+1} = x_k + λ (g(x_k) − x_k), 0 < λ ≤ 1
Close to the fixed point x, write the error as e_k = x_k − x, and let J = ∂g/∂x at x*. To first order,
e_{k+1} = (I + λ (J − I)) e_k
So each eigenvector of J is its own channel. If J has eigenvalue μ along some direction, the error along that direction is multiplied by 1 − λ(1 − μ) at every step. Everything about linear mixing follows from this one factor.
A small example. Suppose J has two eigenvalues, μ_A = 0.95 and μ_B = −0.5.
- With λ = 1 (plain iteration), channel A shrinks by 0.95 per step. Getting its error down by 10⁻⁶ takes ln(10⁻⁶)/ln(0.95) ≈ 270 steps.
- Channel A alone would want a large λ: λ = 1/(1 − 0.95) = 20 removes it in one step.
- But channel B’s factor is 1 − 1.5λ, and it must stay above −1, so λ < 4/3. At λ = 20 channel B is multiplied by −29 per step and the iteration blows up, oscillating.
- The best compromise sets the two factors equal in size: λ = 2/1.55 ≈ 1.29, and both channels then shrink by 0.935 per step. That is still ≈ 208 steps.
One slow direction and one oscillating direction together set a hard limit, and tuning λ can’t get past it. Linear mixing is slow whenever J has eigenvalues spread over a wide range.
The same thing happens in a nonlinear toy: a two-variable map g whose Jacobian at the fixed point has exactly these eigenvalues, with the two directions rotated so they mix, and a quadratic term on top. From the same start, linear mixing needs 273 steps at λ = 1 and 228 at λ = 1.29 to cut the error by 10⁻⁶, and blows up at λ = 1.4. Newton’s method needs 4 (panel a).
Why the slow direction appears near a transition. At a phase transition or a branch point, the solution changes character, and at that point the root of f(x) = g(x) − x becomes degenerate: ∂f/∂x = J − I has a zero eigenvalue, so J has an eigenvalue equal to 1. Approaching the transition, μ → 1 and the factor 1 − λ(1 − μ) → 1, for any λ. This is critical slowing down, seen in the solver. In the 2017 paper the effect shows directly in SrVO₃: far from the Brinkman–Rice transition (U = 1 eV) both methods converge within a few steps, while near it (U = 6 eV) the linear-mixing energy is still creeping after 60 steps.
Solutions that linear mixing cannot find. If J has a real eigenvalue μ > 1, the factor 1 + λ(μ − 1) is above 1 for every λ > 0. That fixed point repels linear mixing, however small the mixing, so the iteration never lands on it. Near the Brinkman–Rice transition the Gutzwiller equations have two solutions with different R (Lanatà et al. 2012). In our runs linear mixing never found the branch with small R, and Newton’s method did. A repelling fixed point is a likely explanation. Panel (b) shows it in the toy: with eigenvalues 1.2 and 0.5, linear mixing moves away from the solution at λ = 1, 0.1 and 0.01, while Newton’s method converges in 4 steps.
Newton’s method
Newton’s method stops treating the loop as an iteration and treats it as root finding, f(x) = g(x) − x = 0:
x_{k+1} = x_k − (J_f)⁻¹ f(x_k), J_f = ∂f/∂x = ∂g/∂x − I
(The paper writes the Jacobian as ∂x_out/∂x_in. In the update the matrix is ∂g/∂x − I, because f = g − x.)
Two things change.
- Convergence no longer depends on how the eigenvalues are spread out. Near a nondegenerate root, Newton’s error roughly squares at every step: 10⁻² → 10⁻⁴ → 10⁻⁸. Slow channels and oscillating channels are treated alike. For the two-channel example above, if the map were exactly linear, Newton would land on the root in one step.
- The iteration does not need to be stable at the fixed point. Newton converges to any root where J_f is invertible, including ones with μ > 1 that linear mixing can never reach.
In the paper, Newton’s method converged in 4–6 outer steps for SrVO₃. For La₂O₃Fe₂Se₂, with 16 correlated atoms in the magnetic cell, linear mixing in the inner loop never found λ that met the occupation constraints, and Newton found them in 6 steps.
Newton’s method has two costs.
It needs a good starting point. Far from the root, a full Newton step can overshoot. The standard remedy is a line search: keep the Newton direction and choose the step length. We used a golden-section search along the Newton line; backtracking (halve the step until the residual |f| decreases) is the simpler common choice. A cap on the step size also helps, because R and E have different scales (R ~ 1, E in eV).
It needs the Jacobian. This is the real cost.
Where the Jacobian comes from
With N correlated spin-orbitals there are 2N unknowns (R_α and E_α). For La₂O₃Fe₂Se₂ that is up to 16 atoms × 10 spin-orbitals × 2 = 320 numbers before symmetry is used. There are three ways to get J_f.
- Finite differences. Perturb each input, rerun the loop, take the difference. That costs 2N + 1 = 321 full loops per Newton step, more than an entire linear-mixing run. Accuracy also depends on choosing the step size.
- By hand, with the chain rule. We did this in 2017. Split J along the two halves of the loop: derivatives of (n, ∂E_kin/∂R) with respect to (R, E) from the band problem, then derivatives of (R, E) with respect to (n, ∂E_kin/∂R) from the many-body problem, and multiply. Eigenvector derivatives come from first-order perturbation theory. In the paper this takes three appendices of formulas.
- Automatic differentiation. Write g once in JAX or PyTorch and let the framework produce J exactly. This is what I would do today.
The inner loop needs the most care in any of the three. The multipliers λ are not computed by a formula. They are
defined implicitly, by the condition that the local occupations N(λ; n, ∂E_kin/∂R) equal n. Their derivatives come
from the implicit function theorem: differentiate the condition, then solve a small linear system for δλ. The
paper’s Appendix C does exactly this, by hand. In JAX the same step is a custom root rule (for example
jax.lax.custom_root), and the framework never differentiates through the inner iterations.
A minimal Newton loop with an AD Jacobian:
import jax
import jax.numpy as jnp
jax.config.update("jax_enable_x64", True)
def newton_fixed_point(g, x, tol=1e-10, max_iter=50):
f = lambda x: g(x) - x
for it in range(max_iter):
fx = f(x)
if jnp.linalg.norm(fx) < tol:
return x, it
J = jax.jacfwd(f)(x) # exact, = dg/dx - I
step = jnp.linalg.solve(J, -fx)
t = 1.0 # backtracking line search
while jnp.linalg.norm(f(x + t * step)) > (1 - 0.5 * t) * jnp.linalg.norm(fx) and t > 1e-4:
t *= 0.5
x = x + t * step
return x, max_iter
Two pitfalls are common to the hand-derived and AD Jacobians:
- Degenerate eigenvalues. First-order perturbation theory divides by energy differences E_j − E_j′. When the ground state of the local problem is degenerate, or two bands cross at a high-symmetry k-point, the derivative of a single eigenvector is undefined. AD does not fix this; it returns NaN or inf. Differentiate quantities that stay well defined (projectors onto a whole degenerate subspace, or the smeared density matrix), not single eigenvectors.
- Which root you get. Newton converges to whatever root is nearby: the metallic solution, the R = 0 insulating one, or a saddle point. Check the energy, and compare against a solution continued from a nearby U.
When not to use Newton’s method
When there are many unknowns (full R matrices, many sites, charge self-consistency with DFT), even an exact Jacobian is too expensive to build and factor. Two middle grounds exist:
- Quasi-Newton mixing (Broyden, Pulay/DIIS, Anderson) builds an approximate inverse Jacobian from the history of past steps. Most DFT codes use it, and it is usually the right first upgrade from linear mixing.
- Newton–Krylov never forms J. It solves the Newton system iteratively and needs only Jacobian-vector products, which forward-mode AD gives at a small multiple of the cost of one loop evaluation each (Knoll and Keyes 2004).
A reasonable default: use quasi-Newton mixing far from the root, then switch to Newton steps with an exact (or Krylov) Jacobian near it, or near a transition, where the slow direction makes every mixing scheme crawl.
The same problem in machine learning
Linear mixing is gradient descent. Write the mixing step as x_{k+1} = x_k − λ (x_k − g(x_k)). If x − g(x) were the gradient of some loss L, this would be gradient descent with learning rate λ. Near the fixed point the “Hessian” is H = I − J, with eigenvalues 1 − μ. The two-channel example above is then gradient descent on a quadratic with curvatures 0.05 and 1.5, condition number κ = 1.5/0.05 = 30. The best step, λ = 2/(0.05 + 1.5) ≈ 1.29, is the textbook optimal learning rate, and the factor 0.935 per step is the textbook bound (κ − 1)/(κ + 1) = 29/31. A slow channel next to an oscillating one is an ill-conditioned problem, and no learning rate fixes ill-conditioning.
A repulsive fixed point is a saddle. An eigenvalue μ > 1 gives a negative curvature 1 − μ < 0, so in the loss picture that fixed point is a saddle (or a maximum). Gradient descent from a random start almost surely does not converge to a strict saddle (Lee et al. 2016), the same mechanism that keeps linear mixing off such a solution. Newton’s method treats all nondegenerate stationary points alike and is attracted to saddles, one reason deep learning avoids plain Newton (Dauphin et al. 2014). The two fields want opposite things from the same fact: in deep learning a saddle is a trap, while in a self-consistency problem the “saddle” may be the physical solution you are looking for, and that is what Newton buys. It is also why the energy check above matters.
The analogy is exact only when J is symmetric, so that x − g(x) really is a gradient. The Gutzwiller map in general is not symmetric, and J can have complex eigenvalues (rotating errors), which have no counterpart in gradient descent. The per-channel factor 1 − λ(1 − μ) holds either way.
Deep equilibrium models (Bai, Kolter and Koltun 2019) define a layer’s output as a fixed point z = f(z, x), solve it with Broyden or Anderson iterations, and get gradients from the implicit function theorem, not by backpropagating through the iterations. Mathematically this is the same as the λ derivatives above: a fixed point, the implicit function theorem, and a choice between exact and approximate Jacobians.
Follow-up: Adam and Newton both rescale the step. What’s the difference?
Reference
J. Zhang, M.-F. Tian, G.-X. Jin, Y.-F. Xu and X. Dai, “Implementation of LDA+Gutzwiller with Newton’s method”, Chinese Physics B 26, 017103 (2017), doi:10.1088/1674-1056/26/1/017103.