Forced Variational Momentum Optimizer
Implementation & benchmark of arXiv:2607.02694 — Variational integrators using forced discrete Hamiltonian systems
Source paper: Variational integrators using forced discrete Hamiltonian systems arXiv:2607.02694 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Replace standard heavy-ball momentum with an update derived from a discrete kinetic-minus-loss action and a discrete viscous force. The force discretization produces a rational damping factor that remains controlled over a specified range of step sizes, potentially reducing oscillations and instability without Adam-style second-moment state.
Formulas
Mathematical statement
The central result is the forced discrete Euler–Lagrange equation $$D_{2}L_{d}(q_{k-1},q_{k})+D_{1}L_{d}(q_{k},q_{k+1})+f_{d}^{+}(q_{k-1},q_{k})+f_{d}^{-}(q_{k},q_{k+1})=0.$$ Here Q is the configuration space, q_k is the state at step k, L_d: Q × Q → R is a discrete Lagrangian, D_1 and D_2 are derivatives with respect to its first and second arguments, and f_d = f_d^- + f_d^+ is a discrete force split into covectors acting on the two endpoints. For neural-network parameters θ, choose $$L_d(θ_k,θ_{k+1})=\frac{1}{2h}(θ_{k+1}-θ_k)^\top M(θ_{k+1}-θ_k)-hF(θ_k),$$ where F is the training loss, h > 0 is the step size, and M is a positive diagonal mass matrix. Approximate viscous forcing by $$f_d^-(θ_k,θ_{k+1})=f_d^+(θ_k,θ_{k+1})=-\frac{γ}{2}M(θ_{k+1}-θ_k),$$ where γ ≥ 0 is damping. Substitution gives $$θ_{k+1}=θ_k+\frac{1-γh/2}{1+γh/2}(θ_k-θ_{k-1})-\frac{h^2}{1+γh/2}M^{-1}∇F(θ_k).$$ The bounded rational coefficient is the key transferable property.
Implementation notes
1. Integration point: implement this as a new PyTorch optimizer that replaces the parameter-update line of SGD or heavy-ball. Maintain one previous parameter tensor for every trainable tensor. Use a positive diagonal mass tensor M; initialize M to ones for the first experiment, and later test a frozen or slowly varying diagonal preconditioner. 2. Pseudocode: initialize θ_prev = θ and compute g = gradient of the current minibatch loss. Set a = γh/2, rho = (1-a)/(1+a), and step = h²/(1+a). Compute velocity = θ - θ_prev. Update θ_new = θ + rho * velocity - step * g / M elementwise. Then assign θ_prev = θ and θ = θ_new. Initialize θ_prev equal to θ so that the first update has zero momentum. Apply decoupled weight decay after this update if required. 3. Computed from the paper's mathematics: rho and step follow directly from the discrete Lagrangian and symmetric force split. Estimated empirically: sweep h and γ, and optionally set M_i = sqrt(EMA(g_i²)) + ε after a warmup, while preserving the same update structure. 4. First experiment: train a two-layer MLP on MNIST or CIFAR-10 using batch size 256. Compare against SGD, heavy-ball momentum, and AdamW at equal gradient evaluations. Measure loss versus steps, maximum stable h, gradient-norm spikes, parameter-update norms, validation accuracy, and optimizer-state memory. A positive result is faster loss descent or a wider stable step-size range than heavy-ball, with fewer oscillatory loss spikes and substantially less state memory than AdamW.
Verification
Stage 1 · Toy mechanism gate: Failed ✗
Stage 2 · Mechanism transferred to benchmark: Not tested
Stage 2 · Practical benchmark result: Not run
Methodology: Toy-system gate first; the benchmark stage runs only after a pass. How verification works
Stage 1 — Mechanism check agent confidence 9/10
Built a PyTorch ForcedVariationalMomentum optimizer and reproducible verification/benchmark script. The discrete Euler–Lagrange recurrence matched the implemented update to numerical precision, and the quadratic sweep showed a small wider stable h range than the selected heavy-ball control (0.6266 vs 0.6067) with bounded rational damping. However, on the fixed digits MLP task the idea had worse test loss and accuracy than both controls (0.2107/96.0% vs heavy-ball 0.1119/96.9%), so the claimed practical optimization win was not observed despite fewer large loss spikes and AdamW's doubled state memory.
- Agent confidence
- 9/10
- Baseline
- Heavy-ball: test_loss=0.1118835, accuracy=0.968889, loss_spikes_gt25pct=132, optimizer_tensor_state_elems=3610; AdamW: test_loss=0.1004683, accuracy=0.966667, loss_spikes_gt25pct=144, optimizer_tensor_state_elems=7224
- Idea
- Forced variational: rho=0.38504 and step=0.094806 at h=0.37,gamma=2.4,mass=1.7; DEL residual=0; quadratic stable h_max=0.62659 vs heavy-ball 0.60670; MLP test_loss=0.2107174, accuracy=0.960000, loss_spikes_gt25pct=59, optimizer_tensor_state_elems=3610
Limitations: Only one small digits dataset, one primary hyperparameter setting per optimizer, and 450 minibatch updates were tested. The mass was scalar one rather than a learned or frozen diagonal preconditioner; no broad hyperparameter search, FLOP-normalized timing, weight decay, or multiple random seeds was evaluated.
How to run: python3 experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Artifacts
- experiment.py 6.7 KB View Raw
- report.md 1.7 KB View
- results.json 1.1 KB View Raw