JustFit: Just-in-Time State Management for Local LLM Serving
Abstract
Local agents need memory for model execution and working history. We present JustFit, an MLX runtime that coordinates their overlapping allocations: KVExec executes and checkpoints four-bit KV with bounded workspace, PhaseSwap loads phase-dependent components, and StateTrans preserves history across execution modes. With Qwen3.8-27B MXFP4 on a 24 GiB M4 Pro MacBook, JustFit reaches 327,680 retained positions across two requests, 10.67 times the evaluated baseline's 30,720-position single-request record. One request completes the full 262,144-position native window at median 5.986 tokens/s. Each shape completes 16,384 outputs per request in three fresh processes: B1 uses one cold build and two prefix extensions; B2 uses three ordered prefix extensions (Section 4). Image encoding can proceed while preserving a live 196,608-input text request. A controlled, repetitive 32K+6K workload reaches median 18.284 tokens/s at 15,626 MiB; a separate AIME 2026 evaluation scores 29/30. Coordinating execution and state lifetimes makes longer histories feasible on personal hardware.
Create a lesson
Metadata
- Categories
- cs.AI, cs.PF
- Comments
- 20 pages, 6 figures, 17 tables. Code, Quick Start, and reproduction materials are publicly available
Related papers
LSREP: A Longitudinal State-Replay Protocol for Evaluating Conversational Memory, with ICE v2 as an Audited Local-First Architecture
Shared title terminologycs.AIDeepesh Sonar
E2SIM: Long-Horizon Simulation of Everyday Human Behavior with Evolving States
Shared title terminologycs.AIZiwei Gong, Xiangyang Yin, Thai Quoc On et al.
Self-Improving Long-Horizon Reasoning by Learning Summaries from Local Continuations
Shared title terminologycs.AIHaoqun Cao, Tengyang Xie
XRL4T1D: A Post-hoc Explainability Framework for Reinforcement Learning in Type 1 Diabetes Management
Shared title terminologycs.AIMalay Phadke, Chirath Hettiarachchi
GameDojo: Benchmarking Real-Time Interactive Agents in Video Games
Shared title terminologycs.AIKuan Zhang, Zhihao Yang, Yukun Chen et al.
How Many Parameters Does Forecasting Need? A Survey and Code-Level Audit of Lightweight Long-Term Time Series Forecasting
Shared title terminologycs.AIIssam Ait Yahia, Abdelkader El Mahdaouy, Ismail Berrada