# MFT Gradient-Flow Monitor

- ID: 2165
- Canonical URL: https://synthcore.org/idea/2165/mft-gradient-flow-monitor
- API JSON: https://synthcore.org/api/idea/2165.json
- API Markdown: https://synthcore.org/api/idea/2165.md
- Verification status: unverified
- Source: [arXiv:2608.12119](https://arxiv.org/abs/2608.12119)
- Category: dynamics
- Solves: stability, speedup
- ML areas: optimizer, training-dynamics, scheduler, regularization
- Math tags: statistical-mechanics, stochastic-processes, dynamical-systems, pde, optimization
- Ratings: usefulness 6/10; difficulty 5/10; novelty 8/10

## Idea description

Coarse-grain the training trajectory into a one-dimensional field over depth or parameter blocks, such as normalized gradient energy per layer, and model its redistribution as a fluctuating diffusive current. Compute the macroscopic fluctuation action over a sliding time window; use unusually large action as an early-warning signal for nonstationary gradient bursts and reduce the learning rate before divergence. The controller explicitly distinguishes flat layer profiles from step-like profiles, avoiding a universal long-memory noise assumption.

## Mathematical statement

MFT represents a density field q(x,t) and current j(x,t) through the continuity equation partial_t q plus partial_x j equals zero. For diffusivity D(q) and mobility sigma(q), the constitutive current is j equals minus D(q) partial_x q plus sigma(q) partial_x p, where p(x,t) is the response field, and the path cost of a current history is S[q,j] equal to the integral of [j plus D(q) partial_x q]^2 divided by 2 sigma(q). The Hamilton equations are partial_t q equals partial_x[D(q) partial_x q minus sigma(q) partial_x p] and partial_t p equals minus D(q) partial_x^2 p minus one half sigma-prime(q) times (partial_x p)^2. In the neural adaptation, x is normalized depth or block index, t is optimizer time, q is normalized squared gradient energy, and j is inferred redistribution of that energy across neighboring blocks. D and sigma are estimated locally from trajectory data. A large action means the observed current is unlikely under the fitted diffusive training dynamics and is used as a control signal.

## Key formulas

- $$\partial_t q(x,t)+\partial_x j(x,t)=0,\qquad j(x,t)=-D(q)\,\partial_xq+\sigma(q)\,\partial_xp.$$
- $$S[q,j]=\int_{t_0}^{t_1}\!dt\int\!dx\;\frac{\left[j(x,t)+D(q)\partial_xq\right]^2}{2\sigma(q)}.$$
- $$\partial_tq=\partial_x\!\left[D(q)\partial_xq-\sigma(q)\partial_xp\right],\qquad \partial_tp=-D(q)\partial_x^2p-\frac{1}{2}\sigma'(q)(\partial_xp)^2.$$
- $$\eta_{t+1}=\eta_t\exp\left[-\kappa\,\max\left(0,\frac{S_t-S_{\rm ref}}{S_{\rm ref}}\right)\right].$$

## Implementation notes

1. Exact integration point: insert the monitor after each optimizer step, before applying the next learning-rate update. Partition the network into L ordered blocks. For each step t, compute q_l(t)=||g_l(t)||_2^2/(sum_m ||g_m(t)||_2^2+epsilon), smooth it over 5 to 20 steps, and use x_l=l/(L-1) as the spatial coordinate. Initially this changes neither the forward nor backward pass; it only controls the scheduler. 2. Pseudocode: compute q from normalized block-gradient energy; estimate dq/dx by centered finite differences; estimate dq/dt from consecutive profiles; solve the discrete continuity equation j[l+1]-j[l]=-dx*dq/dt[l] using a minimum-norm flux and zero-flux boundaries. Estimate D by D=-Cov(j,dqdx)/Var(dqdx), and estimate sigma from sigma=dt*Var(j+D*dqdx)/2 over a sliding window, enforcing positive floors. Compute the discrete action S=sum_l,t dt*dx*(j+D*dqdx)^2/(2*sigma). Update the learning rate using the displayed exponential controller with an EMA reference S_ref from the first stable epoch. 3. Quantities computed directly are block gradients, finite differences, flux estimates, and action values. The MFT construction and action are transferred from the paper; D, sigma, and S_ref are empirical estimates. For a step-like initial gradient profile, use a separate reference distribution rather than the flat-profile baseline. 4. First cheap experiment: train a 4-layer MLP on MNIST with SGD, comparing fixed learning rate, cosine decay, gradient clipping, and this action controller at equal update budgets. Log loss, gradient norm, S_t, and maximum block-gradient ratio. The quantitative prediction is that abrupt gradient-burst windows have approximately linear -log P(S>s) versus measured S in the upper tail, and that reducing the learning rate when S_t/S_ref exceeds 2 lowers the probability of a subsequent burst. Fit perturbation relaxation by spatial Fourier modes; the predicted mode decay is exp[-D k^2(t-t_0)]. Support the method only if measured decay rates are approximately linear in k^2 and the intervention threshold precedes divergence by at least one monitoring window.

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
