Robust Batch-Level Query Routing for Large Language Models under Cost and Capacity Constraints
Organizations: LinkedIn · MIT
Abstract
We study the problem of routing queries to large language models (LLMs) under cost, GPU resources, and concurrency constraints. Prior per-query routing methods often fail to control batch-level cost, especially under non-uniform or adversarial batching. To address this, we propose a batch-level, resource-aware routing framework that jointly optimizes model assignment for each batch while respecting cost and model capacity limits. We further introduce a robust variant that accounts for uncertainty in predicted LLM performance, along with an offline instance allocation procedure that balances quality and throughput across multiple models. Experiments on two multi-task LLM benchmarks show that robustness improves accuracy by 1-14% over non-robust counterparts (depending on the performance estimator), batch-level routing outperforms per-query methods by up to 24% under adversarial batching, and optimized instance allocation yields additional gains of up to 3% compared to a non-optimized allocation, all while strictly controlling cost and GPU resource constraints.
Figures & tables
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| LLM | Input $/1M tokens | Output $/1M tokens |
|---|---|---|
| DeepSeek-Chat | 0.14 | 0.28 |
| DeepSeek-Coder | 0.14 | 0.28 |
| Gemini-1.5-Flash | 0.075 | 0.30 |
| GLM-4-Air | 0.137 | 0.137 |
| GLM-4-Flash | 0.0137 | 0.0137 |
| GLM-4-Plus | 6.85 | 6.85 |
| LLM | Average Cost Per Query |
|---|---|
| WizardLM-13B-V1.2 | 0.0001417 |
| Claude-Instant-V1 | 0.0012362 |
| Claude-V1 | 0.0058702 |
| Claude-V2 | 0.0061528 |
| GPT-3.5-Turbo-1106 | 0.0007086 |
| GPT-4-1106-Preview | 0.0079425 |
| LLM | Profile / Description |
|---|---|
| gpt-3.5-turbo-1106 | Released by OpenAI in November 2023, GPT-3.5-turbo-1106 is a proprietary chat-optimized large language model in the GPT-3.5 family, designed for efficient conversational and general text generation tasks. It supports function calling and improved JSON-structured outputs, and is trained on a mixture of licensed data, human-created data, and publicly available text. |
| claude-instant-v1 | Released by Anthropic in 2023, Claude-Instant-v1 is a proprietary lightweight conversational language model designed for low-latency and cost-efficient deployments. It emphasizes fast response times, summarization, document analysis, and general dialogue capabilities, while maintaining Anthropic’s “helpful, honest, and harmless” alignment philosophy. |
| claude-v1 | Introduced by Anthropic in March 2023, Claude-v1 is a proprietary large language model designed for conversational AI, reasoning, summarization, and instruction following. It was among the first models trained using Anthropic’s constitutional AI framework, prioritizing safety and controllability. |
| claude-v2 | Released by Anthropic in mid-2023, Claude-v2 improves upon Claude-v1 with stronger reasoning, coding ability, and longer context handling. It supports larger context windows and delivers improved performance on math, logic, and complex instruction-following tasks. |
| gpt-4-1106-preview | Released by OpenAI in November 2023, GPT-4-1106-preview is a proprietary preview model from the GPT-4 Turbo family, optimized for faster inference and lower cost while retaining GPT-4-level reasoning. It supports function calling and improved JSON output reliability. |
| llama-2-70b-chat | Released by Meta AI in 2023, LLaMA-2-70B-Chat is an open-weights 70B-parameter model fine-tuned for dialogue using supervised fine-tuning and reinforcement learning from human feedback. It is widely adopted due to open licensing and competitive performance. |
LLM Routing
Large language model routing selects models, tools, experts, or inference strategies to balance answer quality, cost, latency, and deployment constraints.
See all 349 papers