MedASR

June 8, 2026 · View on GitHub

Google's google/medasr ported to transcribe.cpp. 105M-parameter encoder-CTC for medical-dictation English ASR. 17-layer Conformer encoder with RoPE attention (rope_theta=10000), macaron FFNs (residual scalars [1.5, 0.5]), BatchNorm conv module (kernel=32, residual scalars [2.0, 1.0]), and a Linear 512→512 CTC head over a SentencePiece BPE vocabulary.

What it's for

Offline English speech-to-text optimized for medical dictation (radiology, internal medicine, family medicine). Decoder is greedy CTC; no language model, no beam search. This matches what HuggingFace transformers' AutoModelForCTC does by default.

Trained on ~5,000 hours of de-identified physician dictations on top of a LibriHeavy 50k-hour pretrain. The upstream model card flags lower accuracy on non-native accents and a male-skewed speaker distribution.

Licensed under the Health AI Developer Foundations terms. The upstream repo is gated; you must accept the HF terms before download.

Ported from upstream commit ae1e484, pinned 2026-06-04.

Input limits

MedASR is trained for audio up to about 400 seconds (~6.7 min) — the encoder's rotary-position window. Longer audio is accepted, but the library logs a WARN and accuracy may degrade past that window; it is not rejected. Segment long recordings for best results. See the input-length contract.

Download

QuantizationDownloadSizeWER (LibriSpeech test-clean)
F32medasr-F32.gguf417 MB17.88%
F16medasr-F16.gguf202 MB17.88%
Q8_0medasr-Q8_0.gguf122 MB17.86%
Q6_Kmedasr-Q6_K.gguf101 MB17.93%
Q5_K_Mmedasr-Q5_K_M.gguf90 MB17.91%
Q4_K_Mmedasr-Q4_K_M.gguf79 MB18.14%

Recommended default: Q8_0. Smallest preset with no statistically detectable WER degradation versus F32 (122 MB; +0.00 pp within bootstrap CI). Q4_K_M shows a real +0.26 pp degradation on LibriSpeech and is shipped for completeness but not recommended — prefer Q5_K_M if you need smaller than Q8_0.

WER measured on the full LibriSpeech test-clean split (2,620 utterances) with greedy CTC decoding and no external LM. F32 reference baseline (HuggingFace transformers, Mac MPS): 17.88%; transcribe.cpp F32 matches exactly. Absolute WER is higher than general-purpose ASR (e.g. Whisper-base ≈ 5%) because the model is fine-tuned for medical dictation — on the publisher's internal RAD-DICT / GENERAL-DICT / FM-DICT datasets the model scores 6.6%–9.3%, but those datasets are not publicly reproducible. See reports/wer/medasr.test-clean.summary.md for the full sweep.

Quick Start

cmake -B build
cmake --build build

build/bin/transcribe-cli \
  -m models/medasr/medasr-Q8_0.gguf \
  --language en \
  samples/jfk.wav

If your audio is not already 16 kHz mono WAV, convert it first:

ffmpeg -i input.mp3 -ar 16000 -ac 1 output.wav

Performance

Cells are wall-clock latency (mean over 3 iterations after 1 warmup), with speedup over realtime in parentheses. Units: ms below 1 s, s above (2 decimal places).

Apple M4 Max

BackendSampleQ8_0Q4_K_M
Metaljfk (11.0 s)38 ms (290×)44 ms (248×)
Metaldots (35.3 s)84 ms (419×)90 ms (394×)
CPUjfk (11.0 s)161 ms (68×)180 ms (61×)
CPUdots (35.3 s)558 ms (63×)623 ms (57×)

macOS 26.5, transcribe.cpp 8139a4b. Metal device: Apple M4 Max. Mel pipeline uses the shared MelFrontend (Accelerate vDSP fp64 FFT + cblas_sgemm); encoder is the conformer + RoPE + BatchNorm-conv graph in src/arch/medasr/encoder.cpp.

AMD Ryzen 7 4750U Pro

BackendSampleQ8_0Q4_K_M
Vulkanjfk (11.0 s)163 ms (68×)174 ms (63×)
Vulkandots (35.3 s)481 ms (74×)495 ms (71×)
CPUjfk (11.0 s)543 ms (20×)488 ms (23×)
CPUdots (35.3 s)1.84 s (19×)1.63 s (22×)

Fedora 43, transcribe.cpp 79d139a. Vulkan device: AMD Radeon Graphics (RADV RENOIR).

Benchmark reproduction:

uv run scripts/bench/run.py \
  --models medasr --quants q8_0,q4_k_m --samples jfk,dots \
  --backends metal,cpu,vulkan --iters 3 --warmup 1 --name medasr-publication

Numerical Validation

transcribe.cpp is validated tensor-by-tensor against the upstream HuggingFace Transformers reference on samples/jfk.wav via scripts/validate.py. The family-level forward map at reports/porting/medasr/forward-map.md documents the per-stage divergence sources (fp64 vDSP STFT, BatchNorm fusion, CUDA fp16-accumulator workarounds in the macaron + conv residual stack).

FieldValue
Referencetransformers @ 65dc2615 (dev commit; v5.0.0 not yet released), AutoModelForCTC.from_pretrained("google/medasr") device=mps fp32
Dump scriptscripts/dump_reference_medasr_transformers.py
Manifesttests/golden/medasr/medasr.manifest.json
Commanduv run scripts/validate.py all --family medasr --variant medasr

Reproduction

Convert

uv run --project scripts/envs/medasr \
  scripts/convert-medasr.py google/medasr

Quantize

build/bin/transcribe-quantize \
  models/medasr/medasr-F32.gguf \
  models/medasr/medasr-Q8_0.gguf \
  --quant Q8_0

Validate

uv run scripts/validate.py all --family medasr --variant medasr