Skip to main content
OpenAI engineer reviews code on dual monitors, with graphs of question-complexity scores and cost metrics.

Editorial illustration for OpenAI Develops Script to Gauge Question Complexity for AI Efficiency

OpenAI's Smart Script Measures Question Complexity for AI

OpenAI script rates question complexity to reduce LLM inference costs

Updated: 3 min read

Every LLM call costs you money. But not all questions demand the same firepower. A simple “What’s the weather?” doesn’t need the same neural horsepower as a multi-step reasoning puzzle.

That’s the insight behind a deceptively elegant trick: let a cheap model rate each question’s complexity on a scale of 1 to 10, then route the easy ones to a smaller, cheaper model and save the heavy artillery for the hard stuff. The overhead? A single token.

The payoff? Dramatically lower inference costs without sacrificing response quality. This isn’t theory; it’s a five-line script that turns your OpenAI client into a smart dispatcher.

Example: from openai import OpenAI client = OpenAI() def get_complexity(question): prompt = f"Rate the complexity of the question from 1 to 10 for an LLM to answer. Provide only the number.\nQuestion: {question}" res = client.chat.completions.create( model="gpt-5.1", messages=[{"role": "user", "content": prompt}], ) return int(res.choices[0].message.content.strip()) print(get_complexity("Explain convolutional neural networks")) Output: 4 So our classifier says the complexity is 4, don't worry about the extra LLM call as this is generating only a single number. This complexity number can be used to route the tasks, like: complexity < 7 then route to a smaller model, else a larger model.

A single number, nothing more than a token of overhead, can unlock enormous savings. The beauty here is not in the complexity rating itself, but in the decision it enables. Route the simple to the small; reserve the heavy artillery for the hard stuff.

That’s it. No architectural gymnastics, no expensive fine-tuning pipelines. Just a smarter handshake between your query and your model fleet.

The math is brutally simple: cheaper models on most requests, premium models only when they actually matter. Your burn rate drops. Your response quality stays high.

And that extra call? It’s a rounding error in the ledger, a few cents that buy you dollars in efficiency. This isn’t about squeezing performance from the last drop of inference, it’s about letting each model do what it does best.

Let the little one handle the trivial. Let the giant flex only when provoked. That’s the real trick: not building a cheaper model, but building a cheaper *system*.

Common Questions Answered

How does OpenAI's script determine the complexity of a question for large language models?

The script uses a self-referential prompt that asks the AI to rate the complexity of a given question on a scale from 1 to 10. By leveraging the language model itself, the script can quickly assess the potential computational resources required to answer a specific query.

What is the primary goal of OpenAI's complexity assessment script?

The main objective is to manage computational efficiency by predicting the resource intensity of different questions before processing them. This approach helps developers optimize AI inference costs by identifying which queries might require more intensive computational resources.

What example does the script provide for assessing question complexity?

In the example, the script rates the complexity of the question 'Explain convolutional neural networks' as a 4 out of 10. This demonstrates how the tool can quickly estimate the computational load required to generate a response for a specific type of query.

LIVE01:25GLM-5.3 Scores 66.9 on DeepSWE v1.1, Trails Behind GPT-5 and Claude