Skip to content
← Blog

4 December 2026

Running 32B Dense and 30B MoE Models on an 8 GB Jetson Orin Nano with Stock llama.cpp

If you try to load an 8.4 GiB 14B model or an 18.5 GiB 32B model onto an 8 GB NVIDIA Jetson Orin Nano (7.3 GiB usable unified LPDDR5), standard GGUF runtimes hit a wall fast. Stock llama.cpp either OOMs immediately or thrashes +17 GiB of swap until it times out. Python disk-offload stacks like Hugging Face accelerate and AirLLM either time out or crawl along at 0.033 tok/s while burning nearly 290 J/tok and requiring 36.8 GiB of duplicated sharded weights on disk.

I built layerstream-plugin (v0.6.4) to see how far an 8 GB edge box can actually go using stock, unpatched llama.cpp, page-aligned O_DIRECT async GPU streaming, hybrid partial-layer VRAM residency, a TinyLFU hot-expert cache for sparse MoEs, speculative decoding, and isolated on-demand GPU workers that drop back to 0 MB VRAM when idle.

To keep the numbers honest, I measured 130 bare-metal runs across four engines (layerstream-plugin, stock llama.cpp, HF accelerate, and AirLLM 4.0.0) on the same Jetson Orin Nano using the board's built-in INA3221 hardware power rail (~7.7–8.1 W idle) and kernel I/O + live swap counters. Both the full 130-run Parquet dataset and an interactive benchmark explorer are public on Hugging Face.

How zero-patch layer streaming works

A lot of local inference projects maintain large llama.cpp patch queues and pay a constant rebase tax. I wanted zero local patches.

The snag with stock llama.cpp is that ggml-cuda and ggml-vulkan check function-pointer identity inside supports_buft(), so custom wrapper buffer types get rejected by the GPU scheduler. layerstream-plugin works around this using real backend buffers:

  1. Metadata-only discovery (0 MB GPU memory): A pure-Rust GGUF parser inspects single or multi-part shards in ~20–50 ms so /v1/models advertises models immediately with zero GPU memory allocated.
  2. Deferred allocation + three real backend buffers: On first request, llama_model_load_from_file loads graph metadata only (no_alloc = true). Embeddings, norms, output head, and the first R layers (blk.0..R-1) live permanently in one real resident_buf. Every remaining layer blk.R..L-1 aliases into two real ping-pong backend buffers (slot_buf[0] for even layers, slot_buf[1] for odd) sized to the single largest streamed layer.
  3. Architecture-agnostic cb_eval pipeline: Every streamed ggml_tensor* maps O(1) to its layer index. Inside cb_eval, a single I/O worker performs 4K-aligned O_DIRECT pread into a pinned staging buffer and overlaps cudaMemcpyAsync on a dedicated non-blocking copy stream with GPU compute (or reads straight into GPU-visible unified memory on host-mapped Metal/Vulkan iGPUs). Because it hooks tensor pointers rather than model architectures, it works across llama.cpp's model families without per-model rewrites.
  4. Sparse MoE TinyLFU cache + sequential crossover: For MoE layers, cb_eval inspects router top-K indices and fetches only cache-missed experts from NVMe. Whenever more than 25% of a layer's experts miss in one pass (such as during prompt prefill), it switches automatically to a single sequential full-layer O_DIRECT read.
  5. Exact speculative verification + isolated 0 MB idle workers: Both greedy and Leviathan-style sampled (temperature > 0) speculative verification amortize each NVMe sweep across multiple tokens. After --idle-timeout-secs, the isolated GPU worker process exits completely, returning 100% of VRAM/UMA and CUDA driver context to the OS.

Right now only five small internal-header helpers sit in llama_compat.hpp, and I opened two upstream PRs (ggml-org/llama.cpp#32893 and #32951) so the engine can eventually build 100% against public llama.h and ggml-backend.h.

Bare-metal Jetson Orin Nano benchmarks

Test host: NVIDIA Jetson Orin Nano (aarch64, 6× Cortex-A78AE @ 1.728 GHz, 7.3 GiB usable LPDDR5, Ampere sm_87, Crucial T500 NVMe behind LUKS2 dm-crypt AES-XTS, INA3221 VDD_IN rail). Both gross and net J/tok (subtracting ~7.7–8.1 W idle board draw) are reported.

1. Oversized dense models (Qwen2.5-14B 8.37 GiB & Qwen2.5-32B 18.49 GiB)

Model & Engine Config Load TTFT open_ended code_edit Peak RSS Swap Delta Energy (code_edit)
14B Stock llama.cpp -ngl 12/18, -b 512 — OOM OOM OOM 5,978 MiB +3,711 MiB —
14B Stock llama.cpp CPU mmap (-ngl 0) — >300 s Timeout — 6,110 MiB +363 MiB —
14B HF accelerate 4-bit NF4 disk offload 144.0 s >156 s Timeout — — — —
14B AirLLM 4.0.0 4-bit warm shards 2.55 s 33.4 s 0.033 tok/s 0.033 tok/s 3,536 MiB — 288.2 J/tok gross
14B layerstream R=0 pure stream 2.99 s 5.97 s 0.174 tok/s — 2,458 MiB 0 MiB 59.8 J/tok (15.3 net)
14B layerstream auto + 0.5B (R=4) 4.94 s 2.95 s 1.578 tok/s 3.158 tok/s 3,716 MiB 0 MiB 4.87 J/tok (1.93 net)
14B layerstream b5400 + 0.5B (R=7) 4.58 s 2.74 s 1.699 tok/s 3.405 tok/s 4,178 MiB 0 MiB 4.61 J/tok (1.91 net)
14B layerstream Max R=20 + 0.5B 6.75 s 2.31 s 2.109 tok/s 5.974 tok/s 6,153 MiB — 2.73 J/tok gross
32B Stock llama.cpp -ngl 10 — >300 s Timeout — 5,715 MiB +17,243 MiB —
32B layerstream b5400 + 0.5B (R=2) 3.76 s 14.7 s 0.304 tok/s 0.840 tok/s 4,115 MiB 0 MiB 15.5 J/tok (3.82 net)
32B layerstream b5600 + 0.5B (R=6) 6.84 s 8.42 s 0.506 tok/s 0.944 tok/s 5,294 MiB — 14.3 J/tok gross

On Qwen2.5-14B, layerstream-plugin reaches 3.4–6.0 tok/s on code editing (over 100× faster and 60× more energy-efficient than AirLLM warm shards) while holding swap at 0 MiB and sustaining 2.96 GiB/s of pread bandwidth. On multi-turn conversations, resident KV prefix reuse cut Turn 2 TTFT from 14.88 s down to 2.99 s (4.97× faster).

On Qwen2.5-32B (2.53× total usable RAM), stock llama.cpp thrashed +17.2 GiB of swap and timed out, while layerstream-plugin loaded in 3.76 s and decoded at 0.84–0.94 tok/s with 0 MiB swap.

2. Sparse MoE models (OLMoE-1B-7B & Qwen3-30B-A3B) — including where stock wins

Model & Engine Config Load TTFT open_ended code_edit Cache Hit Peak RSS Swap Delta Energy
OLMoE-1B-7B layerstream R=0 full-layer 0.51 s 1.45 s 0.763 tok/s — — 1,312 MiB 0 MiB 14.3 J/tok (4.0 net)
OLMoE-1B-7B layerstream R=0 sparse + TinyLFU 0.68 s 1.72 s 12.05 tok/s 13.05 tok/s 98–100% 2,971 MiB 0 MiB 1.40 J/tok (0.45 net)
Qwen3-30B-A3B Stock GPU MoE -ot exps=CPU — OOM OOM — — 6,014 MiB +12,342 MiB —
Qwen3-30B-A3B Stock CPU mmap -ngl 0 -dev none 25.34 s 17.37 s 1.270 tok/s — OS cache 6,071 MiB +248 MiB 15.26 J/tok gross
Qwen3-30B-A3B layerstream R=0 sparse + 0.6B 3.26 s 11.24 s 0.317 tok/s 0.113 tok/s 16–23% 3,969 MiB 0 MiB 33.0 J/tok (3.21 net)

The MoE table tells two very different stories:

  • Where sparse + TinyLFU shines: OLMoE-1B-7B (64 experts) jumped 15.8×–17.9× (0.76 → 12.05–13.67 tok/s across workloads) at R=0 with 98–100% expert cache hit rate and 0.45 J/tok net energy.
  • Where stock CPU mmap still beats O_DIRECT on an 8 GB Jetson: On Qwen3-30B-A3B (17.3 GiB, 128 experts/layer), a 1 GiB TinyLFU cache only captures 16–23% of active experts. The remaining bursts of tiny random O_DIRECT slices triggered a Jetson Tegra PCIe/NVMe kernel quirk (nvme1: I/O tag ... QID 5/6 timeout, completion polled — 30-second IRQ stalls). Lowering the full-layer sequential crossover from >=75% to >25% cut TTFT 4.3× (59.2 s → 13.8 s) and total runtime 6.4× (560 s → 88 s), and layerstream-plugin still loads 7.8× faster at 2.1 GiB less RAM and 0 MiB swap — but on steady-state decode, stock CPU mmap lets the Linux page cache claim ~6 GiB of RAM and wins at 1.27 tok/s. On 64 GB unified-memory hosts where the TinyLFU cache can hold 20–40 GB of hot experts, that bottleneck disappears.

Three surprises from bare-metal testing

  1. Multi-threaded O_DIRECT hurt throughput by up to 57% on LUKS2 dm-crypt. io_threads=1 hit 3.427 / 1.691 tok/s (code_edit / open_ended) vs. 2.127 / 0.719 tok/s at io_threads=4. A single full-layer pread already fans 128 KB BIOs across all six kcryptd workers without breaking sequential NVMe locality.
  2. A smaller draft model won by 2.5×–3.0× on 8 GB RAM. Qwen2.5-0.5B (469 MiB) crushed Qwen2.5-1.5B (1.04 GiB) because spending the saved ~580 MiB on extra resident target layers (R) outweighed the small acceptance-rate gain.
  3. A silent cuBLAS 12.6 vs. JetPack 7 (CUDA 13) failure. Compiling with cudaPackages_12_6 against JetPack 7's CUDA 13 driver caused cublasSgemm (F32) to return CUBLAS_STATUS_SUCCESS without actually writing the MoE router logits tensor on Qwen3-30B-A3B. Matching flake.nix to nixpkgs's CUDA 13.4 (libcublas 13.8.2.12) fixed it cleanly with zero runtime workarounds.

Using it today (CLI, Mesh-LLM, Python, Node.js)

layerstream-plugin works four ways from the same Rust/C++ core:

  • Mesh-LLM v3 plugin (model_assets.v1): Shares mesh-llm's Hugging Face cache and hands off the GPU cleanly via exclusive_gpu so idle nodes hold 0 MB VRAM.
  • Standalone OpenAI-compatible CLI: layerstream-plugin recommend, pull, check, and serve (CUDA, Vulkan, and Metal).
  • Native Python (PyO3): from layerstream import AutoModel with isolated_worker=True for 0 MB VRAM handoff back to PyTorch, JSON Schema / Pydantic structured output, and NVMe KV snapshots.
  • Native Node.js / TypeScript (napi-rs): Zero-dependency async bindings with AbortSignal cancellation and Zod structured .parse().
# Pick the best GGUF quant for your GPU + NVMe, pull it, and serve:
layerstream-plugin recommend Qwen/Qwen2.5-14B-Instruct-GGUF
layerstream-plugin serve \
  --model /models/Qwen2.5-14B-Instruct-Q4_K_M.gguf \
  --draft-model /models/qwen2.5-0.5b-instruct-q4_k_m.gguf \
  --vram-budget-mb auto \
  --idle-timeout-secs 60

Links & reproducibility