fix(vllm): Propagate nvext.cache_salt in Unified vLLM Prompt Construction - #11218
fix(vllm): Propagate nvext.cache_salt in Unified vLLM Prompt Construction#11218weizhoublue wants to merge 1 commit into
Conversation
Signed-off-by: weizhoublue <weizhou.lan@daocloud.io>
WalkthroughThe vLLM engine's generate() method now applies an nvext cache salt to the constructed prompt via a new ChangesNVExt Cache Salt Application
Estimated code review effort: 1 (Trivial) | ~5 minutes Related Issues: None specified Related PRs: None specified Suggested labels: vllm, testing Suggested reviewers: None specified Poem 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
|
@biswapanda hi , please help check whether this PR makes sense |
|
Took a look at this one. The gap is real: on main the unified engine is the only prompt-build path that skips the salt (llm_engine.py:368 builds TokensPrompt bare, while all three handlers.py call sites go through _apply_nvext_cache_salt from #11082). Ran your new unit test with the repo code first on sys.path: KeyError on main, passes on this branch, and vllm's input preprocessing does consume prompt["cache_salt"] (vllm/inputs/preprocess.py). I didn't run a live two-salt E2E, but the unit-level A/B plus reusing the helper that already ships for the other paths looks correct to me. |
|
Hi @weizhoublue, thanks for the contribution. Can you help fix the merge conflict? |
rmccorm4
left a comment
There was a problem hiding this comment.
LGTM other than merge conflict
The conflict was caused by other merged PR #8197 which also aimed to fix cache_salt issue |
Overview:
Propagate nvext.cache_salt in Unified vLLM Prompt Construction
Details:
A similar nvext.cache_salt issue in PR #11082 exists in a different path components/src/dynamo/vllm/llm_engine.py.
Client sends OpenAI chat/completions request with nvext: {"cache_salt": "tenant-a"} through vLLM unified backend. Dynamo preprocesses request into token IDs plus extra_args.nvext.cache_salt, then components/src/dynamo/vllm/llm_engine.py builds fresh TokensPrompt without cache_salt
In PR #11082, components/src/dynamo/vllm/handlers.py is handler-based vLLM path , where handler creates TokensPrompt or TextPrompt from OpenAI-style text-mode input.
Regarding the PR, in a different path, components/src/dynamo/vllm/llm_engine.py is unified backend path. It receives already-preprocessed GenerateRequest with token_ids and extra_args, then creates its own TokensPrompt. Fix in handlers.py does not cover llm_engine.py, because unified backend bypasses _generate_text_mode.
Both paths construct vLLM prompt objects independently, so both need to propagate nvext.cache_salt at their own prompt-construction point.
Where should the reviewer start?
Related Issues
🔗 This PR is linked to an issue:
🚫 This PR is NOT linked to an issue:
Summary by CodeRabbit