"""Build the artifact's index.html from the synthetic summary and the private review summary (speaker counts and speeds only; no titles or text). usage: build_index.py SYNTHETIC_SUMMARY_JSON ARTIFACT_DIR """ import html import json import sys from pathlib import Path SYSTEMS = [ # name, runtime, note ("nemotron3-offline-preset", "Nemotron-3 Diarization", "NeMo-Speech.cpp · ggml Metal · v3-offline preset"), ("nemotron3-stream", "Nemotron-3 Diarization", "NeMo-Speech.cpp · ggml Metal · default streaming"), ("fluidaudio-nemotron3-offline", "Nemotron-3 Diarization", "FluidAudio · CoreML · offline"), ("fluidaudio-nemotron3-fast32", "Nemotron-3 Diarization", "FluidAudio · CoreML · fast32"), ("nemotron3-full-attention", "Nemotron-3 Diarization", "NeMo-Speech.cpp · --offline full attention (≤6.6 min)"), ("sortformer-v2-stream", "Sortformer 4spk v2", "NeMo-Speech.cpp · ggml Metal · streaming"), ("sortformer-v2-offline-preset", "Sortformer 4spk v2", "NeMo-Speech.cpp · offline preset"), ("transcribecpp-sortformer-v21", "Sortformer 4spk v2.1", "transcribe.cpp (Hex's runtime, pinned rev) · Metal"), ("pyannote-community1-mps", "pyannote community-1", "pyannote.audio 4 · PyTorch MPS"), ("pyannote-community1-cpu", "pyannote community-1", "pyannote.audio 4 · PyTorch CPU †"), ("fluidaudio-community1-offline", "pyannote community-1", "FluidAudio · CoreML · VBx"), ("sherpa-seg3-wespeaker", "seg-3.0 + WeSpeaker", "sherpa-onnx · ONNX Runtime CPU"), ("sherpa-seg3-campplus", "seg-3.0 + CAM++", "sherpa-onnx · threshold 0.5 (untuned)"), ("baseline-vad-campplus-ahc", "Silero + CAM++ + AHC", "ONNX Runtime · 1.5 s windows · threshold 0.6"), ] PRIMARY = {"nemotron3-offline-preset", "transcribecpp-sortformer-v21"} REAL = [ ("nemotron3-offline-preset", "Nemotron-3 (v3-offline)"), ("nemotron3-stream", "Nemotron-3 (streaming)"), ("pyannote-community1-mps", "pyannote community-1"), ("transcribecpp-sortformer-v21", "Sortformer v2.1 (transcribe.cpp)"), ] CANDIDATES = [ ("Nemotron-3 Diarization", "OpenMDW-1.1", "107 MB q8_0 GGUF · 190 MB per CoreML preset", "8", "No; add an embedding model", "NeMo-Speech.cpp C ABI (nemo_speech/diar.h, Apache-2.0, own ggml dylibs ~9 MB), " "or port the V3 head into transcribe.cpp's Sortformer family → transcribe_cpp::DiarizeSession"), ("Sortformer 4spk v2 / v2.1", "CC-BY-4.0 / NVIDIA Open Model License", "147 / 139 MB q8_0 GGUF", "4", "No", "Already in Hex's pinned transcribe.cpp: Model::diarize_info, DiarizeSession::run(pcm); no new dependency"), ("Multitalker Parakeet", "NVIDIA Open Model License", "~0.6 B params (ASR + embedded Sortformer)", "4", "No", "In transcribe.cpp's catalog; speaker-tagged ASR, a bigger change than post-call diarization (not run)"), ("pyannote community-1", "CC-BY-4.0 weights, MIT code", "32 MB (PyTorch) · 21 MB CoreML", "Any (clustering)", "Yes, 256-d WeSpeaker", "No Rust path; PyTorch, or FluidAudio's CoreML port from a Swift bridge"), ("FluidAudio (SDK)", "Apache-2.0", "see models", "8 / any", "Yes (community-1 pipeline)", "Swift package: a SwiftPM dependency behind a bridge like apple_speech.swift; macOS only"), ("Silero + CAM++ + AHC", "MIT + Apache-2.0", "0.6 MB + 29 MB ONNX", "Any", "Yes, 192-d", "ort crate (Hex ships no ONNX Runtime today) or a ggml port"), ("sherpa-onnx seg-3.0 + embedder", "Apache-2.0 / MIT", "6 MB + 26–29 MB ONNX", "Any", "Yes", "sherpa-onnx C API, bundles ONNX Runtime"), ] CSS = """ :root{color-scheme:dark}body{background:#0d0f14;color:#d7dae0;font:15px/1.55 -apple-system,BlinkMacSystemFont,Inter,sans-serif;margin:0} main{max-width:1120px;margin:0 auto;padding:40px 24px 80px}h1{font-size:26px;margin:0 0 4px}h2{font-size:18px;margin:40px 0 10px;color:#fff} .sub{color:#8a90a0;font-size:13px}.verdict{background:#141821;border:1px solid #2a3140;border-radius:10px;padding:16px 20px;margin:20px 0} .verdict b{color:#fff}.verdict ol{margin:8px 0 0 18px;padding:0}table{border-collapse:collapse;width:100%;font-size:13px;margin:8px 0} th,td{padding:6px 10px;border-bottom:1px solid #1e232d;text-align:left;vertical-align:top}th{color:#8a90a0;font-weight:500;white-space:nowrap} td.n{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}tr.hi td{background:#121a24}tr.hi td:first-child{box-shadow:inset 3px 0 #7aa2f7} .good{color:#9ece6a}.bad{color:#f7768e}code{background:#1a1e27;padding:1px 5px;border-radius:4px;font-size:12px} .calls{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:12px}.call{background:#141821;border:1px solid #232937;border-radius:8px;padding:12px} .call audio{width:100%;margin-top:8px}.private{background:#3b1d22;color:#ffb4bd;border:1px solid #6b2a35;padding:2px 8px;border-radius:6px;font-size:12px} a{color:#7aa2f7}.note{color:#9aa0ad;font-size:13px}ul{padding-left:20px} """ def pct(x, digits=1): return "–" if x is None else f"{x * 100:.{digits}f}" def main() -> None: summary = {s["system"]: s for s in json.loads(Path(sys.argv[1]).read_text())} artifact = Path(sys.argv[2]) real = json.loads((artifact / "private" / "summary.json").read_text()) calls = sorted((artifact / "synthetic").glob("call*.m4a")) meta = {} for c in calls: segs = [l.split() for l in (artifact / "synthetic" / f"{c.stem}.rttm").read_text().splitlines() if l.strip()] meta[c.stem] = (sorted({s[7] for s in segs}), max(float(s[3]) + float(s[4]) for s in segs)) rows = [] for name, model, runtime in SYSTEMS: s = summary.get(name) if not s: continue rt = s["rtfx"] or 0 speed = f"{rt:.0f}×" if rt >= 10 else f"{rt:.1f}×" rows.append( f'{model}
{runtime}' f'{pct(s["mean_der"])}{pct(s["mean_confusion"])}' f'{s["count_exact"]}/{len(s["calls"])}{speed}' f'{(s["peak_mb"] or 0):.0f}{pct(s["cross_call_accuracy"], 0)}%' f'{pct(s["reference_accuracy"], 0)}%' f'{pct(s["word_level"])} / {pct(s["segment_level"])}') real_rows = [] for m in real: cells = "".join(f'{m["speakers"].get(k, "–")} · {m["speed"].get(k, 0):.0f}×' for k, _ in REAL) real_rows.append(f'{m["meeting"]} private' f'{m["minutes"]:.0f} min{cells}') cand = "".join(f"{a}{b}{c}{d}{e}{f}" for a, b, c, d, e, f in CANDIDATES) players = "".join( f'
{c.stem} {meta[c.stem][1] / 60:.1f} min · {len(meta[c.stem][0])} voices: ' f'{html.escape(", ".join(meta[c.stem][0]))}' f'truth RTTM
' for c in calls) page = f""" Meeting speakers · diarization spike

Who said what in “Them”: on-device diarization for Hex meetings

Spike t1303 · 2026-11-04 · measurement only, no Hex change · synthetic on M2 Max, real on M4 Pro (both shared with other jobs)
Use NVIDIA Nemotron-3 Diarization, running in transcribe.cpp, plus a separate voiceprint model.
  1. Accuracy. It handles up to 8 speakers. It scored 9.1–9.5% DER on the synthetic calls (pyannote 14.3%) and got the speaker count exactly right on 4 of 5 calls. It finds the same 6–7 speakers as pyannote on the two big real meetings, and gives each speaker 97% of their words.
  2. How it runs in Hex. transcribe.cpp is already linked, and Hex's pinned rev already exposes DiarizeSession. It runs Sortformer v2.1 today at 180× realtime with 11.8% DER, but that model stops at 4 speakers. The remaining work is porting the V3 8-speaker head into that model family. NeMo-Speech.cpp's ggml version, which already runs V3 at 400–640× realtime, is the reference for the port.
  3. Size and voiceprints. The model is 107 MB (q8_0). Voiceprints need a separate embedding model run over each speaker's clean stretches. CAM++ named people across calls correctly 81–94% of the time. It couldn't tell an unknown voice apart at a fixed threshold, though, so Hex should suggest names rather than assign them.

Synthetic calls: scores

5 calls, 2–5 voices made with Qwen3-TTS (VoiceDesign references, Base clones), 3–5% overlap. Each call went through 16 kHz, Opus or AAC at 16–32 kb/s, noise at 20–28 dB SNR and level gaps of up to 9 dB. DER uses a 0.25 s collar and scores overlap. About 9 points of every DER is a floor: the reference marks short pauses inside a turn as speech. x-RT is audio seconds per wall second, not counting model load. Voiceprints use one CAM++ extractor over each found speaker's solo stretches of 0.5 s or more, cosine ≥ 0.5. “Cross-call” enrols each voice from the other calls; “clean ref” enrols from one clean 10 s clip.

{"".join(rows)}
SystemDER %Confusion %Count exactx-RTPeak MBCross-callClean refWords right: word / segment

† PyTorch CPU ran next to an Xcode release build on the same Mac, so its speed is unreliable. Every speed here was measured on a shared worker; compare systems run on the same machine. Call 4 has 5 voices, and every system with an 8-speaker limit still merged two of them (one has 18 s of speech). Word vs segment: the gap is under 1 point everywhere, because Hex's “Them” lines are short. Giving each line its majority speaker is enough.

Real meetings (system.wav only)

Each cell is speakers found · x-RT on M4 Pro. Hex's transcript doesn't say how many people were on a call, so open a page, play it, and check the colours. Each page colours every “Them” line by Nemotron-3's speaker, shows the other systems' timelines next to it, and marks lines where a second speaker holds over 30% of the line.

{"".join(f"" for _, n in REAL)}{"".join(real_rows)}
MeetingLength{n}

Candidates

{cand}
ModelLicenceDownloadMax speakersVoiceprintFrom Rust

Voiceprints: what works and what doesn't

Synthetic calls

{players}

Code: research/meeting-speakers/ in the Hex repo (draft PR). Real audio, transcripts and results stay on the owner's machines, in private/ here.

""" (artifact / "index.html").write_text(page) print(artifact / "index.html") if __name__ == "__main__": main()