← Latest papers
🤖 machine learning

Error-Driven Prompt Optimization for Arithmetic Reasoning

This paper introduces an error-driven prompt optimization framework that significantly enhances the arithmetic reasoning capabilities of on-premises small language models, enabling them to outperform larger models like GPT-3.5 Turbo in privacy-compliant industrial settings without requiring costly fine-tuning.

Original authors: Árpád Pándy, Róbert Lakatos, András Hajdu

Published 2026-05-26
📖 5 min read🧠 Deep dive

Original authors: Árpád Pándy, Róbert Lakatos, András Hajdu

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

The Big Picture: A Local Accountant vs. The Cloud Giant

Imagine you have a very smart, but slightly forgetful, local accountant (a Small Language Model or SLM) who works in your secure office. You also have a super-genius consultant (a Large Language Model like GPT-3.5) who lives in a giant cloud office.

The problem? Your company deals with sensitive financial data. You cannot send this data to the cloud consultant because of privacy rules. You must keep everything in your local office.

However, your local accountant is terrible at math. If you ask, "What is the percentage change in revenue?" they might guess the number or get the units wrong (saying "million" instead of "percent"). They are fast and private, but not accurate enough for serious work.

This paper introduces a clever training method to turn that forgetful local accountant into a math wizard, without sending their data to the cloud or paying for expensive retraining.

The Strategy: "Code, Don't Guess"

The researchers realized that asking the accountant to just "think" about the math was the problem. Instead, they taught the accountant to act like a programmer.

  1. The Old Way: "Here is a table of numbers. Tell me the answer." (The accountant guesses).
  2. The New Way: "Here is a table. Write a short computer script (Python code) that does the math for you, then run it."

This is like giving the accountant a calculator instead of asking them to do long division in their head. The computer code is perfect at math; the accountant just has to write the instructions correctly.

The Secret Sauce: Learning from Mistakes (The "Error-Driven" Loop)

Even with the calculator, the accountant still made mistakes. Sometimes they wrote the wrong formula, or they got the "scale" wrong (saying the answer is in "thousands" when it should be "percent").

The paper's main innovation is a systematic "Mistake Detective" process:

  1. Run the Test: The accountant tries to solve 497 financial questions.
  2. Catch the Errors: The system looks at the questions the accountant got wrong.
  3. Group the Clues: Instead of looking at every mistake individually, the system groups similar mistakes together.
    • Analogy: Imagine a teacher grading a test. Instead of saying "You got question 5 wrong," they notice, "Oh, every student who got question 5 wrong also got question 12 wrong because they all forgot to divide by 100."
  4. Write a Rule: For each group of mistakes, the researchers write a specific rule to fix it.
    • Example Rule: "If the question asks for 'percentage change,' the answer must be in 'percent,' not 'dollars'."
  5. Try Again: They add this rule to the accountant's instructions and run the test again.
  6. Repeat: They keep finding the biggest group of remaining mistakes, writing a new rule, and testing until the mistakes stop improving.

The Results: Beating the Big Guy

By following this "find the mistake, write a rule, repeat" cycle, the researchers achieved something surprising:

  • The Starting Point: The local accountant (Qwen3 4B) started with an accuracy of about 30% (barely better than guessing).
  • The Improvement: After adding just three specific rules derived from their mistake analysis, the accuracy jumped to 70.8%.
  • The Victory: This local, private accountant outperformed the giant cloud consultant (GPT-3.5 Turbo), which only scored 66.2%.

The "Too Many Rules" Trap

The paper also discovered an important limit. Imagine you give your accountant a rulebook.

  • Too few rules: They make simple mistakes.
  • Just the right number of rules: They are perfect.
  • Too many rules: The accountant gets confused. The rulebook becomes so thick and complex that they start ignoring the rules or mixing them up.

The researchers found an "optimal number" of rules. Adding more rules after this point actually made the performance worse. It's like trying to memorize a 50-page instruction manual for a simple task; you just get overwhelmed.

Summary of Claims

  • Privacy First: You can build a highly accurate AI for sensitive data (finance, health) that stays entirely on your own computer (on-premises).
  • No Expensive Training: You don't need to spend millions retraining the model. You just need to analyze its errors and write simple text rules to fix them.
  • Small Can Beat Big: A small, efficient model, when guided by the right "error-driven" rules, can do a better job at arithmetic reasoning than a massive, expensive model.
  • The Method: The key is Code Generation (making the AI write code to do the math) combined with Iterative Prompt Optimization (systematically fixing the AI's specific types of mistakes).

In short, the paper shows that you don't need a bigger brain to solve math problems; you just need a better set of instructions that help the brain avoid its specific blind spots.

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 →