EXP-038: GDN snapshot / pin / restore / fork API + /tq HTTP routes (stages 0-4 hardware-proven)
Env-gated (VLLM_TQ_GDN_SNAPSHOT, default off) serving primitive: park GDN recurrent state, pin KV blocks across request free, zero-kernel restore via cache hit, fork_from_handle into N children with divergent sampling, plus /tq/pin|fork|unpin HTTP routes and async-client plumbing. All four stages + the HTTP path verified on hardware (byte-exact continuations, 98% cache-hit children, zero leaked blocks; fork-research demo end-to-end). Known gaps documented in-tree: quiescent-only pin targeting, blocking fork (v2 = admit-as-normal-requests, also fixes fork children ignoring stop tokens), K-sizing interactions.
@cubic-dev-ai review
🤖 Generated with Claude Code
Summary by cubic
Adds a non-blocking fork path via /tq/fork2 with optional per‑child SSE streaming and a read‑only get_pin_handle, completing “prefill once, fork N” without changing default serve behavior. Old behavior: /tq/fork blocked the engine loop and bypassed eos/stop. New behavior: /tq/fork2 submits children as normal AsyncLLM.generate requests; with stream: true it emits SSE per‑child deltas; the loop stays free and finishes are stop‑correct. Stage‑6 window driver reports hardware PASS (4/4 stop‑correct, full‑cache adoption).
get_pin_handle(handle_id)returns pinned prefix metadata (token_ids,cache_salt) for server‑layer fan‑out; mirrored across async/sync clients, declared on theEngineClientprotocol, and rejected under DP load balancing byDPLBAsyncMPClient.- Shared child‑spec validation lives in
vllm/entrypoints/openai/tq_fork_specs.pyand is used by both/tq/forkand/tq/fork2. /tq/fork2streaming:stream: truereturns SSE events (fork_start; per‑childchild_start→child_delta* →child_done; terminalfork_done). Streaming children useDELTAoutput; non‑stream keepsFINAL_ONLY. Per‑child errors and timeouts are isolated; validation errors remain JSON.
Rollout and limits
- Opt‑in only: set
VLLM_TQ_GDN_SNAPSHOT=1(optionalVLLM_TQ_GDN_SNAPSHOT_PARK_BLOCKS); the router attaches only when gated; never enable on:8001. - Single‑engine only; DP load balancing is rejected.
/tq/pinrequires a quiescent engine with a single running request./tq/forkremains blocking and bounded bymax_steps/max_total_tokens;/tq/fork2is non‑blocking and each child runs as an ordinary generate request (streaming or final JSON).