Skip to main content
QUICK REVIEW

[Paper Review] Few-Bit Backward: Quantized Gradients of Activation Functions for Memory Footprint Reduction

Georgii Novikov, Daniel Bershatsky|arXiv (Cornell University)|Feb 1, 2022
Advanced Neural Network ApplicationsComputer Science5 citations
TL;DR

This paper proposes quantizing gradients of pointwise activation functions using piecewise-constant approximations to reduce memory footprint during deep learning training. By storing only 3-bit indices instead of full-precision inputs for backpropagation, the method achieves up to 40% memory reduction with no accuracy drop on benchmarks, using dynamic programming to compute optimal quantization schemes that are drop-in replacements for common activations like ReLU, GELU, and Swish.

ABSTRACT

Memory footprint is one of the main limiting factors for large neural network training. In backpropagation, one needs to store the input to each operation in the computational graph. Every modern neural network model has quite a few pointwise nonlinearities in its architecture, and such operation induces additional memory costs which -- as we show -- can be significantly reduced by quantization of the gradients. We propose a systematic approach to compute optimal quantization of the retained gradients of the pointwise nonlinear functions with only a few bits per each element. We show that such approximation can be achieved by computing optimal piecewise-constant approximation of the derivative of the activation function, which can be done by dynamic programming. The drop-in replacements are implemented for all popular nonlinearities and can be used in any existing pipeline. We confirm the memory reduction and the same convergence on several open benchmarks.

Motivation & Objective

  • Reduce memory footprint in deep neural network training, particularly for activation tensors stored during backpropagation.
  • Address the overlooked memory cost of storing full-precision inputs to pointwise nonlinearities in modern architectures.
  • Develop a data-agnostic, drop-in replacement method for activation functions that enables low-bit gradient storage without modifying training pipelines.
  • Achieve significant memory savings while maintaining model convergence and accuracy across diverse architectures and tasks.
  • Provide a generalizable framework applicable to any model, including Transformers, without requiring retraining or architectural changes.

Proposed method

  • Use dynamic programming to compute optimal piecewise-constant approximations of the derivative of activation functions, minimizing quantization error.
  • Replace full-precision activation inputs with only bin indices (e.g., 3-bit) in backward pass, drastically reducing memory per tensor element.
  • Store only the quantized derivative values instead of the original activation inputs, enabling lossy compression with negligible impact on gradients.
  • Implement drop-in replacements for common activation functions (ReLU, GELU, Swish, Sigmoid) that integrate seamlessly into existing PyTorch pipelines.
  • Apply the method universally across models, including Transformers and EfficientNet, without dependency on data distribution or model structure.
  • Use CUDA-optimized kernels for efficient inference and training with minimal performance overhead.

Experimental results

Research questions

  • RQ1Can quantizing the gradients of pointwise activation functions to few bits reduce memory usage during backpropagation without degrading model accuracy?
  • RQ2What is the optimal piecewise-constant approximation of an activation function's derivative that minimizes quantization error for low-bit representation?
  • RQ3How much memory reduction can be achieved in practice across diverse models like Transformers, EfficientNet, and GPT-2 using 3-bit or 4-bit quantization of activation gradients?
  • RQ4Can the proposed method be applied as a drop-in replacement across different models and training stages, including fine-tuning pre-trained models?
  • RQ5Does the method remain effective across different data distributions and model architectures, given its data-agnostic design?

Key findings

  • The method achieves up to 40% memory reduction on models like GPT2 and RoBERTa-large by storing only 3-bit indices per activation element.
  • Using 3-bit quantization results in a 20% memory saving on average across multiple benchmarks, including ResNet, EfficientNet, and BERT-based models.
  • The approach maintains training convergence and test accuracy identical to full-precision training on all evaluated models, including ResNet-50, EfficientNet-B7, and RoBERTa.
  • The optimal piecewise-constant approximation of activation derivatives is computed via dynamic programming and is effective across all tested activation functions, including ReLU, GELU, Swish, and Sigmoid.
  • The method is compatible with existing training pipelines and can be applied at any stage, including fine-tuning pre-trained models, without architectural changes.
  • The CUDA implementation achieves low overhead, enabling practical deployment in real training workflows with minimal performance impact.

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.