Re-Reading Is Not Free: Token Traces and Cache-Aware Energy Estimation for LLM Agents in Software Engineering

Tina Vartziotis, Ketevan Peranidze, Rodopi Kosteli, Ezgi Sarikayak, George Dasoulas, Michael Keckeisen, Sotirios Kotsopoulos, Francesca DominiciarXiv 2026

As Large Language Models (LLMs) transition from simple chatbots to autonomous agents capable of managing entire software repositories, their environmental impact is coming under increased scrutiny. A new paper, "Re-Reading Is Not Free," argues that our current methods for estimating AI energy consumption are fundamentally flawed when applied to these long-running "agentic" workflows. By ignoring the massive amount of data these agents "re-read" from their memory caches, we may be underestimating their energy footprint by as much as 25 times.

TL;DR

Current energy estimators for LLMs focus on what the model generates, but for autonomous agents, the real cost lies in "re-reading" accumulated context. This study analyzes a billion-token real-world trace, revealing that 95% of tokens are cached reads, leading to energy demands 25x higher than standard estimates.

What Problem Does This Paper Address?

Most energy models for AI are built for "single-shot" interactions—you ask a question, the model gives an answer, and the session ends. However, AI agents in software engineering (like GitHub Copilot or Claude Code) operate in long sessions. They maintain a history of the conversation, the code they’ve read, and the output of tools they’ve run.

To save time, cloud providers use prompt caching, which avoids re-calculating the "meaning" (embeddings) of this history every time. While this makes the model faster, it doesn't make it "free." Every time the agent generates a new word, it still has to perform "attention" operations over that entire cached history. The authors tackle the gap in current energy accounting that treats this cached context as if it has zero or negligible cost.

Methods

The researchers conducted a retrospective study of a massive real-world dataset. They developed a cache-aware hybrid energy estimator by extending existing analytical models.

The study pipeline for reconstructing API calls and estimating energy.

Their methodology involved:

  • Token Trace Analysis: Categorizing tokens into four classes: uncached input, cache writes, cached reads, and generated output.
  • Hybrid Modeling: Combining model-level computational characteristics (like parameter counts and attention mechanisms) with infrastructure-level data (like server power and cooling efficiency).
  • Delegation Reconstruction: They discovered that standard logs often hide the work done by "subagents" (smaller models called by the main agent), so they manually reconstructed these "invisible" workloads from private transcripts.

Datasets

The study is based on a unique, high-fidelity dataset:

  • The Trace: Nearly one billion tokens collected over ten weeks of real-world AI-assisted software development.
  • Scope: 42 sessions and 752 task episodes across six different industrial research workstreams.
  • Tooling: The data comes from the use of Claude Code, involving various model tiers (Haiku, Sonnet, and Opus).

Key Insights and Ideas

  • The "Attention Tax": Even with caching, the energy cost of "attention" scales with context length. In agentic workflows, "Attention reads" dominate the energy footprint, accounting for roughly 90% of the IT energy.
Fig. 4. Hybrid IT energy by physical term, low active-parameter bound. The dashed line marks the total EcoLogits estimate for the same trace on the same basis (IT energy, low bound, 6.6 kWh).
  • The 260:1 Ratio: For every single token the agent generates, it reads approximately 260 tokens from its cached context. This "re-reading" is the primary driver of energy consumption.
  • Context Bloat: Context doesn't just grow; it accelerates. Over a single development session, the amount of context the model must attend to grows 5.3-fold.
How context (cache-read tokens) accumulates over the course of a session vs. an individual task.
  • The Invisible Subagent: When an agent delegates a task to a subagent, the parent log typically only records the subagent's final response. The authors found this undercounts the actual tokens processed by a factor of ten.

Key Results

The quantitative findings are a wake-up call for "Green AI" researchers:

  • The 25x Gap: Standard output-based estimators (like EcoLogits) estimated the workload at ~10 kWh. The authors' cache-aware model estimated it at ~250 kWh.
  • Task Costs: "Refactoring" tasks are the most expensive, consuming a median of 835k tokens per episode, largely because they require the agent to hold massive amounts of code in its "head" (context).
  • Potential Savings: The study found that simply starting each task from a "fresh" context (clearing the cache) would lower the energy estimate by about 60%, though this comes at the cost of the agent "forgetting" previous work.

Limitations and Future Work

The authors acknowledge several limitations:

  • Single-User Trace: The data comes from one engineer's workflow, which may not represent all software engineering styles.
  • Proprietary Models: Because models like Claude are "black boxes," the authors had to estimate their internal architectures (layer counts, etc.) based on public registries.
  • Modeled vs. Measured: The energy figures are analytical estimates, not direct hardware measurements, which are currently impossible for users of commercial cloud APIs.

Future Work: The researchers call for "workflow-level" energy accounting and suggest that tool vendors should provide users with per-request energy feedback to encourage more sustainable AI usage.

Summary updated

Abstract

As large language models (LLMs) evolve from conversational assistants into autonomous agents embedded in software development workflows, estimating their environmental footprint requires moving beyond conventional token-based accounting. Existing energy estimators focus on isolated request-response interactions, overlooking the repeated processing of accumulated context, cache reuse, and work delegated to subagents. We analyze nearly one billion tokens collected across 42 sessions and 752 task episodes over ten weeks of real-world AI-assisted software development. Cached-context reads make up 94.8% of all API-reported tokens, while uncached input accounts for only 0.017%; for every generated token, approximately 260 cached tokens are read. Context grows 5.3-fold over a session compared with 1.4-fold within individual tasks. To quantify the energy implications, we extend an existing analytical inference-energy model to account for cached-context processing, yielding a cache-aware hybrid estimator. It estimates approximately 250 kWh for the workload, compared with approximately 10 kWh from the output-based estimator EcoLogits, a 25-fold difference largely driven by cached-context reads. Neither estimator has been validated on long cached contexts, but no modeling assumption we varied closes the gap. Starting each task from a fresh context would lower our estimate by about 60%. We also find that parent-session logs report only a subagent's final internal call, undercounting delegated tokens by a factor of ten; for this workload the correction changes the energy estimate by about 5%, but token-volume studies are fully exposed to it. Our findings expose a substantial gap between how current energy estimators and agentic workloads treat context, highlighting the need for workflow-level energy accounting that captures context accumulation, cache reuse, and delegated execution.
BibTeX
@misc{vartziotis2026re,
  author = {Tina Vartziotis and Ketevan Peranidze and Rodopi Kosteli and Ezgi Sarikayak and George Dasoulas and Michael Keckeisen and Sotirios Kotsopoulos and Francesca Dominici},
  title = {{Re-Reading Is Not Free: Token Traces and Cache-Aware Energy Estimation for LLM Agents in Software Engineering}},
  year = {2026},
  eprint = {2611.20873},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.20873},
}
Figure