How far can an LLM router go? Part 0: the plan
I want to answer two questions. How much can an LLM router cut cost without hurting quality? And how well does it hold up when traffic grows? I’ll spend the next six weeks running experiments to find out, and I’ll share what I learn here each week. This post is the plan.
Why I’m doing this
The AI space is moving so fast, and it’s been really fun to watch. A big part of that change is inference: actually running a trained model to answer requests. Companies like Baseten build platforms that run open models in production, fast and cheap. The more I read about how they do it, the more curious I got.
As a backend engineer, I think about cost, latency and scale all the time. AI products have the same problems, just bigger. For example, a lot of AI apps send every prompt to the largest, most expensive model, even though many prompts are easy. That’s paying big-model prices for small-model work.
I want to understand what happens between sending a prompt and getting an answer back, not just how to call an API. Here’s the path one prompt takes:
Each step on that path adds some cost and some time. So instead of just reading about it, I’m going to train, measure and serve models myself, and share real numbers. In week 5, I’ll deploy on Baseten with their open-source tool, Truss, so I get to learn their workflow hands-on.
What I’m building
The end goal is a smart router: a small model that sends each prompt to the cheapest model that can still answer it well. It’ll have three routes:
- Easy: a small LLM answers the prompt.
- Plannable: a large LLM writes a short plan, and a small LLM does the work.
- Hard: the large LLM does the whole thing.
A model I train myself will pick the route. The goal is for it to rate how hard a prompt is in about 10 milliseconds.
The question I’m most curious about: when does “plan with a big model, do the work with a small one” beat just using the big model for everything? I’ll measure cost, quality and latency for each route to find out.
Why a small model is faster
A model writes its answer one token at a time. This is called decode. For every token, the GPU has to read all of the model’s weights from memory, and that read is the slow part. A small model has far fewer weights, so each token comes out faster and cheaper. So the router isn’t just about price. It also sends easy prompts to the model that answers faster. In week 6, I’ll measure how big that difference really is on the same GPU.
The plan, week by week
| Week | Topic | What I’ll build |
|---|---|---|
| 1 | Model types | Compare four kinds of text classifiers on tricky sentences, like sarcasm. |
| 2 | Evals and labels | Run about 2,000 prompts through a small, a medium and a large LLM, then label each one easy, plannable or hard. |
| 3 | Serving basics | Put my first model API in a Docker container and load test it. |
| 4 | Training | Fine-tune a small model on my labels. This becomes the difficulty predictor. |
| 5 | Deployment | Deploy the difficulty predictor on Baseten with Truss. |
| 6 | The router | Connect everything, add a simple UI, and measure each route. |
A few terms, in case they’re new:
- Fine-tune: train an existing model a bit more on your own data.
- Load test: send lots of requests at once to see how a service holds up.
- Truss: Baseten’s open-source tool for packaging and deploying models.
Every week, I’ll learn one concept, build one small experiment and write a short post about it. All the code and numbers will live in my models repo. See you in part 1 👋🏼