explaingit

cactus-compute/cactus-hybrid

Analysis updated 2026-05-18

154ShellAudience · developerComplexity · 3/5Setup · moderate

TLDR

Cactus Hybrid trains small on-device AI models to output a confidence score with every answer. When confidence is low, questions are routed to a larger cloud model, saving cost while keeping most processing local.

Mindmap

mindmap
  root((repo))
    What it does
      Confidence scores
      Route to big model
      On-device AI
    Models
      Gemma 4 E2B Hybrid
      Text vision audio
      Compression support
    Runtimes
      Python package
      Apple MLX
      Hugging Face Transformers
      llama.cpp
    Use cases
      Save cloud costs
      Privacy on device
      Hybrid AI routing
    Metrics
      AUROC scoring
      Benchmark results
    Audience
      App builders
      Cost-conscious teams

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Run a small AI model on-device and only call a cloud API when it is unsure, cutting compute costs.

USE CASE 2

Get a structured confidence score with every AI answer to filter out low-trust responses automatically.

USE CASE 3

Build a hybrid chatbot that stays private for most queries and escalates hard questions to a larger model.

USE CASE 4

Benchmark your own small model's self-uncertainty across text, vision, and audio tasks using AUROC.

What is it built with?

PythonShellMLXTransformersllama.cpp

How does it compare?

cactus-compute/cactus-hybriddockur/proxmoxgoroman/nullevi03
Stars154149160
LanguageShellShellShell
Setup difficultymoderatemoderate
Complexity3/53/5
Audiencedeveloperops devopsgeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Multiple runtime paths each need different setup, the Transformers path requires manual weight loading to avoid a confidence probe path issue with automatic device offloading.

The explanation does not mention a license, so the terms of use are unclear.

In plain English

Cactus Hybrid is a project about making small AI models that run on your own device better at knowing when they are wrong. A small model is fast and private, but it sometimes gives incorrect answers. Cactus trains models to recognize their own uncertainty. Every answer the model produces comes with a confidence score between 0 and 1, returned as structured data rather than extracted from the answer text. The idea is simple in practice. When the model gives an answer with high confidence, you trust it. When the confidence is low, you can send the question to a larger model instead. The README shows this as a basic conditional: if confidence is below a threshold like 0.85, ask a bigger model. This lets you keep most queries on device while only paying for cloud compute on the uncertain ones. The first model released is Gemma 4 E2B Hybrid, the smallest Gemma model. The README claims it matches Gemini 3.1 Flash-Lite on most benchmarks by routing only 15 to 55 percent of queries to the larger model, depending on the benchmark and how much the model is compressed. Compression at lower bit rates requires more handoffs to maintain quality. For example, MMLU-Pro needs 45 to 55 percent handoff at full precision and roughly 90 percent at 4-bit. The project supports several runtimes. You can use it through a Python package called cactus-compute, through MLX for Apple Silicon, through Hugging Face Transformers, or through llama.cpp with a compiled patch. Each path returns the same confidence field alongside the answer. The Transformers instructions include a note about loading weights manually, because the confidence probe reads from a path that breaks with automatic device offloading. The README also reports routing quality using a metric called AUROC, which measures how well the confidence score separates correct answers from wrong ones. A score of 0.5 is random guessing and 1.0 is perfect. Cactus Hybrid averages 0.814 across thirteen benchmarks covering text, vision, and audio tasks. Notably, the probe was trained on no audio data yet still scored 0.79 to 0.88 on audio benchmarks, which the authors argue means it is reading a general correctness signal rather than memorizing patterns.

Copy-paste prompts

Prompt 1
I want to use Cactus Hybrid to route uncertain AI answers to a bigger model. Write a Python function that calls cactus-compute, checks if the confidence field is below 0.85, and only then sends the prompt to an OpenAI model.
Prompt 2
Help me set up Cactus Hybrid with MLX on my Mac so I get a confidence score alongside each answer. Include the code to load the Gemma 4 E2B Hybrid model and parse the returned confidence.
Prompt 3
Using Cactus Hybrid via Hugging Face Transformers, write code that loads the weights manually to avoid the device offloading issue with the confidence probe, and returns both the answer and the confidence score.
Prompt 4
I have Cactus Hybrid running via llama.cpp with the compiled patch. Show me how to interpret the confidence score and build a simple if-statement that routes low-confidence answers to a cloud model.
Prompt 5
Create a benchmarking script using Cactus Hybrid that tests a small model on a dataset, collects the confidence scores, and computes AUROC to measure how well the confidence separates correct from wrong answers.

Frequently asked questions

What is cactus-hybrid?

Cactus Hybrid trains small on-device AI models to output a confidence score with every answer. When confidence is low, questions are routed to a larger cloud model, saving cost while keeping most processing local.

What language is cactus-hybrid written in?

Mainly Shell. The stack also includes Python, Shell, MLX.

What license does cactus-hybrid use?

The explanation does not mention a license, so the terms of use are unclear.

How hard is cactus-hybrid to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is cactus-hybrid for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.