Skip to content

[Bugfix][Frontend] Apply the model's transcription post-processing on the realtime path - #55786

Open
twu3202 wants to merge 1 commit into
vllm-project:mainfrom
twu3202:realtime-post-process
Open

[Bugfix][Frontend] Apply the model's transcription post-processing on the realtime path#55786
twu3202 wants to merge 1 commit into
vllm-project:mainfrom
twu3202:realtime-post-process

Conversation

@twu3202

@twu3202 twu3202 commented Sep 8, 2026

Copy link
Copy Markdown

Purpose

The REST transcription endpoints run model output through post_process_output() /
get_streaming_post_processor_cls(), so models with a structured output format return clean text. The /v1/realtime
WebSocket path forwards output.outputs[0].text verbatim. For Qwen3-ASR every 5 s segment is a separate generation
that starts with a language Chinese<asr_text> header, so realtime clients receive

language Chinese<asr_text>今天天气很好language Chinese<asr_text>我们去公园

instead of the transcript (the "raw format leaks" part of #35767).

Changes:

  • SupportsRealtime gains post_process_output() and get_streaming_post_processor_cls() with identity defaults,
    mirroring SupportsTranscription; Qwen3-ASR and Voxtral keep their existing transcription overrides through the MRO
    (Voxtral has none, so its output is unchanged).
  • RealtimeConnection._run_generation feeds each delta through a streaming post-processor and starts a fresh one at
    every segment boundary (finish_reason on the completion output). Empty deltas produced while the header is buffered
    are not sent. Token ids fed back to the engine and the usage counters still use the raw tokens.

Related PRs: #49658 also applies the streaming post-processor in connection.py, but with a single instance for the
whole connection; Qwen3ASRStreamingPostProcessor diffs against its accumulated text, so from the second segment on the
language Chinese prefix is emitted again. #51037 strips the header with a private rsplit("<asr_text>") helper as
part of a larger KV-reuse change. This PR is the minimal fix through the existing model hooks and is independent of both.

Test Plan

  • New unit test (no GPU) tests/entrypoints/speech_to_text/realtime/test_realtime_post_process.py: pass-through model
    (deltas, token feedback and usage unchanged) and a model using Qwen3ASRStreamingPostProcessor across two segments
    (header stripped from every delta and from done.text, no empty deltas, unstructured output kept).
  • End to end: vllm serve Qwen/Qwen3-ASR-1.7B --hf-overrides '{"architectures":["Qwen3ASRRealtimeGeneration"]}',
    FLEURS cmn_hans_cn clips streamed at 100 ms cadence over /v1/realtime, before/after this patch.

Test Result

Developed with AI assistance (Claude); I reviewed every changed line and ran the tests above.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

… the realtime path

The /v1/realtime WebSocket path forwarded raw model text, so Qwen3-ASR
clients received the 'language Chinese<asr_text>' header of every 5 s
segment. Route realtime deltas through the model's streaming
post-processor (fresh instance per segment, boundary = finish_reason on
the completion output) and expose the two post-processing hooks on
SupportsRealtime with identity defaults.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Tianyao Wu <rayroy31@gmail.com>

@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.

@mergify mergify Bot added frontend bug Something isn't working labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment /ci run for upstream CI or /amd-ci run for AMD CI only whenever CI signals are needed.

Once the PR is approved or has the ready label, the PR author can also use the corresponding /ci run, /ci retry, and /ci cancel commands, or their /amd-ci variants. New commits do not start upstream CI automatically.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant