← Latest papers
💻 computer science

Less Is More: Measuring How LLM Involvement affects Chatbot Accuracy in Static Analysis

This paper demonstrates that in static analysis, using a schema-constrained JSON intermediate representation for translating natural language to query code significantly outperforms both direct generation and tool-augmented agentic approaches, particularly for large language models, by prioritizing structured constraints over increased token consumption.

Original authors: Krishna Narasimhan

Published 2026-04-24
📖 5 min read🧠 Deep dive

Original authors: Krishna Narasimhan

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 you are a detective trying to solve a crime, but you don't speak the language of the police database. You have a brilliant assistant (the AI) who understands your natural English questions perfectly, but the database only accepts very specific, rigid commands written in a strange code called CPGQL.

The paper asks a simple question: How much of the detective work should we let the AI do?

Should we let the AI write the code directly? Should we let the AI fill out a simple form that a human then translates? Or should we let the AI act like a robot, picking up tools one by one to solve the problem step-by-step?

The researchers tested three different ways to bridge the gap between your English question and the database's code. Here is what they found, explained with some fun analogies.

The Three Approaches

1. The "Direct Translator" (Approach A1)

The Analogy: You ask the AI, "Write me a letter to the bank." The AI tries to write the letter in the bank's secret code directly.

  • How it works: The AI looks at your question and tries to write the exact, complex code (CPGQL) needed to query the database.
  • The Problem: It's like asking someone who speaks English to suddenly write a legal contract in a language they've barely seen before. The AI often gets the grammar wrong, uses the wrong words, or creates a sentence that looks okay but means something totally different. It's too much freedom.

2. The "Form Filler" (Approach A2)

The Analogy: You ask the AI, "Fill out this specific form for the bank." The form has boxes like "Name," "Date," and "Reason." Once the AI fills it out, a human (or a simple computer script) takes that form and writes the perfect legal letter for the bank.

  • How it works: The AI doesn't write code. It just fills out a structured JSON form (a digital checklist) with specific answers like "Source: User Input" and "Destination: Database." A deterministic computer script then takes that form and turns it into the perfect code.
  • The Result: This was the winner. By forcing the AI to just fill in the blanks of a form, it made fewer mistakes. The AI didn't have to worry about the complex grammar of the code; it just had to understand your question and pick the right box.

3. The "Robot with Tools" (Approach A3)

The Analogy: You ask the AI to solve the problem, and it says, "Okay, I'll use my wrench, then my hammer, then my screwdriver." It tries to build the solution step-by-step, checking its work after every tool.

  • How it works: The AI is given a set of tools (like "find methods" or "trace data"). It picks a tool, gets an answer, picks another tool, and keeps going until it thinks it has the answer.
  • The Result: This was the worst option. Even though it tried the hardest and used the most energy (tokens), it failed the most.
    • Why? Imagine a chain of 10 links. If every link is 90% strong, the whole chain is only about 35% strong. Every time the AI picks a tool or interprets a result, it has a small chance of making a mistake. By the time it finishes the long chain of steps, the errors pile up, and the final answer is usually wrong. Plus, it took 8 times more money (computing power) to get a worse result.

The Big Surprises

1. Bigger isn't always better (unless you constrain them).
When they used the "Direct Translator" (A1), the huge, smart AI models (70B parameters) were still terrible at writing the code. They hallucinated nonsense.
However, when they used the "Form Filler" (A2), the huge models became superstars. They could perfectly fill out the form, and the computer script turned it into perfect code.

  • The Lesson: A smart person given a blank page will write a mess. A smart person given a fill-in-the-blank form will give you a perfect answer.

2. The "Small Model" Bottleneck.
The small, cheaper AI models (7B parameters) struggled with the "Form Filler" approach. They often filled out the form incorrectly (e.g., putting a date in the "Name" box). Because the form had to be perfect for the computer script to work, these small models hit a ceiling. They couldn't be precise enough to follow the rules.

3. More effort = Less success.
The "Robot with Tools" approach (A3) was the most expensive and took the longest, yet it got the lowest scores. It's like hiring a team of 10 people to carry a single box when one person could have done it perfectly if you just gave them a clear instruction. The extra steps just introduced more chances for things to go wrong.

The Takeaway

If you want to use AI to talk to complex, structured systems (like code analysis tools, databases, or legal systems):

Don't let the AI write the code.
Don't let the AI wander around with tools.

Instead, make the AI fill out a structured form.
Let the AI do what it's good at (understanding your English question), and let a simple, boring computer program do what it's good at (writing the strict code).

"Less is More": By giving the AI less freedom (constraining it to a form), you actually get more accuracy.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →