Repository navigation
[Rust Frontend] Support logprob_token_ids on OpenAI endpoints - #59549
Merged
BugenZhao merged 2 commits intoOct 12, 2026
Merged
Conversation
Member
|
[AUTOMATED] @codex review |
6 tasks done
Expose selected-token logprobs on both Rust OpenAI endpoints using the existing sampling and response paths, with request validation and streaming/non-streaming regression coverage. Related to vllm-project#44280. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Wang Zupeng <zupenwang@gmail.com>
The engine row is the sampled token followed by the top-k or requested tokens, so the sampled token can repeat in chat `top_logprobs`. Keep each token's first entry before applying the `top_logprobs` cut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Bugen Zhao <i@bugenzhao.com>
BugenZhao
approved these changes
Oct 12, 2026
BugenZhao
left a comment
Member
There was a problem hiding this comment.
Thanks @zupengwang for filling this gap. I'll rebase the PR for you
BugenZhao
force-pushed
the
rust-openai-selected-logprobs
branch
from
October 12, 2026 09:55
49984c4 to
82985c9
Compare
Member
|
/ci run |
|
✅ Triggered Buildkite CI #94173 for commit |
michael-gpu
pushed a commit
to practical-inference/vllm-ampere-extended
that referenced
this pull request
Oct 20, 2026
…roject#59549) Signed-off-by: Wang Zupeng <zupenwang@gmail.com> Signed-off-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: OpenAI Codex <noreply@openai.com> Co-authored-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Overview
Add
logprob_token_idssupport to the Rust/v1/chat/completionsand/v1/completionsendpoints. Related to the selected-token item in #44280; scope claim.Claims
Validation
Nonecargo test -p vllm-server -p vllm-text --locked(Rust 1.95)cargo nextest run --workspace --all-features --locked --no-fail-fast(Rust 1.95, Python 3.12)The Python/changed-Rust evaluation made 62 requests covering both endpoints, streaming/non-streaming, empty selections, sampled-token selections, invalid IDs/counts, missing logprobs, beam search, and prompt-only echo. Invalid requests returned 400, and each server remained healthy. One baseline run reproduced the omission and checked unchanged ordinary behavior. This is functional validation, not a throughput or accuracy benchmark.
The full Buildkite Rust style-clippy entrypoint passes, including fmt, Cargo ordering, dependency bans and workspace/all-targets/all-features Clippy with warnings denied. The frontend build and six applicable pre-commit hooks also pass.
The test bootstrap encountered external download failures. After installing nextest from locked source and preparing the CI Python environment, the identical full-workspace nextest command passed in one run. Initial missing tokenizer caches and first-run dependency timeouts were resolved without changing tests or adding skips. This reports local execution of the CI checks, not hosted CI status.
Reproduction commands:
cargo test --manifest-path rust/Cargo.toml -p vllm-server -p vllm-text --locked bash .buildkite/scripts/run-rust-frontend-cargo-ci.sh style-clippy cargo nextest run --manifest-path rust/Cargo.toml --workspace --all-features --locked --no-fail-fastExample chat request used in validation:
{"model":"selected-logprobs-eval","messages":[{"role":"user","content":"The capital of France is"}],"temperature":0,"max_tokens":4,"logprobs":true,"top_logprobs":1,"logprob_token_ids":[0,1,2]}Details
The shared sampling types already support selected-token logprobs, but the two OpenAI request types omit the field and conversion hard-codes it to
None. The change clears natural top-k sampling for a non-empty selection and uses the existing all-candidates response option for chat. No sampler, engine protocol, GPU code or dependency changes are included.Non-duplication: merged #56406 fixes gRPC conversion; #46427 adds
/generative_scoring, #45569 addresses broader validation, and #57394/#49320 concern Python empty-list validation. None exposes selected IDs on these two Rust OpenAI routes. #59518 and #58711 also touch shared Rust chat candidate deduplication. This PR now dedupes chattop_logprobsby token ID before thetop_logprobscut, so a sampled token that is also selected (or the top-1 token) appears once, matching Python.Evaluation used the exact Rust patch and Python source at
cff08b461e08with the same model snapshot, while reusing torch 2.13.0+cu132 and precompiled native extensions from the existing runtime. It was not a complete native rebuild. Rust 1.98 locally raises a newer lint in unchanged multimodal tensor code; pinned Rust 1.95 Clippy passes.AI assistance was used for investigation, implementation and validation. The human submitter reviewed the patch and authorized this submission.
Pull Request Checklist
/pr-checklistskill. (Mandatory for agents, optional for humans).