LLMs are used for classification
Describe the task in a few sentences, add the text to classify, and the model returns a label. Researchers and companies now label data this way at scale.
Social science
Coding tweets and news articles. ChatGPT beat crowd workers on most tasks, at about a thirtieth of the cost.
Gilardi et al., 2023With hundreds of models to choose from, which ones should we use?
An LLM classifier is a noisy measurement instrument
Two models can give different answers to the same question, and so can one model asked twice. Every answer costs money.
We treat each model, with its prompt and settings, as an instrument: each call is a noisy measurement of the true label, at a price.
Which LLMs should we ask, and in what order?When should we stop?
We call the combination of LLM classifiers a circuit
Combining classifiers is a classic problem in machine learning. Each LLM classifier runs on its own hardware, so we call their combination a circuit.
Majority voting, routing and cascades are circuits, and so is LMCircuit, the method of this paper. They differ in which models they ask, in what order, and how they turn the answers into one prediction.
A circuit decides which model to query next and when to stop
After each answer, the circuit either asks another model or stops and predicts. If we care about cost, asking one model at a time loses nothing.1
1 If we care about speed, asking several models in parallel is faster.
The best circuit is the solution of a dynamic program
Each answer changes what the next call is worth, so the choices form a tree. The dynamic program finds the best tree by working backward from the predictions.
It weighs the cost of one more answer against how much that answer lowers the chance of a mistake. Prioritize accuracy and the circuit asks more. Prioritize cost and it asks less.
Any circuit gets better with a little routing
Prompts differ in difficulty. Some are easy for every model and others split them, so one plan for every prompt wastes money.
LMCircuit adds a small prompt classifier. It reads the prompt and predicts the label and which models will get it right. It trains in minutes and runs on a CPU.
LMCircuit is a prompt classifier and a dynamic program
We fit the prompt classifier once. For any setting, from prioritize cost to prioritize accuracy, the dynamic program turns its estimates into a circuit. LMCircuit offers continuous control over how to weigh accuracy vs. cost, tracing the entire frontier.
The prompt classifier reads a text embedding of the prompt (Qwen3-Embedding-0.6B) and the answers collected so far. It returns the chance the prompt is harmful and the chance each model gets it right. It is trained on labelled prompts and recorded model answers.
LMCircuit achieves higher accuracy at nearly every budget
It is more accurate than every single model and than eight routing and cascading methods. Here are five of the seven tasks: four judged by open-weight models and one by decision models.
LMCircuit trains in 3 minutes or less on every task. Several of the baselines take hours.
Time to build each method
LMCircuit's decisions are calibrated
When LMCircuit is 70% sure of a label, it is right about 70% of the time.
We are going through a revolution in classification.
Hundreds of models can now label text on demand, at prices that differ more than a thousandfold. Used together, a few of them are more accurate than any one of them at the same cost.
We show that the best circuit leans on the model that gives the most information per dollar.
* Equal contribution.










