Skip to content

Architecture & math

A reference summary of how dlm streams layers. For the illustrated, long-form walkthrough — zone diagrams, the animated A/B schedule, the data path — see How it works.

The three VRAM zones

The data path

A streamed layer travels direct read (NVMe) → CPU-RAM cache → pinned staging → streaming-zone buffer → compute. Each layer or expert arrives in one positioned, unbuffered read (O_DIRECT on Linux, FILE_FLAG_NO_BUFFERING on Windows): about 3x the throughput of faulting pages in from a memory map on an NVMe drive, without a second copy in the OS page cache. DLM_MMAP_READS=1 goes back to copying from the map. The hot-layer cache skips the disk read on repeat; and the page-locked host buffer lets the PCIe controller DMA straight to VRAM asynchronously — so disk I/O and copies hide under GPU compute.

The LayersToLoad formula

The profiler decides how many transformer blocks fit resident at once:

LayersToLoad =⌊Mfree − Msafety − Mkv_total − MpinnedMlayer_weight⌋
70B @ 16 GB → ⌊(16 − 1.5 − 2.8 − 0.9) / 0.4⌋ = 27 / 80 (34% resident)

The result is clamped to [1, N_layers]. Try it live on the Benchmarks page.

The compute kernels

The transformer math sits behind a block-level ComputeKernel trait — run_block runs one decoder block for one token. Three kernels plug into the same slot:

Distributed & scaling