arXiv:2609.17475cs.AISep 2026

Manuscript Offprint

arXiv:2609.17475

JustFit: 200K-Token LLM Serving on a 24 GiB Laptop with Just-in-Time State Management

Yuhua Chen

Yuhua Chen

www.yuhuachen.com

Abstract. Capable open-weight models make local coding and reasoning attractive, but their context and execution state strain laptop memory. We present JustFit, an MLX-based inference runtime that combines KVExec for compressed KV execution, PhaseSwap for component residency, and StateTrans for state-preserving serving transitions. These mechanisms fuse reconstruction and coordinate just-in-time materialization and release, independently of model-weight quantization. In full-execution capacity tests on a 24 GiB M4 Pro MacBook running Qwen3.8-27B MXFP4, three independent runs complete 196,608 input and 16,384 output tokens, increasing completed single-request context from the mlx-vlm baseline's 30,720 positions to 212,992 (6.93×); a separate two-request run retains 229,376 positions in aggregate. In separate performance tests, a 32K-input, 64-output probe reaches 19.11 tokens/s, and a repeated 32K+6K workload has a median peak process footprint of 16,374 MiB. The integrated runtime answers 29 of 30 AIME 2026 problems correctly, showing how compact state and lifetime-aware execution expand local serving capacity while supporting extended generated reasoning.

1. Introduction

Open-weight 27B models now make demanding local inference worth pursuing. Qwen3.8-27B reports 89.2 on GPQA Diamond and 90.3 on LiveCodeBench v6, compared with 91.3 and 88.8 for Opus 4.6 Max in its upstream evaluation (Qwen Team, 2026). Deploying such capability on a user-owned laptop would give private code and working state a local execution path, without requiring a dedicated accelerator server. The obstacle is no longer simply whether the weights fit: a useful service must also retain context, execute attention, and accommodate changing requests within the same memory budget.

Long context is especially important for repository-scale coding. Source files, tool results, failed attempts, and earlier decisions accumulate over many model calls. Compaction can omit details that later edits require and adds a separate summarization call (Anthropic, 2025; Nous Research, 2026a). Hermes consequently requires at least 64,000 con-

Figure

Figure 1. Completed context and its memory cost. Top: under a 21,000-MiB process guard, the mlx-vlm baseline completes 24K+6K for one request; JustFit completes 192K+16K in three independent single-request runs (Table 1) and, separately, 2×(96K+16K)2 \times (96K+16K) across two concurrent requests (224K aggregate). Bottom: process-peak slopes from separate single-request 64-output probes over the labeled ranges (three successful lengths per runtime). This is system-level growth, not intrinsic KV storage. K = 1,024.

text tokens per active tool-using session (Nous Research, 2026b). Prefix caching avoids recomputing an unchanged history at every turn, but the reusable state must still fit in memory (Zheng et al., 2024). Increasing retained capacity and reducing redundant prefill are therefore complementary requirements.

We target a 24 GiB Apple-silicon laptop running MLX. Weight quantizers such as AWQ, and aggressively compressed models such as Bonsai 27B, already address local deployment by reducing static model storage (Lin et al., 2024; PrismML, 2026). Bonsai's binary and ternary variants use 1.125 and 1.71 effective bits per weight while retaining substantial reported reasoning capability. Our work is orthogonal: we fix the model's MXFP4 weights and optimize the context and execution state around them. Even ideal four-bit storage for 27 billion weights costs about 12.6 GiB; FP16 KV for this model adds another 12 GiB at 192K input positions, before workspaces and other state.

Low-bit KV is a necessary starting point, not a complete execution strategy. KIVI, KVQuant, and TurboQuant establish representations that preserve useful information at low precision (Liu et al., 2024; Hooper et al., 2024; Zandieh et al., 2025). A compressed cache can nevertheless fit while its reconstruction workspaces do not. Flash-based inference systems address when weights should be available (Alizadeh et al., 2024; Sheng et al., 2023; Du et al., 2025); DwarfStar manages routed experts within an SSD-streaming cache and reserves prefill headroom (DwarfStar Contributors, 2026). PagedAttention and chunked-prefill serving address allocation and interference between requests (Kwon et al., 2023; Agrawal et al., 2024). Near a laptop's memory limit, these decisions interact: an output head unused by one request's prefill may still be required by another request's generation, and a finished request can delay new work if it retains page ownership.

JustFit addresses this interaction with just-in-time state management. Persistent KV remains compact; execution operands are reconstructed near their consumer; model components remain attached while a live owner needs them; and departing requests release state at safe execution boundaries. Figure 2 separates these responsibilities into KVExec, PhaseSwap, and StateTrans. Together they expand usable context without rebuilding the target cache when execution switches between singleton multi-token prediction (MTP) and continuous batching.

The contributions are threefold. First, KVExec integrates TurboQuant-based four-bit storage with page-native access, fused inverse reconstruction, and layer-scoped evaluation. Second, PhaseSwap and StateTrans coordinate component ownership with request admission, speculation, and reclamation. Third, the evaluation establishes completed 200K-scale capacity, repeatability at the single-request limit, throughput across context lengths, and end-to-end reasoning with compressed state. Figure 1 compares the evaluated upstream mlx-vlm baseline with JustFit: single-request retained capacity grows 6.93×6.93\times, and the separate two-request record grows 7.47×7.47\times in aggregate.

References (29)