GMAKE is a trust-region framework for stochastic gradient updates enforcing a GMAKE.
Supports studying: SGD, Heavy-ball momentum, Nesterov momentum, and Adam-like behavior within a unified interface.
- Moment estimation of a
$p$ -th moment constrained step-size magnitude - Learning-rate schedules as variational trust-region shaping functions
- Momentum as the design of a trust-region preserving linear time-invariant operator with spectral-norm less than 1.
- [Optional] Matrix-view spectral-norm trust-region constrained step-size magnitudee.
Fully interpretable trust-region constrained step-size mechanism for several practical training elements studied separately.
For a parameter vector
Each individual (
where
-
$\mu> 0$ being a user-defined maximum allowable update step-size. -
$\mathbf v[t]$ being a possibly filtered stochastic gradient input.
The parameter update then satisfies the uniform
which implies
For Individual parameters in a layer:
Input and major training hyperparameters:
- Parameter vector:
$\mathbf w[t]$ and its stochastic gradient:$\mathbf g[t]$ - Moment order
$p\ge 1$ - Max step-size
$\mu > 0$ - First-order filter pole
$0\le\beta<1$ , and filter zero$|\gamma| < \beta$ - Statistical estimators: long-term averaging coefficient
$\rho \to 1$ , small-epsilon$\epsilon \to 0$ for numerical inversions - Weight-decay coefficient,
$0 < \lambda \ll 1$
- EMA: exponential moving average estimator
- LSE: linear shrinkage estimator
- ISRM: inverse square-rooth matrix estimator (efficient polynomial recursion)
For each iteration
Momentum as Gradient filtering via a linear time-invariant operator
2.1 Unified Learning-rate schedule
2.2. Second-moment estimate
2.3. Normalized
2.4. [optional] Matrix-view: inverse-square-root estimate of the covariance matrix
Decoupled Weight decay step
Update step
The arguments passed into SGM_GMAKE are typical arguments that need to be set to carry out practical training via stochastic gradient learning on deep neural nets.
This is a Python-based implementation:
- Ensure the bundled dependency
gmake_lpf.pyis in the same directory withgmake.py. - Ensure
torchis installed
model = net_model()
num_iters = int(1e9) # training iterations
# warmup_steps
m = 0.1 # 10% of training iterations from initialization
e = 0.1 # 10% of training iterations after warmup
# Gmake p=2
optimizer1 = SGM_GMAKE(
model.parameters(), p=2,
tr_cfg=(5e-4, 0.9, 'vrg', False), # trust-region config
stat_cfg=(0.999, 1e-10, 0, False), # stat. estimator config
win_cfg=(2, m, e, 0, num_iters) # lr schedule config
)
# Preset API: Adam
optimizer2 = SGM_GMAKE.Adam(params,
tr_cfg=(5e-4, 0.9, 'phb'),
stat_cfg=(0.999, 1e-10, 0),
win_cfg=(2, m, e, 0, num_iters) # config: cosine annealing decay to zero.
)Using the same hyperparameters (including weight-decay and cosine annealing), we can compare Adam, versus SGM_GMAKE (
1. Validation loss comparison for GPT2-124M model on FineWeb-Edu subset (50M training tokens, 500k validation tokens)
2. Validation loss comparison for GPT2-124M model on TinyStories-v1 (474M training tokens, 4.8M validation tokens)
Note:
- All experiments, were repeated three times on a GPT2-124M model, and the average validation loss curves are reported.
- The GPT2-124M model was configured to process 8192 tokens per iteration.
- Training hyperparameters:
$\mu = {5 \times 10^{-4}, 3 \times 10^{-4}}$ ,$\beta=0.9$ ,$\rho=0.999$ ,$\epsilon=10^{-10}$ ,$\lambda=0$ .
- Current implementation decouples weight-decay from gradient normalization
- Automatically detects vectorized vs matrix-view update step
- Reshapes high-dimensional tensors
- Uses epsilon regularization
- Normalizes tiny parameter values at initialization
Use GMAKE when:
- Experimenting with optimization research on adaptive moment-estimation
- You want to experiment with other momentum designs than Heavy-ball and Nesterov momentum
- Training is unstable with Adam
- You want interpretable step-size control against gradient fluctuations
You can explicitly cite this repo if used, or Cite
Somefun, O. A. 2026. A Trust-region Framework for Moment Estimation Preprint.
Personal Web Link: https://somefunagba.github.io/assets/pdf/momest_trf.pdf
ArXiv Link: https://arxiv.org/pdf/2608.04026
- Extensive Benchmark suite
- Mixed precision training support
- CUDA kernel optimizations
- Improved documentation

