#13941·dynamo

[BUG]: Chat prompt_logprobs only returned on nvext, not on the OpenAI choice

Author: houshengboCreated Aug 27, 2026Updated Sep 30, 2026
Labelsbuglanguage::rustbackend::vllmfrontend

Describe the Bug

Top-level prompt_logprobs on /v1/chat/completions is accepted (CommonExt) and forwarded to the vLLM worker. The worker computes the payload and stashes it on engine_data.prompt_logprobs. The Rust postprocessor only copies it onto nvext.prompt_logprobs, and only when the client also sends nvext.extra_fields: ["prompt_logprobs"].

Native vLLM returns the same data at the response root (prompt_logprobs) from the top-level request field alone. A vLLM-compatible client that only sets "prompt_logprobs": N gets HTTP 200 with no prompt logprobs in the OpenAI-shaped body.

choices[0].logprobs is generation-token logprobs (content / refusal) and is a different field.

Steps to Reproduce

  1. Serve a chat model with Dynamo's vLLM backend and the Rust OpenAI frontend (python -m dynamo.frontend / --dyn-chat-processor dynamo).

  2. POST /v1/chat/completions with top-level prompt_logprobs and no nvext:

bash
curl -sS http://localhost:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "<served-model>",
    "messages": [{"role": "user", "content": "1 + 1 = ?"}],
    "max_tokens": 1,
    "temperature": 0,
    "prompt_logprobs": 2
  }'
  1. Inspect the JSON:
bash
python3 -c 'import json,sys; d=json.load(sys.stdin); c=d["choices"][0]; print({
  "top_level_prompt_logprobs": d.get("prompt_logprobs"),
  "choice_prompt_logprobs": c.get("prompt_logprobs"),
  "choice_logprobs": c.get("logprobs"),
  "nvext_prompt_logprobs": (d.get("nvext") or {}).get("prompt_logprobs"),
})'
  1. Repeat the same request with the nvext opt-in:
json
{
  "model": "<served-model>",
  "messages": [{"role": "user", "content": "1 + 1 = ?"}],
  "max_tokens": 1,
  "temperature": 0,
  "prompt_logprobs": 2,
  "nvext": { "extra_fields": ["prompt_logprobs"] }
}
  1. Send the step-2 payload to native vLLM /v1/chat/completions and compare the response-root prompt_logprobs field.

Expected Behavior

When the request includes top-level prompt_logprobs, the computed array should appear on the OpenAI response root without requiring nvext.extra_fields. That matches native vLLM.

Native vLLM shape: prompt_logprobs is an array next to choices (first prompt position is often null because there is no preceding-token probability). Length matches usage.prompt_tokens. Entries are token-id maps with logprob (native also includes rank and decoded_token).

nvext.prompt_logprobs can remain as an optional extra when extra_fields asks for it; it should not be the only way to read the data.

Actual Behavior

Step 2: HTTP 200, response-root prompt_logprobs is absent, choices[0].prompt_logprobs is absent, nvext is absent. Looks like a no-op.

Step 4: nvext.prompt_logprobs is populated. That shows the engine already computed the values; the frontend is gating them behind nvext.

Environment

  • Dynamo frontend: Rust /v1/chat/completions
  • Backend: dynamo-vLLM (worker serializes RequestOutput.prompt_logprobs onto engine_data)
  • Native vLLM chat completions on the same payload returns top-level prompt_logprobs (confirmed on Qwen/Qwen3-30B-A3B-Instruct-2507)

Additional Context

Gating is NvExtResponseFieldSelection::from_nvext, which only sets prompt_logprobs: true when "prompt_logprobs" is in nvext.extra_fields. chat_completions/delta.rs then passes the engine payload into build_response_nvext.

The /v1/generate path already returns prompt_logprobs when requested on that API. Chat completions should emit the equivalent on the OpenAI response root.

A fix can stay in lib/llm:

  1. When CommonExt.prompt_logprobs is Some, emit the payload even if nvext.extra_fields is omitted.
  2. Copy it onto the OpenAI response root as prompt_logprobs (native vLLM). dynamo-protocols CreateChatCompletionResponse currently has no such field, so this may need a field on NvCreateChatCompletionResponse (or a protocols bump).
  3. Keep nvext.prompt_logprobs working for existing RL clients that opt in via extra_fields.

Related: #13842 (another OpenAI chat field the Rust frontend drops). Not a duplicate of #8548 (SGLang generation logprobs.content).