[Feature]: Whisper serving parity in trtllm-serve — /v1/audio/transcriptions, long-form audio, verbose_json segments, decoder biasing
🚀 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:
-
/v1/audio/transcriptions(and/v1/audio/translations) intrtllm-serve. Today audio reaches the model only through/v1/chat/completionswithinput_audioor the PythonLLMAPI. Every OpenAI-compatible STT client uses the audio route: multipartfile,model,language,prompt,temperature,response_format,timestamp_granularities. Nothing undertensorrt_llm/serve/implements it on currentmain. -
Long-form audio.
WhisperInputProcessoraccepts exactly one clip of at mostmax_source_positions(1500 frames = 30 s) and rejects longer input with "chunk the audio" (modeling_whisper.py, themax_audio_secondscheck). 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 (vllm-project/vllm#58029 documents that failure mode), so this depends on item 3. -
verbose_jsonoutput: per-segmentstart/end,text,avg_logprob,compression_ratio(andno_speech_probwhere available). The input processor currently forces<|notimestamps|>in the decoder prompt, so timestamps are never produced. Per-segmentcompression_ratiois what production pipelines use to detect Whisper's repetition loops; without it the service cannot be monitored. -
Decoder biasing:
prompt(previous-text conditioning across windows) and ahotwords-style bias for proper nouns. faster-whisper exposes both; vLLM acceptshotwords. -
Whisper-specific input validation. A user-supplied
max_seq_lenbelowmax_source_positionsshould be rejected: withmax_batch_size=2it fails at the micro-batch scheduler, but withmax_batch_size=8it passes and silently drops phrases from the transcript (details in #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.
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?
@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
- Your two unit-test files on the
release:1.3.0rc25image with thetensorrt_llm/serve/hunks overlaid: 38 passed, 0 failed. (Overlay note only: rc25'sopenai_server.pydoes not importHTTPExceptionfrom fastapi, main does; without that import the three error-envelope tests raiseNameError. Not a branch problem.) trtllm-serve openai/whisper-large-v3 --backend pytorch --config whisper.yamlwith your documented YAML, exceptmax_batch_size: 2andfree_gpu_memory_fraction: 0.30(the known-good 16 GB settings from #19514 / #19302). On rc25enable_block_reuse: falsehas to stay explicit since #19302 is not in that release. Server ready in 60 s; cross-KV pool sized at 1500 as expected.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.
@ravo42-maker, thanks for the detailed SM120 testing on both the release overlay and the source build. I've opened draft PR #20616: https://github.com/NVIDIA/TensorRT-LLM/pull/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.
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.