Towards Green AI in Fine-tuning Large Language Models via Adaptive Backpropagation

Kai Huang, Hanyun Yin, Heng Huang, Wei Gao

Introduction

The rapid adoption of Large Language Models (LLMs) has brought significant advancements in natural language processing, but at a substantial environmental cost. Fine-tuning a LLaMA-13B model for a large user base can consume energy equivalent to that of a small country. While parameter-efficient fine-tuning (PEFT) methods like LoRA reduce memory requirements, they often fail to significantly decrease total energy consumption because they still require a full backward pass through the model.

The Backpropagation Bottleneck

Current efficiency methods focus on reducing trainable parameters. However, weight updates account for only 25–33% of total training Floating Point Operations (FLOPs). The majority of the computational cost stems from the "backward pass"—calculating activation gradients through every layer to reach the target parameters. This creates a "diminishing returns" wall for energy efficiency in standard PEFT approaches.

GreenTrainer: Adaptive Backpropagation

To address this, we present GreenTrainer, a framework that implements Adaptive Backpropagation. Unlike static strategies, GreenTrainer treats fine-tuning as a constrained optimization problem: maximizing model importance within a specific FLOPs budget.

Adaptive backpropagation strategy across training epochs, showing how different layers are selected for training or frozen over time.

Technical Components

  1. Tensor FLOPs Profiling: GreenTrainer employs a granular mapping of neural network operators to individual tensors. This allows the system to calculate the exact computational cost (FLOPs) required to update any specific part of the model.
Granular mapping of backpropagation operations to specific tensors within a Multi-Head Attention (MHA) layer to calculate precise FLOPs.
  1. Tensor Importance Evaluation: Using a first-order Taylor expansion, GreenTrainer estimates the impact of a weight update on reducing training loss. This identifies "high-value" tensors dynamically during runtime.
  2. Dynamic Programming Selector: A DP algorithm identifies the optimal set of tensors to train in each epoch, ensuring the user-defined energy-saving goals are met without compromising performance.

Experimental Results

GreenTrainer was evaluated using models such as OPT, BLOOMZ, and FLAN-T5 across tasks like abstractive summarization (SciTLDR, DialogSum) and generative QA (WebQuestions, PIQA).

Key findings include:

  • Efficiency: Up to a 64% reduction in training FLOPs compared to full fine-tuning with negligible accuracy loss.
  • Performance: GreenTrainer outperformed LoRA and Prefix Tuning by up to 4% in accuracy at similar computational costs.
  • Scalability: The method scales effectively from 350M to 6.7B parameter models. Notably, on OPT-2.7B, GreenTrainer-0.7 (using 70% FLOPs) surpassed full fine-tuning, suggesting it helps mitigate overfitting.

Conclusion and Future Work

GreenTrainer offers a flexible "knob" for engineers to balance carbon footprint against accuracy. While it introduces some memory overhead for importance evaluation, mechanisms like "early-stopping" help mitigate this. Future work will explore combining GreenTrainer with hardware-level optimizations and scaling to models exceeding 100B parameters.

Summary updated

BibTeX
@inproceedings{huang2024towards,
  author = {Kai Huang and Hanyun Yin and Heng Huang and Wei Gao},
  title = {{Towards Green AI in Fine-tuning Large Language Models via Adaptive Backpropagation}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=Vja3ecieXY},
}
Figure