
Difficulty-aware LLM router
Sends each prompt to the smallest model that can answer it well.
37% less generation energy than always using the largest model
Problem
Running the largest model on every prompt wastes energy, because many prompts are easy enough for a small model.
My role
I designed and built the whole project myself: the energy measurements, the difficulty models, the router and the routing experiment. Dr. Ting Liu and Dr. Kate Meierdiercks were my faculty advisors, in Siena’s Summer 2026 “The Ethical Implications of AI” program.
What I built
- A CPU router that predicts prompt difficulty with TF-IDF, 10 handcrafted features and Ridge regression (Spearman 0.650).
- Per-model energy measurements with NVML on an RTX 2070 via Ollama: qwen2.5:0.5b 72.9 J, llama3.2:1b 128.0 J, llama3.2:3b 221.8 J, llama3.1:8b 486.6 J per generation.
- A router that costs under 10 mJ per prompt.
- A diagnosis of silent CodeCarbon measurement failures on AMD Windows and RAPL-locked Intel.
Result
The router cut generation energy by about 37% compared with always using the largest model, over 19,952 held-out prompts. Both were held to the same quality bar: 90% of prompts reach a model at least as large as their difficulty calls for. That bar comes from a difficulty score rather than graded answers, so grading the answers themselves is the next check.
Stack
Python, TF-IDF plus Ridge regression, Ollama, NVML, CodeCarbon.
Links
What I’d do differently
I’d analyze the model outputs more closely to see whether there’s more room to optimize. With more funding, I’d also test whether the savings change across CPUs with more threads and cores.