Skip to main content
QUICK REVIEW

[Paper Review] Stable and low-precision training for large-scale vision-language models

Mitchell Wortsman, Tim Dettmers|arXiv (Cornell University)|Apr 25, 2023
Multimodal Machine Learning ApplicationsComputer Science5 citations
TL;DR

This paper introduces SwitchBack, a novel linear layer for stable and efficient 8-bit (int8 and float8) training of large vision-language models, achieving 13-25% speedup over bfloat16 training with near-identical accuracy on CLIP ViT-Huge. It also proposes StableAdamW, an AdamW-AdaFactor hybrid that eliminates loss spikes by applying update clipping, significantly improving training stability at scale.

ABSTRACT

We introduce new methods for 1) accelerating and 2) stabilizing training for large language-vision models. 1) For acceleration, we introduce SwitchBack, a linear layer for int8 quantized training which provides a speed-up of 13-25% while matching the performance of bfloat16 training within 0.1 percentage points for the 1B parameter CLIP ViT-Huge -- the largest int8 training to date. Our main focus is int8 as GPU support for float8 is rare, though we also analyze float8 training through simulation. While SwitchBack proves effective for float8, we show that standard techniques are also successful if the network is trained and initialized so that large feature magnitudes are discouraged, which we accomplish via layer-scale initialized with zeros. 2) For stability, we analyze loss spikes and find they consistently occur 1-8 iterations after the squared gradients become under-estimated by their AdamW second moment estimator. As a result, we recommend an AdamW-Adafactor hybrid which avoids loss spikes when training a CLIP ViT-Huge model and outperforms gradient clipping at the scales we test.

Motivation & Objective

  • To accelerate large-scale vision-language model training through low-precision (int8 and float8) computation without sacrificing accuracy.
  • To stabilize training by identifying and mitigating loss spikes that degrade model performance.
  • To enable the first successful int8 training of a 1B-parameter CLIP ViT-Huge model, matching bfloat16 performance within 0.1%.
  • To develop practical, open-source tools such as Triton kernels for future research in low-precision training.
  • To demonstrate that proper initialization and adaptive optimization can enable stable float8 training even without native hardware support.

Proposed method

  • SwitchBack uses 16-bit matrix multiplication for weight gradient computation while performing forward passes and input gradient computations in int8, reducing quantization noise in high-dimensional attention layers.
  • The method employs a hybrid precision strategy: 8-bit operations for inference and input gradients, and 16-bit for gradient accumulation, improving accuracy over standard quantization.
  • For float8 training, SwitchBack is simulated using accurate fp8 emulation, showing it outperforms tensor-wise quantized baselines that diverge at scale.
  • StableAdamW combines AdamW with AdaFactor's update clipping technique, which monitors the ratio of squared gradients to their second moment estimator to dynamically adjust learning rates.
  • The loss scalar is modified to check for Inf/NaN at the tensor level and remain fixed, preventing global training failure due to isolated layer instabilities.
  • Layer-scale initialization with zeros is used to suppress large feature magnitudes, enabling stable float8 training with standard quantization techniques.

Experimental results

Research questions

  • RQ1Can a novel linear layer design like SwitchBack achieve high accuracy in int8 training of large vision-language models while providing significant speedups?
  • RQ2Why do loss spikes occur during large-scale CLIP training, and can they be predicted or prevented?
  • RQ3Can float8 training be stabilized without native hardware support, and what initialization or optimization techniques enable this?
  • RQ4How does the combination of AdamW and AdaFactor's update clipping (StableAdamW) compare to gradient clipping in terms of stability and final performance?
  • RQ5What role do large activations and gradients play in causing instability during low-precision training?

Key findings

  • SwitchBack achieves 13-25% end-to-end speedup in CLIP ViT-Huge training compared to bfloat16, with zero-shot ImageNet accuracy within 0.1 percentage points.
  • SwitchBack enables the largest reported int8 training to date on a 1B-parameter CLIP ViT-Huge model, outperforming LLM.int8() in accuracy.
  • Float8 training with standard tensor-wise quantization diverges beyond 420M parameters, but SwitchBack enables stable training when combined with layer-scale initialization using zeros.
  • StableAdamW, an AdamW-AdaFactor hybrid with update clipping, eliminates loss spikes and outperforms gradient clipping in terms of zero-shot ImageNet accuracy at scale.
  • Loss spikes are consistently preceded by a drop in the ratio of squared gradients to their moving average in the patch embedding layer, indicating underestimation by the second moment estimator.
  • Using a fixed, per-tensor loss scalar that checks for Inf/NaN at the tensor level prevents global training failure and enables stable fp16 mixed-precision training at ViT-Huge scale.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.