← Latest papers
💬 NLP

Planning to Explore: Curiosity-Driven Planning for LLM Test Generation

The paper introduces CovQValue, a curiosity-driven planning method that treats code branch structure as an unknown environment and uses LLM-estimated Q-values to select informative test generation plans, significantly outperforming greedy approaches in achieving higher branch coverage on both existing and newly proposed benchmarks.

Original authors: Alfonso Amayuelas, Firas Laakom, Piotr Piękos, Wenyi Wang, Yifan Xu, Yuhui Wang, Jürgen Schmidhuber, William Wang

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

Original authors: Alfonso Amayuelas, Firas Laakom, Piotr Piękos, Wenyi Wang, Yifan Xu, Yuhui Wang, Jürgen Schmidhuber, William Wang

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 Problem: The "Greedy" Explorer

Imagine you are a treasure hunter exploring a massive, unknown castle. Your goal is to find every single hidden room and secret passage.

Most current AI tools (LLMs) used for writing computer tests act like greedy explorers.

  • How they work: They look at the hallway right in front of them. If they see a door that leads to a room they haven't visited yet, they walk through it immediately.
  • The flaw: What if the most valuable treasure is in a room deep inside the castle, but to get there, you first have to walk through a long, boring hallway with no doors?
  • The result: The greedy explorer gets stuck in the first few rooms. They keep opening the same easy doors because they only care about finding something new right now. They never realize that walking down that boring hallway is the only way to unlock the secret vault later.

In computer terms, this is called the "Corridor Problem." To reach deep, complex code, you often need to set up a sequence of steps (like logging in, initializing a database, or importing specific files). If you don't do these steps, you get zero "coverage" (you don't see any new code). Greedy AI stops trying because it thinks it's wasting time.

The Solution: The "Curious Planner" (CovQValue)

The authors of this paper propose a smarter approach called CovQValue. Instead of just looking at the next step, this AI acts like a strategic explorer with a map.

Here is how it works, using our castle analogy:

1. The Map (The Coverage Map)

Every time the AI tries a test, it updates a "map" of the castle. This map shows exactly which rooms (code branches) have been visited and which are still dark and unknown.

  • Old way: The AI forgets the map after every step.
  • New way: The AI constantly looks at the map to see where it has been and where it needs to go.

2. The "What If" Game (Planning)

Instead of picking just one door to open, the AI imagines three different adventure plans at once:

  • Plan A: Try to break the front door (easy, but maybe nothing new behind it).
  • Plan B: Walk down the long, boring hallway to the library (boring at first, but leads to a treasure room).
  • Plan C: Climb the tower (risky, might fall, but offers a new view).

3. The "Curiosity Score" (Q-Value)

This is the magic sauce. The AI doesn't just ask, "Which plan finds a new room right now?"
It asks: "Which plan will teach me the most about the castle in the long run?"

It gives a score to each plan based on two things:

  1. Immediate Gain: How many new rooms does this plan open today?
  2. Future Potential: If I do this plan, will it unlock future doors that are currently locked?

The Analogy:

  • Greedy AI sees the long hallway and says, "No new rooms here! I'll skip it."
  • CovQValue AI sees the hallway and says, "This hallway has no doors yet, but if I walk all the way to the end, I'll find the key to the Master Bedroom. I'll take this plan!"

How They Tested It

The researchers built a new "training ground" called RepoExploreBench. Imagine a set of 93 different, complex software "castles" (Python packages like Flask, Requests, and Pydantic).

They pitted the Greedy AI against the Curious Planner (CovQValue) using three different AI models (Gemini, GPT, and Mistral).

The Results:

  • The Greedy AI got stuck early. It explored the easy rooms and gave up, covering only about 30–50% of the castle.
  • The Curious Planner kept going. It was willing to take the "boring" steps to unlock the deep secrets. It covered 40% to 77% more of the code than the greedy approach.
  • The Trade-off: The Curious Planner was a bit more "risky." It tried harder, stranger things, so some of its tests failed (crashed). But because it was willing to crash to find the truth, it found way more hidden code than the cautious AI.

Why This Matters

This paper proves that AI needs to be patient and strategic, not just reactive.

  • For Software: It means we can automatically find bugs in deep, complex parts of code that humans and current tools miss.
  • For the Future: This "curiosity" isn't just for code. It could help robots explore unknown environments, scientists design new experiments, or AI agents learn to navigate complex real-world systems by planning ahead rather than just reacting to the immediate moment.

In a nutshell: Don't just look at the door in front of you. Look at the map, imagine the future, and be willing to walk down the boring hallway if it means finding the treasure at the end. That is the power of Curiosity-Driven Planning.

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 →