BigMoeOnEdge README

The project's README from github.com/Helldez/BigMoeOnEdge. As one markdown file: README.md.

BigMoeOnEdge

Helldez%2FBigMoeOnEdge | Trendshift

Latest release CI License

English · 中文 · 日本語 · Español · Français · Italiano

Run Mixture-of-Experts models larger than your device's memory. The engine keeps the weights every token needs and the experts used most in memory, and reads the rest from flash as the model asks for them. One engine for phones, laptops, desktop and datacenter GPUs, on Android, iOS, macOS, Windows and Linux: it measures the machine and the model and sets itself up. Built on llama.cpp.

Qwen3.6-35B-A3B generating an answer on a 12 GB Android phone, in real time. The iPhone app on a 12 GB iPhone with Qwen3.6-35B-A3B loaded: a chat about a picture, the plan, the models and the settings, in real time.
12 GB Android phone
Qwen3.6-35B-A3B · 5-6 tok/s
12 GB iPhone
Qwen3.6-35B-A3B · 6 tok/s
Qwen3.6-35B-A3B generating an answer in the desktop app on a 16 GB Apple-silicon laptop, in real time, at 21 tok/s.
16 GB Apple-silicon laptop
Qwen3.6-35B-A3B · 18-24 tok/s

Qwen3.6-35B-A3B, larger than each device's memory; any MoE model in GGUF runs, at any quantization. Speeds by machine and release: Performance.

The agent on a 2021 laptop, no GPU: the viral voxel-pagoda prompt to the built-in agent on a ThinkPad with 16 GB of RAM, CPU only, and Qwen3.6-35B-A3B Q4_K_M. 988 lines at 2.3 tok/s, then the page in the app's preview; the speed-ups are marked on screen.

The built-in agent writing a voxel pagoda garden as one HTML file on a 2021 ThinkPad with 15 GB of RAM and no dedicated GPU, then the page in the app's preview, turning.

What it does

Platforms

Android iOS macOS Windows Linux
Engine and CLI arm64 arm64 (in the app) Apple silicon x86_64, arm64 x86_64, aarch64
App native app (APK) native app, TestFlight beta desktop app (.dmg) desktop app (installer) desktop app (AppImage)
Accelerators Hexagon NPU, Vulkan, OpenCL Metal Metal CUDA, Vulkan; OpenCL and Hexagon NPU on arm64 CUDA, HIP (AMD ROCm), Vulkan
Run on a 12 GB phone 12 GB iPhones a 16 GB laptop a 16 GB laptop; NVIDIA laptops and desktops in field reports rented NVIDIA cards from 8 to 96 GB, a 192 GB AMD card (ROCm)

What is measured, shipped or still owed on each: docs/platforms.md.

How it compares

BigMoeOnEdge llama.cpp Strata Lucebox ds4 colibri KTransformers
Android phone (NPU too) ✅ ✅ ❌ ❌ ❌ ❌ ❌
iPhone ✅ ✅ ❌ ❌ ❌ ❌ ❌
Mac ✅ ✅ ✅ ❌ ✅ ✅ ❌
Windows ✅ ✅ ✅ ❌ ❌ ✅ ✅
CPU only ✅ ✅ ❌ ❌ ❌ ✅ ❌
NVIDIA ✅ ✅ ✅ ✅ ✅ ✅ ✅
AMD ✅ ROCm, MI300X too ✅ Radeon RX, Strix Halo R9700, Ryzen AI MAX+ Strix Halo Vulkan ✅
Models any MoE GGUF any GGUF a list; your own file since 0.2.23 a list its own GGUFs its own format; GGUF by import listed families
Experts beyond RAM streamed from flash OS page cache spread to SSD by its planner streamed from SSD (DeepSeek V4.1) streamed from SSD streamed from disk held in RAM
Configures itself ✅ --auto, from measurements --fit picks the model by memory a profile per set of GPUs expert-cache budget coli setup, coli tune ❌

What each engine runs on and the speeds each reports, checked on 2026-11-28: docs/comparison.md. Against them on the same machine: Performance.

Install

From the latest release:

Open the app and pick a model under Models. An NVIDIA or AMD card gets its backend from Settings (docs/desktop-app.md).

Command-line tools only (bmoe-cli, bmoe-server):

curl -fsSL https://github.com/Helldez/BigMoeOnEdge/releases/latest/download/install.sh | sh
irm https://github.com/Helldez/BigMoeOnEdge/releases/latest/download/install.ps1 | iex

Use

bmoe-cli -m model.gguf --auto -p "Explain MoE routing."   # plan and run
bmoe-cli -m model.gguf --plan                              # print the plan
bmoe-server -m model.gguf -c 32768                         # the server and its web UI, port 8765

The server speaks the OpenAI API (/v1/chat/completions, /v1/responses) and the Anthropic one (/v1/messages), with streaming, tool calls and reasoning. Add --host 0.0.0.0 --api-key KEY to serve other machines. Reference: docs/server-api.md.

On a machine that stays on, register it as a service of your login instead: it starts with the machine, comes back with its model, and reloads it when a request finds none loaded (running as a service).

bmoe-server service install --host 0.0.0.0 -m model.gguf -c 65536   # systemd, launchd or Task Scheduler
bmoe-server service status
from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8765/v1", api_key="local")
reply = client.chat.completions.create(model="local", messages=[{"role": "user", "content": "Hello"}])
print(reply.choices[0].message.content)

Coding agents need a large context: a few times their first request. 32768 is enough for opencode, 65536 for Claude Code (sizing the context).

opencode, Claude Code and Codex CLI settings
// opencode, ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "bmoe": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://127.0.0.1:8765/v1", "apiKey": "local" },
      "models": { "<model id from /v1/models>": { "limit": { "context": 32768, "output": 8192 } } }
    }
  },
  "model": "bmoe/<model id from /v1/models>"
}
# Claude Code
export ANTHROPIC_BASE_URL=http://127.0.0.1:8765
export ANTHROPIC_API_KEY=local
export ANTHROPIC_MODEL=<model id from /v1/models>
export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=65536
claude
# Codex CLI, ~/.codex/config.toml
model = "<model id from /v1/models>"
model_provider = "bmoe"

[model_providers.bmoe]
name = "bmoe"
base_url = "http://127.0.0.1:8765/v1"
wire_api = "responses"
env_key = "BMOE_API_KEY"   # export BMOE_API_KEY=local

Under Connect apps, the app writes the settings for opencode and Codex CLI and shows the ones for Claude Code.

The agent. The desktop app has its own agent: it works in a folder you choose, reads and edits files and runs commands, and asks before it changes anything unless you allow it. A conversation can also be run by OpenCode, Claude Code, Codex or Pi. See docs/agent.md.

How it works

For each token, the router of each layer picks a few experts. The engine looks for them in up to three tiers, each a cache for the one below:

An expert missing from VRAM is copied from RAM; one missing from RAM is read from flash. On a phone or an Apple-silicon Mac the GPU uses the same RAM as the CPU, so there are two tiers. A model that fits the card runs on it whole. Streaming only reads, so it does not wear the drive.

The engine uses llama.cpp's public API, so its quantizations, tokenizers and chat templates work unchanged, and an upgrade is a submodule bump. Which tensors are experts is read from the file (docs/which-models-stream.md). Design: docs/architecture.md.

The planner

The Plan screen on a 16 GB Apple-silicon laptop with Qwen3.6-35B-A3B Q4_K_M: experts stream from flash with a 6.6 GiB cache, the prompt runs on the GPU and the tokens on the CPU, 23.9 tok/s and 94% cache hits measured, and where the memory goes.

The planner reads the model's header and measures the machine: memory, storage speed, each CPU, GPU and NPU. Its rules name no device or platform, so a phone and a desktop get different plans from the same code. Values you set yourself are kept. See docs/hardware-planning.md.

The planner: the machine and the model go into the plan; the plan decides where each weight goes (VRAM, RAM or flash), which device reads the prompt and which one generates, and the cache sizes and threads; the first answer is measured and what is faster is kept for the next load.

Performance

Decode in tokens per second, --auto, one stream. A range is the spread across runs.

Measured on 0.50 (bench-data):

Hardware Memory Model On disk Experts from Decode tok/s
Desktop GPU (NVIDIA) 24 GB + 23 GB RAM Qwen3.6-35B-A3B 21 GB GPU 156
Qwen3.8-Flash-Next 125B 66 GB flash, GPU cache 16-19
Inkling 2 Mini 17 GB GPU 61
Desktop GPU (NVIDIA) 12 GB + 61 GB RAM Qwen3.6-35B-A3B 21 GB RAM, GPU cache 99-102
Qwen3.8-Flash-Next 125B 66 GB RAM, GPU cache 45-51

Coming, in open pull requests not released yet. They are drafts: the figures can change, and an install does not give them today.

Hardware Model Before With the PR PR
Apple-silicon laptop, 16 GB Qwen3.8-Flash-Next 125B 7-9 14 #741
Apple-silicon laptop, 16 GB Qwen3.6-35B-A3B 18-24 28-29 #741
Desktop GPU (NVIDIA), 12 GB Qwen3.6-35B-A3B 52 59 #741
Apple-silicon laptop, 16 GB Qwen3.6-35B-A3B, code, with a draft model 24 38 #749, #755
Apple-silicon laptop, 16 GB Qwen3.6-35B-A3B, reading a 3k-token prompt 215 367 #749

Earlier releases, kept until a release test measures them again:

Hardware Memory Model On disk Experts from Decode tok/s
Android phone 12 GB DeepSeek V4 Flash 284B 91 GB flash 1
Qwen3.8-Flash-Next 125B 80 GB flash 2-4
Qwen3.6-35B-A3B 21 GB flash 5-6
iPhone 12 GB Qwen3.6-35B-A3B 21 GB flash 6
Apple-silicon laptop 16 GB Qwen3.8-Flash-Next 125B 76 GB flash 7-9
Qwen3.6-35B-A3B 21 GB flash 18-24
Windows laptop 16 GB Qwen3.6-35B-A3B 21 GB flash 5
Desktop GPU (NVIDIA) 12 GB + 128 GB RAM Qwen3.8-Flash-Next 125B 84 GB RAM, GPU cache 16-17
Desktop GPU (NVIDIA) 16 GB + 32 GB RAM Qwen3.8-Flash-Next 125B 66 GB flash, GPU cache 19-21
Desktop GPU (NVIDIA) 24 GB + 96 GB RAM Qwen3.8-Flash-Next 125B 66 GB RAM, GPU cache 70
Qwen3.6-35B-A3B 21 GB GPU 217
Desktop GPU (NVIDIA) 24 GB + 62 GB RAM Qwen3.6-35B-A3B 21 GB GPU 154
12 GB of it free Qwen3.6-35B-A3B 21 GB RAM, GPU cache 59-67
Gemma 4 26B-A4B 17 GB GPU 114
Laguna XS 2.1 33B 20 GB GPU 93-94
Desktop GPU (NVIDIA) 8 GB + 31 GB RAM Qwen3.8-Flash-Next 125B 66 GB flash, GPU cache 16
Qwen3.6-35B-A3B 21 GB RAM, GPU cache 37-44
Two desktop GPUs (NVIDIA) 2 × 16 GB + 60 GB RAM Qwen3.8-Flash-Next 125B 66 GB RAM, GPU cache 41-48
DeepSeek V4 Flash 284B 91 GB flash, GPU cache 5
Datacenter GPU (AMD, ROCm) 192 GB Qwen3.8-Flash-Next 125B 66 GB GPU 53

Against other engines, same machine and file. On Qwen3.6-35B-A3B this engine is ahead: 55 tok/s against Strata's 41 on a 12 GB card (0.45), 154 against Lucebox's 123 on a 24 GB one (0.41). On Qwen3.8-Flash-Next Strata is two to three times faster: 23 against 45 on a 12 GB card, 16 against 49 on an 8 GB one (0.45). Every run: docs/comparison.md.

Method and every run: docs/benchmarks.md. To add your machine, run scripts/bench-report.sh model.gguf and open a benchmark report.

Build from source

git clone --recursive https://github.com/Helldez/BigMoeOnEdge.git
cd BigMoeOnEdge
cd ui && npm ci && npm run build && cd ..
scripts/build-host.sh
build/bin/bmoe-server --open

A llama.cpp backend is a CMake flag passed through: scripts/build-host.sh -DGGML_VULKAN=ON (or -DGGML_CUDA=ON). Tests: cd build && ctest --output-on-failure (needs python3 with gguf). Android: scripts/build-android.ps1, then the APK in examples/android. On the phone itself, in Termux: pkg install git cmake clang make nodejs-lts, then the steps above with scripts/build-host.sh -DBMOE_BACKEND_MODULES=OFF, one CPU library for that phone's cores instead of a module per instruction-set tier. More: CONTRIBUTING.md.

Documentation

docs/. Start with hardware-planning.md, settings.md, server-api.md and limitations.md.

Prior art

AirLLM, Apple's LLM in a flash, FlexGen, PowerInfer, EdgeMoE and flash-moe, a Metal engine that streams a 397B MoE from SSD on Apple silicon.

License

Apache-2.0 (LICENSE). The binaries and apps also carry llama.cpp, ggml and other libraries under MIT, BSD, Apache-2.0 and SIL OFL 1.1: THIRD_PARTY_LICENSES.

BigMoeOnEdge (Helldez/BigMoeOnEdge)

edge-ai
Searching Database…

What is this?BigMoeOnEdge is an adaptive streaming engine that runs Mixture-of-Experts (MoE) LLMs several times bigger than your device's RAM, by keeping in memory only what each token needs and streaming the rest from storage. Output is identical to running the model fully in RAM, and it serves everything through a local OpenAI-compatible API built on llama.cpp.
Is this a standalone app or something I build into my own code?It's a real app you install and run, not a library you code against: a native Android app for phones and a bmoe-desktop package (with a CLI/server) for macOS, Windows and Linux. Any OpenAI-compatible client, including coding agents, then talks to its local server.
How do I get it running?On Android, install the APK from the latest release and pick a model under Models. On macOS/Windows/Linux, download the bmoe-desktop archive and run `bmoe-server --open`, which opens a web app with Chat, Models, Plan, Settings and Metrics screens.
Does it work with any MoE model and any hardware right now?Any MoE GGUF that llama.cpp loads should stream correctly, since routed-expert tensors are detected from the file header, but iOS builds only run in the simulator so far, and extra accelerator backends like CUDA, HIP or SYCL load as separate modules you'd have to build yourself.
Does it use my GPU or NPU, or just the CPU?It picks whatever accelerator the machine has: NPU (Hexagon), Vulkan or OpenCL on Android, Metal on macOS, Vulkan on Windows and Linux. Third-party CUDA/HIP/SYCL modules can be dropped in the same way as the shipped backends.
What does the adaptive streaming optimizer actually do?A built-in planner measures the exact machine (RAM, storage speed, every CPU/GPU/NPU) and decides what stays resident vs. what streams from disk, showing the reasoning behind each choice on a dedicated Plan screen.
How fast is it on a real phone?On a 12 GB Android phone, a 125B-parameter MoE model (80 GB on disk, 6.7x its RAM) decodes at 2.2-3.5 tok/s, and a smaller 30B-A3B model reaches around 5.2 tok/s.
Why is this lossless instead of an approximation?The project treats correctness as a test: ctest verifies that streamed output matches running every expert fully in memory, across caching, eviction, overlap, sessions and split models.
Can I use it with coding agents like opencode?Yes — any OpenAI-compatible client works against the local server, and the README specifically shows wiring it up as an opencode provider via baseURL.
Creator
Helldez
Size
33.5 MB
Stars
1K
Age
4mo
Commits · 90 Days