← Latest papers
🤖 AI

Formalize, Don't Optimize: The Heuristic Trap in LLM-Generated Combinatorial Solvers

This paper argues that Large Language Models should be used primarily to formalize combinatorial problems for verified solvers rather than to generate search heuristics, as attempts at direct optimization often introduce a "heuristic trap" that significantly reduces solution correctness and reliability.

Original authors: Haoyu Wang, Yuliang Song, Tao Li, Zhiwei Deng, Yaqing Wang, Deepak Ramachandran, Eldan Cohen, Dan Roth

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

Original authors: Haoyu Wang, Yuliang Song, Tao Li, Zhiwei Deng, Yaqing Wang, Deepak Ramachandran, Eldan Cohen, Dan Roth

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 solve a massive, complex puzzle, like a 1,000-piece jigsaw where the pieces are constantly changing shape. You have a very smart, well-read assistant (the Large Language Model, or LLM) who knows a lot about puzzles but has never actually built one before.

The paper asks: How should we ask this assistant to help us?

Should we ask them to:

  1. Build the whole machine from scratch to solve the puzzle (write their own search algorithm)?
  2. Describe the puzzle to a professional machine that already knows how to solve it (write a formal model for a solver)?
  3. Describe the puzzle to that machine, but also try to give the machine "tips" on how to solve it faster (add heuristics)?

The researchers built a giant test suite called CP-SynC-XL with 100 different types of puzzles and nearly 5,000 specific instances to test three different ways of asking the AI for help. Here is what they found, translated into everyday terms.

1. The "Translator" Wins (Don't Let the AI Drive)

The study compared three "languages" the AI could use to talk to the puzzle-solving machine:

  • Native Python: The AI writes its own code to solve the puzzle from scratch.
  • Python + OR-Tools: The AI writes a description of the puzzle using a specific toolkit (OR-Tools) that hands the actual solving work to a powerful, verified engine.
  • MiniZinc + OR-Tools: The AI writes a very formal, high-level description of the puzzle (MiniZinc) that also hands the work to the same powerful engine.

The Result:
The "Python + OR-Tools" approach was the clear winner. It was like asking the AI to be a translator who speaks the language of the puzzle perfectly, then handing the map to a professional driver (the solver) who knows exactly how to navigate the terrain.

  • Why? The AI is great at understanding the rules and writing them down clearly, but it is terrible at driving the car itself. When the AI tried to write its own driving instructions (Native Python), it often got lost, took wrong turns, or crashed.
  • The Surprising Twist: Even though MiniZinc is a "fancier" language designed specifically for puzzles, the AI struggled to speak it fluently. It made more translation errors in MiniZinc than in the simpler Python + OR-Tools approach. It's like the AI is fluent in "English" (Python) but stammers when trying to speak "French" (MiniZinc), even though the destination is the same.

2. The "Heuristic Trap" (The Danger of "Helpful" Tips

The researchers also tested what happens if you tell the AI: "Please not only solve this, but also try to make it faster!" This is called a heuristic prompt.

The Result:
This was a trap.

  • The Illusion: On average, the solutions were only slightly faster (about 3% to 12% faster). It looked like a small win.
  • The Reality: The results were bimodal (two distinct groups).
    • Group A: Some puzzles got solved a bit faster.
    • Group B: Many puzzles got slower or the AI started giving wrong answers.
  • The Analogy: Imagine asking a chef to "cook this dinner faster."
    • Sometimes they just chop vegetables more efficiently (good).
    • Sometimes they skip a crucial step, like checking if the meat is raw, because they are rushing (bad).
    • Sometimes they add so many "time-saving" gadgets to the kitchen that the stove catches fire (very bad).

The paper found that when the AI tries to optimize, it often invents "rules" that aren't true. For example, it might say, "I know the answer must be less than 50," when it actually has no proof. The solver then wastes time looking for a solution under 50, misses the real answer, or gives up entirely.

3. The "Silent Failures" (When the AI Lies Confidently)

One of the most dangerous findings is how the AI fails.

  • Native Python: The AI often returns a solution that looks perfect (the right format) but is actually wrong. It's like a student who writes a beautiful essay but got the math wrong. The paper calls this a "schema-valid but verifier-rejected" solution.
  • Solver-Backed (Python/MiniZinc): When the AI uses the professional solver, it's much harder for it to lie. If the solver says "No solution," the AI has to admit it. If it says "Here is the answer," the answer is usually mathematically sound for the model the AI wrote.
  • The Catch: The AI still makes mistakes in writing the model. It might forget a rule or misunderstand a constraint (like thinking "no edge" means "0" when it actually means "infinity"). This leads to the solver finding a perfect solution to the wrong puzzle.

The Main Takeaway: "Formalize, Don't Optimize"

The paper concludes with a simple design principle for using AI on hard logic problems:

Use the AI as a Translator, not a Driver.

  • Do: Ask the AI to take the messy, natural-language problem description and turn it into a clean, formal set of rules (variables, constraints, objectives) for a proven solver.
  • Don't: Ask the AI to invent new search strategies, speed up the engine, or guess shortcuts.

If you want the AI to "optimize" the search, you are asking it to drive the car while it's still learning how to read the map. The paper suggests that any "optimization" the AI writes should be double-checked by a human or a separate system before you trust it, because the AI is very good at confidently inventing rules that don't actually exist.

In short: Let the AI write the recipe, but let the professional chef (the verified solver) do the cooking. Don't ask the AI to try to cook faster by skipping steps.

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 →