Skip to content

[Feature]: Whisper serving parity in trtllm-serve — /v1/audio/transcriptions, long-form audio, verbose_json segments, decoder biasing #19994

Open

Description

@ravo42-maker

🚀 The feature, motivation and pitch

openai/whisper-large-v3 runs on the PyTorch backend once the pending KV-cache fixes land (#19302 for #18609 / #19515, #19516 for #19514), and the engine itself is fast: on an RTX 5070 Ti, fp16, 0.34 s per 30 s clip warm (~87x realtime; ~14x for faster-whisper large-v3 float32 on the same clip). But it is still not usable as a drop-in STT service, because the serving layer is missing. Our use case is clinical dictation (10–20 minute recordings), currently served by faster-whisper and vLLM; every gap below is something those two already provide. Ordered by how blocking it is:

  1. /v1/audio/transcriptions (and /v1/audio/translations) in trtllm-serve. Today audio reaches the model only through /v1/chat/completions with input_audio or the Python LLM API. Every OpenAI-compatible STT client uses the audio route: multipart file, model, language, prompt, temperature, response_format, timestamp_granularities. Nothing under tensorrt_llm/serve/ implements it on current main.

  2. Long-form audio. WhisperInputProcessor accepts exactly one clip of at most max_source_positions (1500 frames = 30 s) and rejects longer input with "chunk the audio" (modeling_whisper.py, the max_audio_seconds check). A 16-minute file needs windowing on the server, ideally seek-based — the next window starts at the last complete segment's end timestamp, as openai/whisper and faster-whisper do. Fixed pre-cut 30 s chunks lose words at mid-sentence cuts ([Bug]: Whisper verbose_json silently drops the words after the last complete segment at every chunk cut (long audio); json/text keep them vllm-project/vllm#58029 documents that failure mode), so this depends on item 3.

  3. verbose_json output: per-segment start/end, text, avg_logprob, compression_ratio (and no_speech_prob where available). The input processor currently forces <|notimestamps|> in the decoder prompt, so timestamps are never produced. Per-segment compression_ratio is what production pipelines use to detect Whisper's repetition loops; without it the service cannot be monitored.

  4. Decoder biasing: prompt (previous-text conditioning across windows) and a hotwords-style bias for proper nouns. faster-whisper exposes both; vLLM accepts hotwords.

  5. Whisper-specific input validation. A user-supplied max_seq_len below max_source_positions should be rejected: with max_batch_size=2 it fails at the micro-batch scheduler, but with max_batch_size=8 it passes and silently drops phrases from the transcript (details in [Bug]: cross Kv sizing with whisper #19514).

Items 1 and 3 are the ones that would let a maintainer or contributor close the gap to vLLM's /v1/audio/transcriptions; 2 builds on 3; 4 and 5 are independent.

Alternatives

A thin service in front of the LLM API that does windowing, emits segment timestamps and emulates the OpenAI response shape. That duplicates what vLLM already ships and every TensorRT-LLM Whisper user would have to write it.

Additional context

Hardware verification runs, the rc25 + patch wheel and the repro kit are described in #18609, #19450, #19514, #19515, #19516 and in the #19302 thread. Happy to test any of the above on sm_120 and on real multi-minute dictations.

Activity

  1. added
    LLM API
    OpenAI API
    on Oct 8, 2026
  2. codebreaker77 commented on Oct 17, 2026

    @codebreaker77

    I'd like to contribute an initial slice of this request: /v1/audio/transcriptions for clips within Whisper's existing input window, with multipart uploads, optional language/temperature and JSON/text output.

    The implementation and tests are available here:
    https://github.com/codebreaker77/TensorRT-LLM/tree/feat/19994-whisper-transcriptions

    Long-form windowing, translations, timestamps/verbose_json, prompt conditioning and hotwords would remain separate work; unsupported fields are rejected explicitly. This partially addresses #19994 and would not close it.

    31 direct CPU tests and seven supplementary isolated serving-method checks pass. I have not validated actual Whisper inference or a full server run in a supported GPU environment.

    Would this initial scope be acceptable to the maintainers, and is anyone already implementing the route? @ravo42-maker, you offered hardware testing in the issue; would you be able to run a short-clip JSON/text smoke test once the scope is agreed?

  3. ravo42-maker commented on Oct 19, 2026

    @ravo42-maker
    Author

    @codebreaker77 — thanks for picking this up. Yes, that scope is a sensible first slice, and I ran it on sm_120 (RTX 5070 Ti, Blackwell consumer, 16 GB), which NVIDIA's CI does not cover.

    What I ran against d50e1d20

    1. Your two unit-test files on the release:1.3.0rc25 image with the tensorrt_llm/serve/ hunks overlaid: 38 passed, 0 failed. (Overlay note only: rc25's openai_server.py does not import HTTPException from fastapi, main does; without that import the three error-envelope tests raise NameError. Not a branch problem.)
    2. trtllm-serve openai/whisper-large-v3 --backend pytorch --config whisper.yaml with your documented YAML, except max_batch_size: 2 and free_gpu_memory_fraction: 0.30 (the known-good 16 GB settings from [Bug]: cross Kv sizing with whisper #19514 / [https://nvbugs/6713231][fix] Guard Whisper cross-KV reuse without encoder tokens #19302). On rc25 enable_block_reuse: false has to stay explicit since [https://nvbugs/6713231][fix] Guard Whisper cross-KV reuse without encoder tokens #19302 is not in that release. Server ready in 60 s; cross-KV pool sized at 1500 as expected.
    3. POST /v1/audio/transcriptions, multipart, with a 30 s and a 16 s 16 kHz espeak clip (synthetic, no real speech):
    request result
    response_format=json, language=en, temperature=0, cold 200, 5.9 s, correct transcript
    same, warm, and a repeat of the same clip 200, 0.35 s each, identical text
    response_format=text 200, plain text
    language omitted 200, same text
    temperature=0.2 200, 0.60 s, text differs slightly from greedy (expected for sampling)
    16 s clip 200, 0.25 s
    two clips concurrently (max_batch_size=2) both 200, 0.43 s wall
    45 s clip 400 "Audio duration exceeds the model's 30s window"
    timestamp_granularities[]=word, hotwords= 400 extra_forbidden
    response_format=verbose_json 400 literal_error
    stream=true 400 "not supported yet"
    YAML file as file= 400 "Cannot decode audio"
    model=nope 404 "Model 'nope' is not served."

    So the route, the 30 s guard and the explicit rejections all behave as documented on sm_120, and the repeat request is fine (#19515 territory). Warm throughput is about 87x realtime for a single 30 s clip.

    Same test on current main (your branch itself, d50e1d20, built from source for sm_120, served from that wheel with no overlay): identical results on every row above, byte-identical greedy transcripts, cold 3.5 s / warm 0.37 s / two concurrent 0.44 s. With enable_block_reuse: true the server logs "Disabling KV cache block reuse for encoder-decoder models with KV cache manager V2" and repeat requests are fine, so on main the YAML no longer needs the explicit reuse-off that rc25 required (#19302 / #19515). One build note for anyone reproducing on a 16 GB card: python3 scripts/build_wheel.py --cuda_architectures 120-real --fast_build in devel:1.4.0rc0 (torch 2.14 nv26.08) fails at the libtensorrt_llm.so link with undefined reference to c10::cuda::getCurrentCUDAStream from tinygemm2; adding c10_cuda to pg_utils in cpp/tensorrt_llm/runtime/utils/CMakeLists.txt fixes it. That is unrelated to this branch (same tree as main), I'll raise it separately if it reproduces on the 26.09 image.

    Happy to re-run on any commit you pin; the client script and config are reproducible and I can post them if useful. For the follow-on items (long-form windowing and verbose_json with per-segment compression_ratio) I'd test those as well; they are what gates replacing a faster-whisper / vLLM deployment in practice.

  4. codebreaker77 commented on Oct 19, 2026

    @codebreaker77

    @ravo42-maker, thanks for the detailed SM120 testing on both the release overlay and the source build. I've opened draft PR #20616: #20616

    It retains the exact commit you tested (d50e1d20) and links your results, including the build-workaround caveat. The scope remains short-clip JSON/text transcription; long-form audio, timestamps/verbose_json and decoder biasing remain separate work. NVIDIA maintainer scope approval and project CI are still pending.

    Your reproducible client script and config would be useful to attach here or to the PR when convenient. No rerun is needed for the unchanged commit at this stage. Thanks again for validating it on hardware.

  5. ravo42-maker commented on Oct 19, 2026

    @ravo42-maker
    Author

    Thanks. I've attached the config, clip recipe, serve commands for both the source build and the rc25 overlay, and the curl smoke script to #20616 so the sm_120 results are reproducible from there. Nothing further from my side until the branch changes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    LLM APIOpenAI API

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions