search
HomeTechnology peripheralsAICompletely crush AdamW! Google's new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

The optimizer is an optimization algorithm and plays a key role in neural network training. In recent years, researchers have introduced a large number of manual optimizers, most of which are adaptive optimizers. Adam and Adafactor optimizers still occupy the mainstream of training neural networks, especially in the fields of language, vision and multi-modality.

In addition to manually introducing optimizers, another direction is for the program to automatically discover optimization algorithms. Someone has previously proposed L2O (learning to optimize), which discovers optimizers by training neural networks. However, these black-box optimizers are usually trained on a limited number of small tasks and have difficulty generalizing to large models.

Others have tried other approaches, applying reinforcement learning or Monte Carlo sampling to discover new optimizers. However, in order to simplify the search, these methods usually restrict the search space and thus limit the possibility of discovering other optimizers. Therefore, current methods have not yet reached SOTA level.

In recent years, it is worth mentioning AutoML-Zero, which attempts to search every component of the machine learning pipeline when evaluating tasks, which is very useful for the discovery of optimizers. ​

##In this article, Researchers from Google and UCLA propose a method to discover optimization algorithms for deep neural network training through program search, and then discover Lion(EvoLved Sign Momentum) optimizer. Achieving this goal faces two challenges: first, finding high-quality algorithms in the infinitely sparse program space, and second, selecting algorithms that can generalize from small tasks to larger, SOTA tasks. To address these challenges, the research employs a range of techniques, including evolutionary search with hot starts and restarts, abstract execution, funnel selection, and program simplification.

  • Paper address: https://arxiv.org/pdf/2302.06675.pdf
  • Project address: https://github.com/google/automl/tree/master/lion##​
Compared with AdamW and various adaptive optimizers (which need to save both first- and second-order moments), Lion only requires momentum and utilizes symbolic operations to calculate updates, and halves the additional memory footprint. This is useful when training large models or large batches. For example, AdamW requires at least 16 TPU V4 to train ViT-B/16 with image size 224 and batch size 4096, while Lion only requires 8. Another practical benefit is that due to its simplicity, Lion has faster runtimes (steps/sec) in experiments, typically 2-15% faster than AdamW and Adafactor, depending on the task, codebase and hardware.

Xiangning Chen, the first author of the paper, said: Our symbolic program search found an effective optimizer that only tracks momentum - Lion. Compared with Adam, it achieved 88.3% zero-sample and 91.1% fine-tuned ImageNet accuracy, as well as up to 5x (compared to ViT), 2.3x (compared to diffusion model) and 2x (compared to LM). ) training efficiency.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

Lion performs well on a range of models (Transformer, MLP, ResNet, U-Net and Hybrid) and tasks (image classification, visual-linguistic contrastive learning , diffusion, language modeling and fine-tuning). It is worth noting that by replacing Adafactor with Lion in BASIC, this study achieved 88.3% zero-shot and 91.1% fine-tuning accuracy on ImageNet (Pham et al., 2021), exceeding the previous SOTA results by 2% and 0.1 respectively. %.

In addition, Lion reduces the pre-training computation on JFT by up to 5 times, improves the training efficiency of diffusion models by 2.3 times, and achieves better FID scores, It also provides similar or better performance in language modeling, saving up to 2 times the computational effort.

Twitter user crumb said: He used Google's Lion optimizer to train a 124M parameter GPT2 model and found that the number of steps required to achieve the same loss as Adam was reduced by 37.5%.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

## Source: https://twitter.com/aicrumb/status/1626053855329898496

Symbolic Discovery of Algorithms

This paper uses symbolic representation in the form of a program to have the following advantages: (1) It conforms to the fact that the algorithm must be executed as a program fact; (2) compared to parametric models such as neural networks, symbolic representations such as programs are easier to analyze, understand, and transfer to new tasks; (3) program length can be used to estimate the complexity of different programs, making it easier to choose a more Simple, often more versatile program. This work focuses on optimizers for deep neural network training, but the approach is generally applicable to other tasks.

In the figure below, Program 2. This simplified code snippet uses the same signature as AdamW to ensure that the discovered algorithm has a smaller or equal memory footprint; Program 3 is given Example representation of AdamW.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

This research adopts the following techniques to address the challenges posed by infinite and sparse search spaces. First, regularization is applied because it is simple, scalable, and successful in many AutoML search tasks; second, it is to simplify the redundancy in the program space; finally, to reduce the search cost, this study reduces the model size and the number of training examples by and steps away from the target task to reduce costs.

Left: Shown are the means and standard errors of five evolutionary search experiments. Right: Both the percentage of redundant statements and the cache hit rate increase as the search progresses.

Derivation and analysis of Lion

Researchers stated that the optimizer Lion has simplicity, high memory efficiency, and powerful performance in search and meta-validation. .

Derivation

The search and funnel selection process led to Program 4, which was derived from the original Program 8 (Appendix ) is obtained by automatically deleting redundant statements. The researcher further simplified and obtained the final algorithm (Lion) in Program 1. Several unnecessary elements were removed from Program 4 during the simplification process. where the cosh function is removed since m will be reallocated in the next iteration (line 3). Statements using arcsin and clip were also removed because the researchers observed no loss of quality without them. The three red statements are converted into a symbolic function.

Although m and v are used together in Program 4, v only changes the way the momentum is updated (two interpolation functions with constants ∼0.9 and ∼1.1 are equivalent to one with ∼ 0.99 function) and does not need to be tracked separately. Note that the bias correction is no longer needed as it does not change the direction.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

##Algorithm 2 below shows pseudo code.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

# Analysis

Symbol updating and regularization. The Lion algorithm produces updates with uniform magnitude in all dimensions through symbolic operations, which is different in principle from various adaptive optimizers. Intuitively, symbolic operations add noise to updates, act as a form of regularization and aid generalization. Figure 11 below (right) shows one piece of evidence.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

Momentum tracking. The default EMA factor for tracking momentum in Lion is 0.99 (β_2) compared to the 0.9 commonly used in AdamW and momentum SGD. This choice of EMA factors and interpolation allows Lion to strike a balance between remembering 10 times the history of the momentum gradient and putting more weight on the current gradient in updates.

Hyperparameter and batch size selection. Compared to AdamW and Adafactor, Lion is simpler and has fewer hyperparameters since it does not require ϵ and factorization related parameters. Lion requires a smaller learning rate, and thus a larger decoupled weight decay, to achieve a similar effective weight decay strength (lr * λ).

Memory and runtime advantages. Lion only saves momentum and has a smaller memory footprint than popular adaptive optimizers like AdamW, which is useful when training large models and/or working with large batch sizes. For example, AdamW requires at least 16 TPU V4 chips to train ViT-B/16 with an image resolution of 224 and a batch size of 4,096, while Lion only requires 8 (both with bfloat16 momentum).

Lion evaluation results

In the experimental part, the researchers evaluated Lion on various benchmarks, mainly comparing it with the popular AdamW (or when the memory becomes Adafactor at bottleneck) for comparison.

Image Classification

Researchers perform experiments covering various datasets and architectures on image classification tasks . In addition to training from scratch on ImageNet, they also pre-trained on two larger mature datasets, ImageNet-21K and JFT. Image size defaults to 224. ​

First train from scratch on ImageNet. The researchers trained ResNet-50 for 90 epochs with a batch size of 1,024, and the other models for 300 epochs with a batch size of 4,096. As shown in Table 2 below, Lion significantly outperforms AdamW on various architectures.

Secondly, pre-train on ImageNet-21K. The researchers pre-trained ViT-B/16 and ViT-L/16 on ImageNet-21K for 90 epochs with a batch size of 4,096. Table 2 below shows that Lion still outperforms AdamW even if the training set is expanded 10 times.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

Finally pre-train on JFT. In order to push the limits, researchers conduct a large number of experiments on JFT. Figure 4 below shows the accuracy of three ViT models (ViT-B/16, ViT-L/16 and ViT-H/14) under different pre-training budgets on JFT-300M. Lion enables ViT-L/16 to match the performance of AdamW’s ViT-H/14 trained on ImageNet and ImageNet V2, but at 3x lower pre-training cost.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

Table 3 below shows the fine-tuning results, with higher resolution and Polyak averaging . The ViT-L/16 used by the researchers matches the results of ViT-H/14 previously trained by AdamW, while having 2x fewer parameters. After extending the pre-training dataset to JFT-3B, Lion-trained ViT-g/14 outperforms previous ViT-G/14 results with 1.8x fewer parameters.

Visual language contrastive learning

This section focuses on CLIP style visual language contrastive training. Rather than learning all parameters from scratch, the researchers initialized the image encoder using a powerful pre-trained model.

For Locked Image Text Tuning (LiT), the researchers compared Lion and AdamW on LiT by training text encoders in a comparative manner using the same frozen pre-trained ViT. Table 4 below shows the zero-shot image classification results at 3 model scales, with Lion demonstrating continued improvement over AdamW.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

Figure 5 (left) below shows an example zero-shot learning curve of LiT-B/16-B, and Similar results were obtained on the other two datasets.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

##Diffusion model

Recently, diffusion models have achieved great success in image generation. Given its huge potential, we tested Lion on unconditional image synthesis and multimodal text-to-image generation.

For image synthesis on ImageNet, the researchers used the improved U-Net architecture introduced in the 2021 paper "Diffusion models beat gans on image synthesis" to perform 64×64 on ImageNet , 128×128 and 256×256 image generation. As shown in Figure 5 above (middle and right), Lion can achieve better quality and faster convergence on FID scores.

For text-to-image generation, Figure 6 below shows the learning curve. Although there is no significant improvement on the 64 × 64 base model, Lion outperforms AdamW on the text-conditional super-resolution model. Lion achieves higher CLIP scores and has smaller noisy FID metrics compared to AdamW.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

#Language Modeling and Fine-tuning

This section focuses on language modeling and fine-tuning. On pure language tasks, researchers found that adjusting β_1 and β_2 can improve the quality of AdamW and Lion.

For autoregressive language modeling, Figure 7 below shows the token-level perplexity of Wiki-40B and the word-level perplexity of PG-19. Lion consistently achieves lower verification perplexity than AdamW. It achieves speedups of 1.6x and 1.5x when training medium-sized models on Wiki-40B and PG-19, respectively. PG-19 further achieves a 2x speedup when the model increases to large size.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

For masked language modeling, the researchers also performed BERT training on the C4 data set , among which Lion performs slightly better than AdamW in terms of verification perplexity. The relevant learning curve is shown in Figure 11 below (left).

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

For fine-tuning, the researcher fine-tuned Base (220M), Large ( 770M) and the largest 11B T5 model. Table 6 below shows the results on the GLUE dev set, where on average Lion beats AdamW at all 3 model sizes.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

##Comparison with other popular optimizers

The study also uses four popular optimizers RAdam, NAdam, AdaBelief and AMSGrad to train ViT-S/16 and ViT-B/16 on ImageNet (using RandAug and Mixup). As shown in Table 7 below, Lion remains the top performer.

Completely crush AdamW! Googles new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast

Please refer to the original paper for more technical details.

The above is the detailed content of Completely crush AdamW! Google's new optimizer has small memory and high efficiency. Netizens: Training GPT 2 is really fast. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:51CTO.COM. If there is any infringement, please contact admin@php.cn delete
从VAE到扩散模型:一文解读以文生图新范式从VAE到扩散模型:一文解读以文生图新范式Apr 08, 2023 pm 08:41 PM

1 前言在发布DALL·E的15个月后,OpenAI在今年春天带了续作DALL·E 2,以其更加惊艳的效果和丰富的可玩性迅速占领了各大AI社区的头条。近年来,随着生成对抗网络(GAN)、变分自编码器(VAE)、扩散模型(Diffusion models)的出现,深度学习已向世人展现其强大的图像生成能力;加上GPT-3、BERT等NLP模型的成功,人类正逐步打破文本和图像的信息界限。在DALL·E 2中,只需输入简单的文本(prompt),它就可以生成多张1024*1024的高清图像。这些图像甚至

找不到中文语音预训练模型?中文版 Wav2vec 2.0和HuBERT来了找不到中文语音预训练模型?中文版 Wav2vec 2.0和HuBERT来了Apr 08, 2023 pm 06:21 PM

Wav2vec 2.0 [1],HuBERT [2] 和 WavLM [3] 等语音预训练模型,通过在多达上万小时的无标注语音数据(如 Libri-light )上的自监督学习,显著提升了自动语音识别(Automatic Speech Recognition, ASR),语音合成(Text-to-speech, TTS)和语音转换(Voice Conversation,VC)等语音下游任务的性能。然而这些模型都没有公开的中文版本,不便于应用在中文语音研究场景。 WenetSpeech [4] 是

普林斯顿陈丹琦:如何让「大模型」变小普林斯顿陈丹琦:如何让「大模型」变小Apr 08, 2023 pm 04:01 PM

“Making large models smaller”这是很多语言模型研究人员的学术追求,针对大模型昂贵的环境和训练成本,陈丹琦在智源大会青源学术年会上做了题为“Making large models smaller”的特邀报告。报告中重点提及了基于记忆增强的TRIME算法和基于粗细粒度联合剪枝和逐层蒸馏的CofiPruning算法。前者能够在不改变模型结构的基础上兼顾语言模型困惑度和检索速度方面的优势;而后者可以在保证下游任务准确度的同时实现更快的处理速度,具有更小的模型结构。陈丹琦 普

解锁CNN和Transformer正确结合方法,字节跳动提出有效的下一代视觉Transformer解锁CNN和Transformer正确结合方法,字节跳动提出有效的下一代视觉TransformerApr 09, 2023 pm 02:01 PM

由于复杂的注意力机制和模型设计,大多数现有的视觉 Transformer(ViT)在现实的工业部署场景中不能像卷积神经网络(CNN)那样高效地执行。这就带来了一个问题:视觉神经网络能否像 CNN 一样快速推断并像 ViT 一样强大?近期一些工作试图设计 CNN-Transformer 混合架构来解决这个问题,但这些工作的整体性能远不能令人满意。基于此,来自字节跳动的研究者提出了一种能在现实工业场景中有效部署的下一代视觉 Transformer——Next-ViT。从延迟 / 准确性权衡的角度看,

Stable Diffusion XL 现已推出—有什么新功能,你知道吗?Stable Diffusion XL 现已推出—有什么新功能,你知道吗?Apr 07, 2023 pm 11:21 PM

3月27号,Stability AI的创始人兼首席执行官Emad Mostaque在一条推文中宣布,Stable Diffusion XL 现已可用于公开测试。以下是一些事项:“XL”不是这个新的AI模型的官方名称。一旦发布稳定性AI公司的官方公告,名称将会更改。与先前版本相比,图像质量有所提高与先前版本相比,图像生成速度大大加快。示例图像让我们看看新旧AI模型在结果上的差异。Prompt: Luxury sports car with aerodynamic curves, shot in a

五年后AI所需算力超100万倍!十二家机构联合发表88页长文:「智能计算」是解药五年后AI所需算力超100万倍!十二家机构联合发表88页长文:「智能计算」是解药Apr 09, 2023 pm 07:01 PM

人工智能就是一个「拼财力」的行业,如果没有高性能计算设备,别说开发基础模型,就连微调模型都做不到。但如果只靠拼硬件,单靠当前计算性能的发展速度,迟早有一天无法满足日益膨胀的需求,所以还需要配套的软件来协调统筹计算能力,这时候就需要用到「智能计算」技术。最近,来自之江实验室、中国工程院、国防科技大学、浙江大学等多达十二个国内外研究机构共同发表了一篇论文,首次对智能计算领域进行了全面的调研,涵盖了理论基础、智能与计算的技术融合、重要应用、挑战和未来前景。论文链接:​https://spj.scien

​什么是Transformer机器学习模型?​什么是Transformer机器学习模型?Apr 08, 2023 pm 06:31 PM

译者 | 李睿审校 | 孙淑娟​近年来, Transformer 机器学习模型已经成为深度学习和深度神经网络技术进步的主要亮点之一。它主要用于自然语言处理中的高级应用。谷歌正在使用它来增强其搜索引擎结果。OpenAI 使用 Transformer 创建了著名的 GPT-2和 GPT-3模型。自从2017年首次亮相以来,Transformer 架构不断发展并扩展到多种不同的变体,从语言任务扩展到其他领域。它们已被用于时间序列预测。它们是 DeepMind 的蛋白质结构预测模型 AlphaFold

AI模型告诉你,为啥巴西最可能在今年夺冠!曾精准预测前两届冠军AI模型告诉你,为啥巴西最可能在今年夺冠!曾精准预测前两届冠军Apr 09, 2023 pm 01:51 PM

说起2010年南非世界杯的最大网红,一定非「章鱼保罗」莫属!这只位于德国海洋生物中心的神奇章鱼,不仅成功预测了德国队全部七场比赛的结果,还顺利地选出了最终的总冠军西班牙队。不幸的是,保罗已经永远地离开了我们,但它的「遗产」却在人们预测足球比赛结果的尝试中持续存在。在艾伦图灵研究所(The Alan Turing Institute),随着2022年卡塔尔世界杯的持续进行,三位研究员Nick Barlow、Jack Roberts和Ryan Chan决定用一种AI算法预测今年的冠军归属。预测模型图

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool