Choosing or deploying a language model requires knowing its energy consumption in advance. Layer-wise estimators predict it from the architecture, but are trained on layers measured in isolation, under GPU conditions that differ from those of the complete model. We introduce Wattribution, a protocol and tool that attributes the energy of a language model to each of its layers within its actual execution, building on the buffer of timestamped NVML power samples, which we characterize for the first time to our knowledge on nine GPUs from Turing to Blackwell, and which provides a new reading every 20 ms instead of a one-second average. Using Wattribution, we collect nearly 34M per-layer values from 11 language models (0.6B to 8B parameters) over 1,548 model--configuration runs; these values are repeatable, add up to the energy of the full generation without any correction factor, and show that the prefill can account for two thirds of the energy of a run with long prompts. A lightweight layer-wise estimator trained on these measurements predicts the energy of a language model from its configuration alone, with a median absolute percentage error of 4.8% on unseen configurations, 13.1% on language models never seen during training, and 16.9% on unseen model families.
翻译:暂无翻译