What is TreeQuest?
TreeQuest is an open-source Python library from Sakana AI that implements Adaptive Branching Monte Carlo Tree Search (AB-MCTS), a method for inference-time scaling: instead of asking a model once, you let a search decide, call by call, whether to try a fresh answer or refine a promising one. The paper behind it was a NeurIPS 2025 spotlight, and Sakana says the same method underpins its Marlin research agent.
You write a function that takes a parent state and returns a new state with a score between 0 and 1, usually by calling an LLM and grading the result. TreeQuest decides which node to expand next. It ships AB-MCTS-A, AB-MCTS-M and a multi-LLM mode that also chooses which model to call, plus checkpointing, a batched ask-tell interface and HTML tree visualisation.
It is Apache 2.0 and on PyPI as treequest, requiring Python 3.11 or later. The latest release is v0.3.3 from 16 October 2026; the repository has about 570 stars and three contributors.
Is TreeQuest worth it?
TreeQuest is a good library with a narrow brief. It does not call models, parse outputs or manage prompts; it decides where to spend the next call. That makes it easy to drop into an existing pipeline, which is its main advantage over writing MCTS yourself, and it is why the README quick start fits on one screen.
The method's best-known result shows both its promise and its catch. On 120 public ARC-AGI-2 tasks with a 250-call budget, Sakana reports that o4-mini with repeated sampling solved 23%, o4-mini with AB-MCTS 27.5%, and multi-LLM AB-MCTS combining o4-mini, Gemini 2.5 Pro and DeepSeek-R1 over 30%. That top figure is Pass@250, counting a task as solved if any attempt was right. Under the contest's two-answer rule it fell to 19.2%, and Sakana names answer selection as unsolved. TreeQuest finds good candidates; it does not tell you which one is correct unless your score function can.
So the quality of a TreeQuest run is the quality of its scorer. Where you have a verifier (unit tests, demonstration examples, a numeric objective) it is a sound way to turn more budget into better answers. Where you only have an LLM judge, the search optimises for what the judge likes.
The project is small and maintained: releases roughly every one to three months since 2025, zero open issues, and three contributors, so continuity depends on Sakana. The README warns that AB-MCTS-M steps can be slow and that large batches skew the tree; it suggests a batch size of five or fewer. For evolving whole programs over many generations, Sakana's ShinkaEvolve is the better-suited tool.
Where it earns its place
An engineer generating code against a unit-test suite
Raise the pass rate on hard tasks by spending more calls only where needed
Score each candidate by the share of tests passed and let AB-MCTS choose between new drafts and refinements. Sakana's ARC-AGI-2 runs capped spend at 250 calls per task.
A team with access to several model APIs
Combine models so one model's near-miss becomes another's starting point
Register one generate function per model and use multi-LLM AB-MCTS; on ARC-AGI-2 Sakana saw DeepSeek-R1 and Gemini fix o4-mini's wrong answers.
A researcher comparing inference-time scaling methods
Benchmark tree search against best-of-N sampling
Run AB-MCTS-A and plain repeated sampling with the same budget, then render both trees to HTML to compare their shapes.
Before you commit
- Setup
- pip install "treequest[all]" or uv add "treequest[all]" on Python 3.11 or later; the README quick start runs a 10-step search in a few lines.
- Integrations
- Model-agnostic: you call any LLM inside your own generate function. Optional extras add AB-MCTS-M dependencies and visualisation; search trees can be checkpointed and rendered to HTML.
- Data and privacy
- TreeQuest itself makes no network calls; whatever your generate function sends to an LLM provider is the only data leaving your machine. Apache 2.0 places no limits on commercial use.
- Cost at scale
- Spend equals the number of search steps times the cost of each generate-and-score call; at 250 calls a task, as in Sakana's ARC-AGI-2 runs, budget follows directly from your model's per-call price.
- Limits
- No final-answer selection beyond top_k by score. AB-MCTS-M is slow per step; batch sizes above five widen the tree too much, according to the README.
What's good
- Small API: one generate function returning (state, score)
- AB-MCTS-A, AB-MCTS-M and multi-LLM search in one package
- Checkpointing and resume for long runs that hit API errors
- Batched ask-tell interface for parallel calls
- Apache 2.0, regular releases, method published at NeurIPS 2025
What's not
- Results depend entirely on your scoring function
- No help choosing a final answer: ARC-AGI-2 Pass@2 was 19.2% against over 30% Pass@250
- AB-MCTS-M steps can be slow
- Large batch sizes distort the search tree
- Three contributors; small community
Best for
Engineers who already have a verifier for model outputs and want a tested search algorithm to turn a bigger call budget into better answers.
TreeQuest alternatives
TreeQuest: common questions
- Is TreeQuest worth it?
- A clean, minimal implementation of a respected search method that does exactly one job, and leaves the hard parts, scoring and choosing a final answer, to you. We rate it 3.8 out of 5.
- How much does TreeQuest cost?
- Free under Apache 2.0. Costs are the LLM calls your generation and scoring functions make.
- What are the downsides of TreeQuest?
- Results depend entirely on your scoring function; no help choosing a final answer: ARC-AGI-2 Pass@2 was 19.2% against over 30% Pass@250; aB-MCTS-M steps can be slow; large batch sizes distort the search tree; three contributors; small community.
- Who is TreeQuest best for?
- Engineers who already have a verifier for model outputs and want a tested search algorithm to turn a bigger call budget into better answers.
- How much does TreeQuest cost for a team or in production?
- Spend equals the number of search steps times the cost of each generate-and-score call; at 250 calls a task, as in Sakana's ARC-AGI-2 runs, budget follows directly from your model's per-call price.
- Is TreeQuest safe for company data?
- TreeQuest itself makes no network calls; whatever your generate function sends to an LLM provider is the only data leaving your machine. Apache 2.0 places no limits on commercial use.
- What are the best TreeQuest alternatives?
- The closest alternatives we have reviewed are ShinkaEvolve, The AI Scientist (v1, v2 and v3) and LangGraph.
Answers checked Oct 26, 2026.