HackerPapers

arXiv:2305.14342cs.LG

Sophia: A Scalable Stochastic Second-order Optimizer for Language Model Pre-training

Hong Liu, Zhiyuan Li, David Hall, Percy Liang, Tengyu Ma

Abstract

Given the massive cost of language model pre-training, a non-trivial improvement of the optimization algorithm would lead to a material reduction on the time and cost of training. Adam and its variants have been state-of-the-art for years, and more sophisticated second-order (Hessian-based) optimizers often incur too much per-step overhead. In this paper, we propose Sophia, Second-order Clipped Stochastic Optimization, a simple scalable second-order optimizer that uses a light-weight estimate of the diagonal Hessian as the pre-conditioner. The update is the moving average of the gradients divided by the moving average of the estimated Hessian, followed by element-wise clipping. The clipping controls the worst-case update size and tames the negative impact of non-convexity and rapid change of Hessian along the trajectory. Sophia only estimates the diagonal Hessian every handful of iterations, which has negligible average per-step time and memory overhead. On language modeling with GPT models of sizes ranging from 125M to 1.5B, Sophia achieves a 2x speed-up compared to Adam in the number of steps, total compute, and wall-clock time, achieving the same perplexity with 50% fewer steps, less total compute, and reduced wall-clock time. Theoretically, we show that Sophia, in a much simplified setting, adapts to the heterogeneous curvatures in different parameter dimensions, and thus has a run-time bound that does not depend on the condition number of the loss.

arXiv comments
Journal reference
DOI
Subjects
cs.LGMachine Learning cs.CLComputation and Language math.OCOptimization and Control

On Hacker News

Linked by 5 identifiable commenters in 5 comments across 4 threads, from May 2023 to Aug 2023. Found in 5 HN submissions from May 2023 to Apr 2026. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments4 threads

    • What are your thoughts on Sophia, an algorithmic replacement for ADAM which promises to converge in fewer steps? https://arxiv.org/abs/2305.14342

      josephgView on HNParent context

    • Super fascinating post. For those who go straight to the comments, it appears that someone managed to train a BERT model[1] to 90% of the GLUE score reported in the original BERT paper on a single GPU in ~100 hours. Note that this includes pre-training! I can't find a clear…

      dwrodriView on HNParent context

    • The achievement of training a BERT model to 90% of the GLUE score on a single GPU in ~100 hours is indeed impressive. As for the original BERT pretraining run, the paper [1] mentions that the pretraining took 4 days on 16 TPU chips for the BERT-Base model and 4 days on 64 TPU…

      oerstedView on HNParent context

    • Optimization by gradient descent is used to do the learning in deep learning. For example, diff eqs are used to create optimizers that improve upon the classic 'adam' say, such as the new 'sophia' [1]. 1. https://arxiv.org/abs/2305.14342

      pumanoirView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.