mmap
A technique that maps a file into a process's address space, making on-disk data accessible like memory. It is commonly used in disk-based storage schemes for vector databases to reduce latency.
Timeline (last 90 days)
Moving weights from RAM to SSD uses the memory mapping mechanism for on-demand paged loading; the cost is I/O latency on first load and a noticeable slowdown when memory is severely insufficient, while the benefit is lowering the runtime memory threshold from 'memory ≥ model size' to 'memory ≥ the working set of a single layer/single expert.'
GGUF supports memory-mapped (mmap) loading, which can shorten large models' startup time and reduce peak memory.
Common implementations of expert swapping in and out include using mmap to map weight files into virtual memory so the operating system pages them in on demand, or maintaining one's own expert cache with LRU eviction.
Loading a 68GB MoE into 12GB VRAM + 16GB RAM in standard llama.cpp produces about 1500 major page faults per token, and generation speed is only 1.47 tok/s.
If agents run in different processes, communicating via shared memory mapping (such as mmap) requires accompanying synchronization primitives, otherwise it introduces data races and undefined behavior.
When model size reaches about twice the physical memory, mmap-based inference schemes collapse due to a 'page-fault storm', with the operating system blindly scheduling pages and inference stuck on disk I/O.
llama.cpp uses mmap by default to load GGUF models, loading pages from the SSD on demand into the Linux page cache via major page faults.
Memory-mapped files (mmap) are an OS-provided mechanism that maps file contents directly into a process's address space, and storage engines such as Lucene and RocksDB make extensive use of mmap.
Memory-mapped file technology allows the operating system to directly map disk files into a process's virtual address space; on macOS the corresponding system call is mmap().
llama.cpp first loads the model into memory and then copies it from memory to VRAM, which stems from the operating system's memory-mapped (mmap) mechanism.
All Facts (10)
Moving weights from RAM to SSD uses the memory mapping mechanism for on-demand paged loading; the cost is I/O latency on first load and a noticeable slowdown when memory is severely insufficient, while the benefit is lowering the runtime memory threshold from 'memory ≥ model size' to 'memory ≥ the working set of a single layer/single expert.'
50%UnverifiedGGUF supports memory-mapped (mmap) loading, which can shorten large models' startup time and reduce peak memory.
50%UnverifiedCommon implementations of expert swapping in and out include using mmap to map weight files into virtual memory so the operating system pages them in on demand, or maintaining one's own expert cache with LRU eviction.
50%UnverifiedLoading a 68GB MoE into 12GB VRAM + 16GB RAM in standard llama.cpp produces about 1500 major page faults per token, and generation speed is only 1.47 tok/s.
50%UnverifiedIf agents run in different processes, communicating via shared memory mapping (such as mmap) requires accompanying synchronization primitives, otherwise it introduces data races and undefined behavior.
50%UnverifiedWhen model size reaches about twice the physical memory, mmap-based inference schemes collapse due to a 'page-fault storm', with the operating system blindly scheduling pages and inference stuck on disk I/O.
50%Unverifiedllama.cpp uses mmap by default to load GGUF models, loading pages from the SSD on demand into the Linux page cache via major page faults.
50%UnverifiedMemory-mapped files (mmap) are an OS-provided mechanism that maps file contents directly into a process's address space, and storage engines such as Lucene and RocksDB make extensive use of mmap.
50%UnverifiedMemory-mapped file technology allows the operating system to directly map disk files into a process's virtual address space; on macOS the corresponding system call is mmap().
50%Unverifiedllama.cpp first loads the model into memory and then copies it from memory to VRAM, which stems from the operating system's memory-mapped (mmap) mechanism.
50%