Tech Tip #59: Batch your inference

An idle GPU waiting for one request at a time wastes power.

Video created by explainapaper.com

The problem

Serving a model one request at a time leaves the accelerator underused while it still draws substantial power. Energy per answer depends heavily on utilisation.

The fix you can use today

  • Batch concurrent requests with a serving engine built for it.
  • Queue non-interactive inference and process it in batches.
  • Cap generated tokens to what the task needs.

GreenCode researchers found batching among the easiest ways to save energy when serving an AI model.

Tools that help

  • vLLM: an LLM serving engine that batches concurrent requests to keep the accelerator busy
  • nvidia-smi: reports the power draw of NVIDIA GPUs from the card's own sensors
  • CodeCarbon: a Python package that estimates the energy and CO2 of a run from hardware power and regional grid intensity

How GreenCode helps

GreenCode helps tackle this by keeping its own AI lean: small fine-tuned models, each request sent to the smallest part that can do it, and heavy jobs held for cleaner power. More on this.

Tags

#llm#inference#gpu#performance

Sources

Transcript

An AI chip waiting for one request at a time wastes power. Many teams serve a model one request at a time. The chip sits half empty. But it still draws a lot of power. So the energy per answer depends on how busy you keep it. Here is the fix you can use today. First, batch requests that arrive together. Use a serving engine built for that, such as vLLM. Second, queue work that nobody is waiting for, and run it in batches. Third, cap the length of answers to what the task needs. Fewer words generated means less work for the chip. Check the gain, using tools like nvidia-smi and CodeCarbon. GreenCode researchers found batching among the easiest energy savings for serving AI. GreenCode helps tackle this by keeping its own AI lean. Requests go to the smallest part that works, and heavy jobs wait for cleaner power. That was GreenCode Tech Tip number fifty-nine. Follow for the next tip, and find more on greencode.ai/tech-tips.

All GreenCode Tech Tips · All GreenCode videos

  • Tip #59
  • For Ops and infrastructure
  • Length 1:06
  • Category AI and machine learning
GreenCode

Want this checked on your own system? Talk to the GreenCode team.

Get in touch