Abstract
We apply stochastic average gradient (SAG) algorithms for training conditional random fields (CRFs). We describe a practical implementation that uses structure in the CRF gradient to reduce the memory requirement of this linearly-convergent stochastic gradient method, propose a non-uniform sampling scheme that substantially improves practical performance, and analyze the rate of convergence of the SAGA variant under non-uniform sampling. Our experimental results reveal that our method often significantly outperforms existing methods in terms of the training objective, and performs as well or better than optimally-tuned stochastic gradient methods in terms of test error.
Introduction
Conditional Random Fields (CRFs) are essential for structured prediction tasks such as part-of-speech tagging and named-entity recognition. However, training these models is notoriously slow. Optimization typically involves a trade-off: deterministic methods like L-BFGS are accurate but require full dataset passes for every update, while Stochastic Gradient (SG) methods are fast per step but converge slowly due to gradient noise and require intensive manual step-size tuning. This paper bridges this gap by adapting the Stochastic Average Gradient (SAG) algorithm to the CRF framework.
Methodology
The researchers build upon the Stochastic Average Gradient (SAG) algorithm, which achieves a linear convergence rate by storing and averaging the gradients of individual training examples. To make this approach practical for high-dimensional CRFs, three key innovations are introduced:
- The Marginals Trick: Standard SAG requires storing a gradient vector for every training example, which is infeasible for large-scale CRFs. The authors observed that CRF gradients depend only on marginal probabilities. Storing these marginals instead of full gradients reduces memory requirements by orders of magnitude.
- Non-Uniform Sampling (NUS): Instead of uniform selection, the algorithm biases its choice toward "difficult" examples—those where the gradient changes quickly (high Lipschitz constant). This focuses the optimization effort on the most informative data points.
- Adaptive Step-Size: By implementing a Lipschitz line-search, the algorithm automatically finds the optimal learning rate on the fly, removing the need for manual grid searching.
Experimental Results
The method was evaluated on four benchmarks: OCR, CoNLL-2000, CoNLL-2002, and POS-WSJ.
Training Speed and Convergence
In terms of minimizing the training objective, the proposed SAG-NUS method significantly outperformed existing methods like L-BFGS, Pegasos, and AdaGrad. As illustrated in the training plots, SAG-NUS often achieves a lower objective value by an order of magnitude compared to competitors within the same number of iterations.
Memory Efficiency
The "Marginals" and "Mixed" storage strategies proved highly effective at mitigating the memory constraints of the SAG algorithm. For instance, on the CoNLL-2002 dataset, the memory footprint was reduced to a tiny fraction of the naive implementation, making the algorithm practical for standard hardware.
Test Accuracy and Robustness
SAG-NUS reached optimal test error faster than deterministic methods and matched the performance of perfectly tuned SG methods. Crucially, while standard SG methods are sensitive to step-size calibration and can diverge if misconfigured, SAG-NUS remained stable and robust due to its adaptive mechanism.
Conclusion and Future Work
This work demonstrates that memory constraints are a primary hurdle for advanced stochastic optimization in NLP, which can be overcome by exploiting model structure. The "Marginals" insight transforms SAG into a practical tool for CRF training. Future work may involve extending this to $L_1$ regularization, exploring parallelization for distributed environments, and further optimizing for models with extremely large label sets.
Summary updated