Repository navigation
fix(inference): AUT-2539 handle string prompts and rejections in KV hand - #8258
Closed
svcnemo-autobot wants to merge 1 commit into
Closed
svcnemo-autobot wants to merge 1 commit into
svcnemo-autobot wants to merge 1 commit into
Conversation
The inference client accepts a string or a token list for add_request_with_kv_handoff() and passes a string through unchanged. On the decode engine, add_request_with_kv_handoff() called torch.tensor() on the prompt, so a string prompt raised inside the engine loop. The SUBMIT_REQUEST_WITH_KV handler had no try/except, unlike SUBMIT_REQUEST, so that error, or any other handoff validation error, escaped schedule_requests() and the client never got a reply. Tokenize a string prompt once, with the request's add_BOS, before block hashing. The deferred and pending import records and the finalizer's add_request() then all carry the same token IDs. Wrap the handler call so a rejected handoff goes through _fail_submission(), which registers the FAILED placeholder the plain path already uses. Every MP rank processes the same broadcast message, so their request state stays mirrored. Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
svcnvidia-nemo-ci
marked this pull request as draft
October 15, 2026 15:57
Contributor
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
Contributor
|
/ok to test a9000e1 |
svcnemo-autobot
marked this pull request as ready for review
October 15, 2026 17:32
This branch was successfully deployed
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.
Background
Decode engines in disaggregated serving admit prefilled requests through
add_request_with_kv_handoff(). The inference review found two gaps:InferenceClient.add_request_with_kv_handoff()accepts a string or a token list and forwards a string unchanged. The decode side calledtorch.tensor()on the prompt, so a string prompt raised inside the engine loop.SUBMIT_REQUEST, theSUBMIT_REQUEST_WITH_KVhandler inschedule_requests()had notry/except. That error, or any other handoff validation error, escaped the loop and the client never got a reply.What changed
inference_state_handoff.py:promptis typedstr | list[int]. A string prompt is tokenized once withcontroller.tokenize_prompt(tokenizer, prompt, sampling_params.add_BOS)before block hashing. The deferred and pending import records and the finalizer'sadd_request()then all carry the same token IDs.dynamic_engine.py: theSUBMIT_REQUEST_WITH_KVhandler wrapsadd_request_with_kv_handoff()and sends any exception to_fail_submission(). That registers the same FAILED placeholder the plain submit path already uses. The_fail_submissiondocstring now mentions this caller.test_schedule_requests_fails_a_rejected_kv_handoff_and_continuesintest_dynamic_engine.pyandtest_string_handoff_prompt_is_tokenized_once_before_importintest_disagg_handoff_lifecycle.py.Details
Every MP rank processes the same broadcast message, so the failure path keeps request state mirrored across ranks. One behavior change: a non-disaggregated engine that receives
SUBMIT_REQUEST_WITH_KVnow fails that one request with a reply instead of raising out of the loop. This was split out of the inference review. It is independent of #8255, which handles replying to a failed KV import.Tested
3914483f, using main's CI image (sha256:7b4e22a3):tests/unit_tests/inference/**/*.py: 3675 passed, 37 skipped, 0 failed.tests/unit_tests/inference/engines/test_dynamic_engine.py: 254 passed, 2 skipped.