Generating Energy-efficient code with LLMs

Tom Cappendijk, Pepijn de Reus, Ana Oprescu
11/15/2024
cs.SEcs.AI

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

The increasing electricity demands of personal computers, communication networks, and data centers contribute to higher atmospheric greenhouse gas emissions, which in turn lead to global warming and climate change. Therefore the energy consumption of code must be minimized. Code can be generated by large language models. We look at the influence of prompt modification on the energy consumption of the code generated. We use three different Python code problems of varying difficulty levels. Prompt modification is done by adding the sentence ``Give me an energy-optimized solution for this problem'' or by using two Python coding best practices. The large language models used are CodeLlama-70b, CodeLlama-70b-Instruct, CodeLlama-70b-Python, DeepSeek-Coder-33b-base, and DeepSeek-Coder-33b-instruct. We find a decrease in energy consumption for a specific combination of prompt optimization, LLM, and Python code problem. However, no single optimization prompt consistently decreases energy consumption for the same LLM across the different Python code problems.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{cappendijk2024generating,
  title  = {Generating Energy-efficient code with LLMs},
  author = {Tom Cappendijk and Pepijn de Reus and Ana Oprescu},
  year   = {2024},
  eprint = {2411.10599},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.10599v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2411.10599.svg)](https://codeofpaper.com/paper/2411.10599)

Discussion