Close
0%
0%

Branching Tree Research with AB-MCTS & Open WebUI

Tree Search Reasoning for Local LLMs via OpenWebUI and Ollama integration.

Public Chat
Similar projects worth following
64 views
0 followers
An open-source tool that brings Monte Carlo Tree Search (MCTS) reasoning to Open WebUI, for locally run models built on research by Sakana AI’s AB-MCTS.

AB-MCTS for Open WebUI: Tree Search Reasoning for Local LLMs via OpenWebUI and Ollama integration.

Running powerful AI reasoning on limited hardware? Here is an open-source tool that brings Monte Carlo Tree Search (MCTS) reasoning to Open WebUI, optimized for small local models built on research by Sakana AI’s AB-MCTS.

What is it?

AB-MCTS (Adaptive Branching Monte Carlo Tree Search) is a tree search algorithm that explores multiple solution paths in parallel, using LLMs to both generate answers and judge their quality. Think of it like having your AI brainstorm several approaches, refine the best ones, and pick the winner—all automatically.

This implementation integrates Sakana AI’s AB-MCTS algorithm with Open WebUI, making advanced reasoning accessible to anyone running local models on consumer hardware.

Key Features

Multi-Criterion Judge Evaluation: Answers are scored across 4 dimensions:

  • Accuracy (25%) – factual correctness
  • Completeness (25%) – thorough coverage
  • Clarity (25%) – clear communication
  • Relevance (25%) – stays on topic

Weights are fully configurable through the dashboard.

Thompson Sampling Depth Control: Instead of hard depth limits, the algorithm naturally balances exploration (trying new approaches) and exploitation (refining good ones) based on iteration count. More iterations = deeper trees when beneficial.

Optimized for Small Models: Tested on 0.6-1B parameter models, the system favors width (multiple attempts) over depth (refinement), since smaller models struggle with iterative improvement but excel at diverse generation.

Clean Open WebUI Integration: Automatically strips auto-generated task wrappers (tags, titles, follow-ups) to ensure AB-MCTS works on your actual questions, not meta-tasks.

Why Use This?

Traditional LLMs give one answer. AB-MCTS explores multiple solution paths, judges them objectively, and returns the best result. 

Perfect for:

  • Complex questions with multiple valid approaches
  • Fact-checking and accuracy-critical tasks
  • Limited hardware where you need quality over raw model size
  • Research and experimentation with tree search reasoning

Technical Stack:

  • Backend: Python, FastAPI
  • Algorithm: Sakana AI’s TreeQuest AB-MCTS
  • Integration: OpenAI-compatible API for Open WebUI
  • Deployment: Docker Compose
  • Persistence: JSON-based config across restarts 

Get Started

The project is fully open source and ready to run: GitHub: https://github.com/johnsonfarmsus/openwebui-ab-mcts-pipeline

Simply clone, configure your models, and docker-compose up. The dashboard provides full control over iterations, judge selection, scoring weights, and multi-model ensembles. 

This project is a bit rough and ready, but is in its final state, please feel free to modify, update, and otherwise improve upon it. The scope and scale during my development fluctuated significantly and led to some bloat and oddities within the code in a way that I would rather start from scratch if I were to endeavor to improve on this idea.

  • Result Comparison: Individual Models vs AB-MCTS Integration

    JohnsonFarms.us10/11/2025 at 02:38 0 comments

    Here are some query and results for the LLMs used individually, and then together in the AB-MCTS integration. You can see that the small models do often struggle but when working together often find a better result.

    Query:

    How many chocolate chips must a cookie contain to be considered a chocolate chip cookie?

    TLDR

    smollm:135m: No Quantity Specified

    qwen3:0.6b: 100

    AB-MCTS using same models: 5-20 grams

    smollm:135m:

    The sweet, crunchy goodness of a chocolate chip cookie! To determine the number of chocolate chips necessary to make a cookie, we need to consider the following factors:
    1. **Sugar content**: The amount of sugar in the cookie affects the sweetness level and the likelihood of it becoming overpowering or underwhelming. A cookie with too much sugar can be overwhelming, while one with too little sugar may not provide enough flavor.
    2. **Fat content**: The fat content in the cookie influences its melting point and stability. A cookie with a high amount of fat (e.g., butterfat) is more prone to becoming solid than a cookie with a low amount of fat (e.g., sugar).
    3. **Chocolate flavor profile**: The chocolate flavor profile, including the type of cocoa bean, roast level, and processing method, affects the overall flavor experience. A cookie with a unique flavor profile can be more enjoyable or less enjoyable to eat than one with a similar flavor but with different characteristics (e.g., caramel-like, nutty, or fruity).
    4. **Sugar content variability**: The sugar content of the cookie varies widely between brands and even within individual cookies. This variability affects the sweetness level and likelihood of it becoming too overpowering or underwhelming.
    5. **Fat content variability**: The fat content in the cookie also varies, but this is more pronounced for chocolate chips than for other types of fats (e.g., butterfat). This variability can make a cookie with high fat content less appealing to some people and more appealing to others.
    6. **Sugar content variation within a single cookie**: Even within individual cookies, there may be variations in sugar content due to factors like the type of cocoa bean used or processing method (e.g., roasting level). This variability can make it challenging for consumers to distinguish between sweet and savory flavors.
    7. **Chocolate chip size and shape**: The size and shape of the cookie also affect the sweetness level, as larger cookies may be more difficult to break down into a satisfying chocolate flavor experience.
    8. **Cookie type and preparation method**: The type and preparation method (e.g., pan-frying, baking) can influence the overall sweetness level and likelihood of it becoming too overpowering or underwhelming. For example, a cookie with a high fat content may be more appealing to those who prefer a caramelized or nutty flavor experience due to its texture and browning.
    9. **Cookie type and preparation method**: The type and preparation method (e.g., pan-frying, baking) can influence the overall sweetness level and likelihood of it becoming too overpowering or underwhelming due to factors like caramelization, nutty flavor, or fruity flavor. For example, a cookie with high fat content may be more appealing to those who prefer a sweet, savory flavor experience due to its texture and browning.
    10. **Cookie type and preparation method**: The type and preparation method (e.g., pan-frying, baking) can influence the overall sweetness level and likelihood of it becoming too overpowering or underwhelming due to factors like caramelization, nutty flavor, or fruity flavor. For example, a cookie with high fat content may be more appealing to those who prefer a sweet, savory flavor experience due to its texture and browning.
    By considering these factors, you can make an informed decision about whether to include chocolate chips in your cookie recipe.

    qwen3:0.6b:

    A cookie containing chocolate chips is typically made with a combination of ingredients, including chocolate chips,...
    Read more »

View project log

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates