Beyond Accuracy and Cost: Latency-Aware LLM Query Routing for Dynamic Workloads
This paper proposes a latency-aware query routing system that integrates a lightweight estimator for time-to-first-token with a joint optimization strategy for accuracy, cost, and latency, achieving up to a 40% improvement in accuracy-cost utility without increasing response times compared to standard load-balancing methods.
Original paper licensed under CC BY 4.0 (http://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 you have a team of chefs, each with a different skill level and price tag. Some are master chefs who can whip up a Michelin-star meal but charge a fortune and take a long time. Others are quick, affordable line cooks who can make a decent burger in a flash. In the world of artificial intelligence, these "chefs" are Large Language Models (LLMs)—the brains behind chatbots that write stories, solve math problems, or summarize news. When you ask a question, a "router" decides which chef gets the job. The goal is simple: get the best answer for the lowest price.
But there's a catch that most routers have been ignoring until now: the line. Even if you pick the perfect chef, if they are already swamped with other orders, your food might sit in the kitchen for ages. In the AI world, this waiting time is called "latency." If you ask a chatbot a question while it's busy, you might stare at a spinning cursor for minutes. This is a problem because sometimes you need an answer now, not just a good one. The big question researchers are trying to solve is: How do we pick the right chef to get a great answer quickly, without breaking the bank, even when the kitchen is chaotic?
Enter a new study by researchers from Carnegie Mellon University and Microsoft that tries to fix this exact problem. They realized that current systems are great at balancing quality and cost, but they are "latency-agnostic," meaning they are blind to how long the line actually is. To fix this, the team built a clever, lightweight "simulator" that acts like a digital crystal ball. Instead of just guessing how busy a server is, this simulator watches the kitchen in real-time. It looks at how many orders are waiting, how long the current dishes take to cook, and even how the kitchen staff batches their work. It then predicts exactly how long it will take for your specific order to get its first bite of food (a metric they call "Time-to-First-Token").
By feeding this prediction into their routing system, the researchers created a smart dispatcher that doesn't just look at the menu price or the chef's reputation; it looks at the wait time, too. They tested this system with different types of questions and varying levels of kitchen chaos. The results were promising: their new method managed to improve the overall "value" of the answers (balancing quality, cost, and speed) by up to 40% compared to standard methods, all while keeping the wait times just as low as the best existing load-balancing tricks. In short, they found a way to make AI chatbots faster, cheaper, and smarter by finally paying attention to the line.
The core of their innovation is a tool they call "Serving Framework Simulation" (SFS). Think of it like a traffic controller for a busy highway. Old methods might just count how many cars are on the road and guess the travel time. But SFS is smarter; it simulates the actual driving conditions. It knows that some cars are fast but heavy (like long, complex questions), while others are light but numerous. It also knows that the highway has specific rules about how cars merge and how fast they can go. By simulating these rules, SFS can predict exactly when a new car will reach the exit ramp.
The researchers found that simply guessing based on how many cars are on the road (a method they call "throughput-based estimation") often leads to bad predictions. If the highway is clogged with slow, heavy trucks, a new car might get stuck even if the total number of cars isn't huge. Their simulation, however, accounts for this "traffic jam" effect. They tested their system on a variety of tasks, from writing short stories to summarizing long reports, and found that it consistently outperformed older methods. In their simulations, their approach improved the "OnTimeUtility"—a score that measures how good the answer was, how much it cost, and whether it arrived on time—by 33% to 40% over the best existing baselines.
One of the most interesting findings is how this system handles "bursty" traffic. Imagine a sudden rush of orders coming in all at once, like a lunchtime crowd. Older systems often get overwhelmed and send everyone to the cheapest, slowest chef, causing massive delays. The new system, however, dynamically shifts the load. It might send a simple question to a fast, cheap model because the line is short, while sending a complex, urgent question to a powerful model that has a slightly longer line but can finish the job faster overall. This flexibility allows it to maintain high performance even when the demand spikes.
The team also showed that their simulator is incredibly fast itself. It takes less than a millisecond to run the simulation and make a decision, which means it doesn't slow down the system it's trying to help. This is crucial because if the router takes too long to decide, it defeats the purpose of trying to save time. They verified that their predictions were accurate, with an error rate of less than 5% in their tests, which is a significant improvement over the 85% error rate they saw with older, simpler guessing methods.
Ultimately, this paper suggests that the future of efficient AI isn't just about building bigger models or finding cheaper ones; it's about being a better traffic manager. By combining the wisdom of "which model is best" with the reality of "how long the line is," we can create systems that feel instant and responsive, even under heavy load. While the results come from simulations and controlled experiments, the authors believe this approach offers a practical path forward for making AI services more reliable and user-friendly in the real world.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.