Data centers & energy · Research feature

The Energy Consumption of Transformer Fine-Tuning: A Roofline-Inspired Scaling Model

Researchers analyze energy consumption in BERT model training on multiple GPUs, linking it to compute, memory traffic, and hardware efficiency.

Adapted from research by Mansour Zoubeirou a Mayaki.

arXiv preprint revision · 2026-06-22 · Attribution & reuse
In this article
Editorial illustration of server racks.

Editor’s introduction

The study examines energy use in BERT-based Transformer training across different GPU configurations, measuring how compute, memory traffic, and hardware efficiency affect total energy. Using a roofline-inspired model, it finds that energy scaling depends not just on FLOPs but also on parallelization overheads and memory pressure. The model incorporates a speedup-based hardware-efficiency factor to capture effects of tensor and data parallelism. This reveals that distributed training can increase energy when coordination costs dominate, even if it reduces training time. The results show that energy inefficiency stems from system-level factors beyond compute intensity, supporting a shift from model-centric to system-aware energy modeling.

Introduction

The rapid growth of deep learning has driven remarkable progress across natural language processing (NLP), computer vision, and multimodal reasoning. In particular, Transformer-based architectures have become the dominant paradigm for language modeling and representation learning, underpinning widely deployed models such as BERT, T5, and GPT. This progress, however, has come at the cost of rapidly increasing computational and energy demands. Training modern Transformer models requires substantial compute resources, leading to high operational costs and a growing environmental footprint.

Recent work has raised serious concerns about the sustainability of large-scale machine learning. As models scale in depth, width, and training data, energy consumption grows nonlinearly and becomes increasingly sensitive to architectural choices, parallelization strategies, and hardware efficiency. While several studies report aggregate energy or carbon footprints for individual large models, a systematic understanding of how training energy scales with compute, memory traffic, and parallel efficiency remains limited. Existing approaches often conflate model size with hardware utilization and provide little guidance for predicting energy consumption under new architectures or training configurations. This paper addresses this gap by developing a predictive framework for training energy consumption in Transformer models. Rather than treating energy as a black-box outcome, we decompose it into interpretable components driven by (i) total compute, (ii) memory traffic, and (iii) hardware efficiency. Our approach is inspired by classical roofline models from high-performance computing and is augmented with an empirically grounded treatment of parallel efficiency derived from execution-time speedup.

We conduct controlled architectural sweeps of BERT models using the Hugging Face implementation, varying depth, width, feed-forward dimension, and attention configuration. From these sweeps, we construct lightweight proxies for parameter count, floating-point operations, and activation memory traffic. To capture parallelization effects, we introduce a speedup-based hardware-efficiency factor for tensor parallelism and fully sharded data parallelism.

We review three strands of work most relevant to this paper: (i) measurement and reporting of energy and carbon in machine learning, (ii) empirical evidence on how scale, architecture, and parallelization affect efficiency, and (iii) roofline-style frameworks for reasoning about compute–memory trade-offs. We conclude by positioning our contribution relative to these lines of work.

Measuring and Reporting Energy and Carbon

Early empirical studies emphasized the need for standardized reporting of energy consumption and carbon emissions in machine learning, highlighting substantial variation across measurement tools and experimental protocols. Subsequent analyses documented the rapid growth of energy use in state-of-the-art training and the importance of system-level factors such as cooling, power usage effectiveness (PUE), and geographic siting. Methodological work has proposed approaches for estimating emissions from public artifacts, as well as telemetry pipelines that attribute energy across CPU, GPU, and memory subsystems. In NLP, popularized reporting carbon alongside accuracy, while more recent lifecycle-aware frameworks combine operational and embodied emissions to support forward estimation under varying hardware and grid assumptions.

Scale, Architecture, and Efficiency

Classical scaling laws relate parameter count, data, and compute to model quality, but they do not directly characterize training energy, which is mediated by utilization, memory traffic, and parallel efficiency. Systems studies have shown that realized throughput for large models depends critically on parallelization strategy and communication behavior. Complementary case studies further show that configuration choices such as batching, numerical precision, and interconnect topology can induce large differences in energy consumption for comparable training objectives. Recent work has also begun to study energy scaling more directly, including efficiency-oriented analyses of local LLM deployment and operation. In particular, study CPU-only local inference for LLMs and VLMs on consumer and embedded devices, showing that inference cost scales approximately linearly with token length for LLMs and exhibits preprocessing-dependent threshold effects for VLMs. Their results highlight compression and input preprocessing as practical levers for sustainable edge inference, whereas our work focuses on distributed training, where parallelization strategy and execution efficiency are the primary determinants of energy scaling.

Roofline Models

Roofline models from high-performance computing provide a principled framework for reasoning about the interaction between compute throughput, memory bandwidth, and achieved performance. Extensions of the roofline approach have been used to analyze GPU kernels and deep learning workloads, highlighting the roles of arithmetic intensity, memory traffic, and utilization in determining performance and energy efficiency. More recent studies apply roofline-style analyses to neural network training to explain when workloads are compute-bound versus memory-bound and how architectural choices shift this balance. However, most roofline-based analyses focus on performance or power at the kernel or single-device level, rather than on training energy under distributed parallelism.

Positioning of This Work

Most prior work falls into three categories: (i) reporting aggregate energy or emissions for specific training runs, (ii) modeling end-to-end emissions without explicitly isolating execution efficiency, or (iii) studying scaling and parallelization primarily through throughput and time-to-solution rather than energy. Recent work by proposes an empirical energy model based on power-law relationships among energy, FLOPs, and a hardware-efficiency factor, validated on single-GPU measurements across LSTM, GRU, and Transformer models. Their approach decomposes Transformer layers into elementary operations and fits operation-level efficiency curves per GPU, yielding accurate predictions under fixed hardware and execution conditions.

Our work is complementary but distinct. We target distributed Transformer training and explicitly study how training energy scales with parallelization. Drawing inspiration from roofline theory, we decompose training energy into compute- and memory-related components, then augment this decomposition with a speedup-derived efficiency proxy that captures the effects of multi-GPU execution. The resulting model is not intended as a universal energy law across all architectures and hardware platforms; rather, it provides an interpretable and predictive framework for reasoning about training energy within a controlled regime, with explicit attention to tensor parallelism and fully sharded data parallelism.

Methodology

This section details our framework for predicting BERT fine-tuning energy. Our methodology combines controlled architectural sweeps with closed-form proxies for parameter count, compute, and memory traffic, together with an explicit efficiency term for parallel execution. The goal is not to causally isolate perfectly orthogonal factors, but to obtain sufficient variation in architecture and system-level quantities to support an interpretable regression model of training energy.

Tasks, Models and Training Protocol

Controlled sweeps. The architectural sweeps are designed to provide broad coverage of the configuration space rather than strict orthogonal control of compute and memory. Changing depth, width, sequence length, and batch size necessarily affects multiple quantities simultaneously; this is inherent to Transformer scaling. Our aim is therefore to generate sufficient variation across configurations to statistically disentangle the contributions of compute, memory proxy, and execution efficiency in the downstream regression model. Unless otherwise stated, each configuration is fine-tuned for a fixed number of epochs under a consistent optimizer and learning-rate schedule. We log step-level telemetry (time, power/energy counters when available) and aggregate metrics within and across epochs. Full training hyperparameters are reported in Appendix G.

Instrumentation and Energy Accounting

We measure training energy using complementary telemetry from Nsight Systems, CodeCarbon, and system-utilization logs. Measurements are converted to kWh, temporally aligned, and integrated over the active training interval after discarding warm-up and cool-down phases. For each configuration, we report mean energy over 5 epochs with standard error. Additional instrumentation details are provided in Appendix G.

Implementation Details

All regressions are performed in log space using ordinary least squares with heteroskedasticity-robust (HC3) standard errors. The reduced-form model in Eq. (13) is estimated with explicit regressors for compute, memory traffic, and hardware efficiency. Parallelization strategy effects are modeled using categorical fixed effects, with single-GPU baseline runs serving as the reference category.

Train–validation protocol

Configurations are stratified by architecture and randomly partitioned into a 70/30 train–validation split. This procedure is repeated over five random seeds, and we report medians and interquartile ranges (IQR) for all metrics. Model fitting is performed exclusively on the training subset; validation results are strictly out of sample.

Interpretation of Energy Scaling Results

We interpret the estimated coefficients of the energy model in terms of their implications for increases or decreases in training energy. Because the model is specified in log space, coefficients correspond to elasticities or multiplicative effects and can be interpreted quantitatively, conditional on a fixed workload and hardware class.

Overall, the results show that training energy is far more sensitive to hardware efficiency than to raw increases in compute or memory traffic. While larger models and workloads do increase energy consumption, their impact is sub-linear and can be mitigated by effective parallelization. In contrast, poorly utilized parallel execution can substantially increase energy despite reduced time-to-solution, underscoring the importance of jointly modeling compute, memory, and efficiency when evaluating the energy cost of training.

Discussion

By decomposing training energy into contributions from compute, memory traffic, and execution efficiency, we explain why energy scaling departs from FLOPs-only intuition and identify the system-level factors that most strongly influence training efficiency. Our results show that energy inefficiency arises not only from compute intensity, but also from memory pressure and parallelization overheads, motivating system-aware energy models rather than purely model-centric ones.

Beyond FLOPs and runtime-based scaling

Across all experiments, hardware efficiency is the dominant driver of training energy variation. While total compute remains a necessary descriptor of workload size, its effect on energy is strongly sub-linear once utilization is accounted for. Faster configurations often operate at higher instantaneous power, offsetting runtime reductions and showing that neither FLOPs nor runtime alone is a sufficient proxy for energy cost.

Parallelism and diminishing returns

Parallelism introduces a fundamental trade-off between time-to-solution and energy efficiency. Although tensor parallelism and fully sharded data parallelism reduce runtime, they also incur coordination, communication, and synchronization overheads that can increase total energy unless parallel efficiency remains high. As a result, scaling to larger device counts can be counterproductive from an energy perspective if the chosen strategy is poorly matched to model structure, hardware, or interconnect regime.

Architectural scaling and strategy choice. Fully sharded data parallelism consistently achieves lower training energy than tensor parallelism, particularly for larger and deeper models. This suggests that sharding parameters and optimizer state is often more energy efficient than partitioning computation across devices. These differences amplify with model scale, indicating that architectural scaling and parallelization strategy must be co-designed for energy-efficient training.

Limitations. Our empirical evaluation is limited to BERT-style Transformer fine-tuning under controlled architectural sweeps. While the modeling structure is not tied to BERT specifically, we do not validate it on decoder-only pretraining, mixture-of-experts models, long-context attention variants, or pipeline-parallel execution; results on larger public models are therefore presented as trend-level consistency checks rather than direct validation.

Conclusion

This work shows that the energy cost of Transformer training is governed not only by total compute, but also by hardware efficiency and parallelization strategy. While distributed training reduces time-to-solution, it can increase total energy when parallel scaling is imperfect or coordination overheads dominate. By modeling training energy as a function of compute, memory traffic, and a speedup-derived hardware-efficiency term, we move beyond FLOPs-only scaling laws and provide an interpretable framework for energy prediction. Our results further show that execution-time scaling can serve as a useful proxy for energy efficiency within a fixed hardware class and operating regime, enabling out-of-sample energy estimation even when direct power measurements are unavailable. Overall, the framework suggests that improving parallel efficiency and utilization can be as important as reducing nominal compute, offering practical guidance for the energy-aware design and evaluation of distributed Transformer training systems.

Impact Statement

This paper studies the operational energy consumption of Transformer training and proposes an interpretable framework for predicting training energy from compute, memory traffic, and execution efficiency. A potential positive impact is to support more energy-aware design and reporting of machine learning systems, including better comparison of training configurations beyond FLOPs or runtime alone.

At the same time, this work focuses only on operational training energy and does not account for embodied emissions, electricity mix, or downstream inference costs. As a result, it should not be used in isolation as a complete measure of environmental impact. More generally, improved energy prediction could also make large-scale training easier to optimize, which may reduce energy per run without necessarily reducing total energy use. We therefore view this work as a tool for improving transparency in system-level trade-offs rather than as a complete sustainability assessment.

Energy Consumption vs. Model Size

For a fixed number of GPUs, FSDP consistently exhibits lower energy consumption than TP at comparable model sizes. This gap widens as the model grows, indicating that tensor parallelism incurs increasing overheads such as additional collective communications and reduced kernel efficiency that are not fully amortized by larger models. In contrast, FSDP scales more smoothly with parameter count, suggesting better preservation of hardware utilization as model size increases.

Energy Consumption vs. Training Duration

Crucially, these results highlight that minimizing time-to-solution is not equivalent to minimizing energy. Faster configurations often operate at higher instantaneous power due to increased device utilization and communication activity, which can offset or even outweigh the benefits of reduced runtime. This decoupling between duration and energy motivates the explicit inclusion of a hardware-efficiency factor in our energy model, as duration alone cannot capture the full cost of parallel execution.

Energy Consumption vs. Computational Resources

Among multi-GPU strategies, FSDP consistently exhibits lower median energy consumption than tensor parallelism at the same GPU count. This difference becomes more pronounced at four GPUs, where TP shows both higher medians and substantially larger variance. The increased dispersion under TP reflects sensitivity to communication patterns and reduced kernel efficiency as tensors are partitioned across devices.

Notably, the single-GPU baseline remains the most energy-efficient configuration in absolute terms for small- and medium-scale models, despite being the slowest in runtime. This highlights a central trade-off in distributed training: optimizing for time-to-solution does not necessarily minimize energy consumption.

Energy Consumption vs. Number of Layers

At fixed depth, increasing the number of GPUs leads to higher total energy consumption across all strategies. Although multi-GPU execution reduces wall-clock time, the increase in instantaneous power draw and synchronization overheads outweighs these gains, resulting in higher overall energy usage. This effect becomes more pronounced as depth increases, reflecting the compounding impact of deeper models on communication and memory traffic.

Across all depths and GPU counts, FSDP consistently achieves lower energy consumption than tensor parallelism. The gap between FSDP and TP widens for deeper models, indicating that TP incurs depth-dependent overheads such as per-layer collective operations and reduced kernel efficiency that scale poorly with model depth. In contrast, FSDP better amortizes communication costs by sharding parameters and optimizer states, leading to more stable energy scaling.

Notably, for shallow models (4–6 layers), the single-GPU baseline remains the most energy-efficient configuration in absolute terms. As model depth increases, however, the baseline becomes increasingly impractical due to long runtimes, making multi-GPU strategies necessary despite their higher energy cost. This highlights a fundamental trade-off between feasibility and energy efficiency in training deep models.

Strategy-Level Stability

The Residuals by Strategy boxplot demonstrates that prediction error is consistent across Baseline, FSDP, and TP. While distributed strategies exhibit slightly higher variance and a few isolated outliers, the median residual for each category remains centered at zero, justifying our use of strategy-specific intercept shifts to account for parallelism overhead.

Error Structure and Normality

The Normal Q-Q Plot displays heavy-tailed residuals (leptokurtosis), where extreme energy outcomes deviate from the Gaussian line at the tails. This is consistent with hardware benchmarking data subjected to transient power spikes. Furthermore, a Durbin-Watson statistic of 2.125 confirms that our aggregation strategy successfully eliminated first-order autocorrelation.

Influence and Numerical Stability

The Cook’s Distance plot identifies two specific clusters of influential observations (near indices 60 and 265). Despite these clusters, all distances remain below 0.08, well within safe thresholds for regression stability. Finally, mean-centering continuous variables reduced the Condition Number to 86.5, ensuring that the effects of compute and parallel efficiency are numerically decoupled and individually interpretable.

Estimated energy under parallel strategies

Using the reconstructed inputs, we estimate energy consumption per epoch and total energy under two parallelization strategies: fully sharded data parallelism (FSDP) and tensor parallelism (TP). Estimates are produced by applying the reduced-form energy model with the corresponding speedup-based hardware-efficiency factors. Reported energy values from the original publications are shown for reference.

Interpretation and limitations

Overall, this analysis demonstrates how the proposed framework can be used to extrapolate training energy for large models from limited experimental calibration, providing a practical tool for comparative and predictive energy analysis when direct measurements are unavailable.