Which read sizes weight loading produces
No loader we traced asks the kernel for tensor-sized reads. vLLM's default reader maps each file and lets kernel readahead read it in 128 KiB commands. fastsafetensors' nogds reader asks for 516 KiB at a time, which reaches the drive as four 128 KiB commands and one 4 KiB command. Our DMA-BUF copier asks for 64 MiB at a time, straight into GPU memory, and the drive gets 2 MiB commands. Tensor sizes matter when a loader reads only part of a model, such as one expert of a mixture-of-experts layer: current MoE checkpoints store experts as 2 to 16 MiB tensors, and some store an expert's scales far from its weights, which adds a read of a few KiB.
Three sizes in one load
A weight load has three different read sizes, and each layer of the stack can change the size it receives. The tensor size is set by the checkpoint file: how big each tensor is and where it sits. The intent size is what the loader asks the kernel for: its read calls, its memory mappings and its io_uring requests. The command size is what reaches the drive: the NVMe read commands, after the page cache, readahead and the block layer have split or merged the loader's requests. We recorded all three for each load with the tracers of the ebpf-syscall project and one bpftrace script.
syscall_monitor), page faults and readahead (mmap_readamp), io_uring request sizes (bpftrace)nvme_tp_monitor)On the drive used here, a normal read command carries at most 128 KiB and a DMA-BUF read command at most 2 MiB. The kernel splits any larger request at that limit.
How checkpoints store their bytes
We read every safetensors header of ten open checkpoints, from a 0.6-billion-parameter dense model to a 2.4-trillion-parameter mixture-of-experts (MoE) model: 836 files and 954,042 tensors. No weights were needed for this part. The chart shows, for each checkpoint, the share of its bytes held in tensors of each size.
| Checkpoint | Type | Tensors | Size | Tensors under 1 MiB | One routed expert |
|---|---|---|---|---|---|
| Qwen3-0.6B | dense BF16 | 311 | 1.4 GiB | 36% | - |
| Qwen2.5-7B | dense BF16 | 339 | 14.2 GiB | 42% | - |
| Qwen2.5-7B AWQ | dense INT4 (AWQ) | 731 | 5.2 GiB | 69% | - |
| Llama-3.1-405B | dense BF16 | 1,137 | 756 GiB | 22% | - |
| Qwen3-Next-80B | MoE BF16 | 75,944 | 151 GiB | 0% | 6 MiB (95% of bytes); 1 extent: 15,071, 2 extents: 9,505 |
| DeepSeek-V3 | MoE FP8 | 91,991 | 641 GiB | 50% | 42.0 MiB (97% of bytes); 1 extent: 14,951, 2 extents: 153 |
| Kimi-K2 | MoE FP8 | 139,644 | 958 GiB | 50% | 42.0 MiB (99% of bytes); 2 extents: 23,040 |
| DeepSeek-V4-Pro | MoE FP4 | 145,116 | 805 GiB | 50% | 33.5 MiB (95% of bytes); 2 extents: 23,424 |
| Kimi-K3 | MoE packed 4-bit | 497,220 | 1.4 TiB | 50% | 16.7 MiB (93% of bytes); 1 extent: 82,432 |
| Qwen3.8-2.4T | MoE BF16, fused experts | 1,609 | 4.4 TiB | 38% | 96 MiB slab inside fused 3-D tensors |
Dense checkpoints keep their bytes in a few large tensors. In Qwen2.5-7B, 89% of the bytes are in tensors of 128 MiB or more. In Llama-3.1-405B, 81% are in tensors of 1 to 2 GiB. Most current MoE checkpoints are the opposite: 87 to 99% of their bytes are in the routed experts, which are stored as separate tensors of 2 to 16 MiB. One expert is 6 MiB (Qwen3-Next) to 42 MiB (DeepSeek-V3 and Kimi-K2 in FP8). Lower precision makes the expert tensors smaller and adds a scale tensor for each weight tensor, so in the FP8 and FP4 checkpoints half of all tensors are scales. The scales hold at most 6% of the bytes. Qwen3.8-2.4T is the exception: it stores all experts of a layer as two fused tensors of 16 and 32 GiB, but one expert is still a contiguous 96 MiB slab inside them.
Where an expert sits matters when a loader reads only some experts. In Kimi-K2 and DeepSeek-V4-Pro every expert is in two places. The safetensors writer groups tensors by data type, so each file holds all its scale tensors together, away from the weights. Fetching one Kimi-K2 expert is one 42 MiB read plus one 10.5 KiB read up to 15 GB away in the same file. In DeepSeek-V4-Pro it is one 31.5 MiB read plus one 2 MiB read. In Qwen3-Next, 9,505 of 24,576 experts are split across two files. In every checkpoint, the tensor data starts off a 4 KiB boundary for more than 99.99% of the bytes, because the data section begins right after a header of arbitrary length.
What loaders ask for
No loader we traced asks the kernel for tensor-sized reads. The loader, not the tensor layout, sets the intent size of a full load. We traced three loaders on four checkpoints that we have in full: two dense BF16 models, an INT4 AWQ model and a 27 GB MoE model (EMO 1b14b, 128 experts per layer). Each load started with an empty page cache, and every tensor was checked against a SHA-256 of the file bytes. All 40 loads matched.
| Checkpoint | Loader | Load time (s), two cold loads | What the loader asks for | NVMe read commands | Drive bytes over loaded bytes |
|---|---|---|---|---|---|
| Qwen3-0.6B (1.5 GB) | vLLM default (safetensors, mmap) | 1.06, 1.02 | no read calls; maps each shard, 0 page faults; readahead fills 1.50 GB | 11,512: 11,479 of 128 KiB | +0.2% |
| Qwen3-0.6B (1.5 GB) | fastsafetensors nogds | 0.245, 0.248 | 2,870 pread64 calls; 2,867 of 516 KiB | 14,369: 11,477 of 128 KiB, 2,879 of 16 KiB or less | +0.9% |
| Qwen3-0.6B (1.5 GB) | DMA-BUF copier | 0.225, 0.225 | 23 io_uring reads into GPU memory; 22 of 64 MiB, the rest shorter shard tails | 748: 716 of 2 MiB | +0.1% |
| Qwen2.5-7B (15.2 GB) | vLLM default (safetensors, mmap) | 8.82, 8.83 | no read calls; maps each shard, 1 page fault; readahead fills 15.23 GB | 116,256: 116,208 of 128 KiB | +0.0% |
| Qwen2.5-7B (15.2 GB) | fastsafetensors nogds | 2.30, 2.28 | 29,062 pread64 calls; 29,050 of 516 KiB | 145,291: 116,212 of 128 KiB, 29,062 of 16 KiB or less | +0.8% |
| Qwen2.5-7B (15.2 GB) | DMA-BUF copier | 2.15, 2.14 | 228 io_uring reads into GPU memory; 224 of 64 MiB, the rest shorter shard tails | 7,332: 7,260 of 2 MiB | +0.0% |
| Qwen2.5-7B AWQ (5.6 GB) | vLLM default (safetensors, mmap) | 3.60, 3.61 | no read calls; maps each shard, 604 page faults; readahead fills 5.57 GB | 42,709: 42,376 of 128 KiB | +0.0% |
| Qwen2.5-7B AWQ (5.6 GB) | fastsafetensors nogds | 0.839, 0.839 | 10,630 pread64 calls; 10,624 of 516 KiB | 53,160: 42,508 of 128 KiB, 10,636 of 16 KiB or less | +0.8% |
| Qwen2.5-7B AWQ (5.6 GB) | DMA-BUF copier | 0.818, 0.788 | 84 io_uring reads into GPU memory; 82 of 64 MiB, the rest shorter shard tails | 2,688: 2,655 of 2 MiB | +0.0% |
| EMO 1b14b MoE (27.1 GB) | vLLM default (safetensors, mmap) | 20.29, 20.44 | no read calls; maps each shard, 32 page faults; readahead fills 27.14 GB | 207,392: 206,993 of 128 KiB | +0.0% |
| EMO 1b14b MoE (27.1 GB) | fastsafetensors nogds | 4.00, 4.08 | 51,793 pread64 calls; 51,760 of 516 KiB | 258,852: 207,044 of 128 KiB, 51,786 of 16 KiB or less | +0.8% |
| EMO 1b14b MoE (27.1 GB) | DMA-BUF copier | 3.82, 3.84 | 413 io_uring reads into GPU memory; 402 of 64 MiB, the rest shorter shard tails | 12,983: 12,931 of 2 MiB | +0.0% |
vLLM's default reader
vLLM's default loader opens each shard with the safetensors library
and calls get_tensor() for every tensor. We ran the same calls
outside vLLM. The library maps the shard into memory and makes no read
call on it. Copying a tensor out of the mapping touches its pages. The
kernel's readahead then reads the whole file ahead of the copy, so the
tracer counted only 0 to 604 page faults per load. The drive gets 128 KiB commands, the largest normal command, and
reads the file once. This path is about 4 to 5 times slower than the
other two here. We did not profile why.
fastsafetensors nogds
The nogds reader reads each shard with pread64
calls of 516 KiB into a host buffer, then copies the buffer to the GPU.
Each call is 512 KiB of data plus 4 KiB for alignment. The drive gets
four 128 KiB commands and one 4 KiB command for each call. These 4 KiB
commands are 20% of all its commands, and they make the drive read 0.8 to 0.9%
more bytes than the files hold. This is the only place in a full load
where we saw many small commands, and they come from the reader's
alignment, not from the tensors.
The DMA-BUF copier
The copier issues io_uring READ_FIXED requests of 64 MiB
straight into GPU memory, with a shorter request at the end of each
shard. The kernel splits each request into 2 MiB NVMe commands, the
largest DMA-BUF command on this drive. For the 15.2 GB model that is
228 requests and 7,260 commands of 2 MiB, against 145,291 commands for
nogds. The drive reads the file bytes to within 0.1%. Its
only read calls are the 8-byte header length and the JSON header of
each shard (9 to 72 KiB). The larger commands are why the copier is the
fastest loader here; the
weight-loading page
explains this with drive rates.
Fetching experts
An MoE server that keeps experts on NVMe reads only the experts a
request needs. That is where tensor size becomes intent size. In EMO
1b14b one expert is three 4 MiB tensors, stored next to each other. We
fetched one expert and eight experts of one layer, once through
safetensors and once with one pread per tensor.
| Checkpoint | Loader | Load time (s), two cold loads | What the loader asks for | NVMe read commands | Drive bytes over loaded bytes |
|---|---|---|---|---|---|
| EMO 1b14b MoE (27.1 GB) | 1 expert, safetensors (mmap) | 0.019, 0.017 | no read calls; maps the shard, 1 page fault; readahead fills 14.5 MB | 142: 111 of 128 KiB, 13 of 16 KiB or less | +25.4% |
| EMO 1b14b MoE (27.1 GB) | 8 experts, safetensors (mmap) | 0.087, 0.085 | no read calls; maps the shard, 7 page faults; readahead fills 106.1 MB | 844: 801 of 128 KiB | +6.6% |
| EMO 1b14b MoE (27.1 GB) | 1 expert, one pread per tensor | 0.015, 0.015 | 3 pread64 calls; 3 of 4 MiB | 117: 100 of 128 KiB, 6 of 16 KiB or less | +10.0% |
| EMO 1b14b MoE (27.1 GB) | 8 experts, one pread per tensor | 0.094, 0.098 | 24 pread64 calls; 24 of 4 MiB | 801: 772 of 128 KiB | +2.3% |
With one pread per tensor, the loader asks for 4 MiB at a
time, and the drive gets 128 KiB commands through the page cache.
Readahead reads past the end of what was asked: 10% extra for one
expert, 2% for eight. Through safetensors the extra is 25% for one
expert and 7% for eight. At these sizes the drive gets no command smaller
than 128 KiB apart from a few at the edges.
Two cases in the larger checkpoints would produce smaller reads. A fetch of one Kimi-K2 expert includes a 10.5 KiB scale read. Qwen3-Next stores 2 MiB expert tensors, so a reader that reads one tensor at a time asks for 2 MiB. We did not trace those checkpoints, because we have only their headers. We have also not traced an expert fetch through the DMA-BUF copier. With it, one expert would be one io_uring read into GPU memory, split into 2 MiB commands.
Software and kernel
| Part | Version | What it does here |
|---|---|---|
| fastsafetensors | 2026-10-28-iouring-dma-buf at eb7ec8f | Our branch adds the DMA-BUF copier. It exports GPU memory as a DMA-BUF, registers it with io_uring as a fixed buffer, and reads each shard into it with READ_FIXED. Without kernel support it falls back to nogds. The same branch provides the nogds reader. |
| Linux kernel | 2026-11-06-dmabuf-io-async-release at a7c2fb31 | The io_uring DMA-BUF series queued for Linux 7.4, the XFS support RFC, ext4 support, patches that let DMA-BUF reads use the drive's largest command (max_hw_dmabuf_sectors_kb, 2 MiB here), and a fix that releases a DMA-BUF registration without waiting about 14 ms. See kernel requirements. |
| Tracers | ebpf-syscall: syscall_monitor, mmap_readamp, nvme_tp_monitor; bpftrace 0.27 | Loader calls with requested sizes, page faults and readahead fills, NVMe commands. The bpftrace script records io_uring setup, registrations and the size of each request. |
| Python stack | Python 3.12, PyTorch 2.9.1 for ROCm 6.4.3, safetensors 0.8.0 | The loaders. |
| GPU | AMD RDNA3 workstation GPU, 48 GB, PCIe Gen4 x16 | The load target. |
| Drive and file system | One PCIe Gen4 x4 NVMe SSD, 4 TB class, 512-byte logical blocks, 128 KiB normal command limit, 2 MiB DMA-BUF command limit; XFS | Holds the checkpoints. |
Reproduce
The scripts are in knlp's
scripts/weight_io.
You need the kernel branch above for the DMA-BUF loader, a built
ebpf-syscall tree, bpftrace, and sudo for the tracers. The loaders run as
your user. Put the fastsafetensors branch on PYTHONPATH:
git clone -b 2026-10-28-iouring-dma-buf https://github.com/mcgrof/fastsafetensors
export PYTHONPATH=$PWD/fastsafetensors
python3 scripts/weight_io/trace_intent.py --tools ~/ebpf-syscall --disk nvme0n1 \
--model qwen2.5-7b=/models/Qwen2.5-7B-Instruct \
--model moe=/models/my-moe --moe moe --out /data/intent
python3 scripts/weight_io/analyze_intent.py /data/intent > intent_summary.json
--moe adds the expert fetches for that model; --layer,
--experts-1 and --experts-8 choose the layer and the
experts. --disk names the block device that holds the models, so
the NVMe tracer watches the right drive. For the checkpoint layout, the
inventory stage of the weight-loading I/O workflow
(make defconfig-weight-io-inventory && make) reads the shard
headers over HTTP without downloading weights, and
inventory_sizes.py turns its inventory.jsonl into the
size classes and expert units shown above.
Limits
- One GPU, one drive and one file system (XFS). A drive with a larger or smaller command limit changes the command sizes.
- The loaders ran outside vLLM with the same calls vLLM makes. A served load can add its own reads.
- Each case ran twice. That is enough to show the sizes, which do not change between runs, not to rank small timing differences.
- The eight large checkpoints were measured from their headers only. Their read sizes under each loader are projected from the layout, not traced.
- No tensor-parallel load was traced. A rank that reads part of a tensor can produce strided reads.
- Expert fetches through the DMA-BUF copier were not traced.