Skip to content

[Bugfix][Rust Frontend] Preserve selected-token logprob mode - #56406

Merged
BugenZhao merged 2 commits into
vllm-project:mainfrom
alec-flowers:codex/grpc-selected-logprobs
Sep 14, 2026
Merged

BugenZhao merged 2 commits into
vllm-project:mainfrom
alec-flowers:codex/grpc-selected-logprobs

Conversation

@alec-flowers

@alec-flowers alec-flowers commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Clients can request log probabilities for specific token IDs at each generated position. The Rust gRPC converter always paired those IDs with logprobs=1, so requests selecting more than one token failed validation.

For example, requesting scores for two valid token IDs [100, 101] produced:

Before After
Selected IDs [100, 101] [100, 101]
Numeric logprobs count 1 Unset (None)
Result Rejected: count 1 does not match two IDs Accepted: the engine derives the count from the IDs

The new behavior matches Python HTTP's selected-token mode. An unset numeric count does not disable scoring when selected IDs are present. It also avoids applying the ordinary top-N limit to selected IDs: for example, 21 selected IDs are valid with max_logprobs=20, subject to the separate selected-ID limit and vocabulary checks.

Empty and absent selectors now use top_n(0), returning only the sampled token’s logprob. Numeric top-N requests keep their existing behavior. This aligns request conversion with Python; existing response-rank and batch-padding issues are separate.

Validation

From rust/:

  • cargo test --locked -p vllm-server --lib grpc::convert::tests — 14 passed; regression fails without the fix.
  • cargo test --locked -p vllm-text --lib logprob — 7 passed.
  • cargo fmt --all -- --check and git diff --check — passed.
  • Live Qwen3-0.6B checks with paired vLLM 0.29 Python HTTP and a matching Rust backport: all eight gRPC cases pass; 21 selected IDs work with max_logprobs=20, and all 42 compared scores match Python within 0.000001 absolute difference.

This fixes Rust gRPC request conversion; related #49320 addresses Python HTTP empty-list validation. AI assistance was used for implementation and independent review.

@mergify mergify Bot added rust bug Something isn't working labels Sep 11, 2026
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Alec Flowers <aflowers@nvidia.com>
@alec-flowers
alec-flowers force-pushed the codex/grpc-selected-logprobs branch from d4a0318 to db83f67 Compare September 11, 2026 18:24
@alec-flowers alec-flowers changed the title [Bugfix][Rust Frontend] Preserve selected logprob token counts [Bugfix][Rust Frontend] Preserve selected-token logprob mode Sep 11, 2026
@alec-flowers
alec-flowers marked this pull request as ready for review September 11, 2026 21:03

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@njhill njhill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alec-flowers

Comment thread rust/src/server/src/grpc/convert.rs Outdated
@BugenZhao

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T02:01:07.843185Z db83f67 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: db83f67ee4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Use top_n(0) for omitted and empty candidate selectors so logprob requests do not implicitly include the highest-scoring candidate. Clarify the comment and update the existing request-lowering regression.

Validation: 48 gRPC tests passed; updated regression fails before the fix. cargo fmt --all -- --check and git diff --check passed.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Alec Flowers <aflowers@nvidia.com>
@BugenZhao BugenZhao added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 14, 2026
@BugenZhao

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

@alec-flowers, CI is now available for this PR.

  • /ci run starts upstream CI; /amd-ci run starts AMD CI only.
  • /ci retry retries failed jobs in the CI build for the current PR head. If the current head has no CI build, it starts a new CI build for the current head containing only jobs that failed in the latest earlier CI build for this PR.
  • /amd-ci retry retries failed jobs in AMD CI for the current PR head. Use /amd-ci run when the current head has no AMD CI build.
  • /ci cancel cancels scheduled or running CI builds for this PR branch; /amd-ci cancel does the same for AMD CI only.

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88744 for commit a35ac722c4ab.

@BugenZhao BugenZhao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

@BugenZhao
BugenZhao enabled auto-merge (squash) September 14, 2026 06:13
@BugenZhao
BugenZhao merged commit e6b4e47 into vllm-project:main Sep 14, 2026
36 of 37 checks passed
Shreya-gaur pushed a commit to Shreya-gaur/vllm_private that referenced this pull request Sep 14, 2026
…oject#56406)

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Alec Flowers <aflowers@nvidia.com>
ItsRoy69 pushed a commit to ItsRoy69/vllm that referenced this pull request Sep 15, 2026
…oject#56406)

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Alec Flowers <aflowers@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants