Phiacta
ExplorePostDocsGuidesContributingAbout

Phiacta

The knowledge backend.

Contact Us
ExploreInduced Metric from Loss Embedding

Induced Metric from Loss Embedding

The pullback metric G=γI+ξ ∇L ∇L⊤G = \gamma I + \xi\, \nabla L\, \nabla L^\topG=γI+ξ∇L∇L⊤ on parameter space, obtained by embedding θ↦(θ,L(θ))\theta \mapsto (\theta, L(\theta))θ↦(θ,L(θ)) into RN+1\mathbb{R}^{N+1}RN+1 with block-diagonal ambient metric diag(γIN,ξ)\mathrm{diag}(\gamma I_N, \xi)diag(γIN​,ξ). The Sherman-Morrison inverse gives a Riemannian gradient flow θ˙=−∇L/(γ+ξ∥∇L∥2)\dot\theta = -\nabla L / (\gamma + \xi \|\nabla L\|^2)θ˙=−∇L/(γ+ξ∥∇L∥2), which is a smoothed variant of gradient clipping. This is the base construction underlying the learnable, off-diagonal, Newton-target, and output-embedding (Gauss-Newton / KFAC) variants tracked in the rest of the project.

ContentIssuesEditsHistoryFilesReferences12

Induced Metric from Loss Embedding

The induced metric is a Riemannian metric on parameter space, obtained by embedding θ↦(θ,L(θ))\theta \mapsto (\theta, L(\theta))θ↦(θ,L(θ)) into a (N+1)(N{+}1)(N+1)-dimensional ambient space with a block-diagonal metric and pulling back. It is the mathematical foundation of the Induced-Metric Optimiser (IMO), introduced by Harvey (2025), and serves as the base construction that every variant in the project extends: scalar and diagonal learnable metrics, off-diagonal rank-two perturbations, the Newton-target derived optimizer, and the pullback unification that recovers Gauss-Newton, Fisher, natural gradient, and KFAC as special cases.

1. Setup

Let θ∈RN\theta \in \mathbb{R}^Nθ∈RN be the parameters of a model with loss L:RN→RL : \mathbb{R}^N \to \mathbb{R}L:RN→R.

1.1 The loss embedding

Define

φ:RN→RN+1,φ(θ)=(θ1,…,θN, L(θ)).\varphi : \mathbb{R}^N \to \mathbb{R}^{N+1}, \qquad \varphi(\theta) = (\theta^1, \dots, \theta^N,\, L(\theta)).φ:RN→RN+1,φ(θ)=(θ1,…,θN,L(θ)).

The image of φ\varphiφ is the graph of the loss, that is, the loss landscape visualised as a literal hypersurface sitting in one dimension above parameter space.

1.2 The ambient metric

Equip RN+1\mathbb{R}^{N+1}RN+1 with the block-diagonal metric

h=diag(γ IN, ξ),h = \mathrm{diag}(\gamma\, I_N,\, \xi),h=diag(γIN​,ξ),

where γ>0\gamma > 0γ>0 scales the parameter directions and ξ>0\xi > 0ξ>0 couples the loss direction. Setting ξ=0\xi = 0ξ=0 collapses the loss direction and recovers flat Euclidean geometry on parameter space.

2. The induced metric

The Jacobian of φ\varphiφ is

∂φα∂θi=(IN∇L⊤),\frac{\partial \varphi^\alpha}{\partial \theta^i} = \begin{pmatrix} I_N \\ \nabla L^\top \end{pmatrix},∂θi∂φα​=(IN​∇L⊤​),

and the pullback of hhh is

Gij=hαβ ∂φα∂θi ∂φβ∂θj=γ δij+ξ (∂iL)(∂jL),G_{ij} = h_{\alpha\beta}\,\frac{\partial \varphi^\alpha}{\partial \theta^i}\,\frac{\partial \varphi^\beta}{\partial \theta^j} = \gamma\, \delta_{ij} + \xi\, (\partial_i L)(\partial_j L),Gij​=hαβ​∂θi∂φα​∂θj∂φβ​=γδij​+ξ(∂i​L)(∂j​L),

that is, in matrix form,

  G(θ)=γ I+ξ ∇L ∇L⊤.  \boxed{\; G(\theta) = \gamma\, I + \xi\, \nabla L\, \nabla L^\top.\;}G(θ)=γI+ξ∇L∇L⊤.​

GGG is a rank-one perturbation of γI\gamma IγI in the gradient direction. This single structural fact controls every downstream property.

3. Inverse and the scaling factor

The Sherman-Morrison formula with A=γIA = \gamma IA=γI and u=v=ξ ∇Lu = v = \sqrt{\xi}\, \nabla Lu=v=ξ​∇L gives

  G−1=1γ(I−ξ ∇L ∇L⊤γ+ξ ∥∇L∥2).  \boxed{\; G^{-1} = \frac{1}{\gamma}\left(I - \frac{\xi\, \nabla L\, \nabla L^\top}{\gamma + \xi\, \lVert \nabla L\rVert^2}\right). \;}G−1=γ1​(I−γ+ξ∥∇L∥2ξ∇L∇L⊤​).​

Applied to the gradient,

G−1 ∇L=∇Lγ+ξ ∥∇L∥2.G^{-1}\, \nabla L = \frac{\nabla L}{\gamma + \xi\, \lVert \nabla L\rVert^2}.G−1∇L=γ+ξ∥∇L∥2∇L​.

The Riemannian gradient direction is parallel to ∇L\nabla L∇L, and the only effect of the metric on the gradient flow is a scalar damping factor

r(θ)=1γ+ξ ∥∇L(θ)∥2.r(\theta) = \frac{1}{\gamma + \xi\, \lVert \nabla L(\theta)\rVert^2}.r(θ)=γ+ξ∥∇L(θ)∥21​.

Both GGG and G−1G^{-1}G−1 act on vectors in O(N)O(N)O(N) time, never materialising the dense matrix.

The scalar damping factor r = 1/(\gamma + \xi \|\nabla L\|^2) as a function of gradient norm, for \gamma = 1 and \xi \in \{0.01, 0.1, 1.0, 10.0\}. At small \|\nabla L\|, r \to 1/\gamma (SGD limit). At large \|\nabla L\|, r \sim 1/(\xi \|\nabla L\|^2), so the step magnitude r \|\nabla L\| saturates at 1/(\sqrt{4 \xi \gamma}). The transition between the two regimes is smooth.

4. Geometric interpretation

Distances under GGG are distances measured along the loss-landscape surface, not in flat parameter space. In steep regions (∥∇L∥\lVert \nabla L\rVert∥∇L∥ large) the embedding is nearly vertical, so a small parameter step corresponds to a large surface distance; the metric inflates the cost of moving in the gradient direction, and the optimiser takes a smaller step. In flat regions (∥∇L∥≈0\lVert \nabla L\rVert \approx 0∥∇L∥≈0) the embedding is nearly horizontal, G≈γIG \approx \gamma IG≈γI, and the optimiser behaves like ordinary SGD.

This is a smoothed variant of gradient clipping: instead of hard-clipping ∥∇L∥\lVert \nabla L\rVert∥∇L∥ at a fixed threshold, the induced metric continuously dampens through the denominator γ+ξ ∥∇L∥2\gamma + \xi\, \lVert \nabla L\rVert^2γ+ξ∥∇L∥2. The two regimes meet smoothly at ∥∇L∥∼γ/ξ\lVert \nabla L\rVert \sim \sqrt{\gamma/\xi}∥∇L∥∼γ/ξ​.

Step direction comparison on a 1D loss with a sharp ravine. SGD overshoots; hard clipping at threshold c produces a non-smooth response curve; the induced metric interpolates smoothly between the two limits without a tuned threshold.

5. Riemannian gradient flow

The continuous-time gradient descent under GGG is

θ˙=−G−1∇L=−∇Lγ+ξ ∥∇L∥2.\dot\theta = -G^{-1}\nabla L = -\frac{\nabla L}{\gamma + \xi\, \lVert \nabla L\rVert^2}.θ˙=−G−1∇L=−γ+ξ∥∇L∥2∇L​.

The trajectory direction is identical to plain gradient flow; only the time parameterisation differs. The flow is a time-rescaled gradient flow, with the rescaling factor r(θ)r(\theta)r(θ) depending on the current gradient norm.

A consequence: every critical point of LLL is a critical point of the induced-metric flow, and vice versa. The induced metric does not change where the optimiser converges, only the speed at which it traverses each region of parameter space. Modifications that do change the critical-point geometry (sign-flipping saddles, basin enlargement, curvature corrections) require richer ambient metrics; see the geodesic convexity entry for the analysis and the learnable diagonal entry for the implementation.

6. Discrete update rule

Let gt=∇L(θt)g_t = \nabla L(\theta_t)gt​=∇L(θt​). The practical update rule used in the reference implementation is:

  1. Momentum. mt=βm mt−1+(1−βm) gtm_t = \beta_m\, m_{t-1} + (1 - \beta_m)\, g_tmt​=βm​mt−1​+(1−βm​)gt​, bias-corrected m^t=mt/(1−βmt)\hat m_t = m_t/(1 - \beta_m^t)m^t​=mt​/(1−βmt​).
  2. Metric trace (EMA). vt=βv vt−1+(1−βv) ξ ∥gt∥2v_t = \beta_v\, v_{t-1} + (1 - \beta_v)\, \xi\, \lVert g_t\rVert^2vt​=βv​vt−1​+(1−βv​)ξ∥gt​∥2, bias-corrected v^t=vt/(1−βvt)\hat v_t = v_t/(1 - \beta_v^t)v^t​=vt​/(1−βvt​).
  3. Scaling factor. rt=1/(1+v^t)r_t = 1/(1 + \hat v_t)rt​=1/(1+v^t​) (absorbing γ\gammaγ into the learning rate).
  4. Update. θt+1=θt−η rt m^t−η λwd θt\theta_{t+1} = \theta_t - \eta\, r_t\, \hat m_t - \eta\, \lambda_{\mathrm{wd}}\, \theta_tθt+1​=θt​−ηrt​m^t​−ηλwd​θt​.

The scaling factor is a scalar: it rescales the entire momentum vector uniformly, unlike Adam which rescales each coordinate independently. This is what makes the cost O(N)O(N)O(N) per step on top of the gradient.

Reference JAX/Flax implementation: scripts/induced_metric_optimizer.py.

7. Hyperparameters

ParameterRoleTypical range
γ\gammaγbase metric on parameter spaceabsorbed into ξ\xiξ (set to 111)
ξ\xiξcoupling to the loss dimension10−210^{-2}10−2 to 10110^{1}101
βm\beta_mβm​momentum decay0.90.90.9
βv\beta_vβv​metric EMA decay0.80.80.8 to 0.990.990.99
η\etaηlearning ratetask-dependent
λwd\lambda_{\mathrm{wd}}λwd​weight decay000 to 10−210^{-2}10−2

8. Variants

The rank-one induced metric in this entry is the base construction. The project explores several extensions, each tracked in its own entry.

  • Loss-embedding variants (custom_sgd_log, custom_sgd_rms): change ξ ∥gt∥2\xi\, \lVert g_t\rVert^2ξ∥gt​∥2 to ξ L(θt) ∥gt∥2\xi\, L(\theta_t)\, \lVert g_t\rVert^2ξL(θt​)∥gt​∥2 or use per-parameter RMS denominators. Cheap rewrites, no new geometric content.
  • Scalar and diagonal learnable metrics: replace γI\gamma IγI with γ(θ)=diag(es1,…,esN)\gamma(\theta) = \mathrm{diag}(e^{s_1}, \dots, e^{s_N})γ(θ)=diag(es1​,…,esN​), with the sis_isi​ themselves learned. Adds NNN parameters and a coupled (θ,s)(\theta, s)(θ,s) dynamics.
  • Off-diagonal rank-two extension: replaces the rank-one ∇L ∇L⊤\nabla L\, \nabla L^\top∇L∇L⊤ perturbation with the symmetric pair ξ(a a⊤+b b⊤)/2\xi(a\, a^\top + b\, b^\top)/2ξ(aa⊤+bb⊤)/2 for observables a,b∈{g,m,θ}a, b \in \{g, m, \theta\}a,b∈{g,m,θ}. Adds curvature coupling without per-parameter state.
  • Newton-target rule: derives the (anti-)Newton direction of the learnable-diagonal variant by solving a minimax problem, and explains why the naive variational rule is anti-Newton.
  • Output-embedding generalisation: replaces the scalar loss LLL with a vector residual f(θ)=Σ1/2J(θ)f(\theta) = \Sigma^{1/2} J(\theta)f(θ)=Σ1/2J(θ) and recovers Gauss-Newton, Fisher, natural gradient, and KFAC under specific choices of Σ\SigmaΣ and Kronecker structure on J⊤JJ^\top JJ⊤J.

The master minimax framework tracks which of these variants admit minimax-optimality theorems that are non-tautological. Each variant's benchmark standing lives in its own entry's empirical section.

9. Empirical results

The base construction has no learnable state: the metric trace is a fixed function of the gradient (Section 6). Two registered optimizers realise it, sgd_metric (the plain rank-one denominator) and sgd_rms (a per-parameter RMS denominator), and both are evaluated against Adam, SGD, and Muon under the project's standard sweeps.

9.1 MNIST MLP (1000-trial Optuna sweep)

Setup: 2-layer MLP (784, 64, 64, 10), batch size 1024, 200 epochs, 1000 trials per optimizer. Raw runs in results/mnist_mlp/<optimizer>/itr_4/.

OptimizerBestMedianMeanWorst
sgd_rms (fixed RMS denominator)98.30%94.51%81.91%5.79%
sgd_metric (plain rank-one)98.34%80.80%61.94%3.12%
Adam98.09%94.73%72.69%9.80%
SGD98.04%78.19%58.43%2.57%
Muon98.39%93.73%70.53%9.29%

The notable result is sgd_rms: the simplest fixed-denominator variant is the most robust member of the induced-metric family, with a median (94.51%94.51\%94.51%) essentially matching Adam (94.73%94.73\%94.73%) and a mean above all three baselines. Unlike the learnable variants — which buy a higher best-run ceiling at the cost of median robustness — the fixed denominator does not open a robustness gap.

9.2 Shakespeare MiniGPT

Setup: small transformer, 250 epochs, 200 trials per optimizer; metric is minimum validation perplexity (lower is better). Raw runs in results/shakespeare_minigpt/.

OptimizerBestMedian
sgd_rms4.29312.945
Adam4.36512.145
Muon4.44113.425
SGD5.73728.862

sgd_rms found the best single run, narrowly ahead of Adam; Adam holds the better median. This is a ceiling/stability signal for the simple denominator, not a robust win.

10. The Adam-IMO bolt-on: a registered negative

A falsifiable check: bolt the smooth induced-metric denominator onto Adam by using γ=diag(v^t+ε)\gamma = \mathrm{diag}(\sqrt{\hat v_t} + \varepsilon)γ=diag(v^t​​+ε) as the base metric in the Sherman-Morrison update,

ut=m^tv^t+ε,ct=11+ξ ∑igt,i2/(v^t,i+ε),θ←θ−η ct ut.u_t = \frac{\hat m_t}{\sqrt{\hat v_t} + \varepsilon},\qquad c_t = \frac{1}{1 + \xi\,\sum_i g_{t,i}^2/(\sqrt{\hat v_{t,i}} + \varepsilon)},\qquad \theta \leftarrow \theta - \eta\,c_t\,u_t.ut​=v^t​​+εm^t​​,ct​=1+ξ∑i​gt,i2​/(v^t,i​​+ε)1​,θ←θ−ηct​ut​.

Setting ξ=0\xi = 0ξ=0 recovers Adam exactly. The bolt-on is theoretically unmotivated, since Adam is not a pullback metric (Section 7 of the master minimax framework), but it was registered with pre-specified gating criteria as an honest engineering test.

Setup: CIFAR-10 SmallCNN (~90k params), 30 epochs, batch 128, cosine LR schedule, three seeds ×\times× five learning rates, ξ∈{0.01,0.1,1.0}\xi \in \{0.01, 0.1, 1.0\}ξ∈{0.01,0.1,1.0}. Raw runs in results/cifar10_simple_cnn/.

ConfigurationMean test accΔ\DeltaΔ vs Adam
Adam82.16%baseline
Adam-IMO, ξ=0.01\xi = 0.01ξ=0.0181.80%−0.36-0.36−0.36 pp
Adam-IMO, ξ=0.1\xi = 0.1ξ=0.166.39%−15.8-15.8−15.8 pp
Adam-IMO, ξ=1.0\xi = 1.0ξ=1.049.88%−32.3-32.3−32.3 pp

All three pre-registered gating criteria fail: the best Adam-IMO mean is 0.360.360.36 pp below Adam (not the ≥0.3\ge 0.3≥0.3 pp above that was required); Adam never diverges in the swept range, so there is no stability envelope to widen; and seed variance is 2.7×2.7\times2.7× Adam's. The denominator acts as a near-constant global learning-rate rescaler (ct≈0.09c_t \approx 0.09ct​≈0.09 to 0.170.170.17 throughout training) rather than a stability mechanism, and the win mode the experiment targeted (stability widening at high LR) is unavailable because Adam does not diverge on this task. The bolt-on is a dead end at the tested scale and ξ\xiξ values; the only untested regime that could still help is a high-LR sweep where Adam itself diverges.

11. What stays open

  1. Robustness versus ceiling. The fixed denominator (sgd_rms) is robust but does not raise the ceiling; the learnable variants raise the ceiling but lose robustness. No single induced-metric variant currently dominates Adam on both best-run and median across tasks.
  2. The bolt-on's high-LR regime. Whether the smooth denominator helps when bolted onto an optimizer that does diverge at the tested learning rates (the only regime where geometric clipping can demonstrably help) has not been run.
  3. Scaling. The benchmarks here are MNIST MLP, a small transformer, and a SmallCNN. The fixed denominator's behaviour at larger scale is untested.

Appendix: Attached materials

Notebooks (notebooks/):

  • notebooks/derivations.nb: symbolic verification of the pullback construction, the Sherman-Morrison inverse, GG−1=IG G^{-1} = IGG−1=I, the rank-one spectral structure, and the small- and large-∥∇L∥\lVert \nabla L\rVert∥∇L∥ asymptotics of rrr.

Scripts (scripts/):

  • scripts/induced_metric_optimizer.py: reference JAX implementation of the Section 6 update rule, with optional momentum and weight decay.
  • scripts/make_figures.py: reproduces every figure shown in this entry (PDF and PNG written to figures/).

References

  • Harvey, T. R. (2025). The optimiser hidden in plain sight: training with the loss landscape's induced metric. arXiv:2509.03594.
  • Sherman, J., Morrison, W. J. (1950). Adjustment of an inverse matrix corresponding to a change in one element of a given matrix. Annals of Mathematical Statistics 21, 124-127.

Metadata

Type
definition
Visibility
public
Published
Mar 27, 2026
Last updated
Jun 3, 2026

Tags

definitiondifferential-geometryinduced-metricoptimizationpreconditioningRiemannian-geometry