TL;DR
AutoCode is a novel framework that elevates Large Language Models (LLMs) from merely solving competitive programming tasks to actively designing them. By employing a multi-role validation loop, the system generates robust test suites with up to 98.7% consistency to official judgments. Furthermore, it creates novel, contest-grade problems that even human Grandmasters recognize as top-tier.
The Challenge of Problem Setting
In competitive programming (CP), solving a problem is difficult, but setting one is arguably harder. A skilled problem setter must design constraints that prevent "cheating" (e.g., ensuring a simple greedy algorithm cannot pass a complex dynamic programming task), provide exhaustive test cases for edge cases, and perfectly calibrate the difficulty.
Current LLM benchmarks for coding often suffer from weak test suites. This leads to high False Positive Rates (FPR)—where incorrect code passes—and False Negative Rates (FNR)—where valid code fails due to malformed test data. This distorted evaluation landscape makes it difficult to use these benchmarks for training advanced models via Reinforcement Learning (RL). If an LLM can reliably set a high-quality problem, it demonstrates a much deeper algorithmic understanding than simply solving one.
Methods: The AutoCode Framework
To tackle this, the authors introduce AutoCode, a closed-loop, multi-role framework that mirrors the workflow of human experts.
- Validator-Generator-Checker Loop:
- Validator: Ensures inputs strictly adhere to problem constraints.
- Generator: Employs three strategies: exhaustive small-case coverage, randomized/extreme data (to catch overflows or precision errors), and "TLE-inducing" data (specifically designed to make slow algorithms time out).
- Checker: Compares contestant output against a reference solution.
- Dual-Verification Protocol: To generate new problems, AutoCode starts with a "seed" problem and modifies it. To ensure the new problem is valid without human intervention, it generates both an efficient reference solution (
std.cpp) and a slow-but-reliable brute-force solution (brute.cpp). The problem is only accepted if both solutions produce identical results across all test cases. - Mutant-based Discrimination: For complex "interactive" problems, AutoCode creates "mutant" versions of the solution (introducing subtle bugs) to verify that the Interactor program can successfully distinguish between correct and flawed logic.
Key Insights
- The "Self-Solving" Paradox: LLMs can generate solvable, logically sound problems that they themselves cannot solve (occurring about 4.2% of the time). This suggests that problem-setting capabilities can outpace problem-solving capabilities, providing a potential path for model self-improvement.
- Recombinational vs. Conceptual Novelty: LLMs tend to innovate by "recombination"—mixing and matching known algorithmic tricks (e.g., embedding a segment tree inside a graph problem). They still struggle to invent entirely new reasoning paradigms.
- Difficulty as a Quality Proxy: There is almost zero correlation between an LLM's self-evaluation of a problem's elegance and a human expert's evaluation. However, an LLM's ability to estimate "difficulty gain" (how much harder the new problem is than the seed) is a reliable signal for identifying high-quality problems.
Key Results
AutoCode was evaluated on massive datasets, including a 7,538-problem benchmark and a newly curated 720-problem Codeforces set.
- State-of-the-Art Consistency: AutoCode achieved 91.1% consistency with official judgments on the large-scale benchmark, far surpassing the previous state-of-the-art (HardTests at 81%). On the recent Codeforces benchmark, it reached an impressive 98.7% consistency.
- Error Reduction: It reduced the False Positive Rate to just 3.7% (compared to ~12% for baselines) and significantly lowered the False Negative Rate.
- Human-Verified Quality: Human Grandmasters (the top 0.3% of programmers) evaluated the generated problems.
As shown in the filtering funnel, over 61% of the generated problems were deemed high enough quality to serve as training data for other LLMs, and 3.2% were judged to be of "ICPC/IOI-level"—the highest tier of international competition.
Limitations and Future Work
Because LLMs cannot yet reliably judge abstract concepts like "elegance" or "novelty," human experts are still required for the final filtering of elite problems. Additionally, the most capable models remain closed-source, limiting the ability to integrate AutoCode into a tight, automated RL loop. Future work will focus on prompting strategies that encourage true "conceptual leaps" rather than just clever combinations of existing algorithms.
Summary updated