---
title: "New paper: GreenCode Constitution: Agent Principles for Optimizing Code and LLM Inference Energy Use"
description: "Aalborg University publishes \"GreenCode Constitution: Agent Principles for Optimizing Code and LLM Inference Energy Use\" in GreenAI workshop, European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases (ECML PKDD 2026)."
url: https://greencode.ai/news/paper-greencode-constitution-agent-principles-for-optimizing-code/
---

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

- 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](https://greencode.ai/researchers/antheas-kapenekakis/), [Esther Hahyeon Kim](https://greencode.ai/researchers/esther-kim/), [Dragos Ionescu](https://greencode.ai/researchers/dragos-ionescu/), [Bent Thomsen](https://greencode.ai/researchers/bent-thomsen/), [Michele Albano](https://greencode.ai/researchers/michele-albano/)

**Contributing partner:** [Aalborg University](https://greencode.ai/partners/aalborg-universitet/)

[Publication page and citation](https://greencode.ai/publications/greencode-constitution-agent-principles-for-optimizing-code-and-llm-inference-en/)

#### Categories

- All news **(43)**
- Publications **(25)**
- Project news **(14)**
- Articles **(4)**

#### Recent Post

- #### [greenai.guide: plain-English help for using AI with less energy](https://greencode.ai/news/greenai-guide/)

  [Read more](https://greencode.ai/news/greenai-guide/)
- #### [New paper: IP-Preserving Enterprise System Modernization via LLM-Driven Specification Extraction and Multi-target Code Generation](https://greencode.ai/news/paper-ip-preserving-enterprise-system-modernization-via-llm-driven/)

  [Read more](https://greencode.ai/news/paper-ip-preserving-enterprise-system-modernization-via-llm-driven/)
- #### [New paper: (How) Do Large Language Models Understand High-Level Message Sequence Charts?](https://greencode.ai/news/paper-how-do-large-language-models-understand-high-level-message-s/)

  [Read more](https://greencode.ai/news/paper-how-do-large-language-models-understand-high-level-message-s/)
- #### [GreenCode is now on YouTube and TikTok](https://greencode.ai/news/greencode-on-youtube-and-tiktok/)

  [Read more](https://greencode.ai/news/greencode-on-youtube-and-tiktok/)
