Apple M4 Pro · 24 GiB unified memory · Qwen3.8-27B MXFP4

Your 27B model,
holding the whole conversation.

JustFit fits Qwen3.8-27B's full 256K-token context — and shares it across concurrent requests — inside 24 GiB of unified memory. No cloud, no truncation, no losing where you were.

scheduler / Qwen3.8-27B · M4 Pro · 24 GiB holding memory: input embedding + output head

Held all at once, this workload needs two of this machine.
JustFit runs it on one.

JustFit · 20,852 MiB KV kept packed+10,696 MiB one layer at a time+11,520 MiB components detached+644 MiB
Pages owned by A B C D E 6 / 18 pages
Attached now output head drafter vision tower

A begins alone and owns six equal-capacity page groups.

git clone --branch justfit-repro-v4 https://github.com/YuhuaBillChen/mlx-vlm
cd mlx-vlm && examples/justfit/run_server.sh
Where these numbers come from
  • 20,852 MiB — measured JustFit peakA 196,608-token conversation with an image admitted beside it. 148 MiB under the 21,000-MiB fail-closed guard.
  • +10,696 MiB — if KV stayed FP16At 229,376 positions the pool is 3,640 MiB packed as TQ4, 14,336 MiB as FP16.
  • +11,520 MiB — if every layer's workspace stayed liveReconstructing one attention layer at 192K costs 768 MiB. JustFit holds one at a time; retaining all 16 costs 12,288 MiB.
  • +644 MiB — if one component stayed residentThe input embedding and output head are untied, 644.14 MiB each.

The green segment is measured. The red segments are each term's own arithmetic from the paper's live-set equation Mlive = W + K + S + X + H, shown at long-context scale — not the measured peak of an alternative run, since the terms overlap in time.

256Ktokens, one request
320Ktokens, shared across two
24 GiBunified memory, no swap
29/30AIME 2026

Proof

Every number traces to a hash.

Each row below is a fresh-process, full-output run with postflight and page-reuse checks. The measured JSON is public.

B1 / single request 8.53×

completed context

30,720 baseline positions → the complete 262,144-position native window on the same 24 GiB laptop.

240K input + 16K output · 1× cold + 2× warm-prefix extension · peaks 20,357–20,450 MiB
B2 / shared pool 327,680

aggregate positions

A 160K-input lane and a 128K-input lane each generate 16K tokens from ordered warm-prefix restores.

9.735 aggregate tok/s median · distinct from the 294,912-position fully cold B2 result
B4 / unequal requests 204,800

aggregate positions

A 128K+12K agent stream begins first; three 8K+12K streams then join it and all four complete from one shared pool.

22.570 common-active tok/s · 12.147 wall-output tok/s · 18,915 MiB · no implicit 8K prompt gate
Capability / separate protocol 29 / 30

AIME 2026

Paged TQ4 generates 696,834 reasoning tokens at 15.04 token-weighted tok/s.

Integrated runtime check · not 256K-context comprehension
All artifacts — paper, guides, pinned components, raw JSON

Development continues at justfit-mlx. These links deliberately resolve against the immutable justfit-repro-v4 tag in the research fork instead — that is the tree the paper cites, so it stays fixed while the code moves on.

Use it today

One endpoint.
Three familiar clients.

Run a secured OpenAI-compatible endpoint locally, then connect a browser UI, a terminal client, or Hermes Agent. No provider account, no per-token bill.

Browser chat

Open WebUI

Add http://host.docker.internal:8080/v1 as an OpenAI-compatible connection, supply the local API key, and select justfit-qwen38.

Terminal chat

Streaming CLI

Use the dependency-free examples/justfit/chat_cli.py client for a direct multi-turn Chat Completions session.

Coding agent

Hermes Agent

Configure the custom endpoint with context length 73728 — 65,536 input positions plus an 8,192-token output ceiling.

How it fits

Three mechanisms.
One memory budget.

Quantizing the KV cache is only the first step — usable context is set by every allocation that overlaps it: weights, resident pages, attention operands, prefill workspace, speculative state, component lifetimes. JustFit treats their overlap as the actual problem.

01KVEXEC

Compact in storage.
Bounded in execution.

Page-addressed 4-bit KV, page-native decode, and direct-inverse reconstruction of only the current layer's floating-point attention operands — never a second full-precision copy.

02PHASESWAP

Components follow
live owners.

The output head, vision tower, and speculative drafter attach only when a request actually needs them, and detach at scheduler-selected safe boundaries — not when you remember to free them.

03STATETRANS

Change execution.
Keep the context.

A request can move speculative → batched → speculative decoding without migrating its surviving KV. Completed and cancelled rows return their pages for immediate reuse.

The paper's full state-transition figure
JustFit component residency and shared page ownership across single-lane and continuous-batching phases
Active computation, component residency, page ownership, waiting requests, and safe reuse.

What JustFit doesn't claim

Boundary, not default.

The headline numbers are real, and they are also the ceiling — not what you should run every day. Stated up front so you don't have to find out the hard way.