shunte88/eomoe
关于
Run big open MoE and hybrid models (Qwen3.6, Qwen3-Coder-Next, gpt-oss, GLM-4.7, gemma 4, Qwen3.8, Bonsai) on one 8 GB NVIDIA GPU. Single-binary Rust + CUDA drop-in for llama-server, faster than tuned llama.cpp on most models; works with Claude Code, Codex, OpenAI and Ollama clients.
开发工具实测星标增长
- 24小时
- +1
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
eomoe - everyman's own MoE: big open models on one 8 GB GPU
A single-binary Rust server that runs mixture-of-experts and hybrid models (Q4_K_M / Q4_0 / MXFP4 / NVFP4 / IQ2_XXS / ternary Q2_0 GGUF) on one 8 GB GPU: Qwen3.6-35B-A3B, Qwen3-Coder-30B-A3B, Qwen3-Coder-Next, gpt-oss-20b, GLM-4.7-Flash, gemma-4-26B-A4B, Qwen3.8-27B, Ternary-Bonsai-2.5-27B, Nemotron 3.5 Bolt (74B-A9B) and Recursive Flint 1.1 (40B-A2.5B). It speaks the same HTTP APIs as llama-server, so Claude Code, Codex and OpenAI clients work unchanged.
NVIDIA GPUs only (CUDA, sm_80 and newer); there is no AMD, Vulkan or ROCm backend. Hardware, coding ability and long-session questions: docs/faq.md.
Experts live in RAM. The ones in use are cached in VRAM, and misses are streamed over PCIe while compute runs. Prefill / decode tok/s on an RTX 5060 8 GB, measured with tools/bench.py (~5K-token prompt, 128 tokens out; details in STATUS.md). eomoe leads on 16 of the 18 numbers:
| Model | eomoe | Best tuned llama.cpp | RustingStrata v1.4.2 |
|---|---|---|---|
| Qwen3.6-35B-A3B | 1467 / 69.8 | 990 / 49.9 | 1308 / 62.7 |
| Qwen3-Coder-30B-A3B | 1325 / 59.5 | 935 / 39.6 | loads, replies empty |
| gpt-oss-20b | 1881 / 51.4 | 1804 / 44.7 | does not load |
| GLM-4.7-Flash | 977 / 35.6 | 863 / 29.2 | does not load |
| Qwen3-Coder-Next (80B-A3B, 64 GB RAM) | 909 / 42.8 | 389 / 26.1 | does not load |
| Nemotron 3.5 Bolt (74B-A9B Mamba-2 hybrid, 24 GB GGUF) | 775 / 34.0 | 480 / 32.2 | not tested |
| Recursive Flint 1.1 (40B-A2.5B, sliding window + sinks) | 1463 / 50.5 | 293 / 44.2 | not tested |
| Ternary-Bonsai-2.5-27B (dense, Q2_0) | 811 / 23.6 | 793 / 23.3 | not tested |
| Qwen3.8-27B (dense, MTP drafts on both) | 371 / 6.2 | 306 / 7.3 | not tested |
Default context is 32K tokens (f16 KV). A Claude Code fix-a-bug session on Qwen3.6 (19K-token prompt) takes 29 s. Claude Code needs 64K+ context to avoid constant compaction: tuned setups per model are in examples/claude-code.
Quick start
cargo build --release
./target/release/eomoe install # model + Claude Code / Codex clients
./target/release/eomoe serve # leave running (127.0.0.1:8080)
./target/release/eomoe claude # Claude Code on the local server
./target/release/eomoe codex # Codex CLI on the local server
./target/release/eomoe opencode # opencode on the local server
./target/release/eomoe openclaw chat # OpenClaw on the local server
./target/release/eomoe top # live dashboard: requests, cache hits, tok/s, memory
./target/release/eomoe check # streamed smoke test of both APIs
install reuses an existing reference install (~/.local/share/local-code-llm) instead of downloading again. eomoe's own home is $EOMOE_HOME, by default ~/.local/share/eomoe.
HTTP API
The API is wire-compatible with llama-server (e6443bd). The gates in tests/phase5_golden.rs diff it against captured oracle traffic (tests/golden/api.json).
| Endpoint | API |
|---|---|
POST /v1/chat/completions |
OpenAI chat: tools, streaming, stream_options.include_usage, timings |
POST /v1/responses |
OpenAI Responses (Codex) |
POST /v1/messages, /v1/messages/count_tokens |
Anthropic Messages (Claude Code) |
POST /v1/completions |
OpenAI text completions: raw prompt (string or token ids), streaming |
POST /completion, /infill |
llama.cpp native completion and fill-in-the-middle (input_prefix, input_suffix, input_extra), for llama.vim / llama.vscode |
POST /api/chat, /api/generate; GET /api/tags, /api/ps, /api/version; POST /api/show |
Ollama API, for tools that only speak Ollama (OLLAMA_HOST=127.0.0.1:8080 ollama run local-code) |
GET /v1/models, /health |
|
GET / |
Minimal web chat page |
/chat/completions, /responses and /models are also served without the /v1 prefix, and /v1/responses/input_tokens counts tokens for Codex.
Structured output: response_format with json_object or json_schema (also Responses text.format) constrains sampling to valid JSON. The supported schema subset is type, properties, required, additionalProperties (absent means false when properties is given, as llama.cpp), items, enum, const, anyOf/oneOf and $ref into the same schema ($defs), which covers Pydantic models. Other keywords (allOf, pattern, minItems, formats) are accepted but not enforced. logit_bias ({"<id>": bias} or [[id, bias]], false bans) is honoured too.
from openai import OpenAI
c = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key="none")
print(c.chat.completions.create(model="local-code", messages=[{"role": "user", "content": "hi"}]).choices[0].message.content)
The prompt prefix is reused across requests (KV cache), so agent follow-up turns only prefill the new tokens.
Configuration
Settings come from flags, environment variables, or a YAML file (--config, or EOMOE_CONFIG_PATH). Flags override environment variables, which override the file. See config.example.yaml and eomoe serve --help.
| Flag | Env | Default |
|---|---|---|
--model |
MODEL_FILE |
<home>/models/Qwen3-Coder-30B-A3B-Instruct-Q4_K_M.gguf |
--host |
127.0.0.1 | |
--port |
PORT |
8080 |
--ctx-size |
CTX_SIZE |
32768 |
--cache-mib |
MOE_CACHE_MIB |
all free VRAM but 512 MiB of desktop headroom (an explicit size may use all but 128 MiB) |
--moeexperts |
MOE_EXPERTS |
the model's (Qwen3-Coder 8, gpt-oss and GLM 4): fewer experts per token is faster at some quality cost (Qwen3-Coder at 4: ~1.6x decode, 80% of greedy choices kept, one gate run) |
--parallel |
PARALLEL |
4 (requests served at once; they share the KV pool, 1..=16) |
--queue-limit |
QUEUE_LIMIT |
no limit (requests that may wait beyond --parallel; more get 503 "server busy") |
--req-timeout |
REQ_TIMEOUT |
no limit (seconds per request, queueing included; then generation stops with finish reason length) |
--max-request-mb |
MAX_REQUEST_MB |
32 (larger request bodies get 413) |
--update |
EOMOE_UPDATE |
notify: at start, one anonymous GitHub query logs a newer release. auto also installs it (SHA256SUMS-verified, used from the next start; never for source builds), off skips the check (package managers) |
--alias |
local-code |
|
--api-key |
LLAMA_API_KEY |
none (comma-separated keys; requests then need Authorization: Bearer KEY or x-api-key: KEY) |
--api-key-file |
LLAMA_ARG_API_KEY_FILE |
none (one key per line, # comments) |
--ssl-key-file, --ssl-cert-file |
LLAMA_ARG_SSL_KEY_FILE, LLAMA_ARG_SSL_CERT_FILE |
none (both set: HTTPS) |
The YAML file also takes logging.level (RUST_LOG overrides it).
Deployment: docker compose up reads ./config/config.yaml and ./models (it needs nvidia-container-toolkit). Or the release image: docker run --gpus all -p 8080:8080 -v ~/models:/models:ro ghcr.io/shunte88/eomoe ./eomoe serve --host 0.0.0.0 --model /models/<file>.gguf (on a CDI-mode toolkit, --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all instead of --gpus all). eomoe.service is a systemd unit.
Remote access
The server binds 127.0.0.1 by default. Ways to reach it from another machine:
- SSH tunnel (nothing to configure): on the laptop run
ssh -N -L 8080:127.0.0.1:8080 gpu-box, then use eomoe as if it were local. - Tailscale: run
eomoe serve --host <tailscale IP> --api-key KEY. For HTTPS,tailscale cert gpu-box.<tailnet>.ts.netwrites a key and a certificate; pass them as--ssl-key-fileand--ssl-cert-file. - LAN: run
--host 0.0.0.0 --api-key KEYand preferably add TLS. Keys travel in headers, so use HTTPS outside a trusted network.
Auth matches llama-server: /health, /v1/health and the chat page at / stay open, and anything else without a valid key gets llama-server's 401 body.
On the client machine, check, claude and codex take --url and --api-key (EOMOE_URL, EOMOE_API_KEY):
eomoe claude --url https://gpu-box.example.ts.net:8080 --api-key KEY
For a self-signed certificate, trust it with SSL_CERT_FILE=cert.pem (check, codex) or NODE_EXTRA_CA_CERTS=cert.pem (claude).
Open / in a browser for a minimal chat page. It streams /v1/chat/completions; enter the key there if one is set.
How it works
| Module | Role |
|---|---|
gguf.rs, tokenizer.rs, template.rs |
GGUF loader, BPE tokenizer, Jinja chat template. Byte-identical to llama.cpp |
qwen3moe.rs, quant.rs, cpu.rs |
Weight map and routing; the f32 CPU reference forward pass (the correctness oracle) |
gpu.rs, kernels/eomoe.cu |
CUDA engine. Kernels are plain extern "C" functions loaded by name, so an all-Rust kernel module can replace the .cu file |
expert_cache.rs |
VRAM expert cache: frequency-class LRU and next-layer prefetch |
generate.rs, toolcall.rs, server.rs, cli.rs |
Sampling, tool-call parsing, the HTTP API, the CLI |
Main techniques:
- Expert cache: experts are cached per layer group in VRAM. Uploads come from pinned RAM on a copy stream that overlaps compute.
- Decode prefetch: during decode, each layer runs the next layer's router on its own output to predict that layer's experts (84% recall) and prefetches them.
- Prefill matrix multiplies: tensor-core GEMM working directly on the Q4_K/Q6_K integers (MMQ-style), with exact weights and ~f32 activations.
- Attention: tensor-core FlashAttention-2 for prefill; split-K attention for long-context decode.
Development
cargo test --release --lib
cargo test --release --test phase6_golden -- --ignored --nocapture --test-threads=1 # GPU gates; one model at a time
A phase is done only when its gate passes against the oracle and the evidence is in STATUS.md. The golden files come from the reference llama.cpp build via tools/capture_*.py. Requirements: Rust, the CUDA toolkit (nvcc; set NVCC to override its path), and an sm_120 GPU with 8 GB of VRAM. For other GPUs, set EOMOE_CUDA_ARCH (e.g. 89).
License and support
eomoe's own source is MIT licensed. Distributed binaries may also include third-party components, run eomoe about for the components and their licenses.
MIT already covers commercial use, so building eomoe into a product needs no permission from me. If you want more than the license gives you - support, an integration, or an OEM arrangement - open an issue and say what you need.
If eomoe helps power your projects, a link back is appreciated:
Built on eomoe - everyman's own MoE, © 2026 Stue Hunter. MIT licensed.
Bug reports, hardware test results, and useful pull requests are welcome. You can also buy me a coffee or browse Team Badger merchandise.
探索相关项目
加载中…