r/madeinrust • u/shunte88 • 17h ago
AI Assisted I wrote an LLM server in Rust that beats llama.cpp on an 8 GB GPU: one binary, no Python
eomoe is a Rust + CUDA inference server for mixture-of-experts models. It runs a 30B coding model (Qwen3-Coder-30B) on a single 8 GB RTX 5060 and serves it over the same HTTP APIs as llama-server, so Claude Code, Codex and Ollama clients just work.
The numbers, against llama.cpp on the same box:
- prompt processing: 953 tok/s vs 393
- generation: 38 tok/s vs 27
The Rust side, for the curious:
- No Python anywhere. The GGUF loader (memmap2), BPE tokenizer (fancy-regex), Jinja chat templates (minijinja) and HTTP server (axum + tokio) are all in one ~9K-line crate.
- GPU via cudarc. The kernels are plain CUDA C compiled into a fatbin and looked up by name, so Rust owns the scheduling and memory: expert cache, paged KV cache, batching of several requests.
- Every model has a pure-Rust CPU reference implementation (rayon). The GPU engine is tested against it, and both are tested against llama.cpp's actual output, token by token.
- Tests are "golden" files captured from the reference implementation. Every gate is mutation-tested: I break the code on purpose and check that the test goes red. That caught a NaN slipping through a float comparison (NaN > x is false...).
- Releases: GitHub Actions builds Linux x86_64/aarch64 and Windows binaries plus a multi-arch Docker image on every tag.
Models so far: Qwen3-Coder-30B, gpt-oss-20b, GLM-4.7-Flash, Qwen3.6-35B-A3B.
The long-term goal is moving the kernels from CUDA C to Rust as well. Advice from anyone who has done serious GPU work in Rust is very welcome.
I built it in 4 days pairing with Claude Code.
Code review, roasts and "why didn't you just use X" are all welcome. That's why I'm posting.
Cheers

