Manuscript Offprint

arXiv:2610.39621

The Real Cost of Context: Predicting Compute Time and Energy Consumption in LLM Prefill and Decode Phases

Lars Krupp, Daniel Geißler, Francisco M. Calatrava-Nicolas, Stefan Gerd Fritsch, Paul Lukowicz, Jakob Karolus

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

A PREPRINT

Lars Krupp

RPTU Kaiserslautern-Landau, DFKI

kruppl@rptu.de

Francisco M. Calatrava-Nicolas

Örebro University

francisco.calatrava-nicolas@oru.se

Paul Lukowicz

RPTU Kaiserslautern-Landau, DFKI

paul.lukowicz@dfki.de

Daniel Geißler

RPTU Kaiserslautern-Landau, DFKI

daniel.geissler@dfki.de

Stefan Gerd Fritsch

RPTU Kaiserslautern-Landau

stefan_gerd.fritsch@dfki.de

Jakob Karolus

RPTU Kaiserslautern-Landau, DFKI

jakob.karolus@dfki.de

October 30, 2026

ABSTRACT

The integration of Large Language Models (LLMs) into agentic architectures has substantially increased token consumption, raising concerns about their energy footprint. Yet, estimating the energy consumption of proprietary API-based models remains challenging, and existing approaches focus primarily on generated output tokens while overlooking the impact of the large input contexts characteristic of agentic workflows. To address this gap, we systematically profile compute time and energy consumption across a wide range of prefill (input) and decode (output) token lengths. Using generalized linear models, we show that decode compute time and energy scale linearly with output length, whereas prefill compute time and energy exhibit both linear and quadratic scaling with input length. These findings demonstrate that input context becomes a relevant factor for large-context workloads. Furthermore, we show that compute time serves as a reliable proxy for energy consumption when direct energy measurements are unavailable. Our mapping framework enables precise energy estimation and supports more sustainable deployment decisions for agentic AI.

Introduction

Large Language Models (LLMs) have evolved from primarily supporting isolated conversational interactions to becoming foundational components of increasingly complex applications. As their adoption and usage continue to grow, accurately estimating their energy consumption is becoming an important operational and environmental concern Luccioni et al. [2023], Samsi et al. [2023]. For open-weight models deployed on accessible hardware, energy consumption can be measured through software telemetry or external power meters Argerich and Patiño-Martínez [2024], Husom et al. [2025]. In contrast, proprietary models accessed through commercial APIs expose little information about their underlying hardware, serving configuration, or power consumption, making their energy footprint considerably more difficult to estimate Rincé and Banse [2025], Krupp et al. [2026a].

At the same time, modern LLM applications increasingly process large amounts of contextual information. This trend is particularly visible in multi-turn and agentic workflows, where conversation histories, system instructions, retrieved documents, tool outputs, and intermediate reasoning steps may be repeatedly included in the model input. Systems

A PREPRINT

such as OpenClaw 1^{1} illustrate how complex agentic workflows can substantially increase input token consumption when solving long-running, multi-step tasks Bai et al. [2026]. Likewise, this challenge applies to any LLM application that processes long input contexts. Despite this development, existing energy estimation approaches largely focus on output tokens only and use short and fixed input lengths Argerich and Patiño-Martínez [2024], Rincé and Banse [2025], AI Energy Score [2025]. Consequently, the significant impact of input length on compute time as well as energy consumption remains inadequately modeled, particularly for large-context workloads.

We address this gap by systematically profiling LLM compute time and energy consumption across a grid of input and output token lengths, independently varying the tokens processed during prefill (input) and those produced during the decode (output) stage. Based on these empirical observations, we first fitted a Generalized Linear Model (GLM) on data collected via an API, capturing the contributions of input and output tokens towards compute time. We show that the number of input tokens has both linear as well as quadratic effects on compute time. These results demonstrate that estimates based predominantly on generated tokens Rincé and Banse [2025], Argerich and Patiño-Martínez [2024] may fail to capture an important component of inference cost for long-context requests.

Our model accurately predicts compute times for input–output configurations with little training data. Beyond prediction, the fitted GLM provides a compact and explainable representation of the LLM’s compute time behavior, which we use to support energy estimation. Because energy consumption depends on both execution time and power draw, compute time predictions alone are insufficient, particularly for proprietary APIs whose underlying hardware and power characteristics are not observable. Following the local-equivalence approach proposed by Krupp et al. [2026a], we collected compute time and energy consumption data from different local hardware and software configurations. This data was used to fit a GLM pair per hardware configuration, one predicting compute time as before and the other predicting energy consumption for input–output configurations. Through comparing the compute time GLMs and selecting the one behaving most similar to the API GLM, we were able to find an energy cost GLM whose direct energy measurements provide an empirically grounded basis for predicting the energy consumption of API-based inference.

Our work presents an empirically validated and explainable modeling approach for estimating LLM compute times and, through locally measured power characteristics, their associated energy consumption. Our method is suitable for both local and API-accessed LLMs and requires no access to the proprietary serving infrastructure. It is particularly relevant to context-intensive applications, including increasingly common multi-turn and agentic workflows.

We outline our primary contributions as follows:

  1. We systematically characterize and quantify the influence of input token length on LLM compute time, with particular focus on the large-context requests increasingly prevalent in modern LLM applications.

  2. We develop generalized linear models (GLMs) that accurately predict LLM compute time and energy consumption from limited measurements while providing excellent interpretability through their direct correspondence to the algorithmic characteristics of LLM inference.

  3. We demonstrate that compute time can serve as a reliable proxy for energy consumption, enabling accurate estimation of the energy footprint of proprietary, API-accessed LLMs through locally profiled equivalent models.

References (21)