A Controlled Experiment on the Energy Efficiency of the Source Code Generated by Code Llama
Vlad-Andrei Cursaru, Laura Duits, Joel Milligan, Damla Ural, Berta, Rodriguez Sanchez, Vincenzo Stoico, Ivano Malavolta

TL;DR
This study empirically evaluates the energy efficiency of source code generated by Code Llama across different programming languages and prompts, revealing that generated code often underperforms human-written code in energy efficiency.
Contribution
The paper provides the first objective assessment of Code Llama's energy efficiency, highlighting language and problem dependence, and showing prompts do not reliably improve efficiency.
Findings
Human code is generally more energy efficient than generated code.
JavaScript generated by Code Llama can outperform human JavaScript in energy efficiency.
Prompting Code Llama for energy-efficient code does not consistently improve energy efficiency.
Abstract
Context. Nowadays, 83% of software developers use Large Language Models (LLMs) to generate code. LLMs recently became essential to increase the productivity of software developers and decrease the time and cost of software development. Developers ranging from novices to experts use LLM tools not only to detect and patch bugs, but also to integrate generated code into their software. However, as of today there is no objective assessment of the energy efficiency of the source code generated by LLM tools. Released in August 2023, Code Llama is one of the most recent LLM tools. Goal. In this paper, we present an empirical study that assesses the energy efficiency of Code Llama with respect to human-written source code. Method. We design an experiment involving three human-written benchmarks implemented in C++, JavaScript, and Python. We ask Code Llama to generate the code of the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsInternet of Things and Social Network Interactions · Energy and Environmental Systems
MethodsLLaMA
