Skip to content

serve: pair a checkpoint's known drafter when the local cache holds it - #3204

Merged
ashhart merged 2 commits into
mainfrom
lead/serve-known-drafter
Nov 16, 2026
Merged

ashhart merged 2 commits into
mainfrom
lead/serve-known-drafter

Conversation

@ashhart

@ashhart ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

serve now pairs a checkpoint's known drafter by itself when that drafter is already on disk. The target-to-drafter table (knownDrafter) moves from server/benchmark_model.zig to server/drafter.zig, so serve and the benchmark read one table. It holds one entry: Qwen3.8-27B (qwen3_5, hidden size 5120, 64 layers) with z-lab/Qwen3.8-27B-DFlash2.

What changes

  • No --drafter: serve looks the target up in the table and resolves the drafter through the same local resolver --drafter uses (a directory, or a revision already in the Hugging Face cache). Nothing is downloaded. A hit logs one line naming the drafter; a miss, a target with no entry, or a config that cannot be read changes nothing.
  • A drafter paired this way that does not open (refused, failed to load, or no room for both) is dropped with one line giving the reason, and the target opens alone. An automatic pairing never stops startup.
  • --drafter none serves without an external drafter. An explicit --drafter is unchanged, including its error when the drafter is not cached.
  • --no-drafts and HIP builds (no DFlash2 there yet) skip the lookup.
  • The benchmark keeps the drafter it chose before: its serve child now gets --drafter none when the plan names no drafter.

Why output is unchanged: the drafter only proposes tokens; the target checks every proposed token against its own sample, so a drafted reply is the same tokens as the same request without the drafter. Pairing changes what is loaded (memory, startup time, speed), not which tokens are accepted.

Tests (host, no GPU)

  • drafter_test.zig: the table (root and nested text_config, wrong shape or family); a local cache hit and miss; a missing or unreadable config; malformed refs and absent snapshots; none, --no-drafts and HIP; an explicit drafter winning over the table and an explicit missing drafter's error. A paired drafter that is refused or fails leaves the target open alone with one line; an explicit drafter's failure is passed through unchanged.
  • benchmark_server_test.zig and benchmark_run_test.zig: the serve child gets --drafter none in every plan that names no drafter.
  • zig build test-server-cpu test-cuda-host test-golden fuzz-cortheon check-native-cuda-host native pass; zig fmt --check and the lean check report nothing new.

Still owed, and it decides whether this lands as the default: Qwen3.8-27B served on Metal and CUDA with the drafter picked from the cache against --drafter none, same token_sha256 at T=0 and sampled, and decode speed at 1 to 8 streams, load time and memory. If any cell is slower with the drafter than without, the default waits.

Fixes #3173

  • Synthena (Ash's Agent)

The target-to-drafter table moves from benchmark_model.zig to drafter.zig,
so serve and the benchmark read one table. With no --drafter, serve looks
the target up there and resolves its drafter through the local hub
resolver only, so nothing is downloaded, and logs one line naming it. A
drafter it paired that does not open is dropped with one line and the
target opens alone. --drafter none serves without one, and an explicit
--drafter keeps its meaning. The benchmark's serve child gets --drafter
none when the plan names no drafter, so it keeps the drafter it chose.

Fixes #3173
@ashhart
ashhart force-pushed the lead/serve-known-drafter branch from 4a6f3d5 to f62fdc8 Compare November 16, 2026 13:38
@ashhart
ashhart merged commit 2a4ba0e into main Nov 16, 2026
17 of 30 checks passed
@ashhart
ashhart deleted the lead/serve-known-drafter branch November 16, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

serve: pair a checkpoint's known drafter when it is present locally

1 participant