Green Optimised Generative AI

A tool that uses AI to cut software energy has to answer for its own. GreenCode runs on small, tuned, retrieval-fed models, routes each request to the cheapest component that can answer it, and schedules the heavy work for when the power is clean.

The obligation that comes with using AI

Generative AI is the fastest-growing energy demand in computing. A project that proposes to spend inference in order to save electricity therefore has a plain obligation: the cure has to cost decisively less than the disease, and the arithmetic has to be published. GreenCode's carbon accounting, built on the providers' own published energy figures, puts the inference for a run at well under a thousandth of the first year's saving even on a very generous token allowance, and that ratio only holds because the generative parts of the pipeline are engineered to be frugal.

This is a cross-cutting feature rather than a single stage. Generative models do the refactoring in the quality stage, write the missing documentation, tests and commit messages, generate infrastructure templates and load-test plans, and rewrite the hotspots the energy benchmark identifies. Every one of those components is pluggable, so a cheaper or better model can replace an incumbent as the field moves, without rebuilding the pipeline around it.

Small models, given only what they need

The largest general-purpose model is almost never the right instrument for a narrow code task. The project's review of the state of the art points the same way: task-specific, fine-tuned models in the 3B to 13B parameter class match far larger ones on constrained coding work, at a fraction of the energy per token, and they are small enough to run on a customer's own hardware where the code cannot leave the building.

The choices that keep AI inference small, attributed down through the systemView full size
Four choices do most of the work.

What reaches the model matters as much as its size. Four choices do most of the work.

  • Domain-specific coding models are tuned for the languages and idioms of the estate being treated, rather than asked to be good at everything.
  • Retrieval from a vector knowledge base built on the codebase index supplies the relevant fragment instead of whole files, so the token count reflects the task rather than the repository.
  • Mixture-of-experts routing sends each request to the smallest component capable of answering it, so a full model is not activated for a trivial edit.
  • Training-data refinement removes redundant and low-value examples before tuning, which shortens training runs and the energy they consume.

Compression, hardware and timing

Beyond the model itself, the pipeline applies compression techniques such as quantisation and distillation, and hardware-aware optimisation so that a deployment is tuned to the accelerator, server or constrained device it will actually run on. The same build therefore behaves sensibly in a cloud region, in a private data centre and on limited on-premise hardware.

Timing is the last lever. Because the pipeline analyses a codebase asynchronously rather than answering a developer keystroke by keystroke, intensive jobs can wait for low-carbon power and run when the grid is clean. Nothing is blocked on the result in the next second, so that flexibility is close to free.

How it is measured

Claims about efficient AI are easy to make and rarely tested, because the usual code-generation benchmarks score correctness and ignore what the generated code costs to run. Partner work on EnergyBench addresses exactly that, scoring generated code for correctness and for energy together, so a model that writes working but wasteful code is not recorded as a success.

Inside the pipeline, the energy of each run is modelled and reported alongside the saving it produced, using the accounting published in the climate case. A pre-assessment compares the two before a run is committed, and where the return does not justify the inference, the honest answer is not to run it.

People stay in charge

Every change the AI makes arrives on a branch as a pull request, with the reasoning behind it, and the team accepts or rejects it. Nothing is merged unseen and nothing runs as a black box. The pipeline builds on existing open models rather than training its own from scratch, treating their training as a cost already spent and adapting them by pruning and fine-tuning for code. Who owns AI-written code is still an open legal question; because people review and approve every change and most of the original code remains, the usual position of a codebase is preserved, as the FAQ explains.

Why it matters beyond this pipeline

Small tuned models, retrieval instead of brute-force context, routing to the cheapest capable component and scheduling against the energy mix are the methods that make AI viable inside a fixed energy budget, at the edge, on battery power and on constrained hardware. They are the substance of green AI and energy-aware computing, and the techniques are one of the deliverables GreenCode will bring out of the project.

To discuss the methods or trial them on your own workload, get in touch through the contact page.

  • Where it applies every generative stage of the pipeline, from refactoring to hotspot rewriting
  • Model class used on premise 3B to 13B parameter code models, fine-tuned per task
  • Share of the saving spent on inference about 0.25%
  • Techniques retrieval, mixture-of-experts routing, compression, hardware-aware optimisation
  • Measured by EnergyBench, which scores generated code for correctness and energy
GreenCode

Want this benefit for your own systems? Talk to the GreenCode team about a trial.

Get in touch