Run from the bench host¶
Bench runs include the network between bench and each target, from under 1 ms (g4dn) to 230 ms (trn2). Use them for end-to-end latency, not to compare the instances. For that, run on the runner hosts; this is one of the alternate run methods.
Pre-flight¶
The code on the bench host. From your workstation, copy the code to the bench host over SSH, then install its dependencies there. This needs an SSH config entry for the bench host (SSH over Session Manager).
make push-hosts HOSTS=<bench-ssh-host>
ssh <bench-ssh-host> 'cd ~/snap-asr-bench && make sync UV_NO_DEV=1'
push-hosts copies to ~/snap-asr-bench in the SSH user's home, so run the
steps below as that user. It sends Git's tracked files, uncommitted edits
included, and never targets.toml, which stays the bench host's own
(Make targets). Without SSH, use
Deploy code via S3 instead.
The targets. On the bench host:
sudo ~/snap-asr-bench/deploy/bench/mount-instance-store.sh
for ip in <trn2-ip> <g4dn-ip> <g7e-ip>; do
curl -s "http://$ip:8000/v1/models" | jq -r '.data[].id'
curl -s "http://$ip:8001/health"; echo
done
Every target should list the same model. targets.toml at the repository
root must list each host's private IP
(Configuration). Plan for
warm-up as for on-host runs.
Run¶
Use tmux so a dropped SSM session doesn't stop the run:
tmux new -s bench
cd ~/snap-asr-bench
BUCKET=<bucket name>
uv run snap-asr-bench "s3://$BUCKET/inputs/sample.mp4" \
--targets targets.toml \
--chunk-seconds 1,2,5,10 \
--strategy independent,growing \
--pacing realtime,afap \
--repeats 2 \
--results-s3 "s3://$BUCKET/results"
Or with make: make bench SOURCE=... CHUNKS=1,2,5,10 ARGS="..."
(Make targets). A local file works as input
too, and is copied to the instance store first. Use --only g4dn to run a
subset. To run many clips in one run, pass --manifest clips.csv (or
make bench MANIFEST=...) instead of the input
(Inputs and manifests). To run a
benchmark plan, pass
--plan resources/plans/<name>.toml (or make bench PLAN=...), and
preview it first with --dry-run.
To read a manifest's clips from a local copy instead of S3, copy them first
with make sync-manifest MANIFEST=clips.csv DATA_DIR=/data, then map the
bucket onto that directory with --rewrite s3://<bucket>/=/data/. The
client still copies each local clip into the work directory before decoding
it.
Targets run one after another, so the run takes about three times as long
as an on-host run of the same sweep. --parallel-targets runs them all at
once instead, at the cost of sharing the bench host's CPU and network
(design decision 3). Each target runs, per input, strategies ×
boundaries × formats × pacings × chunk sizes × repeats streams, and each
realtime stream takes as long as the audio. For example, the command
above on a 10-minute file spends about 3 targets × 2 × 1 × 1 × 4 × 2 × 10 =
480 minutes on realtime streams alone.
Outputs¶
| Path | Contents |
|---|---|
/mnt/nvme/snap-asr-bench/runs/<run-id>/events.jsonl |
Every event for the run |
/mnt/nvme/snap-asr-bench/runs/<run-id>/audio/0000.s16le, ... |
Extracted 16 kHz mono PCM, one file per input in manifest order |
/mnt/nvme/snap-asr-bench/runs/<run-id>/warmup.s16le |
The warm-up input's PCM, with --warmup-input |
/mnt/nvme/snap-asr-bench/inputs/ |
Staged inputs, manifests and S3 references. S3 files are cached until their ETag changes, local copies until their size or modification time does. |
s3://<bucket>/results/<run-id>/events.jsonl |
Uploaded copy, written even if the run fails part-way |
Quick look¶
EV=/mnt/nvme/snap-asr-bench/runs/<run-id>/events.jsonl
# One line per stream
jq -c 'select(.event == "stream_end") | {target, input_id, strategy, boundary, audio_format, pacing, chunk_seconds, repeat, rtfx, failures, wer: .word_errors.wer}' "$EV"
# Per-chunk latency
jq -c 'select(.event == "response_complete") | {target, chunk_seconds, chunk_index, ttft_seconds, seconds}' "$EV"
# Anything that went wrong
jq -c 'select(.event | test("error|exception|unparsed|warning"))' "$EV"
# WER per target and configuration (needs reference transcripts)
uv run snap-asr-bench-score "$EV"
See JSONL events for every field.