Repository navigation
fix(llm): return chat prompt logprobs - #13957
Conversation
|
👋 Hi yankay! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (25)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughChangesThe change adds optional prompt logprobs to OpenAI chat response types. It routes values to the response root and optional Prompt logprobs response contracts Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This change exposes requested prompt logprobs in non-streaming chat responses while preserving existing behavior; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
c8c190a to
43adb22
Compare
|
/ok to test be62e16 |
50c20b2 to
14af348
Compare
|
/ok to test 0ebdf81 |
|
/ok to test 0ebdf81 |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Multi-choice responses repeatedly deserialize the request-sized prompt-logprobs payload after each terminal choice.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Returns requested prompt log probabilities at the root of non-streaming OpenAI chat responses while preserving existing nvext behavior.
Changes:
- Propagates prompt logprobs through delta generation, parsing, aggregation, and request tracing.
- Uses
Arcfor large internal payloads and excludes them from SSE serialization. - Adds regression coverage and updates response fixtures.
| File | Description |
|---|---|
lib/llm/tests/tool_choice.rs |
Updates stream-response fixtures. |
lib/llm/tests/tool_choice_finish_reasons.rs |
Updates finish-reason fixture. |
lib/llm/tests/test_streaming_tool_parsers.rs |
Updates parser fixtures. |
lib/llm/tests/test_reasoning_parser.rs |
Updates reasoning fixture. |
lib/llm/tests/postprocessor_parsing_stream.rs |
Updates postprocessor fixtures. |
lib/llm/tests/logprob_analysis_integration.rs |
Updates logprob fixtures. |
lib/llm/tests/aggregators.rs |
Updates aggregation fixtures. |
lib/llm/src/request_trace/payload_stream.rs |
Preserves prompt logprobs through trace conversion. |
lib/llm/src/request_trace/agent_context.rs |
Updates agent-context fixtures. |
lib/llm/src/protocols/openai/responses/stream_converter.rs |
Updates response-converter fixtures. |
lib/llm/src/protocols/openai/responses/mod.rs |
Updates unary-response fixtures. |
lib/llm/src/protocols/openai/completions/delta.rs |
Validates requested backend prompt-logprob payloads. |
lib/llm/src/protocols/openai/chat_completions/unified_parser.rs |
Updates unified-parser fixtures. |
lib/llm/src/protocols/openai/chat_completions/tool_parser_v2.rs |
Updates tool-parser fixture. |
lib/llm/src/protocols/openai/chat_completions/delta.rs |
Captures and emits requested prompt logprobs. |
lib/llm/src/protocols/openai/chat_completions/aggregator.rs |
Aggregates prompt logprobs into unary responses. |
lib/llm/src/protocols/openai/chat_completions.rs |
Adds root and internal transport fields. |
lib/llm/src/protocols/common/llm_backend.rs |
Makes payload decoding errors explicit. |
lib/llm/src/protocols/anthropic/types.rs |
Updates Anthropic conversion fixtures. |
lib/llm/src/protocols/anthropic/stream_converter.rs |
Updates Anthropic stream fixtures. |
lib/llm/src/preprocessor/speculative_prefill.rs |
Updates speculative-prefill fixture. |
lib/llm/src/preprocessor.rs |
Preserves metadata through legacy parser processing. |
lib/llm/src/perf/logprobs.rs |
Updates performance-analysis fixtures. |
lib/llm/src/http/service/openai.rs |
Updates OpenAI service fixtures. |
lib/llm/src/http/service/metrics.rs |
Updates metrics fixtures. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/ok to test a18df8c |
|
/ok to test 924e495 |
|
/ok to test 924e495 |
⏹️ Dynamo PR CI cancelled — run 37412746204 (attempt 1) on
|
| Other | Jobs |
|---|---|
| dynamo-runtime | ⏹️ 1 |
| frontend | ⏹️ 1 |
Failure details
No jobs failed. The 2 cancelled jobs are not fail-fast or manual cancels: both image builds hit their job timeout while the Docker build was still running. The gate checks fail only because they mirror these. The logs show no error before the timeout, so rerunning the failed jobs is likely enough.
- ⏹️ dynamo-runtime / image / Build multi-arch cuda13.0 · Step:
Build and Push Test Image. Hit the 1h0m0s job timeout (The job has exceeded the maximum execution time of 1h0m0s). - ⏹️ frontend / Build multi-arch cpu · Step:
Build and Push Image. Hit the 1h30m0s job timeout (The job has exceeded the maximum execution time of 1h30m0s).
For agents
{"pr": 13957, "run_id": 37412746204, "run_attempt": 1, "head_sha": "fa1f35e9c15d7728c5219869e97d2af9aea1debd",
"failures": [{"job": "dynamo-runtime / image / Build multi-arch cuda13.0", "job_id": 112104717833, "failed_step": "Build and Push Test Image", "signature": "job timeout (1h0m0s) during image build", "tests": [], "log_cmd": "gh api repos/ai-dynamo/dynamo/actions/jobs/112104717833/logs"},
{"job": "frontend / Build multi-arch cpu", "job_id": 112104715473, "failed_step": "Build and Push Image", "signature": "job timeout (1h30m0s) during image build", "tests": [], "log_cmd": "gh api repos/ai-dynamo/dynamo/actions/jobs/112104715473/logs"}]}Posted automatically by Devin for run 37412746204. Updated on every full-CI run of this PR.
|
/ok to test feac185 |
|
@yankay can you take a pass to the opening conversation and address / mark them resolved? |
|
@yankay This PR worked fine with default --dyn-chat-processor. We tested it with --dyn-chat-processor set to vllm, it did not work well: non-streaming /v1/chat/completions with --dyn-chat-processor --dyn-chat-processor sglang This needs follow-up changes. |
Signed-off-by: Ryan McCormick <rmccormick@nvidia.com>
|
/ok to test 80cdb61 |
|
/ok to test 80cdb61 |
|
/ok to test fa1f35e |
|
/ok to test fa1f35e |

Overview
Return requested prompt logprobs at the root of non-streaming OpenAI chat completion responses.
Summary
Dynamo computed
prompt_logprobsbut only exposed them throughnvext. Preserve them through unary aggregation and return them at the response root while keeping existingnvextbehavior.Details
prompt_logprobs: 0.PromptLogprobspayloads withArcacross parser template and fan-out paths to avoid deep clones.Where should the reviewer start?
lib/llm/src/protocols/openai/chat_completions/delta.rsValidation
prompt_logprobs: 0.cargo check -p dynamo-llm --lib --no-default-featurescargo clippy -p dynamo-llm --tests --no-default-features -- -D warningscargo fmt --all -- --checkgit diff --checkQwen/Qwen3-0.6B, using anon-streaming request with
max_tokens: 1,temperature: 0, andprompt_logprobs: 2:fc956aad0b): HTTP 200, but response-rootprompt_logprobswas absent. It was only available through
nvext.extra_fields: ["prompt_logprobs"].43adb22444): response-rootprompt_logprobscontained 13entries, matching
usage.prompt_tokens; the first entry wasnull,and no
nvextrequest extension was needed.Patched response excerpt (first two prompt-logprob entries shown):
{ "model": "Qwen/Qwen3-0.6B", "usage": { "prompt_tokens": 13, "completion_tokens": 1, "total_tokens": 14 }, "prompt_logprobs": [ null, { "14582": { "logprob": -5.97626, "rank": 1 }, "38297": { "logprob": -6.47626, "rank": 2 } } ] }prompt_logprobsat the response root for the samerequest.
Related Issues