Persistent Session-State Management for LLM Serving: An Identity-Keyed Architecture for Durable, Engine-Agnostic Sessions
Abstract
Mainstream LLM serving engines can lose conversational state when processes terminate or context windows overflow. We present qml-router, a control plane for resource-constrained edge and on-premises serving based on a single invariant: the canonical session state is an identity-owned token log that is engine-agnostic at the storage layer, while engine-specific KV caches are rebuildable acceleration derived from it. Persisting state under explicit session identities enables restart recovery, avoids cross-session content matching during storage lookup, and archives trimmed history for queryable retrieval. With the engine’s restore path modified as described, restoring 32K tokens on an RTX 4090 takes 0.66 s versus 3.03 s for recomputation; the same reconnect on a Jetson AGX Orin at 30 W takes 4.2 s versus 87.9 s ( $20.7\times $ ). Correctness-gated benchmarks demonstrate a 20,000-turn session without a material increase in per-turn latency and continuation across llama.cpp, vLLM, and SGLang by token-log replay followed by prefill, given a shared tokenizer and a compatible model configuration. A first-order cost model matches the measured restore/recompute boundary within 2–10% at the measured points (not a general error bound) across three hardware classes, and regimes favoring recomputation are reported.