modulate's picture
squash: clean history after accidental venv upload
0041cfd
|
Raw History Blame Contribute Delete
6.06 kB

Reproducing the Entity Transcription Benchmark

This harness runs the benchmark end to end against any speech-to-text endpoint and scores it with the same matcher we used for our published numbers. If you follow the protocol below, your number for a given system is directly comparable to ours.

pip install -r requirements.txt

matcher_v5.py already lives in this repo under scripts/. If you are running from a copy of the scripts folder it is already beside you; otherwise:

huggingface-cli download modulate/entity-transcription-benchmark scripts/matcher_v5.py \
  --repo-type dataset --local-dir .

Run it

The harness is vendor-neutral. It needs an endpoint, the name of an environment variable holding your key, and where the transcript sits in the JSON response. Nothing about it is specific to any one provider.

export MY_STT_KEY=...
python run_benchmark.py \
  --endpoint https://api.example.com/v1/transcribe \
  --api-key-env MY_STT_KEY \
  --response-path result.transcript \
  --system-name acme-stt-v2 \
  --out runs/acme.jsonl
python score_benchmark.py --hyps runs/acme.jsonl

Options for the generic path, all passed as --provider-opt k=v:

Option Default Purpose
send body body posts raw bytes; multipart posts a file field
field_name file multipart field name
content_type audio/wav request content type for send=body
auth_header Authorization: Bearer {key} header template; {key} is substituted
response_path text dotted path to the transcript, list indices allowed

Endpoints needing no key work too — omit --api-key-env.

Convenience adapters exist for three vendors so you do not have to look up their response shapes. They are shortcuts, not the supported path:

export DEEPGRAM_API_KEY=...
python run_benchmark.py --provider deepgram --provider-opt model=nova-3 --out runs/nova3.jsonl

export OPENAI_API_KEY=...
python run_benchmark.py --provider openai --provider-opt model=gpt-4o-transcribe --out runs/oai.jsonl

Each adapter reads <PROVIDER>_API_KEY by default; --api-key-env overrides that with any variable name you like. Keys are never read from argv, so they stay out of shell history and out of the run manifest.

Collection is resumable — rerun the same command after an interruption and only the missing clips are fetched. Add --overwrite to start a file from scratch.

The protocol

These five things determine the number. Change any of them and you are no longer comparing like with like:

Default Flag
Entity spans scored tier A only --tier
Clips transcribed all 2,151 --tier on run_benchmark.py
Metric span-level entity accuracy —
Matcher matcher_v5.hit, self-test must pass 49/49 --matcher-path
WER normalizer basic --wer-normalizer
Dataset revision latest --revision

Tier is per span, not per clip. entity_tiers is an array parallel to entities, so a single clip can hold both tier A and tier B spans. Tier A spans are discriminative; tier B spans are trivial for every modern system and wash out the differences. The headline number counts tier A spans only.

Span-level accuracy. Each annotated entity is one trial. A clip with three entities contributes three. Hit means matcher_v5.hit(entity, hypothesis) returned true; clips with zero annotations are retained as negative examples and contribute no trials.

WER is reported over every clip, regardless of tier, since the tier label belongs to the span rather than the audio.

The matcher is the benchmark. matcher_v5 does more than substring matching: Unicode canonicalization, abbreviation aliases, spoken-form reconstruction (numbers, years, dates) and contiguous token matching. Entity accuracy is extremely sensitive to those rules, which is why a scorer written from scratch will not land on our numbers. score_benchmark.py refuses to run if matcher_v5.py is absent or its 49-case self-test fails, rather than quietly substituting a weaker rule.

No post-processing. Hypotheses are scored exactly as the endpoint returns them. If your system has a formatting layer, benchmark it on and off and report both, but say which one the headline number used.

Pin the revision with --revision <commit-sha> for anything you publish. Corrections to the annotations will move the numbers slightly.

Reporting

score_benchmark.py writes three files next to the hypotheses:

  • *.hits.csv — one row per entity span, with the hit flag and the transcript
  • *.summary.json — headline accuracy, WER, per-type and per-subset breakdown
  • *.manifest.json — dataset revision, tier, system name and request options

Publish the summary and the manifest together. A percentage without the manifest is not reproducible by anyone, including us.

If your number disagrees with ours, diff at the span level rather than arguing about the percentage:

python score_benchmark.py --hyps runs/mine.jsonl --compare reference/nova3.hits.csv

That writes a *.diff.csv of exactly which entities the two runs disagree on. We would rather hear about those than about the headline.

Known limits

  • Hosted models drift. Vendor endpoints change without version bumps, so a rerun months later may not match ours. Always record the model string and the run date; both go into the manifest automatically.
  • Our own system is not public. Third parties can reproduce the numbers for any hosted vendor on this list, and can score their own system on the same scale, but cannot independently verify our internal result.
  • Annotations are LLM-assisted. Entity type labels were generated by model passes with human adjudication of disagreements, and a residue of boundary artifacts remains. These depress every system equally, so comparisons hold, but the ground truth is not gold-standard human annotation. Corrections are welcome at ml.modulate@modulate.ai.