← Latest papers
🤖 machine learning

Counterexample Guided Learning in the Large using Reasoning Agents

This paper demonstrates that equipping LLM agents with counterexample-guided learning strategies, where a verifier provides specific feedback on incorrect regular expression candidates, significantly improves sample efficiency and success rates in complex symbolic induction tasks compared to standard prompting.

Original authors: Hongyi Liu, Frederic Sala, Thomas Reps, Adithya Murali

Published 2026-06-11
📖 5 min read🧠 Deep dive

Original authors: Hongyi Liu, Frederic Sala, Thomas Reps, Adithya Murali

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 trying to teach a very smart, but slightly confused, robot how to sort a pile of mixed-up toys. You want the robot to learn a specific rule, like "Keep all the red blocks and the blue cars, but throw away everything else."

In the past, you might have just shown the robot a few examples: "Here is a red block (keep it), here is a blue car (keep it), here is a green ball (throw it)." The robot would guess a rule. If it guessed wrong, you'd just show it more examples. This is like standard prompting: you keep feeding data, hoping the robot eventually figures it out.

This paper introduces a smarter way to teach the robot, called Counterexample-Guided Learning. Instead of just showing more random examples, the robot gets a "teacher" that acts like a strict proofreader.

The Core Idea: The "Proofreader" Teacher

Here is how the new method works, using a simple analogy:

  1. The Guess: The robot (the "Learner") looks at the examples you gave it and writes down a rule (a "Regular Expression," which is just a fancy way of saying a pattern description).
  2. The Check: A "Teacher" (a computer program that knows the actual correct rule) checks the robot's rule.
  3. The Counterexample (The "Gotcha!"): If the robot's rule is wrong, the Teacher doesn't just say "No." It finds a specific toy that the robot got wrong.
    • Example: The robot's rule says "Keep all red things." The Teacher finds a red ball that should be thrown away according to the true rule. The Teacher hands the robot this red ball and says, "Look! You kept this, but you shouldn't have. Fix your rule."
    • This specific mistake is called a Counterexample. It's a direct proof of why the current guess failed.

The Secret Sauce: "Clustered" Mistakes

The paper found that sometimes the robot makes the same type of mistake over and over. If the rule is "Keep all letters," and the robot forgets the letter 'Z', the Teacher could show it 'Z', 'A', 'B', 'C'... all at once. That's too much noise.

So, the authors invented Clustered Counterexamples. Instead of showing the robot 26 different letters that are wrong, the Teacher says, "You are missing the whole category of Letters." It groups similar mistakes together into a single, powerful clue. This helps the robot understand the pattern of its error rather than just memorizing a list of bad examples.

The "Agent" Workflow: Reflection and Repair

The paper also gives the robot a "brain" that can think about its own thinking. This is called an Agentic Workflow. It happens in two loops:

  • Reflection (The "Pause and Think"): After the Teacher points out a mistake, the robot is asked to stop and explain why it made that mistake. "Oh, I thought 'red' meant 'all red things,' but the rule actually meant 'red blocks only'." This helps the robot learn the logic, not just the answer.
  • Repair Loop (The "Do-Over"): If the robot's new rule still has a syntax error (like a typo) or still gets an example wrong, the system doesn't give up. It sends the robot back to the drawing board with a specific note: "Your rule has a typo here, and you still got that red ball wrong. Try again." The robot keeps trying until it gets it right.

What They Found

The researchers tested this on two types of "toy sorting" tasks:

  1. Simple Rules: Basic patterns (like "red blocks").
  2. Complex Rules: Tricky patterns with lots of nested conditions (like "red blocks that are also square, but not if they are shiny").

The Results:

  • Standard teaching (just showing examples) failed miserably on the complex rules. The robot got stuck guessing the wrong patterns.
  • Counterexample teaching (using the "Gotcha!" feedback) made the robot much better. It needed far fewer examples to learn the complex rules.
  • The "Agent" method (Reflection + Repair) was the winner. On the hardest tasks, the success rate jumped from a tiny 3.2% (with standard teaching) to 38.1%. On another set of hard tasks, it jumped from 38.9% to 74.1%.

The Bottom Line

The paper claims that Large Language Models (LLMs) are great at guessing, but they struggle when they just get more data. They need rich, structured feedback that tells them exactly where and why they are wrong.

By treating the learning process like a game of "Hot and Cold" with a strict teacher who points out specific mistakes (and groups those mistakes together), and by giving the model a chance to reflect and repair its own work, we can teach it to solve complex symbolic puzzles that it previously couldn't handle.

In short: Don't just give the student more homework; give them a teacher who marks their specific errors, explains the logic, and lets them try again until they get it right.

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 →