BT-APE: A Computationally Light Backtracking Approach to Automatic Prompt Engineering for Requirements Classification
The paper proposes BT-APE, a computationally efficient backtracking-based framework for automatic prompt engineering that achieves accuracy comparable to state-of-the-art methods in requirements classification while significantly reducing token consumption and execution time.
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 stubborn, robot how to sort a pile of mixed-up letters. Some letters are about "what the system should do" (Functional), some are about "how well it should do it" (Quality), and some are about "keeping things safe" (Security).
In the past, humans had to write the instructions (called prompts) for the robot by guessing and checking. They would say, "Here is a letter, tell me what it is," and if the robot got it wrong, the human would tweak the sentence slightly and try again. This was slow, inconsistent, and relied heavily on the human's gut feeling.
This paper introduces a new, lighter way to teach the robot called BT-APE (Backtracking Automatic Prompt Engineering). Here is how it works, using simple analogies:
1. The Problem: The "Guess-and-Check" Trap
Imagine you are trying to find the perfect recipe for a cake. Instead of just baking one, tasting it, and changing the sugar, you have a robot baker.
- Old Way: You write a recipe, the robot bakes, you taste it, and you manually rewrite the recipe. You might get stuck writing a recipe that is too long or confusing, and you don't know why it's failing.
- The Issue: In the world of software requirements (the "letters" in our story), humans were doing this manual rewriting for years. It was hit-or-miss.
2. The Solution: BT-APE (The "Smart Hiker")
The authors created a system where the robot helps write its own instructions. But instead of just wandering aimlessly, BT-APE acts like a smart hiker looking for the highest peak (the best performance).
Here is the hiker's strategy:
- The Map (The Prompt): The hiker starts with a basic map (a simple instruction).
- The Compass (The Feedback): The hiker tries the map on a small group of test letters. If the robot gets them wrong, the hiker notes exactly which ones were wrong.
- The "Balanced" View: Crucially, the hiker doesn't just look at the mistakes. They look at a balanced batch: one letter the robot got right, one it got wrong, and one from each category. This ensures the robot sees the full picture, not just the failures.
- The "Backtracking" Trick: This is the paper's secret sauce. Imagine the hiker is climbing a hill but keeps slipping down a dead-end path.
- Old methods might keep walking forward, hoping to get lucky, or give up immediately.
- BT-APE says: "Okay, I've tried this path three times and it hasn't gotten better. I'm going to backtrack to the last good spot I found and try a different direction from there."
- This prevents the system from wasting time on bad ideas.
3. The Race: BT-APE vs. The Heavyweight Champion
The researchers compared their "Smart Hiker" (BT-APE) against two other competitors:
- The Manual Writers: Humans writing instructions (Zero-shot, Few-shot, Chain-of-Thought).
- The Heavyweight Champion (PE2): Another automatic system that is very powerful but very heavy. It carries a massive backpack of every single instruction it has ever tried to decide the next step.
The Results:
- Accuracy: The Smart Hiker (BT-APE) and the Heavyweight Champion (PE2) reached the exact same peak. They were equally good at sorting the letters. Both crushed the Manual Writers.
- The Weight Difference: Here is the big win. The Heavyweight Champion carried a huge backpack, consuming a lot of energy and time. The Smart Hiker (BT-APE) carried a tiny, lightweight pack.
- BT-APE used 72% fewer "words" (tokens) to get the same result.
- It finished the job 66% faster.
- Why this matters: Because it is so light, you can run it on a small, local computer (like a laptop or a small server) without needing a massive, expensive cloud supercomputer. This is great for companies that need to keep their data private and can't send it to the cloud.
4. What Makes a Good Instruction?
The researchers also looked at the "recipes" the robot created to see what made them work. They found that the best instructions weren't long and fancy. They were:
- Short and Punchy: Like a military order.
- Action-Oriented: Full of verbs (e.g., "Identify," "Check," "Sort").
- Clear: Using punctuation like colons and dashes to organize thoughts.
- Simple: Avoiding complex, confusing sentence structures.
5. Do You Need an Expert to Start?
The team tested two starting points:
- The Expert Start: Giving the robot a highly detailed, textbook-perfect definition of the categories from the start.
- The Beginner Start: Giving the robot a very simple, vague definition (e.g., "Functional means what the system does").
The Surprise: It didn't matter much. Even if you started with the "Beginner" vague definitions, the robot's iterative process (the hiker climbing and backtracking) was smart enough to figure out the perfect definitions on its own. The final result was almost the same as starting with the expert definitions.
Summary
This paper shows that we don't need to be prompt-writing wizards or use massive, expensive computers to get great results with AI. By using a lightweight, backtracking method, we can automatically teach AI to sort software requirements just as well as the most advanced methods, but with a fraction of the cost and time. It's like swapping a heavy, fuel-guzzling truck for a nimble, electric scooter that gets you to the same destination.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.