• 01 September, 2026
  • GreenCode

New paper: GreenCode Constitution: Agent Principles for Optimizing Code and LLM Inference Energy Use

Large language models are good at rewriting code, but code optimisation with them has mostly chased speed, not energy. This paper gives an AI agent a written constitution for the job: five rules it may never break, with correctness first, and 37 energy anti-patterns in four tiers of severity, plus skill documents for each language and technology it meets. The agent measures a baseline with hardware energy counters, profiles the hot paths, plans ranked fixes, checks each change against the principles, measures again and keeps only what saves energy, leaving reviewable changes for developers. On llama.cpp, an already highly tuned LLM inference engine, it cut GPU energy by 4.7% (3.7% in total), showing that LLMs can reduce the energy of the software they run on. It also saved 28.4% on FFmpeg 4K transcoding, 9.4% on a data synthesis pipeline and 25.1% across 45 algorithmic problems in six languages. The constitution and its tooling are open source and published as a skill any agent can use.

Authors: Antheas Kapenekakis, Esther Hahyeon Kim, Dragos Ionescu, Bent Thomsen, Michele Albano

Contributing partner: Aalborg University

Publication page and citation