Abstract
While the massive energy cost of pre-training large language models often dominates discussions regarding AI’s environmental impact, the cumulative carbon footprint of the "pre-train then fine-tune" paradigm remains under-explored. This study provides a rigorous empirical analysis of the energy consumption associated with fine-tuning BERT across various tasks and hardware configurations. By measuring energy use at both the software and hardware levels, we quantify the factors driving consumption—such as token count, sequence length, and hardware efficiency—and offer a framework for understanding the total environmental cost of the NLP research lifecycle.
Introduction
In modern Natural Language Processing (NLP), the standard operating procedure involves taking a massive pre-trained model and fine-tuning it on a specific, smaller dataset. Because a single pre-training run is computationally expensive, most "Green AI" research has focused on this initial stage. However, while pre-training occurs once, fine-tuning is performed thousands of times by researchers and developers worldwide. This paper addresses the lack of quantitative data regarding the relative energy contributions of fine-tuning, seeking to identify the primary drivers of consumption and how they compare to the initial "sunk cost" of pre-training.
Methodology
To ensure high-fidelity measurements, the researchers employed a dual-measurement approach across two hardware setups: NVIDIA A100 and RTX 8000 GPUs.
- Software Tracking: The CodeCarbon package was used to track programmatic energy usage.
- Hardware Calibration: Software results were calibrated using a physical Kill-A-Watt meter at the wall outlet. This allowed the team to calculate a "power loss coefficient" (ranging from 1.06x to 1.09x), accounting for energy lost in the power supply and other physical components.
Crucially, to ensure an "apples-to-apples" comparison, the authors pre-trained BERT variants from scratch on the same hardware used for fine-tuning, rather than relying on reported figures from disparate infrastructure.
Evaluated Tasks and Datasets
The study evaluated energy consumption across a suite of common supervised NLP tasks:
- Natural Language Inference (NLI): RTE (6K examples) and MNLI (433K examples).
- Question Answering (QA): SQuAD v1 (98K) and SQuAD v2 (142K).
- Sentiment Analysis: IMDB (50K) and SST2 (70K).
- Named Entity Recognition (NER): CoNLL 2003 (21K) and CoNLL 2012 (143K).
- Pre-training: A combination of BookCorpus and Wikipedia (43M examples).
Analysis of Energy Drivers
Tokens and Padding
The study found that the most accurate predictor of energy consumption is not the number of examples in a dataset, but the total number of tokens processed, including padding. Because models process batches in fixed lengths, short sequences padded to match the maximum length still incur a computational and energy cost. Energy consumption was found to scale almost perfectly linearly with the "true" number of training tokens seen when accounting for dynamic padding.
Sequence Length and Task Type
Fine-tuning exhibits a high sensitivity to sequence length. Tasks involving long sequences, such as Question Answering, demonstrate a significantly sharper spike in energy intensity during the fine-tuning phase compared to tasks with shorter inputs. This suggests that the nature of the task itself is a primary determinant of the carbon footprint.
The Distillation Dividend
Knowledge distillation—creating smaller models like DistilBERT—requires approximately 50% more energy upfront than standard pre-training. However, DistilBERT is roughly 50% more energy-efficient for every subsequent fine-tuning run. The authors calculated a "break-even" point: the carbon cost of distillation is offset after just 86 fine-tuning runs on a large task like MNLI, making it a superior choice for frequently tuned models.
Hardware and Parallelization
NVIDIA A100 GPUs were consistently more energy-efficient than the older RTX 8000s, primarily due to lower idle power overhead and architectural improvements. Furthermore, the study noted that multi-GPU setups (e.g., using four GPUs) can reduce training time but may decrease energy efficiency. For tasks with short sequences like NER, the communication overhead between GPUs can make the process less efficient than using a single GPU.
Key Results and Environmental Impact
- Pre-training vs. Fine-tuning: Pre-training BERT-base is equivalent to approximately 400 MNLI fine-tuning runs or 45,000 RTE runs, depending on the dataset size.
- Study Footprint: The researchers estimated that the experiments conducted for this paper alone resulted in the emission of 350 kg of CO2 equivalents—comparable to driving a passenger car for 800–900 miles.
Limitations and Future Work
This study focused exclusively on BERT-base and DistilBERT. While foundational, these models are significantly smaller than contemporary Large Language Models (LLMs) such as Llama 3 or GPT-4. Future research is required to determine if these findings extrapolate to models with billions of parameters or to generative tasks like summarization. Additionally, the authors plan to investigate the emissions profiles of fine-tuning on public cloud infrastructure versus the on-premises academic hardware used in this study.
Summary updated