arXiv(opens in a new tab)cs.OSAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.12114

The Ingestion Tax: Adopting File-Backed Weights in Tensor Frameworks

Yuan Si, Yufeng Lin, Daming Li, Jialu Zhang

Abstract.

Open-weight models can occupy a middle capacity regime: active weights fit in DRAM as cached file pages, but a second framework-owned copy does not fit or must be refilled as layers run, so low-batch decode rereads the weights every token. On integrated and coherent-memory systems those file pages are already GPU-readable, yet ordinary loading paths copy them into framework allocations before use. We call this copy the ingestion tax.

We present file-backed weight adoption: a framework-independent producer maps each tensor with map_shared, wraps the pages as a no-copy GPU buffer, and exports a DLPack capsule that PyTorch or MLX imports as ordinary storage. Zero-copy import alone is insufficient: the implementation must also keep activations accelerator-resident and establish ordering on the GPU; an adopter that omits both runs a dense decode stage 2.3×2.3\times slower than stock in the live system. With both in place, adoption removes the tax: the public route reaches 516 GB/s versus 53–82 for the default constructors, matches the identical kernel over resident storage ([-0.66%, +0.48%], paired), and is within 1.3% of a resident control on a matched Qwen2.5-72B (7.14 vs. 7.23 tok/s).

At the same throughput, the weights remain clean, shared, evictable file pages: NN processes decode from one mapped copy where resident loading creates NN copies (at capacity, 5.5 vs. 0.08 tok/s), and a 65 GB checkpoint cuts time to first token by 6.4×\times versus stock loading. In Kimi K3, a 2.8T-parameter MoE, the dense int8 spine stage falls from 2.62 to 0.35 s per token (7.5×\times; 3.8×\times from storage alone). The same mechanism improves llama.cpp by 1.21×\times at half the footprint on an AMD APU, falls inside the 5% selection band of overlapped streaming on a capacity-exceeding GH200 workload, and is 39×\times slower across PCIe. The deployment rule follows memory topology: adopt file pages only where the GPU can already read them.

1. Introduction

A model whose active weights exceed accelerator-owned capacity can still fit in host DRAM and the page cache. Low-batch decode then rereads each active matrix per token. Integrated GPUs and coherent CPU–GPU links allow those rereads to access host-resident pages directly: the checkpoint’s file pages already occupy a memory domain the GPU can read, so a kernel need not move them to distinct physical memory.

Tensor-framework loaders nevertheless make that move in software: constructor or transfer paths allocate framework-owned storage and copy file-backed bytes into it, and a streaming loader refills it as layers run. We call the transfer the ingestion tax. Unlike offload from storage or a copy into discrete-GPU memory, it creates a second software-owned representation in the same GPU-readable domain. This consumes bandwidth and capacity without changing physical placement.

Standalone runtimes such as llama.cpp can expose mapped model storage to Metal while controlling command submission (ggml-org/llama.cpp contributors, 2023). A tensor framework must also preserve activation placement, ordering, aliasing, lifetime, and mutation semantics. DLPack and MLX’s conditional zero-copy Metal import (ml-explore/mlx contributors, 2026) alone do not make a checkpoint mapping a fast, correctly ordered framework tensor. An adopter that removes ingestion this way but round-trips activations through the host and dispatches outside the framework runs a dense decode stage 2.3×2.3\times slower than stock in the live system: the synchronization it adds costs more than the copy it removes (§2.1).

This paper develops file-backed weight adoption: map a tensor with map_shared, wrap the pages as a no-copy GPU buffer, export a DLPack capsule, and import it as ordinary framework storage. The design spans operating-system and architecture boundaries. On the operating-system side, mapping semantics, page-cache residency, and clean-page reclaim decide what storage is represented: adoption makes VM-managed file pages ordinary accelerator storage that remains shared and evictable under existing kernel policy. On the architecture side, memory topology (unified, coherent-link, or discrete) decides whether reading that storage in place is profitable at all. Accordingly, we provide an execution contract and causal decomposition for framework integration, a topology-driven placement rule, and a public mechanism that connects the two layers.

(1) A cross-layer execution contract and causal decomposition. We separate three requirements: adopt the mapped pages (C1), retain activations in the accelerator-visible domain (C2), and establish dependencies on the GPU (C3). A randomized factorial experiment removes each condition while using the same kernel, tensor shapes, allocator, and host path. Removing C1, C2, or C3 adds +12.3+12.3, +5.6+5.6, and +3.4+3.4 ms per pass, and the full 232^{3} model resolves one interaction: ordering overhead is measurable only when activations remain accelerator-resident. A campaign across 8 processes separates the ordering mechanisms themselves: cost begins where a signal becomes host-visible, not where the queue changes owner (§4). (2) A public adoption path with end-to-end impact. A framework-independent producer turns aligned file mappings into versioned Metal DLPack tensors. The public PyTorch path reaches 516 GB/s under the matched protocol, and MLX reaches 517.5 GB/s through a capsule from the same producer. In Kimi K3, a packed kernel over adopted storage takes the dense stage from 2.62 to 0.35 s, a 7.5×7.5\times overall speedup—the storage change alone contributes 3.8×\times relative to the same packed kernel over copied int8 (1.34 s)—and cuts per-token latency from 4.14 to 1.87 s. A matched Qwen2.5-72B evaluation reaches 7.14 tok/s through adoption versus 0.94 tok/s through per-use ingestion, within 1.3% of a load-once resident control (7.23 tok/s) while the weights stay reclaimable. Rebinding the parameters of stock transformers modules leaves the model code unchanged and preserves probe logits bitwise, and a capacity-scale Qwen2.5-32B cuts time to first token by 6.4×\times versus the stock loader; the storage change alone contributes 1.6×\times, paired per round on identical files. (3) A topology- and capacity-aware deployment rule. The same loader decision improves llama.cpp by 1.21×\times and removes its duplicate model footprint on an AMD Ryzen 7 9700X APU, falls within the 5% policy band of overlapped streaming for a capacity-exceeding NVIDIA GH200 workload, and is rejected on an NVIDIA RTX 5070 Ti because every mapped read crosses PCIe. Full-working-set endpoint probes select the observed outcome on all four platforms, and on a held-out Apple machine one session exercises the capacity gate and the other the tie band; in both, mapping is the faster of the two endpoints run end to end.

References (19)