← Latest papers
💻 computer science

Smells Like Prompt Spirit: Evaluating Energy Efficiency and Performance of Local LLM Inference on CPU vs GPU

This empirical study demonstrates that while transitioning local LLM inference from CPU to GPU drastically improves energy efficiency and speed, it introduces hardware-induced nondeterminism that degrades code quality in 0-shot scenarios, a challenge effectively mitigated by 3-shot prompting to ensure stable and sustainable code generation.

Original authors: Simão Cunha, Francisco Ribeiro, Luís Cruz, João Saraiva

Published 2026-10-14
📖 5 min read🧠 Deep dive

Original authors: Simão Cunha, Francisco Ribeiro, Luís Cruz, João Saraiva

Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a world where the software that runs our modern lives is written not just by human hands, but by artificial intelligence. These digital assistants, known as large language models, have become so proficient at writing code that they are now part of the daily workflow for millions of developers. They can finish a sentence of programming, debug a broken function, or build a small program from a simple description. However, this convenience comes with a hidden cost. Every time these models think, they consume vast amounts of electricity, contributing to a growing carbon footprint that threatens the very environment we hope to protect. As the demand for these tools grows, scientists are asking a critical question: how can we make them faster and cheaper without burning up the planet?

To answer this, researchers recently set out to test how these artificial minds behave when moved from one type of computer hardware to another. For years, developers have known that running these models on specialized graphics chips, originally designed for video games, is much faster than running them on standard computer processors. But speed is only half the story. The team wanted to know if this switch to faster hardware also saved energy, and more importantly, if it changed the quality of the code the models produced. They were also curious about a subtle trick used in prompting: giving the model a few examples of the task before asking it to work. Does showing the model a sample of the work help it save energy, or does it just make the process longer?

The researchers took five different open-source coding models and put them through a rigorous test. They ran the same set of programming challenges on two very different machines: a standard computer processor and a powerful cluster of graphics cards. They measured exactly how much energy each run consumed, how long it took, and whether the code generated actually worked. They also compared two ways of asking the models for help. In the first method, they gave the model a task with no examples, a "zero-shot" approach. In the second, they provided three examples of similar tasks first, a "three-shot" approach, to guide the model's thinking.

The results were striking and revealed a clear trade-off between speed and stability. When the models were moved to the powerful graphics hardware, the difference in speed was almost unimaginable. The time it took to generate code dropped by more than 99 percent, turning processes that took seconds into fractions of a second. This massive speedup also led to a significant drop in energy use, with some tasks consuming nearly 90 percent less power than they did on the standard processor. It was a clear victory for efficiency. However, the story became more complicated when the researchers looked at the quality of the code.

When the models were asked to work without any examples, the switch to faster hardware caused them to behave unpredictably. Because the graphics chips process information in a different way than standard processors, the models sometimes produced code that was structurally different or simply failed to work, even though the settings were identical. It was as if the same person, asked to write a story in two different rooms, would come up with completely different endings. This inconsistency was most severe when the models were left to figure things out on their own.

The solution to this instability turned out to be surprisingly simple. When the researchers provided three examples before asking the model to write code, the behavior changed dramatically. The models became much more consistent, producing reliable results regardless of which computer they were running on. Furthermore, this method of showing examples also saved energy. By giving the model a clear path to follow, it avoided generating unnecessary chatter or long explanations that often clutter the output when no examples are provided. This "three-shot" approach trimmed the fat from the process, reducing energy consumption by over 60 percent in some tests and making the code generation both faster and more accurate.

The study ultimately suggests that simply buying faster hardware is not enough to solve the problems of energy and quality in artificial intelligence. While moving to powerful graphics cards makes the process incredibly efficient, it does not guarantee better results on its own. In fact, without the right guidance, the speed can come at the cost of reliability. The most effective strategy found was a combination of the two: using the powerful hardware for speed, but pairing it with a prompting style that gives the model a few examples to follow. This approach not only kept the energy usage low but also ensured that the code produced was stable and correct.

In the end, the research highlights that the future of green artificial intelligence depends on how we ask questions, not just what machines we use. By carefully designing how we interact with these models, we can harness their speed without sacrificing the quality of their work or the health of our planet. The path forward is not just about building bigger, faster computers, but about finding the right balance between the tools we use and the instructions we give them.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →