TL;DR
When Large Language Models (LLMs) design new algorithms, a brilliant conceptual idea is often discarded simply because its single generated code implementation had a minor bug or a bad hyperparameter. Algorithm Tree Policy Optimization (ATPO) fixes this by branching each natural-language idea into a tree of multiple executable code candidates, allowing reinforcement learning to separately judge the potential of an idea from the quality of its code. By giving credit where credit is due, LLMs learn genuine algorithmic intuition that transfers across unseen problem instances and completely different search frameworks.
What Problem Does This Paper Address?
Using LLMs for Automated Algorithm Design (LLM-AAD)—like DeepMind’s FunSearch or AlphaEvolve—typically treats the LLM as a frozen generator inside an evolutionary loop: prompt the model with good past programs, test the new ones, keep the winners, and repeat.
Recently, researchers started adding online Reinforcement Learning (RL) so the LLM itself improves from evaluator feedback during the search. However, existing RL methods rely on linear rollouts: one prompt yields one natural-language idea/plan, which yields one code snippet, receiving one final score.
Here is the catch: a single code execution is a terrible proxy for an idea's true worth. If the LLM dreams up a clever heuristic for the Traveling Salesman Problem but makes a syntax error or picks a poor weight (0.5 instead of 0.1), outcome-level RL punishes both the code and the underlying idea. Intermediate reasoning gets noisy credit, steering the search away from promising conceptual territory.
Methods
ATPO plugs directly into standard search backbones (FunSearch, EoH, and OpenEvolve) without altering their outer population loops. What’s new is how it generates candidates and updates the LLM policy (via LoRA and Group Relative Policy Optimization, or GRPO):
- Two-Level Tree Sampling: Instead of a linear chain, each search prompt branches into $N_I$ distinct natural-language ideas, and each idea branches into $N_C$ executable code implementations (e.g., $4 \times 4 = 16$ leaves per prompt).
- Optimistic Idea Aggregation: Leaf codes are scored by the task evaluator (with penalties for syntax or runtime errors). To score a parent idea, ATPO doesn't take a plain average—because an idea's value lies in its achievable potential, not its worst attempt. Instead, it takes a temperature-controlled softmax over the Top-$K$ best child codes.
- Two-Level Credit Assignment: ATPO computes two distinct normalized advantages: an inter-idea advantage (comparing different ideas under the same prompt) and a within-idea advantage (comparing sibling code implementations of the same idea). These signals update the model either as a weighted trajectory-wide scalar or via disjoint token masks (training idea tokens solely on idea advantages, and code tokens on code advantages).
- Breakthrough Replay Buffer: Alongside the standard program database, ATPO caches "breakthrough prompts"—contexts that yielded historical best scores—replaying them once if the search stagnates.
Datasets
ATPO requires no supervised fine-tuning (SFT) datasets; it learns purely online from evaluator feedback on three classic combinatorial benchmarks adapted from the LLM4AD platform:
- Admissible Set Problem (ASP): Constrained mathematical set construction.
- Online Bin Packing (OBP): Sequential, online decision-making.
- Traveling Salesman Problem (TSP): Constructive routing heuristics.
No new benchmarks are introduced, though the authors generate held-out test instances using separate random seeds to test generalization.
Key Insights and Ideas
- Naive RL can actually hurt algorithm search: Standard GRPO underperforms the frozen base LLM in several settings! Without tree branching, noisy single-sample code failures actively mislead the policy away from good ideas.
- True conceptual transfer: Because ATPO rewards ideas based on reliable multi-code estimates rather than lucky instance-specific quirks, an LLM trained inside FunSearch can be dropped zero-shot into EoH or OpenEvolve and immediately accelerate search on unseen instances.
- Search and RL are symbiotic: Ablations show that RL without an evolving search population stagnates due to repetitive prompts, while search without RL hits a ceiling because the generator never internalizes feedback.
- Bigger models aren't automatically better: On ASP and OBP,
Qwen2.5-1.5Bfrequently matches or beatsQwen2.5-7B, echoing prior findings that raw parameter count doesn't guarantee better heuristic exploration.
Key Results
Under a matched budget of 20,000 evaluator calls using Qwen2.5-1.5B and Qwen2.5-7B, ATPO consistently lowers the average relative optimality gap (lower is better) of the top-5 discovered algorithms:
- Big wins on TSP (
Qwen2.5-7B): Integrating ATPO slashes FunSearch's relative gap from 11.31% to 7.90% (whereas standard GRPO worsened it to 13.41%). With OpenEvolve, ATPO drops the gap from 13.23% to 8.35%. - Cross-Search Generalization: Taking a
Qwen2.5-7Bpolicy trained viaFunSearch + ATPOand deploying it zero-shot on held-out TSP instances (2,000-evaluation budget) beats both base and GRPO-trained models across all frameworks—for example, improving EoH from 15.20% (base) to 11.26%. - Top-$K$ vs. Mean: Using Top-$K$ idea aggregation beats simple mean averaging on ASP (6.17% vs. 6.74% gap), confirming that ideas should be judged by their best instantiations.
Limitations and Future Work
- Compute vs. Evaluator Budget: Comparisons strictly match the number of algorithm evaluations (20,000), not wall-clock time, GPU-hours, or generated tokens.
- Finite Sampling & Parsing Quirks: Four code samples per idea reduce variance but remain vulnerable to sampling luck. Furthermore, marker-based text parsing doesn't strictly prevent the LLM from leaking code details into the idea segment (or vice versa).
- Not a universal sweep & narrow transfer: ATPO occasionally trails standard GRPO (e.g., EoH on TSP: 9.05% vs. 8.89%) or the base model (FunSearch 1.5B on OBP). Also, policy transfer is only demonstrated within the same problem type, not across entirely different domains (like TSP to Bin Packing).
- Future Directions: Dynamically allocating more code samples to high-uncertainty ideas, and deduplicating/cleaning rollout trajectories to better coordinate evolutionary search databases with online RL updates.
Summary updated