AlgoSkill: Verification-Guided Algorithm Design
- AlgoSkill is a framework for automatic algorithm design that maps natural-language descriptions to candidate algorithms using sequential decision-making over a typed skill library.
- It combines a learned scheduler with Monte Carlo Tree Search to explore and verify skill sequences, ensuring correctness, efficiency, and repair through targeted feedback.
- Empirical results show notable improvements in correctness, time-optimality, and robustness across benchmarks, contest problems, and modified constraints.
AlgoSkill is a framework for automatic algorithm design that treats the transformation from a natural-language problem statement into an algorithm as sequential decision-making over a typed library of human-like skills. In contrast to direct generation or generic self-refinement, the framework makes explicit the stages of identifying problem structure, reading constraints, choosing a suitable paradigm, checking correctness, and refining complexity. A learned scheduler proposes skills from the current design state, and a Monte Carlo Tree Search (MCTS) controller explores skill sequences under verification feedback from compilation, testing, stress testing, and complexity analysis. The resulting candidate algorithm includes code, complexity analysis, and a correctness argument (Song et al., 29 Jun 2026).
1. Formalization as sequential decision-making
AlgoSkill formulates algorithm design as a Markov-decision process over a discrete set of typed skills. A problem instance is represented as
where is the natural-language description, and are the input/output formats, are explicit constraints, and is the evaluation metric.
The framework uses a fixed library with typed skills. At step , the design state is
where 0 is the parsed problem type and key entities, 1 is the current solution plan, 2 is the current code, 3 is a symbolic time/memory estimate, 4 is the set of accumulated failures, and 5 is the history of applied skills.
Skill application is constrained by typed preconditions. The valid set is
6
and the scheduler 7 chooses
8
A deterministic state transition then produces
9
After at most 0 steps, the final state is decoded into
1
with full trajectory
2
The optimization target is the expected verifier reward:
3
The reward decomposes as
4
where 5 aggregates compilation success, unit-test and stress-test pass rates, and oracle agreement; 6 penalizes symbolic or executed time/memory overshoot; 7 rewards a clear idea statement, pseudocode, complexity proof, and correctness argument; 8 credits skill-guided repair; and 9 penalizes compile-time or time-excess risk. This formulation places correctness, efficiency, explanation quality, and repair behavior within a single optimization objective (Song et al., 29 Jun 2026).
2. Typed skill library
Each skill 0 is defined as
1
where 2 is the applicability condition, 3 is the deterministic update, 4 is the desired post-state property, 5 indicates the intended complexity effect, 6 is a local verification rule, and 7 lists common failure modes. The formal effect is
8
Eight core skills are described explicitly.
- Problem Abstraction 9 parses 0 into a structured problem type such as DP, graph, or greedy, and extracts key entities. Its postcondition checks that the parsed representation includes a valid problem class.
- Constraint Reading 1 reads 2 to infer a target complexity budget 3 via rules such as 4. Its postcondition requires that the inferred budget remain within admissible algorithms.
- Brute-Force Construction 5 builds a correct but slow 6 baseline. The postcondition checks that the baseline compiles and passes tiny tests.
- State Design 7 chooses a DP or search state 8 that captures all necessary context. Its postcondition checks that the state suffices to reconstruct the solution.
- Data-Structure Substitution 9 replaces repeated 0 scans with a tree, heap, segment-tree, or related structure. The complexity effect records improvements such as 1.
- Counterexample Construction 2 generates adversarial inputs, including empty, singleton, sorted, and extreme cases, to expose flaws. Its postcondition requires at least one new counterexample.
- Complexity Refinement 3 identifies the bottleneck in a correct-but-slow draft and replaces it with a faster subroutine such as binary search, prefix sums, or two-pointers. The postcondition requires that the new estimate satisfy the budget.
- Exchange Argument (Greedy Proof) 4 attempts a correctness proof for a greedy choice by exchange with an optimal solution, adding an invariant or invariant check to the plan. Its postcondition verifies the local exchange property.
The paper states that the complete library contains 20 reusable skills: abstraction, constraint analysis, brute-force, state design, data-structure selection, invariant/exchange proofs, counterexample, complexity refinement, decomposition, relaxation, duality, analogy, mathematics, symmetry, randomization, approximation, caching, and parallelization. Only eight are detailed in the main technical overview, while the remaining twelve are said to follow the same pattern and are summarized in Appendix A, Table A1 (Song et al., 29 Jun 2026).
3. Scheduler architecture and search controller
The learned scheduler operates on an input representation 5 that encodes parsed problem type 6 as a one-hot vector over classes, the constraint profile 7, the plan sketch 8, the code 9, the failure signals 0, and the history 1 of the last 2 skills. These signals are concatenated as tokens plus numeric features and passed through a lightweight Transformer encoder. The output is a softmax over valid skills:
3
Training uses policy-gradient reinforcement learning. With 4, the gradient is
5
where 6 is a learned value baseline. An entropy bonus
7
is added to encourage exploration.
AlgoSkill augments greedy scheduling with MCTS over design states. Each node is a state 8, each edge a skill 9, and for each valid skill the search keeps 0, 1, and 2. The tree policy selects
3
where 4 is the learned prior and 5 controls exploration. Expansion applies 6, simulation decodes 7 into a candidate 8 and runs the verifier, and backpropagation updates
9
After 0 rollouts, the controller returns the best candidate algorithm found in the tree. In the paper’s characterization, this is MCTS-guided skill scheduling rather than tree search over unrestricted code edits (Song et al., 29 Jun 2026).
4. Verification-guided refinement
Verification is not an auxiliary evaluation stage but the main control signal for search and repair. After each simulation, the verifier provides detailed signals from compilation, unit tests, stress tests, and symbolic complexity analysis.
Compilation and unit-test failures trigger a restricted subset of repair-oriented skills:
1
This ties observed failure modes to explicit reasoning actions such as counterexample generation, state redesign, invariant revision, or greedy-proof analysis.
Stress tests contribute new failing cases to 2, which are then available to subsequent skill applications. The framework describes this as counterexample-driven repair. Symbolic complexity analysis checks whether estimated 3 or fitted exponent 4 exceeds the budget. When it does, the enabled refinement subset is
5
The stated purpose is to refine the plan using complexity-oriented transformations rather than to regenerate a solution from scratch.
The paper characterizes this as a “tight feedback loop” in which each skill proposal is driven by objective verification and failing drafts are systematically repaired by invoking the relevant skill subset. A plausible implication is that verification feedback functions as a typed routing mechanism: the observed defect determines not only whether a candidate fails, but also which repair operators become semantically appropriate (Song et al., 29 Jun 2026).
5. Benchmarks, baselines, and reported results
The experimental evaluation uses four benchmarks.
| Benchmark | Size | Description |
|---|---|---|
| CP-275 | 275 | 100 Codeforces, 100 AtCoder, 75 LeetCode Hard |
| Hard-15 | 15 | especially challenging contest problems requiring nonstandard algorithmic insights |
| Rule-200 | 200 | procedurally generated “clean” problems with known complexity targets |
| Post-Cutoff 40 | 40 | real contest problems released after 2024-08-01 |
The baselines are Direct LLM, CoT, Self-Refine, Reflexion, MCTS-NoSkills, AlgoSkill (Greedy), and AlgoSkill (Full). The metrics are pass@1, pass@5, T-opt, and S-opt.
On CP-275 pass@1, the reported values for positive-gain backbones are: Direct at 78.2% (215/275), CoT at 79.3%, and AlgoSkill (Full) at 80.7% on Haiku-4; Direct at 11.6% (32/275), CoT at 16.0%, and AlgoSkill (Full) at 18.2% on Gemini-2.5. The reported improvements are 6 on Haiku-4 and 7 on Gemini-2.5.
On Rule-200, using Haiku-4, Direct obtains T-opt 45% and S-opt 95%, CoT obtains T-opt 68% and S-opt 99%, and AlgoSkill obtains T-opt 89% and S-opt 100%. On Hard-15 pass@5 and T-opt on Haiku-4, Direct reaches 20% (3/15) and 100%, Reflexion reaches 47% (7/15) and 86%, and AlgoSkill (MCTS) reaches 47% and 100%, with 8 in pass@5.
The post-cutoff results are summarized qualitatively rather than numerically in the provided overview. On post-cutoff real contests, AlgoSkill is reported to improve over Direct and CoT across both pre- and post-cutoff backbones, “confirming robustness to memorization.” On problem modifications—Constraint Mutation, Dimension Extension, and Objective Shift—the reported gains over Direct are +6.7–+20.0 pp. Within the bounds of the provided data, the empirical pattern is that gains appear in correctness, time-optimality, and robustness, rather than in correctness alone (Song et al., 29 Jun 2026).
6. Ablations, interpretation, and relation to one-shot generation
The ablation study isolates the contribution of typed skills and search. In a Skill Ablation using the Greedy variant over 60 runs, removing Problem Abstraction drops pass@1 from 95.0% to 73.3%. Removing Complexity Refinement or Counterexample reduces pass@1 to approximately 86.7%. In the MCTS Ablation, replacing MCTS with beam-search 9 yields similar pass@1 but slight pass@5 degradation.
These results bear directly on several common simplifications. One simplification is that the framework’s gains arise from search alone. The reported comparison against MCTS-NoSkills, defined as tree-search over free-form code-edits rather than typed skills, and the skill-ablation results both argue against that reading. A second simplification is that AlgoSkill is primarily a coding system. The formal decoding target 0 includes code, complexity analysis, and correctness argument, and the reward explicitly values explanation and repair in addition to correctness. A third simplification is that the framework merely benefits from benchmark memorization. The inclusion of Post-Cutoff 40 and the stated gains on problem modifications are presented as evidence against that interpretation.
The paper’s central takeaway is that automatic algorithm design is better treated as “verification-guided skill scheduling rather than one-shot code generation.” This suggests a shift in emphasis from monolithic generation to structured skill composition under verifier control. Within the reported experiments, the components that matter are typed skills, verification-guided repair, and search-based scheduling, and the framework is presented as a systematic composition of all three (Song et al., 29 Jun 2026).