Manuscript Offprint
arXiv:2610.36564DeepInfer-Mac: Running a 750B-Class MoE on a 24 GB Laptop
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
DeepInfer-Mac runs the 750B-class DeepSeek-V4.1-Flash model on a MacBook Air with 24 GB of unified memory. A mixed low-bit conversion occupies 338 GiB on the internal SSD. About 7.6 GiB of weights remain resident; routed experts and Engram rows are loaded when needed. This separation makes the model executable, but it leaves each generated token waiting for a succession of storage reads. We organize expert weights so that reads fill reusable GPU buffers directly, and couple cache allocation with the lifetime of those buffers. In end-to-end runs, the system generates English, Chinese and code at 0.21–0.72 tokens per second, with a largest sampled process footprint of 16.73 GiB across the tested requests. Matched decode comparisons show a 21.0% throughput gain from next-layer prefetching over resident-expert overlap alone, at the cost of additional reads. Longer prompts remain costly. We describe the design, provide the implementation and measurement scripts, and identify the limits of this operating point: a model far larger than memory can run locally, while storage and prefill still govern the user's wait.
1 INTRODUCTION
A 750B-class model appears far beyond a laptop with 24 GB of memory. Even after compression, the checkpoint used in this work occupies 338 GiB. Yet a mixture-of-experts model does not use all of those parameters for each token. DeepSeek-V4.1-Flash selects six of the 384 routed experts in each of its 40 layers (DeepSeek-AI, 2026b). Most of the model can stay on disk while a much smaller working set moves through memory.
This paper follows that observation through to a running system. DEEPINFER-MAC executes the model on a single MacBook Air, using its internal SSD to hold routed experts and Engram tables. Attention, routers and other frequently used weights remain in unified memory. A selected expert is read directly into a reusable GPU buffer, computed, and retained until its space is needed. The model's size determines the storage requirement; the active experts and their reuse determine the cost of generating a token.
Making the working set fit is only the beginning. A GPU cluster can keep many tokens in flight and overlap their communication with computation (DeepSeek-AI, 2026a; 2024). On this laptop, one token passes through one layer at a time. The router must run before the system knows which experts to read, and those reads must finish before the missing experts can be computed. The next layer then repeats the same sequence. The SSD has enough capacity for the model, but its bandwidth and this dependency chain govern the pace of generation.
Our design spends memory to shorten that chain. The dense weights stay resident, expert reads avoid an extra user-space copy, and repeated expert use is served from a bounded cache. The same budget also has to cover buffers whose GPU work has not finished. We therefore couple cache allocation, expert batching and buffer lifetime. This makes the memory constraint enforceable even when optional reads are still in flight.
The resulting system generates text on the target laptop. Runs with 4.495 GiB of reserved expert capacity produce English, Chinese and Python at 0.21–0.72 tokens per second. A 3,764-token retrieval prompt completes in 309.0 seconds to the first token. These measurements use full prefill and local weights throughout. They also show why feasibility needs to be reported alongside latency: fitting the working set does not make a long prompt cheap.
Once the system fits, reading the next layer's likely experts can hide some of the remaining wait. A controlled comparison restores the same model state, warmup and continuation before each schedule. Adding demand-first speculation increases aggregate decode throughput by 21.0% over resident-expert overlap in these matched blocks, while reading 5.4% more expert data. The improvement comes from moving useful transfers earlier, with enough capacity reserved for the next demand group. The system exposes all three schedules so that the tradeoff can be tested on other requests and machines.
The contribution is a complete implementation and a measured account of this operating point: a 750B-class MoE, one 24 GB laptop, and SSD-backed execution. We explain which data must remain resident, how the rest can be supplied safely, and what limits the resulting performance. Operator-level comparisons with the reference and a study of indexer arithmetic support the implementation. The implementation, converted weight layout and raw measurements are available for others to reproduce and extend this case study.
24 GB unified memory, one GPU

Figure 1: The full checkpoint lives on the SSD. Memory holds the frequently used weights and a changing set of experts. The router determines which expert records enter the buffers; the GPU consumes them in place. Engram lookup follows a separate row cache.
There are two other substantial parts of the model. Compressed sparse attention stores a compressed history and uses an indexer to choose the positions a query attends to. Engram looks up hashed n-grams in large embedding tables. Its tables occupy 114.4 GiB after conversion, but a lookup reads only the rows addressed by the current tokens. Both mechanisms separate a large stored state from the portion needed immediately. Table 1 summarizes the model and machine; Appendix A gives the full storage layout.
Prior work has established that sparse activation can make flash storage useful for inference (Alizadeh et al., 2024; Song et al., 2024b; Eliseev & Mazur, 2023). The question here is how far that separation carries a much larger MoE on a small unified-memory machine. A server sends token activations to devices that already hold the experts. This machine has only one GPU, so it brings the experts to the token. That reverses the direction of data movement and makes the storage path central to the design.
The resource tradeoff is direct. A larger expert cache avoids more storage reads, but takes memory from activations, sequence state and the operating system. More simultaneous reads may keep the
Table 1: The model, checkpoint and target machine. Storage sizes are binary GiB; 24 GB is the machine's marketed memory configuration. The parameter count excludes quantization metadata (Appendix A.1).
| Model | DeepSeek-V4.1-Flash, 748.5B text weights, 40 layers |
|---|---|
| Routed computation | 6 of 384 experts per layer, plus one shared expert |
| Converted checkpoint | 337.6 GiB; mixed 2/3/4-bit routed experts and 4-bit Engram rows |
| Resident weights | 7.6 GiB; mainly attention, shared experts and routing |
| Machine | MacBook Air M4, 10-core GPU, 24 GB unified memory |
| Storage | 1 TB internal SSD |
| Workload | One sequence at a time; inference runs locally |
SSD busy, but they also keep more buffers unavailable for reuse. The runtime must manage these demands together. Otherwise a nominally small cache can still leave too little room to execute the next layer.
3 KEEPING THE TOKEN MOVING
The design follows one token from routing to expert computation. Its aim is to make each required byte available with little additional storage or copying, then retain that byte when reuse is likely.
3.1 A DIRECT PATH FROM SSD TO GPU
Each routed expert is stored as one contiguous record, already arranged in the quantized layout consumed by MLX (Hannun et al., 2023). A cache miss assigns the record a slot in preallocated GPU arrays. The read writes directly into that slot, and the GPU later uses the same memory. Unified memory removes the need for an additional user-space staging copy. The expert files use uncached reads to avoid retaining a second copy in the operating system's page cache.
The router selects the experts before the host issues missing reads. Experts that are already resident can be computed while the others arrive. Once their buffers are ready, the missing experts pass through the same gathered matrix operations. This preserves the model's selected experts while changing when their work is issued. The on-disk arrangement and execution layout therefore serve the same purpose: an expert moves from storage to computation without being unpacked into another full-sized weight buffer.
3.2 MEMORY THAT CAN ACTUALLY BE REUSED
A cache entry is useful only if keeping it does not prevent the next request from running. This matters under lazy GPU execution: a host call may have returned while the GPU still refers to its weights. Replacing those weights too early can change a computation already in flight.
We keep one global expert-buffer budget and account for the different record sizes used by different layers. The available slots determine how many experts a prefill batch may contain. Demand acquisition protects both hits and newly loaded experts together, and that protection remains until the relevant GPU work is safe. Optional reads are admitted only while enough slots remain for the next demand group. Appendix C states the capacity invariant and its assumptions.
Within those constraints, replacement is least recently used. A hit saves an entire expert read, so cache capacity has a direct effect on the token's storage demand. The budget bounds expert buffers rather than the whole process: dense weights, attention state, temporary arrays and the operating system still need memory. We measure the process separately instead of treating a cache setting as a memory measurement.
3.3 THE LIMITS OF READING AHEAD
Routing creates a dependency that storage bandwidth alone cannot remove. A layer runs attention and its router, reads any missing experts, and computes their outputs before the next layer can proceed. A useful first approximation is
where is the number of expert bytes actually fetched and is the transfer time hidden by independent computation. The expression identifies two different opportunities: reuse reduces the bytes required, while scheduling may hide part of the time needed to deliver them.
Computing cached experts supplies some independent work, but a miss-heavy layer offers little of it. Predicting a later layer’s experts gives the SSD a longer head start. We use the established next-layer router predictor and demand-first ordering of Eliseev & Mazur (2023): guesses are issued after the current layer’s demand reads have completed. Speculative entries receive low insertion priority, an established way to limit cache pollution (Qureshi et al., 2007). The budget and lifetime rules apply to these reads as well.
A prediction can still be costly after those safeguards. An unnecessary read uses bandwidth, and a read that is already in flight can outlast the idle interval that motivated it. Demand-first admission guarantees neither lower latency nor freedom from contention with a later layer. We therefore evaluate speculation against a schedule that simply overlaps resident expert computation with missing reads. Section 5.2 compares them on identical work.
4 EXECUTING THE COMPLETE MODEL
Attention state, Engram lookup and the residual mixers share the machine with the expert cache. DEEPINFER-MAC implements the reference model's compressed attention, indexers, Engram lookup and Hyper-Connections in MLX, with a common forward path for prefill and decode. A streaming converter reads the released tensors, converts them one at a time and writes the final checkpoint without first storing a second complete copy of the release.
The dense FP8 tensors retain their values when converted to MLX's MXFP8 representation. Routed experts use affine quantization at two to four bits per weight, selected by layer; Engram tables use four-bit rows. The conversion is consequently lossy as a whole. The per-layer precision choices trade reconstruction error against storage and read volume. Appendix A records the formats and allocation sizes.
Long prompts introduce a different working set. Many tokens pass through a layer together, so prefill can touch most of its experts. We process those experts in batches that fit the same cache budget. The engine also supports bounded replay, inherited from the upstream execution strategy, which omits much of the later-layer work on older prompt tokens. Because truncating this computation is an approximation, the end-to-end measurements use full prefill. Prefix reuse and the optional replay mode remain available for applications that make different latency tradeoffs.
Correctness checks follow the boundaries of the implementation. Small configurations run against the official PyTorch reference to test attention, routing, state updates and the vision encoder. Other tests force buffer eviction races, unfinished reads and repeated state restoration. These checks establish behavior for the exercised cases; they do not make the quantized checkpoint equivalent to the release. English, Chinese, code and retrieval requests supply complementary evidence that the complete text path runs with real weights. Additional interfaces and the speculative decoder are available in the repository, but are not needed for the central result.
5 WHAT THE LAPTOP CAN DO
Once the model fits, latency becomes the visible constraint. We begin with complete requests, then isolate the effect of scheduling on their decode steps. The end-to-end and matched runs use the M4 laptop in Table 1, local Engram tables, full prefill and the same converted checkpoint. Other desktop applications remain open; this is a shared-machine measurement rather than an isolated hardware benchmark.
5.1 GENERATION WITHIN THE MEMORY BUDGET
Table 2 reports requests in English, Chinese and Python, followed by retrieval from longer prompts. Each request starts with an empty expert cache and a fresh sequence state. We count decode throughput from the intervals after the first emitted token, so a short answer does not turn its prefill work into an apparent decoding speedup.
Table 2: End-to-end requests with 4.495 GiB of reserved expert buffers. TTFT is time to the first token after model construction. Footprint is the largest process value sampled at 0.5-second intervals during the request. Retrieval outputs are too short for a useful throughput comparison.
| Request | Prompt tokens | Output tokens | TTFT (s) | Decode (tok/s) | Footprint (GiB) |
|---|---|---|---|---|---|
| English | 22 | 69 | 65.0 | 0.21 | 12.88 |
| Python | 27 | 25 | 26.6 | 0.25 | 12.94 |
| Chinese | 25 | 57 | 28.2 | 0.72 | 12.94 |
| Retrieval 1K | 971 | 2 | 145.1 | - | 14.64 |
| Retrieval 4K | 3764 | 2 | 309.0 | - | 16.73 |
The three short requests generate 0.21–0.72 tokens per second. Their outputs include a physical explanation, a Python function and a Chinese explanation; the complete token sequences and text are preserved in the logs. These examples demonstrate operation across several kinds of input. Their timing also reflects a changing machine state, so the rows are not a comparison of language or task speed. Both retrieval requests return the planted access code exactly. The larger retrieval request has 3,764 input tokens and takes 309.0 seconds to produce its first token.
The working set remains much smaller than the checkpoint. Across these requests, the largest sampled process footprint is 16.73 GiB, while the checkpoint occupies 337.6 GiB on disk. Figure 2 shows how footprint changes during prefill and generation. Footprint, expert-buffer capacity and MLX allocations measure different things: the dense weights plus the configured cache are not a sufficient estimate of the peak.
(a) Stored model and memory

(b) Process footprint during requests
Figure 2: Checkpoint storage and measured working memory. Left: the stored checkpoint is much larger than physical memory. Right: process footprint during the requests, with request boundaries marked. The footprint includes more than the expert cache and is sampled rather than an exact peak measurement. Host swap activity is reported separately.
Host swap was active before model loading and grew during the suite. Its change cannot be assigned entirely to the inference process on this shared desktop. The experiment establishes execution on a 24 GB machine with a measured process footprint; it does not establish swap-free operation. Appendix E gives the memory accounting and host counters.
Long prompts expose the other part of the tradeoff. During decode, a token selects only a few experts in each layer. A prompt contains many routing decisions, so prefill can visit most experts and must also build its attention state. A small resident working set therefore coexists with substantial startup latency. The full-prefill retrieval requests make that cost visible instead of hiding it behind the optional bounded-replay approximation.
5.2 TRADING STORAGE TRAFFIC FOR LATENCY
The dependency chain in Section 3.3 leaves intervals in which storage and computation can overlap. We compare three schedules: serial execution, computing resident experts while missing experts load, and adding demand-first next-layer speculation. Each measured block starts from the same prompt snapshot, the same serial warmup and the same expert-cache state. Its input continuation is fixed, and the generated token ids must agree. Configuration order rotates across rounds.
Table 3: Matched-work schedule comparison. Each schedule processes 108 measured tokens across 9 blocks, using 4.495 GiB of reserved expert capacity. Throughput is total measured tokens divided by their elapsed time. The ratio is the median per-block elapsed time relative to the corresponding serial block; lower is faster.
| Schedule | Tokens/s | Relative time | Expert payload (GiB/token) |
|---|---|---|---|
| Serial | 0.77 | 1.00 | 2.02 |
| Overlap resident experts | 0.92 | 0.97 | 2.01 |
| Add next-layer speculation | 1.11 | 0.80 | 2.12 |
Adding next-layer speculation changes aggregate throughput from 0.92 to 1.11 tokens/s, a increase relative to overlap alone. Expert payload grows by , and all compared schedules return the same measured output tokens. Figure 3 shows the incremental effect of speculation in each paired block. It is faster than overlap alone in all nine blocks, though the gain varies between prompts. These warmed blocks isolate scheduling; their rates are distinct from the complete-request measurements above. The result supports the measured schedules in this configuration; it does not rank them across SSDs, cache sizes or concurrent workloads.

Figure 3: The incremental effect of next-layer speculation, relative to resident-expert overlap alone. Each point is one prompt–round pair with the same continuation and initial cache state; short horizontal bars mark medians. The dashed line at one marks equal time. Rotation balances schedule position, but does not eliminate thermal or shared-machine effects.
This is the central scheduling tradeoff on the laptop. A cache hit eliminates a necessary transfer. A speculative read instead places a bet that the transfer will be useful soon enough to repay its bandwidth and residency cost. Keeping the SSD occupied is therefore an incomplete objective. The useful quantity is the time removed from the token's critical path after accounting for that extra work.
5.3 WHAT THE CORRECTNESS EVIDENCE COVERS
The implementation passes 78 tests with the official reference available. The suite covers operator comparisons on small configurations, cache and buffer lifetime, sampling, state restoration and serving behavior. The matched runs add a check that scheduling changes preserve the measured tokens on the full checkpoint. Neither check establishes the quality loss introduced by converting the original weights.
An older teacher-forced evaluation compared the converted model with API continuations. The API vectors and the checkpoint came from different release dates, so their disagreement mixes model revision and compression effects. Appendix B preserves the per-case results. A same-revision, broader quality evaluation remains necessary before claiming that the low-bit checkpoint preserves the original model's capabilities.
6 WHEN COMPUTATION BECOMES VISIBLE
Expert reads dominate much of decoding, while long prompts also expose the cost of choosing attention keys. The indexer scores many query-key pairs before selecting a small set. Its inputs have already been quantized to FP4 values with power-of-two scales, which creates an opportunity to use faster arithmetic without introducing another quantization step.
For the model’s 128-element dot products, we give a sufficient condition under which BF16 multiplication with FP32 accumulation produces the same final BF16 value as the reference FP32 computation. The condition bounds the range of the block scales and excludes underflow and overflow. The discrete inputs then make every partial sum exactly representable in FP32. Appendix D.4 gives the proof and the boundary of the guarantee; the runtime does not yet enforce it with a guard and fallback for every input.
On captured inputs from a 32K-token prompt, the BF16 path matched 1.078 billion scores. The matrix multiplication was 1.5–1.9 times faster in the measured blocks, and fusing the subsequent head reduction removed repeated passes over the intermediate scores. These are local improvements, whose end-to-end value depends on how much time a request spends in the indexer.
Avoiding some scores altogether was less useful in our exploratory study. DoSA (Meng & Fang, 2026) uses bounds to reject keys before full scoring, but the model's existing candidate selection leaves a smaller domain to prune. Our adaptation saved only a modest fraction of arithmetic on the captured queries, and its heuristic BF16 allowance is not a sound general bound. Screening therefore remains disabled. The detailed measurements in Appendix D explain this decision without making it part of the throughput claim.
7 RELATED WORK
Running a model larger than memory has a substantial history. FlexGen schedules weights, activations and KV state across GPU, CPU and disk to serve large batches (Sheng et al., 2023). LLM in a Flash exploits activation sparsity and storage-friendly layouts to load only needed weights (Alizadeh et al., 2024). PowerInfer places frequent neurons on the GPU and computes others on the CPU (Song et al., 2024b). These systems establish the broader strategy of trading storage or host computation for scarce accelerator memory. Our contribution is its realization and measurement for this 750B-class model on a 24 GB unified-memory laptop.
MoE offloading makes the working set explicit through expert routing. Eliseev & Mazur (2023) combine an expert cache with next-layer prediction and demand-first speculative loading. MoE-Infinity and ProMoE develop expert caching and prefetching, including coordination between prediction and inference (Xue et al., 2024; Song et al., 2024a). Pre-gated MoE changes routing to expose later expert choices earlier (Hwang et al., 2024), while Fiddler uses CPU expert computation to reduce transfers (Kamahori et al., 2025). We adopt established caching and prediction ideas; the single-sequence SSD setting changes their costs. Our budget and lifetime protocol couples their allocations so that outstanding reads and GPU work leave enough capacity for the next demand group.
Several open-source projects already bring DeepSeek-V4-generation models to Apple silicon. ds4 provides a C and Metal engine and the API-sampled vectors used in our earlier checks (Sanfilippo, 2026). flash-moe streams experts from SSD, and MLX ports target V4-Flash and V4.1-Flash (dandeveloper, 2026; ssd-moe, 2026; PipeNetwork, 2026). DEEPINFER-MAC builds on the official reference structure and MLX, with local Engram lookup, a streaming converter and a common sequence-state path. This paper provides an auditable account of its resource use and scheduling behavior at 24 GB. A common cross-system benchmark remains future work.
The indexer study addresses a separate cost within sparse attention. GVR, LiteTopK and DoSA reduce selection or scoring work while preserving specified selection behavior (Cheng et al., 2026; Yin et al., 2026; Meng & Fang, 2026). Accurate GEMM on lower-precision matrix units is also an established line of work, including the Ozaki scheme (Mukunoki, 2025). Our measured BF16 path uses the discrete structure already present in the model inputs, and its equality proof has explicit conditions. The screening study is an exploratory application of existing ideas, with the numerical limitations documented in the appendix.
8 DISCUSSION AND CONCLUSION
A small laptop can execute a model whose stored parameters are far larger than its memory when the active working set is small enough and the remaining weights can be supplied from storage. DEEPINFER-MAC realizes that separation for DeepSeek-V4.1-Flash. The implementation runs the full text path, and the measurements report the memory and latency required to do so.
The laptop makes the model locally accessible at the cost of storage traffic and a substantial wait for longer prompts. More concurrency does not remove the dependency between routing and expert availability; it changes which transfers can happen before they are needed. Memory spent retaining useful experts can avoid reads. Memory and bandwidth spent on wrong predictions can instead delay the next layer. The runtime must account for both effects within the same budget.
The evidence is limited to one laptop, one converted checkpoint and a single sequence at a time. The desktop is shared, host swap is active, and the generated examples are not a broad quality benchmark. The low-bit conversion and optional bounded replay also need separate quality evaluation; the latter is disabled in these runs. The code and logs allow these limits to be tested on other machines and workloads. Measurements on a second storage device and a same-revision quality reference would help separate hardware sensitivity from compression loss.
AI USE STATEMENT
Generative AI tools assisted with code, experiments and manuscript drafting. The accompanying logs and tests document the checks performed. The author takes responsibility for the final manuscript and implementation.
REPRODUCIBILITY STATEMENT
An archived snapshot of the implementation, converter, regression tests and measurement logs accompanies this preprint as ancillary material. Development continues at https://github.com/haoruilee/DeepInfer-Mac. Appendix E gives the commands, measurement definitions and source fingerprints. Tables and plots are generated directly from the saved measurements. The weight layout and numerical arguments are in the appendix. Reference tests require the official source through DSV41_REF; without it those tests are skipped. Historical logs remain available but are not used to estimate the fresh schedules' speedups.
REFERENCES
Keivan Alizadeh, Iman Mirzadeh, Dmitry Belenko, Karen Khatamifard, Minsik Cho, Carlo C. Del Mundo, Mohammad Rastegari, and Mehrdad Farajtabar. LLM in a flash: Efficient large language model inference with limited memory. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics, 2024. URL https://arxiv.org/abs/2312.11514.
Long Cheng, Ritchie Zhao, Timmy Liu, Mindy Li, Xianjie Qiao, Kefeng Duan, Yu-Jung Chen, Xiaoming Chen, Bita Darvish Rouhani, and June Yang. Guess-Verify-Refine: Data-Aware Top-K for Sparse-Attention Decoding on Blackwell via Temporal Correlation. arXiv preprint arXiv:2604.22312, 2026. URL https://arxiv.org/abs/2604.22312.
dandeveloper. flash-moe. https://github.com/dandeveloper/flash-moe, 2026.
DeepSeek-AI. DeepSeek-V3 technical report. arXiv preprint arXiv:2412.19437, 2024. URL https://arxiv.org/abs/2412.19437.
DeepSeek-AI. DeepInfer. https://github.com/deepseek-ai/DeepInfer, 2026a.
DeepSeek-AI. DeepSeek-V4.1-Flash: Pushing the limits of KV cache compression. Technical report, DeepSeek-AI, 2026b. URL https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/blob/main/DeepSeek_V41_Tech_Report.pdf.
Artyom Eliseev and Denis Mazur. Fast inference of mixture-of-experts language models with offloading. arXiv preprint arXiv:2312.17238, 2023. URL https://arxiv.org/abs/2312.17238.
Awni Hannun, Jagrit Digani, Angelos Katharopoulos, and Ronan Collobert. MLX: Efficient and flexible machine learning on Apple silicon. https://github.com/ml-explore/mlx, 2023.
Ranggi Hwang, Jianyu Wei, Shijie Cao, Changho Hwang, Xiaohu Tang, Ting Cao, and Mao Yang. Pre-gated MoE: An algorithm-system co-design for fast and scalable mixture-of-expert inference. In Proceedings of the 51st Annual International Symposium on Computer Architecture, 2024. URL https://arxiv.org/abs/2308.12066.
Keisuke Kamahori, Tian Tang, Yile Gu, Kan Zhu, and Baris Kasikci. Fiddler: CPU-GPU orchestration for fast inference of mixture-of-experts models. In International Conference on Learning Representations, 2025.
Fanxu Meng and Taosong Fang. DoSA: Dots Sparse Attention. arXiv preprint arXiv:2610.13990, 2026. URL https://arxiv.org/abs/2610.13990.
Daichi Mukunoki. DGEMM without FP64 arithmetic: Using FP64 emulation and FP8 tensor cores with Ozaki scheme. arXiv preprint arXiv:2508.00441, 2025. URL https://arxiv.org/abs/2508.00441.
PipeNetwork. deepseek-v41-mlx. https://github.com/PipeNetwork/deepseek-v41-mlx, 2026.
Moinuddin K. Qureshi, Aamer Jaleel, Yale N. Patt, Simon C. Steely, and Joel Emer. Adaptive insertion policies for high performance caching. In Proceedings of the 34th Annual International Symposium on Computer Architecture, pp. 381–391, 2007.
Salvatore Sanfilippo. ds4. https://github.com/antirez/ds4, 2026.
Ying Sheng, Lianmin Zheng, Binhang Yuan, Zhuohan Li, Max Ryabinin, Beidi Chen, Percy Liang, Christopher Ré, Ion Stoica, and Ce Zhang. FlexGen: High-throughput generative inference of large language models with a single GPU. In International Conference on Machine Learning, 2023. URL https://arxiv.org/abs/2303.06865.
Xiaoniu Song, Zihang Zhong, Rong Chen, and Haibo Chen. ProMoE: Fast MoE-based LLM serving using proactive caching. arXiv preprint arXiv:2410.22134, 2024a.
Yixin Song, Zeyu Mi, Haotong Xie, and Haibo Chen. PowerInfer: Fast large language model serving with a consumer-grade GPU. In Proceedings of the ACM SIGOPS 30th Symposium on Operating Systems Principles, 2024b. URL https://arxiv.org/abs/2312.12456.
ssd-moe. deepseek-v4-flash-mlx. https://github.com/ssd-moe/deepseek-v4-flash-mlx, 2026.
Leyang Xue, Yao Fu, Zhan Lu, Luo Mai, and Mahesh Marina. MoE-Infinity: Offloading-efficient MoE model serving. arXiv preprint arXiv:2401.14361, 2024. URL https://arxiv.org/abs/2401.14361.
Ziqi Yin, Jianyang Gao, Peiqi Yin, Jiangneng Li, and Gao Cong. LiteTopK: Exploiting the Curse of Dimensionality for a Fused Indexer-TopK Kernel in Long-Context Sparse Attention. arXiv preprint arXiv:2607.11976, 2026. URL https://arxiv.org/abs/2607.11976.
A WEIGHT LAYOUT
A.1 PARAMETER ACCOUNTING
Unpacking the source tensor shapes gives 543.582 billion routed-expert weights, 196.614 billion Engram entries and 8.299 billion other text weights, for a total of 748.495 billion. The backbone excluding Engram is 551.881 billion weights, consistent with the model card's rounded 552B backbone count (DeepSeek-AI, 2026b). Quantization scales describe the stored representation and are excluded from these counts. The optional draft network adds 14.225 billion weights; the vision encoder and aligner add 0.485 billion. Neither is needed in the text-generation runs.
An earlier 754.6B count adds 6.144 billion Engram scale entries to the text weights. We use “750B-class” to avoid treating that metadata as additional model parameters. The audit is reproducible with scripts/parameter_audit.py and saved in logs/parameter_audit.json. The 337.6 GiB storage total below includes the optional components and quantization metadata actually stored on disk.
A.2 STORED REPRESENTATION
Each routed expert is one record of three projections: gate and up () and down (). Each projection is stored as packed integers, per-group scales and per-group biases in MLX's affine format with group size 64, and the record is padded to a multiple of 16 KiB. Table 4 gives the bit widths per layer. We chose them with scripts/quant_damage.py, which runs real layers once with the converted experts and once with the original FP4 experts and compares hidden states layer by layer. The first four layers, the layers that own KV caches or index keys, and the decoder band received 3 bits, the last layer 4 bits, and the rest 2-bit gate/up projections. The DSpark draft experts use 2-bit gate/up and 3-bit down projections.
Table 4: Expert bit widths and record sizes.
| Layers | Bits | Record |
|---|---|---|
| 0–3, 8, 14, 20–38 | 3/3/3 | 15.5 MB |
| 4–7, 9–13, 15–19 | 2/2/3 | 12.5 MB |
| 39 | 4/4/4 | 19.9 MB |
Table 5: Converted weights of DeepSeek-V4.1-Flash as stored on disk. Sizes are in GiB.
| Component | Format | Size | Location |
|---|---|---|---|
| Dense layers: attention, shared experts, routers, mHC, Engram projections | mxfp8, lossless | 6.9 | memory |
| Output head and other global tensors | affine 8-bit / BF16 | 0.7 | memory |
| Embedding | BF16, memory-mapped | 1.2 | SSD |
| Routed experts, 40 × 384 | affine 2/3/4-bit, g = 64 | 208.3 | SSD |
| DSpark layers: dense parts / experts (3 × 128) | mxfp8 / affine 2/3-bit | 0.7 / 4.5 | SSD |
| Vision encoder | BF16 | 0.9 | SSD |
| Engram tables, 2 × 384M rows | affine 4-bit, g = 32 | 114.4 | SSD |
| Total on disk | 337.6 |
B PER-CASE API AGREEMENT
Table 6: Historical teacher-forced checks against an older API snapshot (September 10 versus the October 17 checkpoint). NLL is the mean negative log-likelihood per continuation token. The macro-average gives the twelve one-token retrieval cases most of the weight; all-token agreement is 123/141 (87.2%), and non-retrieval agreement is 111/129 (86.0%). These are not same-revision quantization measurements.
| Case | Prompt | Continuation | NLL (ours) | NLL (API) | Top-1 agreement |
|---|---|---|---|---|---|
| Prose | 15 | 32 | 0.733 | 0.038 | 78.1% |
| Code | 17 | 32 | 0.637 | 0.278 | 84.4% |
| Arithmetic | 18 | 1 | 0.000 | 0.000 | 100% |
| Prose | 21 | 32 | 0.244 | 0.115 | 90.6% |
| Italian | 15 | 32 | 0.512 | 0.354 | 90.6% |
| Retrieval (×12) | 127–16,385 | 1 | ≤0.006 | 0.000 | 100% each |
| Mean over 17 cases | 0.127 | 0.046 | 96.7% |
C CAPACITY AND BUFFER LIFETIME
The store couples its allocation to the maximum live working set. The plan accounts for heterogeneous record sizes, sets the prefill batch size, and reserves slots for demand. These guarantees concern capacity and buffer lifetime; next-layer prediction and demand-first prefetching follow prior work (Eliseev & Mazur, 2023).
Let layout have aligned record size , serve layers, and receive slots. Let be the largest decode routing set, including the draft model, and let be the requested slab budget. We require and reject smaller budgets before allocating. For , the initial plan is
Rounding leftovers buy additional slots only when their full record size fits. Thus and . Prefill uses batches of at most experts; decode requests already fit because . The budget covers record capacity and bounds the array payloads, not dense weights, KV caches, allocator overhead or process RSS.
Admission and leases. Two previous request groups remain pinned while lazy GPU work may reference them. An optional read is admitted only if (i) the number of unfinished, unleased reads remains at most , and (ii) at least slots remain free or immediately evictable. Condition (i) is needed even at cold start, when the pin sets are empty. Demand acquisition starts reads and pins existing hits in the same critical section. The outer decode lease covers both the resident and missing expert groups; each inner acquisition transfers protection to the lazy pin sets before releasing its lease. A failed split read is not considered finished until all of its writers stop.
Proposition 1. Under the single-compute-thread protocol, with requests of at most distinct experts and at most two previous pinned groups, admitted optional reads cannot cause demand allocation to run out of slots. Every acquired slot remains protected until its lease or lazy-compute pin is released.
Proof. At a demand boundary, at most slots are pinned and at most contain unfinished unleased reads. At least slots are therefore free or evictable. Protecting resident members of the incoming request consumes no more than one slot per member and reduces the number of additional slots needed by the same amount. The remaining misses fit. Allocation and lease publication use one lock, and eviction excludes both leases and pins. Nested leases are reference-counted, so releasing a subgroup cannot release the outer request.
This is a capacity and lifetime guarantee. It does not bound I/O latency, cancel an SSD read, or assert that a wrong prediction never displaces an old, unpinned cache entry.
Allocation audit. The former allocator imposed a minimum of 96 slots separately on every layout, after proportionally dividing the requested budget. This exceeded that budget on the production manifest. Table 7 reports a deterministic calculation from that manifest, saved in logs/cache_budget_audit.json; these are not RSS measurements. Regression tests exercise all experts at the minimum capacity, hold speculative reads unfinished across successive demand batches, force the former hit-eviction race, and inject both whole-record and split-read failures.
Table 7: Aligned expert-record capacity in GiB. The revised allocation obeys the requested budget; the historical timings elsewhere used the former allocator.
| Requested | Former allocator | Revised allocator |
|---|---|---|
| 2.0 | 4.285 | 1.993 |
| 2.5 | 4.458 | 2.493 |
| 3.5 | 5.159 | 3.500 |
| 4.5 | 6.118 | 4.495 |
| 5.0 | 6.610 | 4.995 |
| 5.5 | 7.091 | 5.499 |
| 6.5 | 8.061 | 6.494 |
D INDEXER ARITHMETIC AND SCREENING
Long prompts take minutes on a laptop, and part of that time goes to the indexer. For a query with indexer heads and signed head weights , the reference scores each visible compressed key as
with the outer sum accumulated in FP32, and keeps the best keys. Before candidate filtering, scoring all visible query-key pairs grows quadratically with the prompt length. We studied two ways to make it cheaper: faster scoring, with equality under the conditions below, and screening keys before fully scoring them.
D.1 FASTER SCORING WITH THE SAME RESULTS
BF16 products. The reference computes each product in FP32 and then rounds it to BF16. Both inputs are FP4 values with power-of-two scales, which BF16 represents exactly, and the following lemma shows when a BF16 matrix multiplication returns the same rounded result.
Lemma 1. Let hold E2M1 values with one power-of-two scale per block of 32 elements, each exactly representable as a finite BF16 value. Let be the product of the two scales of block . Assume that , that , and that no partial sum overflows FP32. Then every partial sum of , in any order, is exactly representable in FP32, and a BF16 matrix multiplication that accumulates in FP32 and rounds once returns , the reference result.
Appendix D.4 gives the proof. MLX's BF16 matrix kernels accumulate in FP32, although we checked this empirically rather than for every kernel variant. Where the scale condition fails, both computations are ordinary FP32 sums whose last bit can depend on the order of summation, just as it can between different GPU kernels running the reference. On indexer inputs captured from a real 32K-token prompt, the BF16 version reproduced every one of about a billion scores.
Fused head reduction. After the matrix multiplication, Equation (3) still needs a ReLU, a weighting and a rounding for every element, followed by a sum over heads. Written as array operations, this reads a large intermediate tensor three times. We replaced it with a single Metal kernel in which each thread handles one pair of query and key and walks over the heads, preserving the per-head roundings. On every input we tested it matches the array version. Both sum the heads in FP32, but a different summation order need not be identical for all possible inputs. Figure 4a reports the measured block timings and equality checks.
Fixed tie order. A partition-based Top-K leaves ties at the boundary to the kernel. We sort by a 64-bit key built from the BF16 score and the position, so that ties go to the earlier position; NaN scores are mapped to negative infinity. Selection thereby becomes a pure function of the scores, which an exact screening method must also reproduce.
D.2 SKIPPING KEYS: AN EXPLORATORY SCREENING STUDY
DoSA (Meng & Fang, 2026) skips keys while keeping the selection exact. A seed set of keys gives a lower bound on the K-th best score, a cheap upper bound is computed for every other key, and keys with are dropped before full scoring. DoSA reports large speed-ups on GLM-5.2 and DeepSeek-V3.2 at contexts of half a million tokens and more. V4.1-Flash differs in three ways that could matter: it has fewer indexer heads, a smaller K, and its own two-level candidate selection. We therefore measured how well such a bound works on this model.
Setup. We captured the indexer inputs of a real 32K-token prompt and studied every index layer except the one that chooses the candidate blocks, which needs all block maxima and cannot skip keys. For each layer we used the last decode query and sixteen queries from the prompt. A key is eligible for a query if the query can see it and, in the later layers, if it lies inside the query's candidate blocks. As in DoSA, the bound evaluates the positive heads P and the strongest negative heads E exactly, and merges the remaining negative heads into a single term:
This is a real-arithmetic bound because . The historical script added heuristic BF16 slack and found no violation on its captured queries. That slack is not a certificate for Equation (3): three positive heads with dot product 64.75 and weight 0.31640625 produce an exact rounded score of 62, above the heuristic upper value 61.9421. This implementation does not have a general exactness guarantee. The following costs describe the captured data only, and screening remains disabled. Its cost counts the fully scored seed keys, the dot products of the bound for every other eligible key, and the remaining heads for every key that survives.
Results. Figure 4b and Table 8 show the cost at the best head budget for each layer. A useful bound needs about two thirds of the heads, and even then screening saves only a tenth to a fifth of the indexer's work, before the overhead of compacting the survivors on the GPU. DoSA's joint bound for omitted positive heads did not drop a single additional key on this model, and a low-rank bound built from the leading singular vectors of the query heads failed as well, because those singular values decay slowly. Two properties of the model explain the difference from DoSA's setting. At these context lengths, K is a large fraction of the keys, so the threshold sits low in the score distribution. And the model's own candidate selection already removes many keys before the indexer score matters. Arithmetic savings alone do not establish an end-to-end benefit once bounds, compaction and selection are included. Screening remains disabled in the runtime. The picture may change at contexts of 128K tokens and more, but prefilling such a prompt takes hours on this machine.
(a) Scoring kernels

(b) Exploratory screening
Figure 4: (a) Indexer time per prefill query block on real inputs, before and after the BF16 matmul and the fused head reduction. Labels give the layer and the block shape as rows times keys. Scores and selected keys are identical on these blocks. The matmul alone runs 1.5 to 1.9 times faster and the head reduction 5 to 6 times faster. (b) Historical cost of the heuristic screening bound relative to fully scoring the eligible keys, per index layer, at the best head budget. The heuristic was checked on captured inputs but is not generally sound under BF16 rounding; the cost includes scoring the seed keys and is averaged over 17 queries of a 32K-token prompt with .
D.3 SCREENING MEASUREMENTS
Table 8 lists, for each index layer, the best configuration of the bound averaged over 17 queries (the last decode query and 16 prefill queries), with up to 4096 of the most recent eligible keys as the seed set. The BF16 allowance is heuristic, so this table describes observed arithmetic cost rather than certified pruning. is the number of negative heads evaluated exactly, the resulting number of dot products per key (positive heads, negative heads and the merged term; it varies slightly between queries), and the cost includes scoring the seed keys. scripts/dosa_study.py reproduces the table and checks that no dropped key belongs to the true Top-.
Table 8: Best screening configuration per layer (32K-token prompt; layers 2–14 see 16K compressed keys, layers 24–36 see 32K keys, of which about 16K are eligible). Survive is the fraction of the non-seed eligible keys whose bound is not below .
| Layer | e | m (mean) | Survive | Cost vs. full scoring |
|---|---|---|---|---|
| 2 | 0 | 24 | 18.1% | 85% |
| 8 | 0 | 23 | 31.7% | 87% |
| 14 | 4 | 26 | 24.4% | 91% |
| 24 | 4 | 21 | 38.5% | 85% |
| 28 | 0 | 22 | 40.0% | 88% |
| 32 | 0 | 24 | 8.9% | 83% |
| 36 | 0 | 22 | 19.9% | 81% |
D.4 EXACT ACCUMULATION FOR FP4 INPUTS
E2M1 magnitudes are , i.e., integers in times . In block with scales and , each product is therefore an integer of magnitude at most 144 times , where is a power of two. Let and be the smallest and largest block products. Every product, and hence every partial sum over any subset of the 128 terms, is an integer multiple of . Its magnitude is at most . Expressed in units of , a partial sum is an integer below , which FP32's 24-bit significant represents exactly. Hence every FP32 addition in any order is exact, the accumulated value equals the real dot product, and the single final rounding to BF16 equals . This assumes that the block products stay in the normal FP32 range, i.e. and no overflow. The quantizer clamps each scale at , so the assumption can fail for blocks of near-zero activations; on our captured inputs the scale exponents lie roughly between -8 and 4.
D.5 TOP-K ORDER KEY
For a BF16 score with bit pattern (16 bits), the key if the sign bit is set and otherwise is monotone in the score value, after mapping to . For position we select the largest values of , a 64-bit integer, with a partition. This yields the order “higher score first, then earlier position” regardless of the partition kernel. In the candidate-block level the query’s own block has score . After NaNs are replaced by , this block ranks ahead of every finite competitor.
E MEASUREMENT PROTOCOL AND EVIDENCE
E.1 FRESH END-TO-END REQUESTS
The generation suite uses scripts/paper_benchmark.py with a requested 4.5 GiB cache, full prefill, greedy sampling and a limit of 128 output tokens for each of three short requests. The two retrieval requests have a 16-token output limit. The expert slab is cleared before each request; the host page cache is not purged. Prompt construction and tokenization precede the request timer. Model construction is timed separately, while work evaluated lazily on the first request is included in its latency.
Time to first token is the interval from calling the stream to receiving its first output. Decode throughput is for emitted tokens, including the terminal token if emitted. It therefore excludes prefill and does not count a final forward pass whose output is never used. The log retains every output id, complete text and intertoken interval. Retrieval throughput is omitted from the main table because its answers are too short to characterize sustained decoding.
A background thread samples macOS process resident size and physical footprint every 0.5 seconds through proc_pid_rusage. The log also records the process RSS high-water mark and MLX's peak allocation counter. The latter is reset before each request and includes allocations managed by MLX, not all process memory. Sampled maxima may miss short-lived peaks. Physical footprint and RSS are different accounting measures and are not added together.
Host-wide swap usage, VM counters and thermal status are recorded before and after each request. Swap usage rises from 6.54 GiB before model loading to 13.36 GiB after the suite. Swap-in and swap-out counter deltas count pages transferred across the entire machine, not bytes attributable to the model. Other applications remain open, so these measurements describe execution in a shared desktop environment. No claim of zero swap or isolated-device throughput follows from them.
E.2 MATCHED SCHEDULES
The schedule suite uses three prompts, three rounds, eight serial warmup tokens and twelve measured tokens per prompt-round block. Every configuration restores the same prompt snapshot, clears the expert cache, and replays that warmup before consuming the same continuation. The starting cache fingerprint and generated ids must match. Schedule position rotates across rounds. The workload contains 108 measured tokens per prompt across all schedules and 324 measured tokens in total.
Expert-read volume counts the record payload, excluding alignment padding, for both required and speculative reads submitted in the measured region. A final submission barrier attributes outstanding speculative submissions to that region; completion of optional work outside the timed forward calls is not charged as token latency. Cache reset drains outstanding reads before the next configuration. Thus the throughput measures forward-call latency, and the byte counter also exposes speculative work that may continue beyond it.
E.3 COMMANDS AND PROVENANCE
The two suites are run sequentially from the repository root, using one model process at a time:
python scripts/paper_benchmark.py --suite generation
--cache-gb 4.5 --tokens 128 --replay full
--out paper/logs/laptop_generation.json
python scripts/paper_benchmark.py --suite matched
--cache-gb 4.5 --tokens 12 --rounds 3 --warmup 8
--replay full --out paper/logs/laptop_matched.json
The logs contain the operating-system and MLX versions, model configuration, metadata hashes, actual expert-buffer capacity and a SHA-256 fingerprint of the runtime and benchmark sources. The matched protocol also saves its per-block data in laptop_matched.matched.json. Figure and table generation reads these files directly. Prompts, token ids and source fingerprints allow changes in workload or implementation to be distinguished from changes in the machine's state.
E.4 HISTORICAL EVIDENCE
Earlier measurements used an allocator whose per-layout floor exceeded the requested global capacity. A run labeled 5.5 GiB actually reserved 7.091 GiB of expert records and observed 1.23 tokens/s. Its schedule comparisons advanced a shared generation, so configurations processed different tokens and inherited cache effects. Those records remain in the repository, but their reported 11–27% improvements are not used as controlled estimates in this paper. Appendix C preserves the allocation audit.
The historical API comparison used continuations sampled on September 10, 2026 and the converted October 17 checkpoint. Its per-case table is retained in Appendix B; the version mismatch prevents isolating quantization loss. Indexer measurements in bench_kernels.log and dosa_study_v2.log are separate captured-input experiments, not fresh end-to-end benchmarks.
Runtime regression validation with the official reference passes 78 tests. Eight sampling and converter cases fail against the earlier a4df33c package, and the former allocation overshoot and hit-eviction race are reproducible. Their logs are stored as runtime_regression_baseline.log and runtime_regression_fixed.log. These checks support the revised implementation; they are not throughput measurements.