atlas

Research map / Large language models / Agents, code and math

Counterexample Guided Program Repair Using Zero-Shot Learning and MaxSAT-based Fault Localization

AAAI 2025 · Large language models › Agents, code and math · approach: Code generation benchmarks · 2 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Combines MaxSAT-based fault localization (CFaults) with open LLMs in a zero-shot counterexample-guided (CEGIS) loop that gives bug-free program sketches to repair introductory C programming assignments.

Problem

Automated program repair for introductory programming assignments: symbolic FM-based repair tools (Clara, Verifix) fail on control-flow mismatches, while LLMs often rewrite code extensively rather than making minimal fixes.

Approach

Use MaxSAT-based fault localization to mask minimal buggy statements as holes in a program sketch, then have an off-the-shelf LLM fill the holes zero-shot inside a CEGIS loop where failing test cases are fed back as counterexamples; repair quality is also scored by a tree-edit-distance-based distance score.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add MaxSAT-localized sketches to a basic description-and-test-suite prompt (ablation)LLM-driven repair · student programsprograms fixed: CodeGemma: 597 (41.7%) -> 682 (47.7%); CodeLlama: 492 (34.4%) -> 573 (40.0%); Gemma: 496 (34.7%) -> 532 (37.2%); GraniteHelped
Add a counterexample to the description, test-suite, and sketch prompt (ablation)CodeGemma · student programsprograms fixed: 682 (47.7%) -> 688 (48.1%)Helped
Add a counterexample to the description, test-suite, and sketch prompt (ablation)Granite · student programsprograms fixed: 691 (48.3%) -> 681 (47.6%)Hurt
Add a counterexample to the description, test-suite, and sketch prompt (ablation)LLMs across configurations · student programsprograms fixed: Portfolio (All LLMs): 900 (62.9%) -> 907 (63.4%); CodeLlama: 573 (40.0%) -> 561 (39.2%); Phi3: 547 (38.2%) -> 535 (37.4%Mixed
Add reference implementations to prompts (ablation)Portfolio (All Configurations) · student programsprograms fixed: 1013 (70.8%) -> 1190 (83.2%)Helped
Add reference implementations to the sketch, description, test-suite, and counterexample prompt (ablation)Granite · student programssum(Distance Score): 533.6 -> 334.5Hurt
Add reference implementations to the sketch, description, test-suite, and counterexample prompt (ablation)Granite · student programsprograms fixed: 681 (47.6%) -> 876 (61.2%)Helped
Replace the buggy program with a MaxSAT-localized sketch (ablation)LLM-driven repair · student programsprograms fixed: The paper reports higher success for sketches than basic prompts across all six LLMs.Helped
Use reference implementations in place of prompts without them (ablation)LLM-driven repair · student programspatch sizeHurt
Add a counterexample-guided loop (ablation)LLM-driven repair · student programsrepair accuracyHelped
Use sketch prompts with description and test suite instead of ClaraGranite · student programs where Clara fails due to control-flow issuesprograms fixed: 290 (37.0%) vs. 0Helped
Use sketch-based prompts instead of symbolic semantic repairLLM-driven repair · student programsprograms fixed: Clara: 495 programs (34.6%); Verifix: 91 programs (6.3%)Helped

Surprising findings

Limitations

Experimental setup

Datasets: student C programs from an introductory programming course (1431 semantically incorrect programs)

Benchmarks: 1431 incorrect student C programs

Metrics: number of programs repaired sum of distance score based on tree edit distance repair rate by cyclomatic complexity quartile

Baselines: Clara Verifix Granite CodeGemma CodeLlama Gemma Llama3 Phi3

Builds on: CEGIS CFaults Clara Verifix

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy