Skip to main content
QUICK REVIEW

[Paper Review] AutoFreeze: Automatically Freezing Model Blocks to Accelerate Fine-tuning

Yuhan Liu, Saurabh Agarwal|arXiv (Cornell University)|Feb 2, 2021
Topic ModelingComputer Science72 references16 citations
TL;DR

AutoFreeze accelerates BERT fine-tuning by adaptively freezing layers that converge early, using a gradient-norm-based criterion to identify stable layers. With activation caching and distributed execution, it achieves up to 2.55× speedup on a single GPU and 5.03× cost reduction on a 64-GPU cluster, matching state-of-the-art accuracy without model accuracy loss.

ABSTRACT

With the rapid adoption of machine learning (ML), a number of domains now use the approach of fine tuning models which were pre-trained on a large corpus of data. However, our experiments show that even fine-tuning on models like BERT can take many hours even when using modern accelerators like GPUs. While prior work proposes limiting the number of layers that are fine-tuned, e.g., freezing all layers but the last layer, we find that such static approaches lead to reduced accuracy. We propose, AutoFreeze, a system that uses an adaptive approach to choose which layers are trained and show how this can accelerate model fine-tuning while preserving accuracy. We also develop mechanisms to enable efficient caching of intermediate activations which can reduce the forward computation time when performing fine-tuning. We extend AutoFreeze to perform distributed fine-tuning and design two execution modes that minimize cost and running time respectively. Our evaluation on ten NLP tasks shows that AutoFreeze, with caching enabled, can improve fine-tuning on a single GPU by up to 2.55x. On a 64 GPU cluster, for fine-tuning on the AG's news dataset, AutoFreeze is able to achieve up to 4.38x speedup when optimizing for end-to-end training time and 5.03x reduction in total cost when optimizing for efficiency, without affecting model accuracy.

Motivation & Objective

  • To address the high computational cost of fine-tuning large pre-trained models like BERT, which can take up to 27 hours on a 4-GPU cluster.
  • To overcome the limitations of static fine-tuning strategies that freeze fixed layers or use lottery ticket pruning, which often reduce model accuracy.
  • To develop an adaptive, runtime-determined method for freezing model blocks during fine-tuning that preserves accuracy while accelerating training.
  • To integrate efficient activation caching and distributed execution modes to further reduce training time and cost in multi-GPU environments.

Proposed method

  • AutoFreeze uses a gradient-norm-based test to rank layers by their rate of change during training, identifying those that converge early and can be frozen.
  • Layers with the slowest gradient norm decay are selected for freezing, avoiding backward pass computation and reducing both computation and communication overhead.
  • The system employs dynamic activation caching to avoid recomputing intermediate outputs during forward passes, reducing forward computation time.
  • AutoFreeze supports two distributed execution modes: one optimized for end-to-end training time and another for minimizing total cost, enabling efficient scaling across clusters.
  • The method is integrated into PyTorch and supports both single-GPU and multi-GPU fine-tuning with minimal runtime overhead.
  • Freezing decisions are made periodically during training, with evaluation intervals tuned to balance speedup and accuracy.

Experimental results

Research questions

  • RQ1Can adaptive layer freezing during fine-tuning significantly reduce training time without degrading model accuracy?
  • RQ2How does the gradient-norm-based criterion compare to static freezing or lottery ticket pruning in terms of speedup and accuracy preservation?
  • RQ3To what extent can activation caching and distributed execution further accelerate fine-tuning in multi-GPU settings?
  • RQ4What is the optimal frequency for evaluating layer convergence to balance speedup and model performance?

Key findings

  • On a single GPU, AutoFreeze with caching achieves up to 2.55× speedup on ten NLP tasks compared to standard fine-tuning.
  • On a 64-GPU cluster, AutoFreeze reduces end-to-end training time by up to 4.38× and total cost by up to 5.03×, with no accuracy degradation.
  • The gradient-norm test introduces minimal overhead—less than 1% of interval time and 453MB memory per epoch—making it practical for real-world use.
  • Freezing only the slowest-changing layers preserves model accuracy, unlike static approaches that freeze early layers and reduce accuracy from 87% to 76.5% on MRPC.
  • The method maintains state-of-the-art accuracy while significantly reducing training time, outperforming prior methods like EarlyBERT that suffer from accuracy drops.
  • Optimal freezing frequency lies between 2 to 5 evaluation intervals per epoch, balancing speedup and model stability.

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.