Apply to my task
arXiv:2602.11481 ★ 87 Feb 12, 2026

Compiler-Guided Refinement: Precise Feedback Beats General Instructions

Key result

The paradox: The researchers gave GPT-5 the Idris language docs — it solved 30 of 56 problems. Gave it a reference guide — 34. Pasted in the actual compiler errors and asked for fixes — 54. The difference isn't knowledge, it's the format of the feedback. The method lets you get precise results even with 10+ hard requirements (character limits, banned words, mandatory items) — exactly where a model usually lets something slip. The gist: use any strict verifier (compiler, linter, validator, tests, checklist) that gives precise feedback. The model generates → the verifier finds a problem → you paste the error into the prompt → the model fixes it. Repeat 3-15 times until it passes every check. From 39% accuracy on the first try to 96% after iterating.

01

TL;DR

Compiler-Guided Refinement is a way of working with an LLM through repeated iterations with precise feedback from a "strict checker". The researchers tested how GPT-5 learns Idris, a rare programming language: at first the model solved 22 of 56 problems (39%), and after iterating on compiler errors — 54 of 56 (96%).

The main finding: precise, structured feedback works many times better than general instructions. When the model was given documentation on "how to avoid errors", it solved 30 problems. When given a language reference, 34. But when the researchers pasted in the actual compiler errors and asked for a fix — 54. A huge gap. The problem isn't that the model "doesn't know the language" — it's that general instructions don't point to specific problems in specific code. The compiler says "undefined function foo on line 12" — that's actionable. The docs say "remember to define your functions" — that's useless.

The core principle: use any "hard verifier" (compiler, linter, validator, tests, checklist) that gives precise feedback. Copy the output in full → paste it into the next prompt → the model fixes that specific problem. Repeat until it passes. The study ran up to 20 iterations — hard problems needed 10-15 rounds of fixes, but nearly all of them got solved.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: The model generates a solution
STEP 2: You run it through a verifier → get the exact error
STEP 3: You copy the error in full → add it to the prompt → ask for a fix
STEP 4: The model generates a corrected version
STEP 5: You repeat steps 2-4 until it passes the check

Each round is a separate request to the model with the accumulated history.

03

Example in Action

Task: You're writing an SEO-optimized product listing for Amazon. It has to fit the platform's limits and pass review: title up to 60 characters, description of 500-2000 characters, no banned words ("guarantee", "100%", "best"), and the product specs must be included.

Prompt, round 1:

Write a product listing for Amazon:

Product: TWS wireless earbuds with noise cancelling
Price: $29.99
Features: 
- Active noise cancelling (ANC)
- 24-hour battery life with the case
- Bluetooth 5.3
- IPX4 water resistance

Amazon requirements:
- Title up to 60 characters
- Description 500-2000 characters
- Not allowed: "guarantee", "best", "100%", emoji
- Required: specs in the text

→ The model produced 320 characters (too short) and used the word "best"

Prompt, round 2:

I checked the text and found problems:

1. The description is 320 characters — it needs at least 500
2. The banned word "best" appears in the sentence "The best choice for workouts"
3. IPX4 water resistance isn't stated explicitly

Fix these 3 problems. Leave everything else as is.

→ The model fixed them, but now it's 2100 characters (over the limit)

Prompt, round 3:

The description came out at 2100 characters — the max is 2000.
Cut 100 characters without losing any specs.

Result: After 3-4 iterations you'll have a listing that passes every Amazon check. Each round: a specific error → a specific fix.

04

Why It Works

LLMs are bad at juggling lots of constraints at once. Give a prompt like "write 500-2000 characters without words X, Y, Z and with features A, B, C" and the model will lock onto 2-3 things and drop the rest. That's not a bug, it's how generation works: the model optimizes locally (the next word), not globally (all the rules at once).

A compiler (or any verifier) is external memory that remembers ALL the rules and checks EVERYTHING. The model tries → the verifier says exactly what's wrong → the model focuses on that one problem → fixes it. On the next iteration the verifier finds the next problem — and so on until everything checks out.

Why a precise error beats documentation: "undefined function foo on line 12" gives context (where, what, what it's called). "Remember to define functions" gives no clue where to look. Models are good at local edits when the location is pinpointed — they don't need to understand the whole system, just the specific note.

Control levers: - Number of iterations — 2-3 is enough for simple tasks, hard ones can take 10-15. Save tokens on the easy stuff, be patient on the hard stuff. - What to copy from the error — the whole validator output or just the specific line. The more precise the pointer → the faster it converges. - When to stop — you can set a criterion ("until 100% of checks pass") or a cap ("5 attempts max").

05

Prompt Template

Round 1 — Generation:

Do {task} following these requirements:

{requirements_list}

Context:
{task_data}

Rounds 2+ — Fixing:

I checked the result with {verifier}. Found these problems:

{exact_check_output}

Fix these problems. Don't touch anything that already works.

What to fill in: - {task} — what you're making (text, formula, config, table) - {requirements_list} — every constraint you know up front - {verifier} — what does the checking (linter, Hemingway Editor, Excel formula, checklist) - {exact_check_output} — paste it as is, don't paraphrase

06

Limitations

⚠️ You need a "strict checker": The principle doesn't work for subjective judgments ("make it more creative", "doesn't sound convincing"). You need a check with precise output — a compiler, a test, a validator, an SEO analyzer, a clear yes/no checklist.

⚠️ Lots of iterations: Hard tasks can take 10-15 rounds. If you need it fast, this method isn't for you. If you need it right, be patient.

⚠️ Cascading errors: In the study, 2 problems didn't get solved even in 20 attempts — fixes in one place broke something else. If you're going in circles after 5-7 iterations, stop and reframe the task.

07

How They Tested It

Researchers at USC took the Exercism platform (programming practice problems) and tested GPT-5 on 56 problems in Idris — a rare, strongly typed functional language. For context, they also checked popular languages: Python (the model solved 90% of problems), Erlang (74%). Idris was a flop: 39% without any help.

Then they compared 4 strategies for helping the model. Method 1: copy the errors from the Exercism platform into the prompt (1 iteration and 5 iterations) — raised it to 48%. Method 2: give the model a guide to "common Idris errors and how to avoid them" via a vector store (RAG) — 54%. Method 3: give it the official language documentation — 61%. Method 4: local compilation + pasting compiler errors into the prompt, up to 20 iterations — 96%.

Why such a gap? The researchers analyzed the error types. The most frequent: "undefined name" (123 times), "ambiguity" (111 times), "syntax" (33 times). These aren't deep logic failures — they're surface problems with imports, function names and module visibility. The docs explain "how the Idris import system works" but don't tell you what's wrong on your line 12. The compiler says "function foo is undefined on line 12" — it's obvious where to push.

A surprising insight: problems needed on average 7-8 iterations to compile and 1-2 iterations after that to pass the tests. In other words, 95% of the effort goes into clearing the "hard barrier" (the compiler), 5% into logic (the tests). That explains why in production tasks (copy, formulas) precise constraints (an SEO validator, a client's checklist) work better than vague ones ("make it good").

08

Adaptations and Extrapolations

🔧 Technique: Midway check-ins → token savings

Instead of 20 blind iterations, you can check in midway:

Let's pause after 3 attempts. Show me:
1. Which problems you've already fixed
2. Which problems are left
3. Why they keep happening

Then we'll continue.

Effect: You see the error pattern → you can nudge the model in the right direction ("look, you keep forgetting the character limit — focus on that").


🔧 Technique: Two-stage feedback

Combine a soft + a hard verifier:

Step 1: The model generates → you read it → you give meaning-level notes ("forgot about the audience", "wrong tone")

Step 2: The model revises → you run it through a hard verifier (Hemingway Editor, checklist) → precise errors → final fix

Effect: First you nail the strategy (what to say), then the tactics (how to say it).


🔧 Technique: The model as the verifier

If there's no ready-made validator, write a checklist and ask the model to check itself:

Check your text against this checklist:
- [ ] Title up to 60 characters
- [ ] Description 500-2000 characters
- [ ] No words: "guarantee", "best", "100%"
- [ ] All specs present: ANC, 24h, BT 5.3, IPX4

For each item write ✅ or ❌ and what needs fixing.

Then:

Here's your check:
[paste the output]

Fix everything marked ❌.

Effect: The model finds the problems itself → fixes them itself. It works worse than an external validator (the model can miss its own mistake), but it beats nothing.

09

Resources

Compiler-Guided Inference-Time Adaptation: Improving GPT-5 Programming Performance in Idris The study uses the Exercism platform for testing and references prior work on MultiPL-E (a multilingual code generation benchmark), Self-Refine (iterative improvement through self-critique), DrRepair and Baldur (using compiler errors to repair code).

Authors: Minda Li, Bhaskar Krishnamachari — Ming Hsieh Department of Electrical and Computer Engineering, Viterbi School of Engineering, University of Southern California.

Research digest

Key result

The paradox: The researchers gave GPT-5 the Idris language docs — it solved 30 of 56 problems. Gave it a reference guide — 34. Pasted in the actual compiler errors and asked for fixes — 54. The difference isn't knowledge, it's the format of the feedback. The method lets you get precise results even with 10+ hard requirements (character limits, banned words, mandatory items) — exactly where a model usually lets something slip. The gist: use any strict verifier (compiler, linter, validator, tests, checklist) that gives precise feedback. The model generates → the verifier finds a problem → you paste the error into the prompt → the model fixes it. Repeat 3-15 times until it passes every check. From 39% accuracy on the first try to 96% after iterating.

Principle

Don't try to cram every requirement into one prompt. Work in loops: Round 1: The model generates a solution with the core requirements Round 2: You run it through a check → copy the exact output ("line 12: undefined function foo") Round 3: You paste the error into the prompt: "Found problems: {check_output}. Fix these specific spots" Rounds 4+: Repeat until it passes Each iteration is a separate request with the accumulated history. The model focuses on one specific problem instead of juggling all the rules at once. In the study, hard problems needed 10-15 rounds — but nearly all of them got solved.

Why it works

An LLM generates token by token — it optimizes locally (the next word), not globally (all the rules at once). Give it a prompt like "write 500-2000 characters without words X, Y, Z and with points A, B, C" and the model will lock onto 2-3 things and lose the rest. A verifier = external memory that remembers EVERYTHING and checks EVERYTHING. It doesn't say "remember all the rules" (useless), it says "undefined function foo on line 12" — that's actionable. Models are great at local edits when the location is pinpointed — they don't need to understand the whole system, just the specific note. Numbers from the paper: general "how to avoid errors" docs → 30 problems solved. A language reference → 34. Actual compiler errors → 54. Precise feedback is 1.8 times more effective than documentation.

When to apply

Programming → generating code that has to pass a compiler/linter/tests Marketplace copy → SEO listings with hard limits (Amazon: 60-character title, 500-2000-character description, banned words) Legal documents → contracts you check against a checklist of mandatory clauses Financial reports → Excel sheets with formulas that have to reconcile NOT suited to subjective judgments ("make it more creative", "doesn't sound convincing"). You need a check with precise output — yes/no, pass/fail, a specific error on line X.

Mini recipe

1. Generate: Give the task with the core requirements (don't try to cram in every detail) `Write an Amazon product listing — title up to 60 characters, description 500-2000 characters, no "guarantee"/"best"` 2. Check: Run the result through a verifier (linter, validator, checklist, character count) For example: description is 320 characters (too short), contains "best", the IPX4 spec is missing 3. Exact error into the prompt: Paste the check output as is, don't paraphrase `Checked it — found 3 problems: 1) The description is 320 characters, it needs at least 500. 2) The banned word "best" appears in the sentence "...". 3) IPX4 water resistance is missing. Fix these spots, leave the rest alone` 4. Repeat steps 2-3: Each round finds a new problem → the model fixes it → you check again Hard tasks may take 3-15 iterations 5. Stop criterion: Either "until 100% of checks pass" or a cap on attempts (if you're going in circles after 7-10 iterations, stop and reframe the task)

Examples

[BAD]: `Write a SQL query that pulls users over 25 with active subscriptions, groups them by city, sorts by signup date, joins the orders table and calculates the average order value` (The model will drop 2-3 conditions or mess up the syntax — too many requirements at once) [GOOD]: Round 1: `Write a SQL query: pull users over 25 with active subscriptions` Round 2: `The query threw an error: "Column 'subscription_status' not found". Fix it — the field is called 'is_active'` Round 3: `Add grouping by city and sorting by signup date` Round 4: `We need a join with the orders table and the average order value — add that to the current query` (Each step is one specific fix with precise feedback)

In plain words

The point here is that even the smartest model, like GPT-5, gets dumb when you pile a bunch of strict rules on it at once. It works as a next-word predictor, not a strategist, so it easily forgets a constraint halfway through a sentence. The Compiler-Guided Refinement method moves quality control out of the model's head and onto an external "bouncer" — a compiler or a strict checking algorithm. Instead of trying to nail a perfect result on the first try, the model turns in a draft, gets its knuckles rapped by the system for specific mistakes and fixes them until it's flawless.

It's like learning a foreign language with a merciless tutor. You try to put a sentence together, and instead of just saying "wrong, do it again", they jab a finger at every mistake: "wrong case here, wrong tense there". You fix one detail, they find the next. After ten rounds of this torture you produce a flawless sentence, even though you barely knew the alphabet at the start. In the study with the Idris language this worked like magic: the model jumped from a measly 39% to 96% success simply because it wasn't allowed to finish until the compiler said "OK".

In real life this works anywhere there are clear boundaries — say, SEO for marketplaces. If you ask a model to write 1000 characters without the words "best" and "guarantee", it will almost certainly slip up and sneak in a banned word. But if you run its text through a checking script that flags "line 3, word 5 — not allowed" and make it redo exactly that piece, the result will be bulletproof. Precise feedback turns a hallucinating model into a disciplined worker that ends up delivering expert-level output.

The principle is universal and isn't limited to code in obscure languages. You can stretch it to legal contracts, technical specs or even complex financial reports — anywhere there's an objective criterion of truth. The researchers showed you don't have to wait for an "even smarter" model to tackle hard problems. You just have to stop taking the model at its word and add a step of automatic punishment for mistakes. That turns the process from guesswork into an engineering system with a guaranteed result.

Bottom line: forget about crafting the "perfect prompt" that solves the task in one shot — that's a dead end. The future is iterative polishing, where the model works in tandem with a strict checking algorithm. Either you build a system that slaps the model's hand for every slip-up, or you get garbage out. 96% success on some of the hardest programming there is, in Idris, is a big fat hint that it's time to stop being just a "prompt engineer" and start being an architect of control systems.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Compiler-Guided Refinement: Precise Feedback Beats General Instructions arXiv:2602.11481

Sign in to apply this study New accounts get 50 free credits.