Skip to content
Dynamic layer-streaming inference

Run models bigger than your VRAM.

Whatever card you have — 4, 6, 8, 16 GB or more. dlm quantizes the weights at load so more of the model stays resident, and streams whatever still doesn’t fit.

Apache-2.0 · No GPU required to try the profiler.

GPU VRAM
Model
27/80
layers resident · 34% in VRAM
~8–14 tok/s
est. · PCIe 4.0 · warm cache
VRAM budget16.0 GB
Pinned 0.9KV 2.8Resident 10.8 GBFree 0.0
Streaming zone · double buffer53 layers stream through

Amber executes on the GPU while teal streams the next window in over PCIe — then they swap. DMA hides under compute.

Live budget — same formula the engine runs. Try your own card.

The hardware wall

The model doesn't fit. That's the whole problem.

Resident loading means every weight sits in VRAM at once, so the card's size is a hard yes-or-no on the model. dlm answers that two ways: shrink the weights so they fit, and stream whatever still doesn't. It's not a 16 GB tool — it's for the 4 GB laptop GPU, the 6 GB gaming card, the 8 GB workstation.

Qwen2.5-1.5B, bf16
3.3 GiB
won't fit a 4 GB card (3.2 GiB free)
--quant int4
79–87 tok/s
all 28 layers resident — no streaming
bf16, --stream
21–27 tok/s
27 / 28 resident — it runs, slower
Reach for this first

Quantize before you stream.

--quant int4 shrinks each layer 4x at load (int8: 2x), which usually means more of the model stays resident and streaming shrinks or stops entirely — worth far more than any amount of making streaming itself faster. Measured on a 4 GB GTX 1650: a 1.5B model that doesn't fit in 16-bit goes from 21–27 tok/s streamed to 79–87 tok/s fully resident.

VRAM · 16 GB70B
Pinned1.5 GB
Streaming · 29 layers
A
B
Cache → CPU RAM / NVMe51 layers wait

Pinned zone

always resident

Embeddings, final norm, and the LM head never move. They stay put so every token starts and ends without a transfer.

Streaming zone

double-buffered A · B

A working window of layers lives here. Buffer A computes the current block while buffer B streams the next one in — then they swap. That swap is the whole trick.

Cache zone

spills to CPU RAM · NVMe

Layers not in VRAM wait in a tiered CPU-RAM cache backed by the weights on NVMe. They stream in on demand, just ahead of when they're needed.

The fallback

What still doesn't fit gets streamed.

A layer is read from NVMe in one unbuffered read, held in an optional host-RAM cache, staged in a page-locked buffer, and uploaded on a dedicated copy stream so the transfer overlaps compute. Be clear-eyed about the limit: streaming costs bandwidth, and moving most of a model across the bus every token costs far more than the arithmetic does. The window evicts the most recently used layer, so most of it stays put across tokens and only the rest crosses the bus.

01NVMe
Direct read

one unbuffered read per layer or expert

02tiered
CPU-RAM cache

hot layers held in host RAM

03DMA
Pinned staging

page-locked buffer for transfer

04VRAM
Streaming buffer

next window lands here

05GPU
Compute

current window executes

Stages 01–04 run asynchronously while stage 05 computes. The transfer never blocks the GPU — DMA hides under compute, so the next layer is already resident when it’s needed.

What's in the box

A complete inference engine.

Load-time quantization, the streaming core, the CUDA kernels, the server loop, and the scaling stack — shipped and running today.

Zero-dependency local inference

shipped

A single Rust binary. No Python runtime, no container, no cloud call. Runs air-gapped on the machine you already have.

Quantize at load — the lever that matters

shipped

--quant int4 shrinks each layer 4x (int8: 2x) from a float checkpoint, so more of the model stays resident and streaming shrinks or stops entirely. On a 4 GB card it took a 1.5B model from 21–27 tok/s streamed to 79–87 fully resident. dlm pack does it once, ahead of time, for a model that still streams.

OpenAI + Anthropic API

shipped

/v1/chat/completions, /v1/completions, /v1/messages and count_tokens — with SSE streaming, tool calling, image input for Gemma 3, bearer or x-api-key auth, and Prometheus /metrics. Either SDK points at dlm with a URL change.

Dynamic VRAM profiling

shipped

dlm profile measures your card and reports exactly how many layers stay resident — before you load a single weight.

Layer streaming, for what still won't fit

shipped

A bounded window of layers, read straight from NVMe; a miss uploads on a dedicated copy stream so the transfer overlaps compute, and evicts the most recently used layer, so most of the window stays put across tokens. Output is bit-for-bit identical to a fully-resident run — but streaming costs bandwidth, so quantize first.

Speculative decoding

shipped

A small draft model, an EAGLE-3 head, Qwen3.6's own MTP head, or n-gram lookup over the request's own context (on by default on the GPU) proposes tokens the large model verifies in bulk; with greedy sampling the output is provably identical to plain decoding. Per-request acceptance lands in the usage response.

Multi-GPU / multi-node scaling

shipped

Pipeline-parallel across local GPUs, or shard layers across worker nodes over TCP with heartbeats and local fallback. Scheduling, routing and correctness are implemented and tested on CPU over localhost; NCCL/RCCL transport is future work.

Cross-request prefix cache

shipped

Requests that share a system prompt resume from a cached KV snapshot instead of re-prefilling it — real savings on shared prefixes.

MoE bigger than your VRAM and RAM

shipped

A streamed Mixture-of-Experts model keeps attention and routers resident and fetches only the experts each token picks — cached by routing frequency, prefetched from the next layer's router, run once per batch. Qwen3.6-35B-A3B, a 22 GB file, decodes at 2.5–2.9 tok/s on a 4 GB card with 16 GB of RAM.

Continuous batching

shipped

A background scheduler admits concurrent requests into each streaming pass, with per-request output identical to running alone.

Measured, with conditions

The numbers, and exactly when they hold.

The tok/s figures below were measured on a 4 GB GTX 1650; the resident-layer count comes from the engine's own budget math. Every figure states its hardware and its --quant setting so you can judge it against your own. The projected throughput model lives on the benchmarks page, labelled as a projection.

443tok/s

total decode at batch 16, Qwen2.5-0.5B bf16 · 4 GB GTX 1650 — 1.4–1.6× vLLM fp32 (269–318) on the same card, measured back to back

3–4×faster

Qwen2.5-1.5B at --quant int4, all 28 layers resident (79–87 tok/s), vs bf16 streamed (21–27 tok/s, 27/28 resident) on the same 4 GB card — quantizing beats streaming

2.5–2.9tok/s

decode of Qwen3.6-35B-A3B, a 22 GB Q4_K_M GGUF, on the same 4 GB card with 16 GB of RAM — experts streamed from NVMe, answers matching the CPU's

See it decide

Point the profiler at your card. Read the plan.

No weights loaded, no GPU required — dlm profile does the budget math and tells you what will stay resident before you commit. Pass --model-path to profile a real checkpoint from its measured layer sizes.

$ dlm profile --quant int4
  gpu backend  : none (host fallback)
  geometry     : 80 layers, hidden 8192, 64 q-heads / 8 kv-heads
  quantization : Int4 (0.5 bytes/param), ~70.6 B params

  ── VRAM PLAN ─────────────────────────────────
    M_free           :    16384.0 MiB
    M_safety         :     1536.0 MiB
    M_kv_total       :     2560.0 MiB
    M_layer_weight   :      420.5 MiB
    usable           :    12288.0 MiB
    ▶ layers_to_load :          29 / 80
    ▶ resident       :       36.2%
  ──────────────────────────────────────────────

  swap cycle   : 3 streaming pass(es), window of 29 layer(s)
  pipeline     : 4 steps, 2 overlapped (DMA hidden under compute)
Built-in Llama-3-70B-class sample against a simulated 16 GB card, 8,192-token context. Without --quant the same model computes at the checkpoint's own 16-bit dtype — a 1.7 GiB layer, and only 7 of 80 fit.
Built in the open

What's shipped, and what isn't.

dlm is built in the open, one phase at a time — the streaming core, the CUDA kernels, and the full serving stack are merged and shipped. AMD GPU compute is not: the rocm-kernels build compiles from source but has not been verified on an AMD card, so there is no prebuilt ROCm binary.

Phase 1shipped

The streaming core

  • VRAM profiler & layer-budget math
  • Double-buffered A/B streaming schedule
  • CPU host-fallback kernel
Phase 2shipped

On the GPU

  • CUDA compute kernels — AMD/ROCm compute planned
  • PagedAttention KV cache
  • Speculative decoding
Phase 3shipped

Serve & scale

  • OpenAI-compatible server loop
  • Multi-GPU / multi-node partitioning
  • Quantization-aware layer packing
Phase 4shipped

Beyond the card

  • Streamed MoE from NVMe — a 35B model on 4 GB
  • dlm pack: quantize once, stream ready weights
  • Image input, MTP and EAGLE-3 speculation
Where it fits

A different bet than resident loading.

Most engines assume the model lives in VRAM in full. dlm streams it, which changes what runs on the hardware you own.

dlmvLLMllama.cpp
ApproachStream layers through VRAMResident in VRAMResident + CPU offload
Model larger than VRAMYes — streamedMust fitPartial (CPU spillover)
Primary targetConsumer GPUDatacenter GPUCPU / consumer
Weights in VRAM at onceA working windowAll layersOffloaded split
APIOpenAI + AnthropicOpenAIOpenAI (server)
RuntimeSingle Rust binaryPythonC++ binary

Reflects each project’s typical default approach; capabilities evolve.

The GPU you already own is enough.

Clone the repo, run the profiler on your card, and watch a 70B model fit where it shouldn’t. No GPU required to try it.

Apache-2.0 · Rust 1.75+ · Linux · macOS · Windows