PGS: Effective LLM Code Refinement via Property-Oriented and Structurally Minimal Feedback

Lehan He, Zeren Chen, Zhe Zhang, Xiang Gao, Lu ShengICML 2026

Large Language Models (LLMs) are highly capable at generating code, but ensuring the functional correctness of their outputs remains a persistent challenge. While many recent approaches use Test-Driven Development (TDD) to refine code via execution feedback, this feedback is often noisy and uninformative.

The Property-Generated Solver (PGS) is a novel framework that shifts the focus from mass-generating test cases to improving feedback quality. By providing high-level "property-oriented" feedback and "structurally minimal" counterexamples, PGS achieves a bug fix rate 1.4x to 1.6x higher than previous state-of-the-art debugging methods.

The Challenge: Self-Deception and Cognitive Overload

While LLMs are impressive coders, they often struggle to debug their own work. Current TDD-based approaches hit two major walls:

  1. The Cycle of Self-Deception: If an LLM generates both the code and the test cases, it often bakes the same logical biases into both. If the model misunderstands a corner case during generation, it is unlikely to catch that same corner case when writing the test oracle.
  2. Cognitive Overload: Traditional automated tests often produce long, complex inputs and intricate execution traces. For an LLM, this acts as "noisy" data that overwhelms its reasoning process, leading to failed repairs.

The core bottleneck in automated code refinement is not the quantity of tests, but the quality and simplicity of the feedback.

The PGS Framework

PGS is a multi-agent framework consisting of a Generator (which writes and fixes code) and a Tester (which provides feedback). It operates on two foundational principles:

  • Property-Oriented Feedback: Instead of merely checking if a specific input produces an exact output, the Tester identifies high-level semantic rules (properties) the code must follow. For example, in a prime factorization task, a property might be: "The product of all output factors must equal the input N." This is logically simpler for the model to verify than generating the exact factors from scratch.
  • Structural Minimality: When a bug is found, PGS does not just hand the LLM a random failing input. It searches for the simplest possible counterexample—specifically, the one with the lowest token count. This isolates the root cause and drastically reduces the noise the LLM must process.

The PGS Workflow

  1. Initial Generation: The Generator writes a first draft of the code.
  2. Property Extraction: The Tester extracts logical properties from the natural language prompt and converts them into executable assertions (e.g., assert math.prod(output) == N).
  3. Input Synthesis: The Tester generates a diverse pool of new inputs to stress-test these properties.
  4. Minimal Feedback: If a property is violated, the Tester isolates the smallest failing input and returns it to the Generator with a clear explanation of the broken rule.

Key Insights

  • The Asymmetry of Verification: A crucial insight driving PGS is that verifying a solution is much easier for an LLM than generating one from scratch. On "Hard" problems in LiveCodeBench, model generation accuracy was only 32.4%, but verification accuracy was 76.5%. PGS exploits this gap to create a more reliable oracle.
  • Tokens as a Proxy for Simplicity: The authors found that minimal token count is the most effective signal for guiding LLM reasoning. Shorter prompts allow the model's attention mechanism to focus entirely on the flawed logic rather than parsing bulky data.
  • Turning Latent Bugs into Explicit Errors: PGS effectively converts silent "Wrong Answer" failures into explicit AssertionErrors. By injecting properties directly into the code, it forces the model to confront specific logical violations.

Evaluation and Results

The researchers evaluated PGS across five diverse benchmarks: HumanEval, MBPP, LiveCodeBench (LCB), CodeContests (CC), and SWE-bench. They tested various models, including DeepSeek-R1-32B, Qwen2.5-Coder, and Claude models.

  • State-of-the-Art Performance: PGS consistently outperformed existing debugging frameworks like Self-Debugging, Reflexion, and MGDebugger.
  • Higher Fix Rates: On HumanEval, PGS achieved a bug fix rate of up to 67.9%, establishing a new benchmark for automated refinement.
  • High Efficiency: PGS is remarkably cost-effective. It frequently surpassed the final performance of baseline methods in just two iterations (compared to five or more for others), consuming significantly fewer total tokens.
  • Model Agnosticism: The verification asymmetry principle held true even when a weaker model (e.g., Qwen2.5) acted as the Tester for a stronger model (e.g., DeepSeek-R1).

Limitations and Future Directions

While highly effective, PGS relies on the LLM to generate the properties. If the model misses a crucial property or generates an incorrect one, the feedback loop can break. Furthermore, there is a minor risk of overfitting, where the model patches the code to pass specific properties rather than solving the underlying problem.

Future work will likely explore more autonomous property discovery and stronger validation techniques to handle complex, repository-level tasks where API contracts and system properties are largely implicit.

Summary updated

BibTeX
@inproceedings{he2026pgs,
  author = {Lehan He and Zeren Chen and Zhe Zhang and Xiang Gao and Lu Sheng},
  title = {{PGS: Effective LLM Code Refinement via Property-Oriented and Structurally Minimal Feedback}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=6xeSRifGeL},
}
Figure