arXiv:2610.19819cs.DCOct 2026

Manuscript Offprint

arXiv:2610.19819

The Cost of Context: Profiling the Energy Footprint of Input Tokens in Large Language Models

Boris Ruf, Marcin Detyniecki

BORIS RUF, AXA AI Research, France

MARCIN DETYNIECKI, AXA AI Research, France

The rapid adoption of Retrieval-Augmented Generation (RAG) and long-context LLMs has shifted the computational burden toward the prefill phase—the initial stage where the model processes all input tokens in parallel before generating a response—yet its energy impact remains poorly characterised. We investigate the contradiction between massive hardware-level power spikes and the sub-linear marginal cost of input tokens reported in system-level studies. Through high-resolution telemetry of Llama-3.1 and Qwen-2 models on NVIDIA A100 hardware, we identify the efficiency threshold where O(n2)O(n^2) attention complexity overcomes GPU parallelisation. Our results quantify how optimised memory orchestration (PagedAttention) delays this scaling bottleneck across three orders of context scaling, yielding up to an 8.9×8.9\times energy efficiency advantage at 112,000 tokens compared to standard baselines. Furthermore, we characterise the energy disparity between input and output tokens, demonstrating that optimised serving (vLLM) causes this ratio to narrow (from ≈850×\approx850\times to 750×750\times) as context scales due to high decode efficiency, whereas unoptimised baselines show a much smaller, roughly constant gap ( ≈150−230×\approx150-230\times) because their prefill is itself expensive. This work establishes context-scaling laws that differentiate engine-level optimisations from inherent model constraints, providing an empirical framework for sustainable LLM deployment.

CCS Concepts: • Hardware → Power and energy; • Computing methodologies → Natural language processing; Machine learning.

Additional Key Words and Phrases: Large Language Models, Energy Efficiency, Sustainability, PagedAttention, Prefill Phase

1 Introduction

The rapid proliferation of energy-intensive Large Language Models (LLMs) has made efficiency a key focus of systems research. Frontier models are predominantly accessible via APIs that prevent direct energy measurement, resulting in reliance on approximations [8]. Common estimation methodologies are based on output token counts, assuming that the primary driver of inference costs is autoregressive, sequential token generation, while input tokens are omitted [12].

In practice, however, the vast majority of modern LLM applications are heavily dependent on massive input contexts. Retrieval-Augmented Generation (RAG), long-document summarisation, and complex coding assistants all represent use cases where the input volume significantly outweighs the generated output.

This raises the question of how input tokens actually influence the energy balance, as recent research presents diverging results. Hardware-centric benchmarks like TokenPowerBench [10] report that inference engines such as vLLM [7]—a high-throughput LLM serving framework—spike GPU power draw by up to 3× during prefill. This aligns with the O(n2)O(n^{2}) complexity of self-attention [15], which arises because the mechanism requires pairwise comparisons between all tokens in the sequence, causing computational requirements to grow with the square of the context length. Conversely, systematic usage studies [2] observe that processing even very large contexts (e.g., 50,000 tokens) consumes only marginally more total energy than small prompts, suggesting a sub-linear marginal cost. This creates an apparent “Prefill Paradox” where high instantaneous power draw is seemingly decoupled from total energy expenditure.

This discrepancy highlights a lack of understanding of how context-length scaling affects energy costs in LLM inference, emphasising the need to characterise the prefill and decode phases independently.

In this short paper, we address the following research questions:

(1) At what context length threshold does the O(n2)O(n^{2}) complexity of attention overcome GPU parallelisation, and how does this point of compute saturation differ across engines?

(2) How do distinct memory-orchestration strategies (PagedAttention vs. SDPA) influence the location and stability of the efficiency threshold as context length scales?

(3) How does the energy intensity disparity between input and output tokens evolve across varying context depths, and how is this relationship modulated by engine-level optimisations?

References (10)