Competitive programming agent breaks into global top 1, with new models from Nanjing University and Tsinghua University exceeding a CF rating of 3,500
Large Language Models have continuously improved their capabilities in code generation, but they still frequently fail on complex algorithmic problems, especially in competitive programming scenarios, due to incorrect algorithm selection, overlooked edge cases, poor complexity estimation, or insufficient coverage of hidden test cases. Solvita is an agent framework designed for competitive programming, which forms a closed-loop system through four roles (Planner, Solver, Oracle, Hacker) and accumulates experience using a trainable graph-structured knowledge network.
Competitive programming is far more than "translating problem descriptions into code". A correct solution typically goes through multiple complex stages: understanding natural language problem statements, abstracting mathematical structures, selecting appropriate algorithm paradigms, estimating complexity, implementing code, constructing test cases, handling multi-solution outputs, and troubleshooting hidden edge conditions.
For LLMs, this type of task presents several typical difficulties:
1. Algorithm selection is highly dependent on problem structure
Even for problems categorized under graph theory, dynamic programming, or string processing, different constraints may correspond to completely different algorithms. If the model retrieves examples based solely on superficial similarity, it is easy to select approaches that "look similar but are fundamentally incorrect".
2. Sample tests are far from sufficient
Many incorrect solutions can pass the provided samples but fail on hidden test cases. In particular, edge conditions, complexity limits, multi-answer checkers, and precision issues are difficult to cover through ordinary self-testing.
3. Failure experiences are hard to reuse
Many existing coding agents retry, regenerate, and debug after failing, but once a task is completed, these failure experiences usually do not change the solution strategies for subsequent tasks. The system does not truly learn "what pitfalls to avoid when encountering similar structures next time".
4. Multi-agent frameworks remain relatively static
Methods such as AlphaCodium and MapCoder have broken down problem-solving into multiple stages, but they follow more fixed workflows. While each stage can call the LLM, they lack a long-term memory and routing mechanism that updates with historical experience.
Researchers from institutions including Nanjing University and Tsinghua University have proposed Solvita, an Agentic Evolution framework for competitive programming. Instead of fine-tuning the underlying large language model, it builds a trainable graph-structured knowledge network outside the four types of agents (Planner, Solver, Oracle, Hacker), enabling the system to continuously accumulate experience from problem-solving, testing, attacking, and repairing processes.
Code Repository: https://github.com/NJU-LINK/Solvita
Paper Link: https://arxiv.org/pdf/2605.15301
The core motivation behind Solvita is that human competitive programmers improve through practice not by solving every problem from scratch, but by accumulating experiences such as "which approach to use for which type of problem", "which implementations are prone to Wrong Answer", and "which tests are most likely to hack incorrect programs".
How does Solvita work?
The core idea of Solvita is to organize competitive programming problem-solving into a closed-loop system, where each stage is equipped with a trainable knowledge network. The entire system consists of four agents:
1. Planner: Responsible for problem abstraction and strategy selection
The Planner first converts the original problem statement into a more formal mathematical description, removing narrative backgrounds and irrelevant information, and extracting variables, constraints, objectives, and input-output structures. It then predicts potential algorithm labels, implementation ideas, and complexity estimates. The knowledge network behind it records the formal structure, predicted labels, and final results of historical problems. When encountering new problems later, the Planner does not rely solely on ad-hoc prompting, but refers to the historical experience of structurally similar problems.
2. Solver: Responsible for code generation and local repair
The Solver generates C++ programs based on the Planner's strategy and verifies them against samples and tests generated by the Oracle. Unlike many methods that "rewrite the entire code after failure", Solvita emphasizes patch-based repair: if the program fails, the Solver will try its best to generate local patches in SEARCH/REPLACE format instead of completely regenerating the entire code. This approach preserves the already correct parts, focuses modifications on the truly erroneous local sections, and avoids breaking previously satisfied conditions during each rewrite.
3. Oracle: Responsible for constructing reliable internal tests
The Oracle's task is not to write the final answer, but to construct "trustworthy supervision" for solutions. It generates a testlib-based generator, validator, checker, and reference solver, verifies that the reference solver can reproduce the public sample outputs, then generates more test inputs and authenticates them. For multi-solution problems, the Oracle also needs to provide evidence for custom checkers. Only when conditions such as test inputs, expected outputs, and authentication ratios meet requirements will the tests generated by the Oracle be accepted.
4. Hacker: Responsible for proactively attacking candidate programs
The Hacker acts like an expert in cross-testing programs. It analyzes potential vulnerabilities in the candidate code, generates a structured vulnerability report, then selects attack approaches such as semantic testing, stress testing, and anti-hashing to construct inputs that can break incorrect programs. If one attack approach fails, the system continues to try along a fallback chain. The bugs successfully hacked are not only used to repair the current problem, but also propagated as failure experiences to the knowledge networks of Planner, Solver, Oracle, and Hacker.
The Trainable Graph-Structured Knowledge Network
The most critical design of Solvita is not "adding more agents", but that each agent is equipped with a trainable graph-structured knowledge network.
Taking the Solver as an example, its knowledge network is divided into three layers:
- Q Layer: Records historical problem descriptions and metadata;
- M Layer: Records solution decomposition, failure comparisons, and metacognitive analysis;
- S Layer: Records reusable algorithm skills and C++ templates.
When a new problem arrives, the system first retrieves similar Q nodes, then activates relevant skills along the two-hop path Q→M→S.
The edge weights of different paths are not fixed, but updated based on historical successes and failures. Successful paths are reinforced, while failed paths are weakened or new contrastive nodes are generated. This is fundamentally different from traditional RAG.
Traditional RAG is more like "finding similar texts and stuffing them into the prompt", while Solvita's knowledge network is more like "learning which problem structures should be routed to which algorithm skills". Memory is no longer just static retrieval, but becomes a trainable strategy routing mechanism.
Oracle and Hacker
For algorithmic problems, testing itself is part of the capability. Whether an agent can solve a problem largely depends on its ability to judge if its solution is truly correct.
Solvita breaks down testing capabilities into two complementary directions:
The Oracle focuses on "reliable supervision".
It tends to construct reference solvers, generators, validators, and checkers, with the goal of generating internal tests that can stably determine program correctness.
The Hacker focuses on "discovering vulnerabilities".
It tends to find attack cases such as edge inputs, complexity limits, structural counterexamples, or hash collisions, with the goal of exposing hidden errors in the candidate code.
The two functions do not overlap. The Oracle is more conservative and can better protect correct solutions from being mistakenly rejected; the Hacker is more aggressive and better at uncovering hidden bugs. The paper's experiments also show that the combination of the two achieves a better balance in incorrect solution detection, correct solution retention, and stronger test confirmation.
Experimental Results
The paper evaluates Solvita on CodeContests, APPS, AetherCode, and recent Codeforces rounds, and compares it with methods such as single-pass, Codex CLI, Claude Code, AlphaCodium, and MapCoder.
The main experimental results show that Solvita achieves the highest pass@1 in 14 out of 15 backbone-benchmark combinations.
Taking the GPT-5.4 backbone as an example:
It can be observed that Solvita achieves a substantial improvement over single-pass; compared with existing agent frameworks, it also maintains a steady lead across multiple benchmarks. More importantly, this improvement is not achieved by infinitely increasing token usage. The paper's cost analysis shows that the average token consumption of Solvita is in a similar range to open-source agent frameworks, and does not approach the higher consumption levels of some commercial CLI agents.
Ablation Studies
The paper further conducts additive ablation studies to distinguish two questions:
First, are the gains of Solvita simply due to the more complex multi-agent workflow?
Second, does the trainable knowledge network truly bring additional improvements?
The results show that switching from single-pass to an untrained multi-agent framework already significantly improves performance. This indicates that the closed-loop structure of solve–certify–attack–repair is indeed more suitable for complex algorithmic problems.
However, on this basis, adding the Solver/Oracle/Hacker knowledge networks further improves performance, and the gains continue to grow as the number of training problems increases from 1.5k to 3k and then to 4.5k.
On GPT-5.4, the full system ultimately achieves:
This demonstrates that the three networks do not replace each other, but complement and stack on top of each other. The Solver network mainly improves algorithm skill routing and implementation repair; the Oracle network enhances internal supervision quality; the Hacker network improves the ability to attack hidden vulnerabilities. The full system integrates the three types of experiences to achieve the strongest performance.
Patch-based Repair: Why not rewrite every time?
The paper also specifically compares two repair approaches inside the Solver: full regeneration and patch repair
Full regeneration generates the complete code from scratch after every failure;
Patch repair only generates local patches for the diagnosed error locations.
Under the same maximum iteration budget, patch repair not only achieves a higher pass rate, but also requires fewer average iterations and saves more tokens.
Taking GPT-5.4 as an example:
This shows that in long-pipeline problem-solving, "starting over from scratch" is not always a good strategy. In many cases, the candidate solution already has most of the logic correct, and what is truly needed is precise repair rather than regenerating a new code that may introduce new errors.
Real Contest Evaluation on Codeforces
In addition to offline benchmarks, the paper conducts evaluations that are closer to real contests on recent Codeforces rounds.
The evaluation selects 12 post-cutoff Codeforces rounds, totaling 76 problems. Each contest is completed within the official time limit, with no post-contest modifications allowed, following the same constraints as human participants. The results show that the Solvita versions using GPT-5.4, Claude Opus 4.6, and DeepSeek V4 Pro as backbones all ultimately reach the Legendary Grandmaster range; while the bare models with the same backbones remain at a lower level.
This demonstrates that the gains of Solvita do not come solely from the underlying model itself, but from systematic enhancements brought by the agentic loop, knowledge network, and adversarial verification mechanism.
Summary and Outlook
Solvita is an Agentic Evolution framework for competitive programming. It attempts to answer an important question: How can a code agent not just "try multiple times", but truly accumulate experience from past successes and failures?
The core contributions of this research can be summarized into three points:
1. Proposing the solve–certify–attack–repair closed loop
Solvita breaks down algorithmic problem-solving into four roles: Planner, Solver, Oracle, and Hacker, forming a closed loop for strategy selection, program generation, test certification, and adversarial attack.
2. Introducing trainable graph-structured knowledge networks
Each agent has its own knowledge network, which updates edge weights through feedback signals such as pass/fail verdicts, test certification quality, and adversarial vulnerabilities, continuously accumulating experience without fine-tuning the underlying LLM.