Cosine-Covered Flat-Region Escape
Implementation & benchmark of arXiv:2608.07716 — The cosine measure of a function at a point
Source paper: The cosine measure of a function at a point arXiv:2608.07716 ⓘ · analyzed Sep 1, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Augment gradient descent with a directional-search step when the gradient norm is small or the loss has stalled. In each parameter block, evaluate a small positively spanning set of normalized perturbations, use their directional loss slopes to identify descent directions, and combine them through nonnegative coefficients so that the update remains inside their positive span. The cosine measure supplies a quantitative trigger: low directional coverage means the current perturbation pool is not sufficient to guarantee an escape direction, so the pool is expanded or resampled.
Formulas
Mathematical statement
The paper defines the positive span of a nonempty set \(\mathcal S\subset\mathbb R^n\) as \(\pspan(\mathcal S)=\{\sum_{i=1}^k\lambda_i\mathbf d_i:k\in\mathbb N,\mathbf d_i\in\mathcal S,\lambda_i\ge 0\}\), and its normalized positive span as \(\npspan(\mathcal S)=\pspan(\mathcal S)\cap\mathbb S^n\), where \(\mathbb S^n=\{u:\|u\|_2=1\}\). For a normalized finite direction set \(S\), use the geometric cosine measure \(\operatorname{cm}(S)=\min_{u\in\mathbb S^{n-1}}\max_{d\in S}u^\top d\); it is positive exactly when the positive span covers all directions. For a loss \(L\), define the one-sided directional slope \(\Delta_\varepsilon L(\theta;d)=[L(\theta+\varepsilon d)-L(\theta)]/\varepsilon\), and use the empirical function-descent cosine \(\operatorname{cm}_L(\theta;S)=\max_{d\in S}[-\Delta_\varepsilon L(\theta;d)]_+/ (\max_{d\in S}|\Delta_\varepsilon L(\theta;d)|+\delta)\), where \(\theta\) is the parameter block, \(d\) is a unit perturbation, \(\varepsilon\) is the finite-difference radius, and \(\delta>0\) prevents division by zero. This proxy is positive when the sampled set contains an observed descent direction and near zero when all sampled directions are flat or uphill.
Implementation notes
Integrate this as a fallback branch after the normal AdamW update, operating independently on parameter blocks such as each transformer layer or each convolutional layer. At step t, compute the ordinary minibatch gradient g_t and AdamW proposal. If the gradient norm for a block is below a threshold tau_g, or if its exponential loss improvement over the last K steps is below tau_L, activate directional search. Sample m normalized Gaussian directions d_i in that block; for a cheap positively spanning pool, include antipodes so that S={d_1,-d_1,...,d_q,-d_q}, or use coordinate directions for very small blocks. Evaluate the same minibatch at theta+epsilon*d_i, preferably in one concatenated forward batch, and compute Delta_i=(L(theta+epsilon*d_i)-L(theta))/epsilon. Compute c=max_i[-Delta_i]_+/(max_i|Delta_i|+delta). If c is below c_min, resample directions once; if it remains low, skip the expensive escape step. Otherwise set weights lambda_i=softmax(-Delta_i/tau_d) over directions with Delta_i<0, form d=sum_i lambda_i d_i, and apply theta <- theta - eta*g + alpha*d, clipping alpha*d to a block norm proportional to the AdamW update norm. Do not backpropagate through the finite-difference evaluations. The paper-derived quantities are the positive-span construction and cosine-coverage criterion; epsilon, c_min, m, and alpha are empirical hyperparameters. Start with a 2-layer MLP on MNIST or CIFAR-10, compare AdamW against AdamW plus this fallback under matched total forward FLOPs, and test deliberately flat conditions such as saturated activations or a large learning-rate decay. Success is lower stall duration, more escapes from near-zero-gradient regions, and improved final accuracy at equal optimizer evaluations; a negative result is extra evaluations without faster loss descent or accuracy gain.
Verification
This idea has not been verified yet.
Verification happens in two stages: Stage 1 — a mechanism check on a toy system confirms the claimed mathematical phenomenon reproduces; Stage 2 — a benchmark implements the idea on a real (small) neural network task and compares it against a tuned baseline over 8 paired seeds with a permutation test.
Artifacts
Artifacts unavailable.