Design decisions¶
Each entry records what was decided, why, and what it costs. For how the client works, see Benchmark client.
1. Python client, managed with uv¶
Decision: The client is Python 3.12 (Ubuntu 24.04's system Python) with
pyproject.toml and uv.lock.
Why: It sits close to the vLLM and OpenAI client tooling, the analysis step will probably use pandas, and the Qwen3-ASR README already uses uv.
Cost: The bench host needs uv and a venv, unlike a single static binary.
2. Streaming means client-side chunking over HTTP¶
Decision: The client splits the audio and sends each chunk as a separate
streamed POST /v1/audio/transcriptions request to a stock vllm serve.
Why: Qwen3-ASR's native streaming (init_streaming_state /
streaming_transcribe) runs only in-process through
Qwen3ASRModel.LLM(...). vLLM's server has no websocket or realtime route for
it. Chunking over HTTP keeps the servers stock, works the same on all three
platforms (the trn2 fork is benchmarked through this endpoint) and keeps
/metrics and the journal available.
Cost: The latency profile isn't Qwen's own streaming algorithm (fixed
and unfixed chunks, token rollback). Two strategies get close from different
directions: independent chunks (cheap, no revision) and a growing window
(revises the transcript, costs more per request).
3. Targets run sequentially¶
Decision: One target at a time by default, in file order. Each target
runs the full sweep before the next starts. --parallel-targets runs every
target at once from the same client, for when wall-clock time matters more
than isolation.
Why: It keeps bench-host CPU and network contention out of the comparison.
Cost: Wall-clock time is the sum over targets. Runs at different times can
also see different conditions (for example noisy neighbors), so use
--repeats. On-host runs (16)
give each host one target, so the hosts run in parallel. With
--parallel-targets, the targets share the bench host's CPU, event loop and
network: client_cpu_seconds, host_cpu_busy_fraction and the loop lag
cover every target running at the time, and each target's network baseline
overlaps the others' traffic. run_start.options.parallel_targets records
the choice.
4. Real-time and as-fast-as-possible pacing, single stream¶
Decision: Pacing is realtime (send when a live stream would have the
audio) or afap. Each stream sends its requests one after another.
--concurrency runs N such streams at once, each replaying the input from a
different point, and is swept like the other options.
Why: It matches the requested load shapes. realtime measures what a
live caption consumer sees, and afap measures raw per-stream speed.
Concurrent streams fill the batch slots that one stream leaves idle, such as
trn2's four DP replicas.
Cost: Each stream stays closed-loop, so offered load never exceeds what the server absorbs, and the levels are fixed, not a ramp to a capacity figure. See Limitations 5.
5. One JSONL file per run, everything in it¶
Decision: Client events, every SSE line, /metrics snapshots, journal
lines and telemetry all go to one events.jsonl. A shared envelope adds
ts, mono_ns, seq and context.
Why: One file is one timeline: no merging and no clock-joining across
files. seq makes ordering exact, and mono_ns makes durations immune to
wall-clock adjustments. Fields are left raw (headers, full SSE payloads,
full ffprobe output, journald's native JSON) so the analysis step decides
what matters.
Cost: Files are large (a metrics_snapshot every second per target), and
consumers must filter by event.
6. /metrics scraped by the client¶
Decision: The client polls each target's Prometheus /metrics every
--metrics-interval seconds and logs parsed samples.
Why: It needs no Prometheus server, and the samples land in the same timeline as the requests.
Cost: Resolution is limited to the interval, and the scrape itself puts a small load on the server.
7. A live log sidecar on each inference host¶
Decision: A standard-library HTTP sidecar on port 8001 streams
journalctl -o json for vllm.service, plus allow-listed telemetry commands
(nvidia-smi, neuron-monitor), as NDJSON. The client follows it live.
Why: Server-side output arrives during the run, interleaved with client
events. The alternatives were SSM SendCommand after the run (needs extra
IAM, nothing live) and pushing to S3 (delay plus a merge step). Journal
streams resume by __CURSOR, so reconnects lose nothing.
Cost: It is another service to install. The port is unauthenticated and relies on the security group (bench subnet only), and commands are fixed in config so the client can't run arbitrary ones. Journal timestamps come from the inference host's clock.
8. Inputs and extracted audio on the instance store¶
Decision: Each input is copied or downloaded to the NVMe instance
store of the host the client runs on, and its first audio stream
(-map 0:a:0) is decoded once to headerless 16 kHz mono s16le PCM on the
same disk. A clip's PCM is read into memory on its turn, and chunks are
sliced there and encoded in the stream's upload format, WAV by default
(13).
Why: It's what was asked for, and it keeps EBS and S3 latency out of the measurement. Decoding once means ffmpeg cost isn't counted per chunk. Raw PCM makes slicing exact to the sample, and chunk boundaries are planned in whole samples to avoid float drift.
Cost: Instance-store data is lost on stop/start, so results are uploaded to S3 at the end of each run.
9. vLLM in containers under systemd¶
Decision: NVIDIA hosts run the upstream vllm/vllm-openai image
(v0.33.0). trn2 runs an image built on the host from AWS's Neuron SDK 2.33
vLLM image with the jimburtoft fork cloned in. A shared vllm.service runs a
per-platform start-vllm.sh, which runs the container in the foreground with
host networking. Settings, including the image tag, come from
/etc/snap-asr-bench/vllm.env.
Why: A pinned image is reproducible and avoids resolving CUDA wheels on
the host (a venv install on 2026-11-02 mixed CUDA 13.0 torch with CUDA 12.9
torchaudio). Running docker run in the foreground under systemd keeps the
server's output in the vllm.service journal, so the sidecar works
unchanged. The start script logs the image ID and digest, and the trn2
entrypoint logs the fork commits, so both reach each run's JSONL.
Cost: Images are large (about 10 GB for vLLM and 8 GB for trn2). The
NVIDIA image comes from Docker Hub. The trn2 image is built with pinned fork
commits and pushed to a private ECR repository in the trn2 host's region,
created outside Terraform (see Container images). The instance role's ecr-trn2-image policy allows pull
and push on that repository only, so the trn host can rebuild the image.
10. trn2 uses the jimburtoft/vllm-neuron fork¶
Decision: Use qwen3-asr/0.29-champion and nki-library
qwen3-asr/2.33-champion, starting from the fork's documented throughput
configuration.
Why: The stock release can't compile TP1 at batch sizes of 2 or more and can't run LNC=1. The fork reports WER parity (about 6% on Earnings22) and much higher RTFx.
Cost: It is pinned to Neuron SDK 2.33 and vLLM 0.29. 0.6B is undocumented.
11. Verbose by default, but vLLM at INFO¶
Decision: VLLM_LOGGING_LEVEL=INFO, ffmpeg at -loglevel verbose, and
LogRateLimitIntervalSec=0 on the vLLM unit. The NVIDIA hosts do not use
--enable-log-requests / --enable-log-outputs.
Why: The brief is to log everything possible, and vLLM first ran at
DEBUG. On 2026-11-10 trn2 at DEBUG wrote about 427,000 journal lines in
an 80 s run. With the client on the same host
(16), streaming that would
compete with vLLM for CPU, so all three hosts use INFO. Without the
journald rate limit override, bursts would be dropped silently. In vLLM 0.33.0,
request logging breaks every /v1/audio/transcriptions request with a 400
(Unable to serialize unknown type: ... UploadFile), so it is off. The client
already logs each request and response in full.
Cost: Logging adds some overhead on the server, so compare platforms with the same settings. trn2 (vLLM 0.29) still has request logging on and is untested. Remove it there too if it hits the same error, or to keep platforms identical.
12. Security groups use port-specific egress¶
Decision: Terraform defines all four hosts, their VPCs and peering, and
security groups with port-specific egress. Host software is set up by the
install pages and make targets, not Terraform.
| Security group | Egress |
|---|---|
| bench | TCP 443 and TCP 80 to 0.0.0.0/0, all traffic to the peered inference VPCs |
| accelerator | TCP 443 to 0.0.0.0/0 |
Why: In the account this was built in, an organisation-wide
auto-remediation control revoked all-protocol egress to 0.0.0.0/0 on every
security group, default included. The hosts then lose SSM, S3, image pulls
and package downloads. A TCP 443 rule to 0.0.0.0/0 was left alone during a
15-minute test on 2026-11-02. Port 80 is only there for Ubuntu's apt mirrors.
Cost: Anything outside 443 and 80 (and bench-to-peer traffic) is blocked, so the client image's apt uses HTTPS. Host software isn't set up by Terraform: it takes the install targets or steps on each host.
13. Upload format is a sweep dimension, encoded up front¶
Decision: --audio-format sweeps wav, flac, aac, opus and
mp3. Every chunk of a stream is encoded with ffmpeg (WAV in process)
before the stream's first request, in parallel threads, and each encode is
logged.
Why: Smaller uploads could lower latency, but encoding costs time and lossy codecs change the audio. Encoding up front keeps the request schedule identical across formats. Logging encode time lets analysis add it back. vLLM 0.33 decodes all five formats (torchcodec, then soundfile, then PyAV).
Measured on 2026-11-03 (bench to g4dn, same VPC peering, TTS speech):
| Format | 2 s slice | Request time | 25.6 s clip | Request time |
|---|---|---|---|---|
| WAV | 64 KB | 167 ms | 819 KB | 1.17 s |
| FLAC | 44 KB | 165 ms | 490 KB | 1.17 s |
| AAC 64k | 18 KB | 150 ms | 228 KB | 1.18 s |
| Opus 32k | 8 KB | 168 ms | 101 KB | 1.24 s |
| MP3 64k | 17 KB | 164 ms | 206 KB | 1.19 s |
Inside the VPC the upload is a small part of the request. Format matters more for what the model hears: AAC's encoder delay made a 2 s slice decode as 3 s and changed the words at the cut.
Cost: One ffmpeg process per chunk per stream. Encoded chunks are held in memory for the length of a stream.
14. Silence-snapped chunk boundaries¶
Decision: --boundary silence moves each cut back to the quietest
10 ms frame (energy smoothed over 30 ms) in the last
--boundary-search-seconds (default 0.5) of available audio. Requests keep
their fixed cadence. Audio after the cut carries into the next chunk.
Why: Fixed cuts split words. On 2026-11-03 a 2 s slice that ended inside
"subscriptions" came back as "international trade". A causal search
(looking back only) works on a live stream and keeps realtime pacing
meaningful. vLLM uses the same energy idea when it splits long audio. Plain
energy needs no model or new dependency beyond NumPy.
Measured on 2026-11-03 (g4dn, 25.6 s macOS say clip, 2 s chunks,
independent, simple word error rate against the script):
| Format | fixed |
silence |
|---|---|---|
| WAV | 14.0% | 7.0% |
| FLAC | 14.0% | 7.0% |
| AAC 64k | 17.5% | 8.8% |
| Opus 64k | 8.8% | 7.0% |
| MP3 64k | 14.0% | 5.3% |
Silence cuts fixed "international trade. National subscriptions" and "release. Designed onboarding". They added one error: the cut landed in the stop before "-teen" in "fourteen" ("grew four. 18"). Held-back audio averaged about 0.23 s per chunk (0 to 0.5 s). This is one synthetic voice, so treat it as a sanity check, not a result.
Cost: Held-back audio adds latency for the words in it
(held_back_seconds). Continuous speech with no pause in the window still
gets cut, at the quietest point available. Stop consonants (the closure in
"t", "k", "p") are short quiet spots inside words and can win the search.
Background noise can hide gaps that energy alone can't see.
Alternatives considered:
- Qwen's own streaming method (
qwen_asrstreaming_transcribe): re-feed all audio and pre-fill the answer with the previous text minus its last 5 tokens. vLLM's/v1/audio/transcriptionsputspromptin a system turn, not the answer, so this would need/v1/chat/completionswithcontinue_final_message, which is a second request path. - vLLM's realtime WebSocket (
/v1/realtime,Qwen3ASRRealtimeGenerationin vLLM 0.33): it cuts fixed 5 s segments with no context, so it has the same boundary problem. - Overlapping chunks with text stitching: robust to speech without pauses, but resends audio and needs a word-alignment step.
- A neural VAD (Silero, WebRTC): better in noise, but adds a model or a native dependency.
15. Network baseline in every run¶
Decision: Before a target's first stream and after its last, the client
measures TCP connect time, kept-alive HTTP round trips and upload times for
fixed payload sizes. It logs them as network_baseline events. Every chunk
request also logs httpcore's connection phases as request_trace. The
sidecar gained /ping and /sink for this.
Why: Each inference host has its own VPC in a different place, so the network adds very different amounts to each target's latency. A streamed request costs at least one round trip before the first token can arrive. Measuring the baseline in the same run, from the same client, lets analysis subtract it, or compare targets on server time alone. Measuring at the start and the end shows whether the network changed during the run.
Measured on 2026-11-10 from bench (us-east-1c), 20 samples each, p50:
| Target | Location | TCP connect | HTTP round trip | Upload 64 KiB | Upload 1 MiB | Path MTU |
|---|---|---|---|---|---|---|
| g4dn | us-east-1c (same AZ) | 0.22 ms | 0.82 ms | 0.93 ms | 1.67 ms | 9001 |
| g7e | us-east-2b | 12.0 ms | 11.5 ms | 11.7 ms | 12.2 ms | 8500 |
| trn | ap-southeast-4c | 226 ms | 230 ms | 230 ms | 232 ms | 8500 |
On a warm connection even 1 MiB fits in about one round trip. The first large upload on a connection took an extra round trip (459 ms to trn) while TCP slow start opened the window.
The first request_trace showed every chunk opening a new TCP connection,
because the client stopped reading at data: [DONE] and httpx discarded
the half-read connection. That would have added a 230 ms handshake to every
trn chunk. The client now reads each response to the end. The env files set
VLLM_HTTP_TIMEOUT_KEEP_ALIVE=60 (vLLM's default is 5 s), so realtime
streams with chunks of 5 s or more also keep one connection, like a live
client would. On g4dn, each new connection had also cost 14 to 17 ms
before vLLM finished taking the request body. With reuse it takes under
1 ms.
Cost: Each baseline sends about 27 MB per target at the defaults
and takes about 40 s for trn. --network-samples 0 skips it.
16. Benchmarks run on each inference host¶
Decision: For comparisons, the client runs on each inference host against
its own vLLM over 127.0.0.1, started on all three hosts at once by
deploy/client/run-on-hosts.sh. The client runs in a container built from
deploy/client/Dockerfile. S3 inputs are cached on each host's instance
store and downloaded again only when their ETag changes. vLLM logs at
INFO (see 11).
Why: The hosts are in three regions only because capacity blocks weren't available in one place in time. The goal of this proof of concept is to compare the instances, so anything outside them is noise. From bench, trn2 is 230 ms away and g4dn under 1 ms away (15), so network time would be a large part of each trn2 request. On-host, every target sees loopback. Amazon Linux 2023 has no ffmpeg package, so a container gives all three hosts the same Python, ffmpeg and dependencies without installing unofficial binaries. The hosts share nothing, so they run in parallel.
Measured on 2026-11-10 with the 26 s TTS clip, 2 s independent WAV
chunks, realtime pacing, second repeat. All three hosts sent
byte-identical chunks:
| Target | TTFT p50 | Request p50 | Host CPU busy | From bench (same clip) |
|---|---|---|---|---|
| g7e | 22 ms | 43 ms | 0.4% | 70 to 135 ms (12 ms away) |
| trn2 | 51 ms | 99 ms | 2% | 280 to 720 ms (230 ms away) |
| g4dn | 77 ms | 169 ms | 2.7% | about 195 ms (under 1 ms away) |
The first repeat on trn2 was slower (RTFx 0.49) while its four DP ranks warmed up.
Cost: The client and sidecar streams share the host's CPU with vLLM,
which bench runs avoid. stream_end logs client_cpu_seconds and
host_cpu_busy_fraction so contention can be checked, and chunks are
encoded before each stream starts. Running in parallel means the three
hosts see the same time window rather than one after another
(3 still applies to bench runs). Bench runs
remain available for end-to-end latency, network included.
17. Prefix caching off on every server¶
Decision: Every vLLM server runs with --no-enable-prefix-caching.
Why: The benchmark sends the same or overlapping requests again and again:
--repeatssends byte-identical chunks.growingre-sends everything heard so far.- Every request shares the same prompt template.
With prefix caching on, vLLM reuses the KV cache blocks of a matching prefix and skips that part of the prefill. Later requests would then be faster than they would be on a live stream, by an amount that depends on the sweep order, so repeats would stop being independent samples. A live caption stream never sends the same audio twice.
vLLM 0.33 turns prefix caching on by default. The fork's trn2 configuration
already turned it off. Until 2026-11-16 the NVIDIA env files didn't set it,
and the g4dn journal shows enable_prefix_caching=True on every start up to
then. Runs on g4dn and g7e before that date had it on.
This is prefix caching, not the KV cache. vLLM can't run without a KV cache: decoding uses it for every token.
Cost: Requests that share a prefix pay for the full prefill every time. That's the cost a live stream would pay, so it's what the benchmark should measure.
To check a run, look at the prefix-cache counters in its
metrics_snapshot events: hits should stay at zero. The counter names vary
between vLLM versions; recent ones use vllm:prefix_cache_hits.
18. Many clips per run, scored in the client¶
Decision: A run takes a manifest CSV of clips, and the clip is the
outermost sweep dimension: each target runs every configuration on one
clip before the next. Every clip is staged and decoded before any target
is contacted, and one that fails is skipped rather than stopping the run.
When a clip has a reference transcript, the client scores each stream's
WER as it ends, and snap-asr-bench-score scores runs again from their
JSONL. Under --concurrency, a load is one clip, and only speaker 0, the
one that starts at the beginning of the clip, is scored.
Why: One run, with one run ID, one warm-up and one set of network baselines per target, is how a benchmark over many clips stays comparable (Limitations). Putting the clip outermost keeps a clip's configurations close together in time, so server drift over a long run lands between clips, which differ anyway, rather than between the configurations being compared. Preparing every clip first means a bad path or file fails in minutes, not hours into the sweep. The manifest's default columns are those of the Ego4D and Ego-Exo4D clip sets, so their metadata can be grouped by without conversion. Scoring in the client puts WER next to latency in the stream's own summary, and recording the reference text in the JSONL lets the score command rescore any run, with a newer normalizer, without the original files.
Cost: Every clip's source media and decoded audio (115 MB per hour)
sit on the work disk for the run, and the media stays as a cache. Comparing one configuration across clips mixes in
drift between clips. The JSONL grows by each reference's text. Aligning a
transcript with its reference takes memory in proportion to the product of
their word counts (about 80 MB for 30 minutes of speech) and some CPU at
the end of each stream. It runs in a thread so the telemetry collectors
aren't held up. In a load, speaker 0 is scored while the other speakers
send their last chunks, which load_end's client CPU and loop lag
include. A load's WER rests on that one stream.