ramgod
A C++ inference engine built on llama.cpp that runs Mixture-of-Experts LLMs larger than RAM on Apple Silicon Macs by streaming expert weights from SSD.
At a Glance
Free for personal projects, hobby use, research, education and other noncommercial purposes under PolyForm Noncommercial 1.0.0. Source-available, not OSI open source.
Engagement
Available On
Alternatives
Listed Dec 2026
About ramgod
ramgod is a C++ inference engine for Apple Silicon Macs that runs Mixture-of-Experts (MoE) language models larger than the machine's RAM. It is built on llama.cpp and published by Ri4dH under the PolyForm Noncommercial 1.0.0 license. The README reports 3.7 tokens/s for gpt-oss-20b and 3.5 tokens/s for Qwen3-30B-A3B on an 8 GB M1, which it states is 3.2–5.1× faster than llama.cpp's best settings on that machine.
What It Is
ramgod streams a MoE model's experts from the SSD as they are needed. llama.cpp still does all the math, so output matches llama.cpp's. ramgod only decides when and how expert weights move from the SSD into RAM. It takes GGUF MoE models as input and is run from a command-line tool with chat, run and bench-fetch commands.
How the streaming works
ramgod hooks llama.cpp's per-layer router output and acts before each layer's experts run:
- It reads the chosen experts in large parallel chunks (8 I/O threads, 4 MB reads), skipping pages already in RAM.
- It predicts the next layer's experts and prefetches them while the current layer computes (pre-gating). The README says this finds 87–89% of the experts the next layer will pick.
- It maps freshly read pages in background threads before the math threads touch them, avoiding page-fault stalls.
- It locks each layer's most-used experts in RAM with
mlockand leaves the rest to the page cache.--no-pinturns this off.
Setup path
The build requires an Apple Silicon Mac, Homebrew's llama.cpp and a MoE model in GGUF format. make builds build/ramgod, and make test runs unit tests that need no model. Other commands include run with detailed stats, --mode none for a plain llama.cpp comparison, and scripts/engine_ab.py for alternating A/B benchmarks. An optional script trains a small correction for the gpt-oss next-layer predictor.
Tradeoffs to know
The README recommends plain llama.cpp when the model fits in free RAM. ramgod is macOS on Apple Silicon only. It was tested on one 8 GB M1 with llama.cpp build 12359 and depends on llama.cpp's internal tensor names, so newer llama.cpp versions may break it. Other MoE GGUFs such as Mixtral and OLMoE are listed as untested. The license permits noncommercial use only.
Collections
Popular collections
- Charts, Graphs, and Diagrams
Collection by @joemseifi
- Pick Up Where Your Agent Left Off
Collection by @caiovalverde
- Give Your Agent Design Taste
Collection by @linetwk
- UI Design Skills for Coding Agents
Collection by @mayachen
Add ramgod to one of your collections.
Community Discussions
Be the first to start a conversation about ramgod
Share your experience with ramgod, ask questions, or help others learn from your insights.
Pricing
Noncommercial License
Free for personal projects, hobby use, research, education and other noncommercial purposes under PolyForm Noncommercial 1.0.0. Source-available, not OSI open source.
- PolyForm Noncommercial 1.0.0 license (not OSI-approved)
- Commercial use not permitted under this license
- macOS on Apple Silicon only
Capabilities
Key Features
- Streams MoE expert weights from SSD on demand
- Parallel 4 MB reads with 8 I/O threads
- Next-layer expert prediction and prefetching (pre-gating)
- Pre-faulting of freshly read pages
- Locks most-used experts per layer in RAM
- Interactive chat and single-run commands with detailed stats
- SSD expert read benchmark (bench-fetch)
- Alternating A/B benchmark script against llama.cpp
- Optional trained pre-gate correction for gpt-oss
