Phiacta
ExplorePostDocsGuidesContributingAbout

Phiacta

The knowledge backend.

Contact Us
ExploreInduced-Metric Optimizer: Learnable Scalar Metric

Induced-Metric Optimizer: Learnable Scalar Metric

Induced-metric optimizer where the inverse metric γ⁻¹ = exp(s)·I is a learnable scalar, updated online each step by ascending a local surrogate v = ξ·exp(s)·‖g‖² with regularization and clipping in log-domain. Plain and log-loss embedding variants. O(1) learnable state (one scalar s).

ContentIssuesEditsHistoryFilesReferences2

Induced-Metric Optimizer: Learnable Scalar Metric

Extends the fixed induced-metric optimizers by making the inverse metric a learnable scalar parameter updated online during training.

Motivation

In the fixed metric variants, the base metric on parameter space is γI\gamma IγI — a fixed identity scaling. The ratio ξ/γ\xi/\gammaξ/γ determines how strongly the optimizer responds to curvature, and it must be tuned as a hyperparameter. But the optimal ratio may change during training as the loss landscape evolves. A natural extension is to let the optimizer learn this ratio online.

The Learnable Inverse Metric

Instead of fixing γ−1=I\gamma^{-1} = Iγ−1=I, parameterize the inverse metric as:

γϕ−1=es⋅I\gamma^{-1}_\phi = e^s \cdot Iγϕ−1​=es⋅I

where s∈Rs \in \mathbb{R}s∈R is a single scalar learned during training. Working in log-space (sss rather than ese^ses directly) ensures the inverse metric is always positive definite by construction — no constraints needed. When s=0s = 0s=0, γ−1=I\gamma^{-1} = Iγ−1=I and we recover the fixed metric.

How the Metric Enters the Update

The inverse metric scales both the trace computation and the momentum:

Preconditioned gradient: g~t=es⋅gt\tilde{g}_t = e^s \cdot g_tg~​t​=es⋅gt​. This is the gradient "seen through" the learned metric.

Metric trace: vt=ξ⋅⟨gt,g~t⟩=ξ⋅es⋅∥gt∥2v_t = \xi \cdot \langle g_t, \tilde{g}_t \rangle = \xi \cdot e^s \cdot \|g_t\|^2vt​=ξ⋅⟨gt​,g~​t​⟩=ξ⋅es⋅∥gt​∥2. The trace now depends on sss: a larger ese^ses amplifies the trace, which increases v^t\hat{v}_tv^t​, which decreases rtr_trt​. So the learnable metric directly controls how aggressively the induced metric dampens updates.

Preconditioned momentum: m~t=es⋅m^t\tilde{m}_t = e^s \cdot \hat{m}_tm~t​=es⋅m^t​. The momentum is also scaled by ese^ses before the global rtr_trt​ is applied.

Full update: δθt=−η⋅rt⋅m~t−ηλwdθt\delta\theta_t = -\eta \cdot r_t \cdot \tilde{m}_t - \eta\lambda_{\text{wd}}\theta_tδθt​=−η⋅rt​⋅m~t​−ηλwd​θt​, where rt=1/(1+∣v^t∣)r_t = 1/(1 + |\hat{v}_t|)rt​=1/(1+∣v^t​∣) (plain) or rt=Lt/(Lt2+∣v^t∣)r_t = L_t/(L_t^2 + |\hat{v}_t|)rt​=Lt​/(Lt2​+∣v^t​∣) (log-loss).

Online Metric Learning

The scalar sss is updated each step by ascending on a local surrogate objective — the trace v(ϕ)v(\phi)v(ϕ) itself. The intuition: the optimizer wants γ−1\gamma^{-1}γ−1 to maximize the metric trace, because a larger trace means the metric is "seeing" more curvature and providing stronger preconditioning. Regularization prevents sss from diverging.

The gradient of the trace with respect to sss is:

∂v∂s=ξ⋅es⋅∥gt∥2\frac{\partial v}{\partial s} = \xi \cdot e^s \cdot \|g_t\|^2∂s∂v​=ξ⋅es⋅∥gt​∥2

The update rule for sss is:

s←s+ηmetric⋅∂v∂s−ηmetric⋅λreg⋅ss \leftarrow s + \eta_{\text{metric}} \cdot \frac{\partial v}{\partial s} - \eta_{\text{metric}} \cdot \lambda_{\text{reg}} \cdot ss←s+ηmetric​⋅∂s∂v​−ηmetric​⋅λreg​⋅s

The first term drives sss upward (stronger preconditioning), while the L2 regularization term −λreg⋅s-\lambda_{\text{reg}} \cdot s−λreg​⋅s pulls sss back toward zero (the identity metric). The balance between these determines the learned metric scale.

After the update, sss is clipped to [−c,c][-c, c][−c,c] (default c=4c = 4c=4, so es∈[e−4,e4]≈[0.018,54.6]e^s \in [e^{-4}, e^4] \approx [0.018, 54.6]es∈[e−4,e4]≈[0.018,54.6]) to prevent extreme values during early training.

Variants

  • Plain embedding — scaling rt=1/(1+∣v^t∣)r_t = 1/(1 + |\hat{v}_t|)rt​=1/(1+∣v^t​∣)
  • Log-loss embedding — scaling rt=Lt/(Lt2+∣v^t∣)r_t = L_t/(L_t^2 + |\hat{v}_t|)rt​=Lt​/(Lt2​+∣v^t​∣)

Cost

O(1) learnable state (one scalar sss) on top of the base optimizer state. The metric learning step adds negligible computation — one scalar gradient, one scalar update, one clip.

Metadata

Type
method
Visibility
public
Published
Mar 27, 2026
Last updated
Mar 27, 2026

Tags

induced-metricJAXlearnable-metricoptimizerPyTorchscalar