feat(benchmarks): add reproducible indexing-latency benchmark with real DiDeMo corpus - #128
Conversation
Adds a command that generates synthetic media via FFmpeg testsrc2 and measures per-stage indexing throughput, per-stage wall time, and peak memory across configurable modalities. Supports regression detection against a prior baseline report. - : corpus generation, run orchestrator (drives real run_index/ModelRuntime), per-stage aggregation, baseline comparison - CLI command with --modalities, --videos, --duration-seconds, --resolution, --repetitions, --input-mode (transcript/transcribe), --audio-mode, --baseline, --baseline-tolerance - documents the protocol, output schema, and limitations - 23 unit tests for validation, aggregation, clip command building, baseline comparison, and corpus spec
- Reject resolutions with extra components (e.g. 320x180x1) - Accumulate record_counts across repetitions instead of overwriting - Move corpus generation inside try block for proper failure handling - Pass reset parameter through instead of hardcoded True - Validate baseline configuration compatibility before comparison
Add a --corpus mode to vidxp benchmark index-latency so the throughput benchmark can index the real DiDeMo videos prepared by vidxp benchmark prepare, instead of only synthetic testsrc2 clips. Named corpora resolve under the application data directory and honor media-overrides.json; arbitrary media directories are supported too. Real corpora have no released transcripts, so dialogue requires --input-mode transcribe and is transcribed by Whisper. Reports record the corpus as kind 'real' with name, clip count, bytes, duration range, and containers, and baseline comparison rejects a baseline whose corpus signature differs so synthetic and real results never mix.
| manifest = run_index( | ||
| sources, | ||
| config, | ||
| reset=reset, |
There was a problem hiding this comment.
With the default reset=False, only the first repetition performs indexing. Every later call uses the same run and generation ID, so run_index() resumes the completed manifest and skips the videos. That means --repetitions 3 measures one indexing run followed by two resume/skip runs. Please ensure every repetition performs a complete fresh indexing cycle and add a test covering the orchestration, not only aggregation.
| raise ValueError("input_mode must be 'transcript' or 'transcribe'.") | ||
| if audio_mode not in {"none", "sine", "flite"}: | ||
| raise ValueError("audio_mode must be 'none', 'sine', or 'flite'.") | ||
| if "dialogue" in selected and input_mode == "transcribe": |
There was a problem hiding this comment.
This validation also applies to real corpora. As a result, the documented DiDeMo command with --modalities dialogue --input-mode transcribe fails unless --audio-mode flite is added, even though real-corpus audio comes from the video and audio_mode is documented as ignored. Please apply the flite requirement only to generated synthetic media.
| """ | ||
| if corpus is None: | ||
| return None, None | ||
| if isinstance(corpus, Path): |
There was a problem hiding this comment.
--corpus arrives from Typer as a string, so a directory supplied on the command line never reaches this Path branch. Every string except didemo is treated as an unknown named corpus, making the advertised --corpus <directory> mode unusable. Please recognize directory strings as paths and validate that the resulting directory exists.
Summary
Adds
vidxp benchmark index-latency, a reproducible indexing-latency benchmark, and extends it with a real-media corpus mode (--corpus didemo) that indexes the real DiDeMo videos prepared byvidxp benchmark prepare.The benchmark measures per-stage indexing throughput, per-stage wall time, and peak RSS across configurable modalities (
scene,actor,dialogue), supports baseline regression detection, and records the exact corpus, git revision, and environment fingerprints so results are reproducible and comparable between builds.Motivation
VidXP has official quality adapters (DiDeMo, HiREST) but no way to detect performance regressions or measure the latency impact of model/architecture changes. This PR adds that measurement surface in two layers:
testsrc2clips generated on the caller's machine, with a seeded synthetic transcript for dialogue. Cheap to run anywhere, fully reproducible, suitable for CI-style regression gates.--corpus didemoruns the same pipeline over the real DiDeMo videos (from Localizing Moments in Video with Natural Language, ICCV 2017) already downloaded and verified byvidxp benchmark prepare didemo. Real decode workloads, real faces foractor, and (with--input-mode transcribe) real Whisper transcription fordialogue. Any directory of media files is also accepted.What's included
src/vidxp/benchmarks/latency.py— corpus generation/discovery, run orchestrator driving the realrun_index/ModelRuntimepipeline, per-stage aggregation, real/synthetic corpus specs, and baseline comparison.src/vidxp/benchmarks/cli.py—vidxp benchmark index-latencycommand with--modalities,--videos,--duration-seconds,--resolution,--repetitions,--input-mode(transcript/transcribe),--audio-mode,--corpus,--reset,--baseline,--baseline-tolerance,--json.docs/benchmarking/performance.md— full protocol, report schema, evidence rules, limitations, usage.docs/benchmarking/README.md— catalog link.tests/test_benchmark_latency.py— 39 unit tests (validation, transcript generation, clip command building, aggregation, baseline comparison, corpus resolution/discovery/overrides, real-vs-synthetic baseline isolation).Usage
Key design points
dialogueon a real corpus requires--input-mode transcribe(real Whisper) — synthetic transcripts are never silently substituted for real media.--corpus didemohonorsmedia-overrides.jsonwritten byvidxp benchmark prepare(e.g. the documented Wikimedia replacement clip).realsplit in the run directory/generation ID, keeping them distinct fromsyntheticruns.Validation
uv run --no-sync ruff check src/vidxp/benchmarks/ tests/test_benchmark_latency.py— clean.uv run --no-sync pytest -q tests/test_benchmark_latency.py— 39/39 pass.test+benchmarksextras): 685 passed; 22 failures are the documented pre-existing missing-optional-deps (chromadb,cv2) on the local macOS x86_64 host where theactorextra cannot install (onnxruntimehas no compatible wheel); the two previously-noted failures (test_benchmark_cli.py,test_benchmarks.py) are among them.vidxp benchmark index-latency --help— shows--corpus.index-latencysmoke could not be re-run here because the storage dependencychromadbis unavailable on this host; the real-corpus pipeline (discovery → ffprobe validation → source building → corpus spec) was verified against a real generated clip, and the dialogue/transcribe gating was verified to raise before touching storage.Limitations (documented in
performance.md)testsrc2has no semantic scene content and no actors;actormeasures face-detection overhead with zero detections, andtranscriptmode measures embedding on a seeded synthetic transcript.vidxp benchmark prepare didemodownloaded locally and on any recorded media overrides.