Skip to content

[Feat] sgl-router: Separate LoRA block IDs from prompt lookup keys - #42818

Merged
ShangmingCai merged 4 commits into
mainfrom
kan/lora-kv-router
Oct 14, 2026
Merged

ShangmingCai merged 4 commits into
mainfrom
kan/lora-kv-router

Conversation

@sherlockwu

@sherlockwu sherlockwu commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Worker KV-event block IDs may include a worker-local LoRA UUID and cannot be reproduced from an incoming prompt. This separates those external IDs from canonical lookup keys, so base requests and different adapters do not receive each other's prefix credit.

Stacked on #42817. Both existing event modes can supply LoRA events; the router uses tokens, the public adapter name, and cache salt to compute lookup keys.

Changes

  • Translate LoRA stores through a shared sgl-kv-indexer::lora implementation. Keep mappings scoped to each worker/DP rank, retain parent digests for continuation events, and count independent external owners of each lookup key on each storage tier.
  • Make store replay idempotent. Removing one external block revokes only tiers that lost their last owner, so separate adapter loads and GPU/host copies do not evict each other's prefix credit. Clear local mappings on worker clear/reset/teardown; clear bridge mappings on AllBlocksCleared.
  • Apply the same translation in the local event index and remote indexer bridge. Existing base-model stores and removals keep their published-key path, including the existing medium and unknown-tier handling.
  • Preserve replay, bootstrap sequence gates, snapshot watermarks, and rank filtering. Buffered LoRA stores retain the tokens needed for translation. Peer snapshots retain the external-ID map for subsequent removals and continuations.
  • Negotiate LoRA snapshots with include_lora=true. New consumers receive version 2 when mappings are present; legacy consumers receive a base-only version-1 view at the same watermark. Mixed-version deployments can continue bootstrapping base caches. Base-only snapshots remain version 1.
  • Thread request namespaces through local/remote prefix scoring, pending prefixes, DP-rank selection, and reorg routing. Resolve base:adapter to the base model's workers while preserving the adapter in the forwarded body.

Validation

  • Entire Rust router/indexer workspace: 1,531 tests passed, including the existing event replay, concurrency, tiers, bootstrap, proxy, and remote indexer suites.
  • Added coverage for opaque IDs, separate load ownership, duplicate stores, tier transitions, delayed parents, salt/bigram atoms, snapshot round trips and removal after restore, bootstrap token retention, and actual HTTP mixed-version snapshot negotiation.
  • The LoRA proxy test feeds opaque worker IDs through event ingestion and verifies adapter/base worker selection.
  • All 10 engine-derived lookup parity cases passed; regenerated fixtures are unchanged.
  • Clippy with warnings denied, rustfmt, Black/isort, and diff whitespace checks passed.

Serving E2E and CUDA HiCache transitions remain unverified on this revision: the GPU devbox was evicted for low ephemeral storage. The remote indexer retains its existing soft-state/reconnect limitations. Reloading different weights under the same public adapter name still requires versioned names to avoid stale lookup credit.


CI States

Latest PR Test (Base): ✅ Run #38592394711
Latest PR Test (Extra): ❌ Run #38592394633
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.

@sherlockwu
sherlockwu added this pull request to stack #42819 October 6, 2026 21:57
@sherlockwu
sherlockwu force-pushed the kan/lora-kv-router branch 4 times, most recently from 4a701ed to cbbc3bb Compare October 12, 2026 05:15
@sherlockwu sherlockwu changed the title [sgl-router] Namespace request block hashes by LoRA adapter and cache_salt [sgl-router] Separate LoRA block IDs from prompt lookup keys Oct 12, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file lora labels Oct 12, 2026
Base automatically changed from kan/lora-kv-events to main October 14, 2026 14:56
@ShangmingCai ShangmingCai changed the title [sgl-router] Separate LoRA block IDs from prompt lookup keys [Feat] sgl-router: Separate LoRA block IDs from prompt lookup keys Oct 14, 2026
Kan Wu and others added 4 commits October 14, 2026 23:46
…_salt

Workers publish LoRA blocks under hashes keyed by the adapter name, and
salted blocks under a salt-seeded chain. The router hashed every prompt
as an unsalted base-model prompt, so LoRA, base and salted requests
matched each other's blocks, and salted requests never matched their own.

Requests now carry a CacheNamespace (cache_salt, and the adapter from
`model: "base:adapter"` or `lora_path`), and every prefix lookup hashes
the prompt the way the engine publishes it. Chat also resolves
`base:adapter` model ids to the base model's workers.

The parity fixture gains salt and LoRA cases, and its
--validate-against-sglang mode now checks against the engine's KV event
recorder (RadixKey.hash_page no longer exists).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ShangmingCai

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 14, 2026
@ShangmingCai
ShangmingCai merged commit c964d9b into main Oct 14, 2026
123 of 131 checks passed
@ShangmingCai
ShangmingCai deleted the kan/lora-kv-router branch October 14, 2026 16:50
ShangmingCai added a commit that referenced this pull request Oct 16, 2026
Resolve conflicts with #42674 (squash-merged), #42818 and #44072:
- prepare() resolves OpenAI-route models with lookup_openai, so HTTP
  `model: "base:adapter"` keeps routing to the base model.
- Leg::new passes the pinned prefill rank so decode still receives
  disagg_prefill_dp_rank under --dp-aware.
- PreparedRequest::completion and ::typed set cache_namespace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation lora run-ci CI: run the baseline test suite on this PR unified-radix-cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants