Benchmarking

Benchmarking

How to compare speech-to-text models with voicsh benchmark. The workflow, dataset cache and result storage are described in DEVELOPMENT.md ; this file covers the two modes, the metrics and the backend builds.

The command needs the benchmark feature, which full (the default) includes. Use voicsh benchmark --help for the authoritative flag list.

Accuracy mode (default)

Scores each model on the FLEURS test split of --lang and reports WER, CER, real-time factor (RTF) and load time.

voicsh benchmark                                          # all installed models, German
voicsh benchmark --models base,large --lang en --limit 50
  • --models (or the positional MODEL) takes comma-separated catalog names; without it, every installed model is scored. See voicsh models list.
  • --lang selects the FLEURS split (default de); --limit N scores N clips spread evenly over it.
  • -t, --threads sets inference threads; --no-download stops missing models from being installed first.
  • A failing model is reported at the end and does not stop the others.
  • Compare models only on the same --lang and --limit.

Each run replaces ~/.local/share/voicsh/benchmarks/<model>.<lang>.json; the schema is ModelResult in src/benchmark/accuracy.rs. Text normalization and its limits are documented in src/benchmark/score.rs.

Speed mode

--audio FILE skips FLEURS and measures speed on your own WAV file.

voicsh benchmark --audio speech.wav --models tiny,base -n 3
voicsh benchmark --audio speech.wav --models base -o json > results.json
  • -n, --iterations N averages over N runs (default 1).
  • -o, --output table|json selects the format (default table).
  • -v also prints each transcription with detected language and confidence.

Table columns:

  • Time (ms): total transcription time.
  • RTF: processing time divided by audio duration. Below 1.0 is faster than real time, which live dictation requires.
  • Speed: 1/RTF, how many times faster than real time.
  • CPU/Core % and Mem (MB): resource use during transcription.

Comparing backends

The backend is chosen at build time; the speed-mode JSON records it per result. Build once per backend and compare the outputs:

cargo build --release --no-default-features --features whisper,benchmark   # CPU
cargo build --release --features cuda                                      # needs CUDA toolkit
cargo build --release --features vulkan                                    # needs Vulkan SDK
./target/release/voicsh benchmark --audio speech.wav --models tiny -o json

Accuracy-mode RTF depends on the backend the same way.

Criterion

cargo bench --bench wav_transcription runs a statistical timing benchmark on tests/fixtures/quick_brown_fox.wav; the report is written to target/criterion/report/index.html.