[https://nvbugs/5926823][fix] Cherry-pick: Propagate logprobs from prefill to decode in disagg (#11727) - #11792
Conversation
…de in disagg (NVIDIA#11727) Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
|
/bot run --disable-fail-fast |
📝 WalkthroughWalkthroughThis PR adds support for propagating log probabilities of the first generated token across disaggregated workers in multi-phase generation pipelines. It introduces a new Changes
Sequence DiagramsequenceDiagram
participant Client
participant ContextWorker as Context Worker
participant GenerationWorker as Generation Worker
participant ResultHandler as Result Handler
Client->>ContextWorker: Send context_only request
ContextWorker->>ContextWorker: Process prefill tokens
ContextWorker->>ContextWorker: Generate first_gen_log_probs
ContextWorker->>ResultHandler: Return context phase result
ResultHandler->>ResultHandler: Propagate first_gen_log_probs<br/>to disaggregated_params
ResultHandler->>Client: Return context result with<br/>first_gen_log_probs
Client->>GenerationWorker: Send generation_only request<br/>with first_gen_log_probs
GenerationWorker->>GenerationWorker: Receive and validate<br/>first_gen_log_probs
GenerationWorker->>GenerationWorker: Process decode phase
GenerationWorker->>ResultHandler: Return generation phase result
ResultHandler->>ResultHandler: Append first_gen_log_probs<br/>to final output
ResultHandler->>Client: Return generation result<br/>with complete logprobs
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tensorrt_llm/serve/openai_protocol.py`:
- Around line 1090-1133: Update _deserialize_first_gen_log_probs to strictly
validate types: ensure the top-level "serialized" is a list and each position is
a list (already present), but additionally enforce that each item dict contains
"token_id" as an int, "logprob" as a numeric (int/float) and "rank" if present
is either None or an int; convert numeric logprob to float and rank to int (or
None) before constructing Logprob. In practice, inside
_deserialize_first_gen_log_probs (the loop that iterates pos and item) add
explicit isinstance checks for token_id, logprob and rank, raise ValueError with
clear messages on bad types, cast logprob via float(item["logprob"]) and rank
via (None if item.get("rank") is None else int(item["rank"])), then call
Logprob(logprob=..., rank=...). Ensure error messages reference
first_gen_log_probs indices for easier debugging.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
tensorrt_llm/_torch/pyexecutor/llm_request.pytensorrt_llm/_torch/pyexecutor/py_executor.pytensorrt_llm/disaggregated_params.pytensorrt_llm/executor/result.pytensorrt_llm/serve/openai_protocol.pytests/integration/defs/disaggregated/test_disaggregated_single_gpu.pytests/integration/test_lists/qa/llm_function_core.txttests/unittest/disaggregated/test_openai_disagg_service.py
|
PR_Github #37106 [ run ] triggered by Bot. Commit: |
|
PR_Github #37106 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #37175 [ run ] triggered by Bot. Commit: |
|
PR_Github #37175 [ run ] completed with state |
Superjomn
left a comment
There was a problem hiding this comment.
LGTM on the llmapi changes.
e922a86
into
NVIDIA:release/1.3.0rc5.post1
Summary by CodeRabbit
Release Notes
New Features
Tests
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.