Optimizing Attention with Mirror Descent: Generalized Max-Margin Token Selection

Addison Kristanto Julistiono, Davoud Ataee Tarzanagh, Navid Azizan

TL;DR

This paper extends our understanding of how attention mechanisms optimize by analyzing Mirror Descent (MD) algorithms rather than standard Gradient Descent (GD). The authors prove that using an $\ell_p$-norm potential function causes the attention weights to implicitly converge toward a generalized hard-margin SVM solution, enabling stronger token selection. Crucially, choosing $p$ close to 1 induces significant parameter sparsity and improves generalization on real-world text and vision tasks without increasing training time.

What Problem Does This Paper Address?

When training overparameterized neural networks, the optimization algorithm we choose does more than just find a local minimum—it exhibits an implicit bias toward solutions with specific structural properties. For standard linear classification, gradient descent naturally favors max-margin separators (like SVMs). Recent work has shown a similar effect in softmax attention models, where GD biases the key-query matrix to maximize the margin between "optimal" tokens and sub-optimal ones.

However, standard GD is tied to Euclidean ($\ell_2$) geometry. More general optimization frameworks, like Mirror Descent (MD), allow researchers to explore alternative geometries (such as $\ell_p$-norms) that can yield beneficial properties like sparsity. Until now, the mathematical foundations, convergence rates, and implicit biases of MD within the highly non-linear and non-convex landscape of softmax attention remained completely unexplored.

Methods

The authors introduce and theoretically analyze a family of MD algorithms tailored for attention mechanisms, termed $\ell_p$-AttGD.

  1. Potential Function: Instead of the standard $\ell_2$ squared norm, they use the $p$-th power of the $\ell_p$-norm as the mirror potential function ($\psi(\cdot) = \frac{1}{p}\|\cdot\|_{p,p}^p$).
  2. Generalized Attention SVM ($\ell_p$-AttSVM): They define a new hard-margin SVM problem based on the $\ell_p$-norm to characterize the directional convergence of the attention weights.
  3. Joint Optimization: They analyze the complex joint training dynamics ($\ell_p$-JointGD) where both the key-query matrix ($W$) and the linear decoder ($v$) are optimized simultaneously under a logistic loss.

Datasets

The authors validate their theoretical findings using both synthetic data and standard real-world benchmarks:

  • Synthetic Datasets: Specially constructed token sequences to verify exact directional convergence and margin separation.
  • Stanford Large Movie Review Dataset (IMDb): Used for training a transformer-based text classification model to evaluate sentiment analysis and token selection.
  • CIFAR-10 & CIFAR-100: Used to train Vision Transformers (ViTs) to analyze image classification performance and weight distributions.

Key Insights and Ideas

  • Implicit Token Selection as an SVM: The paper proves that $\ell_p$-AttGD forces the attention mechanism to act as an optimal token selector by maximizing a generalized $\ell_p$-margin.
Visualization of the hyperplanes separating optimal tokens from sub-optimal tokens in an $\ell_p$-AttSVM framework for $p=3$.
  • The Power of Sparser Geometries: When $p$ is chosen close to 1 (e.g., $p = 1.1$), the algorithm implicitly performs feature selection. It concentrates representational capacity on the most discriminative attention components while driving irrelevant weights toward zero.
  • Logarithmic Convergence Rates: Despite the highly non-linear, non-convex nature of softmax attention, the authors establish that the directional convergence rate of $\ell_p$-AttGD is inverse poly-logarithmic—comparable to the convergence rates seen in much simpler linear binary classification models.

Key Results

  • Better Generalization: On the IMDb dataset, $\ell_{1.1}$-MD consistently outperformed standard $\ell_2$-MD (which is equivalent to GD). For a 3-layer transformer, $\ell_{1.1}$-MD achieved 83.47% ± 0.09% test accuracy compared to 81.66% ± 0.09% for $\ell_2$-MD.
  • Pronounced Sparsity: Weight histograms from Vision Transformers trained on CIFAR-10/100 revealed that $\ell_{1.1}$-MD produces significantly more near-zero weights than Adam or standard GD, validating its implicit feature-selection property.
  • No Computational Slowdown: Even though MD introduces a more complex geometry, the per-step update remains coordinate-wise separable. Empirical tests on CIFAR-10/100 showed that the cumulative training time across 2,000 epochs was virtually identical to Adam (approx. 25-29 hours), meaning the sparsity benefits come at zero cost to training efficiency.

Limitations and Future Work

The primary limitation is that the rigorous theoretical guarantees (such as the exact convergence rates and joint optimization proofs) are established for a simplified single-head, single-layer attention model with a fixed or linear decoder. While the empirical results demonstrate that these principles successfully scale to multi-layer, multi-head architectures (like ViTs), extending the formal mathematical proofs to deep, multi-layer attention networks remains an open and important challenge for future research.

Summary updated

BibTeX
@article{julistiono2026optimizing,
  author = {Addison Kristanto Julistiono and Davoud Ataee Tarzanagh and Navid Azizan},
  title = {{Optimizing Attention with Mirror Descent: Generalized Max-Margin Token Selection}},
  journal = {J. Mach. Learn. Res.},
  year = {2026},
}
Figure