Skip to content

v0.1.0: a 30B model in 3 GB of RAM, no GPU

Choose a tag to compare

@github-actions github-actions released this 09 Aug 17:46
· 65 commits to main since this release

ramvamp is a Rust runtime that runs a 30B-parameter Mixture-of-Experts model in about 3 GB of RAM on an ordinary Linux x86_64 machine with no GPU. It does that by never loading the checkpoint into memory: the always-needed common weights stay memory-mapped, and the routed experts, which are most of the model, live on an NVMe SSD in a page-aligned packed format and are read with io_uring and O_DIRECT only when the router asks for them, through a small per-layer cache.

This is the first release. It runs Qwen3-30B-A3B Q4_K_M on CPU inside a 3 GB memory cgroup with a cold page cache, and the forward pass is validated against llama.cpp on byte-identical weights.

Highlights

  • ramvamp serve is the shipping surface. OpenAI Chat Completions on 127.0.0.1: /v1/chat/completions streaming SSE and buffered, /v1/models, /health. Tool calls work in both paths, parsed from Qwen's native <tool_call> tokens, sharing one parser and one id minter; the renderer is byte-identical to 20 committed transformers fixtures, and OpenCode drives it with real tool calls. It serves one request at a time on purpose, and reuses the KV cache across requests by longest-common-prefix match against the ids actually fed, so a repeated system prompt is not re-prefilled every turn. Fields it cannot honour exactly (n > 1, stop, forced tool_choice, non-text content parts) come back as typed 400s rather than being accepted and quietly ignored.
  • ramvamp chat, with an optional live status panel. A multi-turn REPL. --tui adds prefill progress, tokens per second, context used and the expert cache hit rate, updated while it generates. That exists because a long prompt is minutes of prefill before the first character appears, and silence is indistinguishable from a hang. Plain chat stays the reference behaviour.
  • ramvamp-repack install is a streaming installer. Ranged Hugging Face downloads repacked directly into the .rvmp layout in one pass, with resume and verify. No full model, shard or tensor is ever materialized in heap memory, and the quantized bytes are copied unchanged: it repacks, it never requantizes.
  • ramvamp generate and ramvamp plan. generate streams a completion to stdout with timing and expert-streaming stats on stderr. plan resolves the dials and prints the projected memory footprint without loading the model, so "will this fit here" is answered in well under a second instead of by an OOM kill part way through prefill.
  • Context is a dial and configurations have names. --context (default 4096) trades conversation length against resident bytes, and --profile / --config / RAMVAMP_CONTEXT name and reuse a set of dials. A 32K profile projects roughly 5,649 MiB and needs a bigger budget than 3 GB; the 3 GB contract is a property of the 4K default, not of the runtime.
  • The expert cache is small on purpose. At the default 1,440 MiB budget that is 11 slots per layer out of 128 experts. Per layer the router picks 8 of 128; hits dispatch to the compute pool immediately and the misses go to io_uring as one batch of O_DIRECT reads, which bypass the page cache and so cost the memory budget nothing, with the hit compute hiding their latency.

Measured performance

Intel Core Ultra 9 185H (CPU only, 16 GB RAM, Micron 2400 DRAM-less QLC NVMe) running Qwen3-30B-A3B Q4_K_M with a cold page cache inside memory.max=3G and memory.swap.max=0, release build, at the shipped 11 slots per layer:

measured
Decode about 2 tok/s: 1.46 to 2.19 tok/s over ctx 64 to 3,961 (EXP-023), and 1.43 to 2.16 over the same rungs on a later branch (EXP-025)
Prefill 11.25 tok/s at ctx 512 (EXP-023)
Peak RAM 2,497 to 2,929 MiB of a 3,072 MiB ceiling: 2,497.0 at ctx 64 (EXP-025), 2,929.3 at ctx 3,961 (EXP-023)
Expert cache hit rate 53.0% to 59.3% across five context rungs, no trend in context (EXP-023)
Model on disk 17.35 GiB, about a 6x memory saving
Fidelity mean full-vocab KL 1.04e-2 against llama.cpp, top-1 agreement 8/8 (EXP-004)

Those are two decode ladders and not one curve. They come from different binaries in different sessions, and the drift between sessions is measured rather than assumed: the later session re-ran EXP-023's byte-identical binary at two rungs and read 1.85 tok/s against 1.91 at ctx 512, and 1.33 against 1.46 at 3,961, which is 3.1% and 8.9% slower a day later on the same machine with no code change. On a DRAM-less QLC part a decode figure describes its session as well as its device.

The conditions that make those figures valid, all of which each run satisfies: the page cache is evicted before the run and the eviction is proven with mincore rather than trusted; the run is inside memory.max=3G with memory.swap.max=0, because zram counts as swap and a run that swaps is measuring reclaim rather than decode; it is a release build, since the debug profile is opt-level = 1 and not comparable; and it runs as the user that owns the install, because the kernel will not report page-cache residency for a file the process neither owns nor may write, so a model unpacked by root and run by you degrades to buffered reads and changes both the memory figure and the throughput figure.

One caveat those decode figures carry: they are taken at --max-new 64 from a cache the prefill sweep emptied, so the published curve describes the first 63 tokens after a prompt. Steady-state decode at 256 generated tokens and beyond has not been measured cold.

Conditions, drive detail and the full table: docs/benchmarks.md. Every EXP-NNN above is an entry in docs/experiments.md with what it tested, its evidence and its verdict.

What this is good for, and what it is not

About 2 tok/s is not fast, and it is worth saying plainly rather than leaving it to be discovered. This is a local 30B endpoint for a machine that could not otherwise run one at all: low-volume local chat and completion, on 16 GB of RAM and no GPU. It is not an agentic coding backend, where a single turn is thousands of output tokens and 2 tok/s is unusable.

Throughput is stated per drive on purpose. Decode is I/O-bound: expert reads are 44.4% of a decode token at ctx 512 and 33.2% at 3,961, and because that bucket is measured as a residual it is a lower bound rather than the drive's busy time. The reference part is DRAM-less QLC and sustains about 1.6 GB/s at decode's own read geometry: 1.565 to 1.694 GB/s with a median of 1.633 across all 48 expert files. A mainstream TLC Gen4 drive should do materially better. By how much is unmeasured, and this project does not publish numbers it has not measured.

Install

One command, Linux x86_64 only:

curl -sSL https://y0sif.github.io/ramvamp/install.sh | bash

That puts ramvamp and ramvamp-repack in /usr/local/bin. Pin a tag with RAMVAMP_VERSION=v0.1.0, change the destination with RAMVAMP_INSTALL_DIR, and re-run the same line to upgrade. On anything that is not Linux x86_64 it refuses and installs nothing.

Or take the tarball on this release directly, which is what the installer fetches anyway. It holds both binaries plus the README and both licences.

curl -sSL -o ramvamp.tar.gz \
  https://github.com/y0sif/ramvamp/releases/download/v0.1.0/ramvamp-linux-x86_64.tar.gz
tar xzf ramvamp.tar.gz
sudo install -m755 ramvamp ramvamp-repack /usr/local/bin/

Then install the model. That is a 17.35 GiB download, the destination wants to be on an NVMe SSD, and it should be run as the user who will run the model:

# Download and repack the pinned Qwen3-30B-A3B in one streaming pass.
ramvamp-repack install --output ~/models/qwen3-30b-a3b.rvmp

# Chat in the terminal, with the live status panel.
ramvamp chat --model ~/models/qwen3-30b-a3b.rvmp --tui

# Or serve it on loopback.
ramvamp serve --model ~/models/qwen3-30b-a3b.rvmp --port 8080

Building from source needs Rust 1.88 or newer and nothing else; the tree has no C dependencies.

git clone https://github.com/y0sif/ramvamp
cd ramvamp
cargo build --release

Requirements and limits

  • Linux x86_64 only. io_uring is a Linux interface and the fast kernels are AVX2 plus F16C. Both have fallbacks, a pread path and a scalar reference, so the runtime does run elsewhere, slowly, but no number above describes those paths and the release ships no binary for them.
  • One model. Qwen3-30B-A3B Q4_K_M is the v0 pin. ramvamp-repack refuses any GGUF whose architecture is not qwen3moe, by name. Gemma 4 is the intended second model and is roadmap, not present tense.
  • An NVMe SSD, or the numbers above mean nothing. Decode is I/O-bound and the drive is the dominant term. About 18 GB of free space for the installed model.
  • The server is loopback only, with no --host flag, no auth and no CORS. The HTTP layer has no header-size cap, so anything that needs to be reachable from elsewhere belongs behind a reverse proxy, which is also where TLS and request limits belong.
  • One v0 correctness gate is still open: perplexity against llama.cpp. The reference side is banked at PPL 6.3810 +/- 0.16588 (llama-perplexity b10217, WikiText-2 raw, -c 512 --chunks 40, same GGUF); the ramvamp side has never been run. It is unclaimed and self-contained.
  • Model weights are not included and remain governed by their own terms.

What is next

From docs/roadmap.md, which is the plan of record. These are commitments to sequence, not to dates.

  1. Gemma 4 26B-A4B as model two. Structurally cheaper than the v0 pin: 30 layers against 48, and it has a shared expert, which is unconditional per-layer compute that outstanding reads can be overlapped against. Qwen3 has none, so today the decode loop's only cover for a read in flight is cache-hit compute.
  2. A GPU backend behind the existing kernel trait, Vulkan or CUDA. Standing rule: it is an additional configuration and never a substitute for the CPU path, which stays the reference that correctness is measured against.
  3. Bring your own model. The .rvmp format is already model-agnostic and that is verified in the code rather than asserted; layer geometry comes from the manifest at runtime. Three things are pinned, and the roadmap names all three with file and symbol.
  4. Architectures beyond linux x86_64. aarch64 NEON kernels are the obvious first target, and the kernel trait plus the two existing fallbacks are the whole scaffolding for it.

Docs, and one thing worth more than a patch

README is the pitch and the install flow. docs/architecture.md is the design and is worth reading before touching the runtime, docs/landscape.md is why the design decisions were made the way they were, docs/install.md covers requirements and the three I/O modes, docs/server.md the routes and refusals, docs/configuration.md the dials and profiles.

If you run this on a different drive, report the number. Every published figure here comes from a single DRAM-less QLC part, and that is the largest hole in the project's evidence. A second drive turns a published band into a curve and tests the central claim, that the design scales with the device. CONTRIBUTING.md has the measurement protocol a published number has to satisfy, and scripts/cold_bench.py is the harness. Open an issue with the run and the drive.