feat: speculative indexing for PrecisePrefixCacheScorer#659
Open
bongwoobak wants to merge 4 commits intollm-d:mainfrom
Open
feat: speculative indexing for PrecisePrefixCacheScorer#659bongwoobak wants to merge 4 commits intollm-d:mainfrom
bongwoobak wants to merge 4 commits intollm-d:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of llm-d/llm-d-kv-cache#353
Summary
PrepareDataPlugininterface for pre-computed block keys and prefix cache match infoPreRequesthook to inject speculative entries into Index after routing decisionip:portto match KV event topic format — speculative entries previously used IP-only, causing lookup mismatches with confirmed entries from KV events (which usekv@ip:port@modeltopic format)Details
Part 2 of Speculative Indexing (llm-d/llm-d-kv-cache#353).
Depends on kv-cache changes: (llm-d/llm-d-kv-cache#369)
PrepareDataPlugin (PrepareRequestData)
Indexer.ComputeBlockKeys()PrefixCacheMatchInfoon each endpoint for downstream consumersPluginStatefor reuse by Score/PreRequestScore() Optimization
PreRequest (Speculative Entry Injection)
PodEntry(Annotation: "speculative") to Index immediately after routingip:portformat to match KV event topic (kv@${POD_IP}:${PORT}@${MODEL})TTL Cache for Speculative Entries
OnEvictioncallback auto-removes speculative entries from Index on expiryAnnotationvalue)PodIdentifier ip:port Format Fix
AddressandPortfields asip:portAddress(IP) was used, which didn't match the PodIdentifier from KV events (kv@ip:port@modeltopic → PodIdentifierip:port)ip:portformat, enabling proper deduplication and score merging10.0.0.1:8000for rank 0,10.0.0.1:8001for rank 1). Without the port, all DP ranks would be indistinguishable and collapse into a single PodIdentifierData Flow
Test plan
Breaking Change: PodIdentifier Format
ip:portformat (e.g.,10.0.0.1:8000) to match KV event topic format (kv@ip:port@model)10.0.0.1) was used, which caused mismatches with confirmed entries from KV eventskv@${POD_IP}:${PORT}@${MODEL}format, so this aligns the scheduler with the engine behavior