Skip to content

feat(benchmarks): add reproducible indexing-latency benchmark with real DiDeMo corpus - #128

Open
Mahnoor-Zaffar wants to merge 3 commits into
grayhatdevelopers:mainfrom
Mahnoor-Zaffar:feat/perf-benchmark-corpus
Open

feat(benchmarks): add reproducible indexing-latency benchmark with real DiDeMo corpus#128
Mahnoor-Zaffar wants to merge 3 commits into
grayhatdevelopers:mainfrom
Mahnoor-Zaffar:feat/perf-benchmark-corpus

Conversation

@Mahnoor-Zaffar

Copy link
Copy Markdown

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 by vidxp 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:

  1. v1 — synthetic media (deterministic, hermetic). FFmpeg testsrc2 clips 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.
  2. Real-media corpus (paper-published media). --corpus didemo runs the same pipeline over the real DiDeMo videos (from Localizing Moments in Video with Natural Language, ICCV 2017) already downloaded and verified by vidxp benchmark prepare didemo. Real decode workloads, real faces for actor, and (with --input-mode transcribe) real Whisper transcription for dialogue. Any directory of media files is also accepted.

What's included

  • src/vidxp/benchmarks/latency.py — corpus generation/discovery, run orchestrator driving the real run_index/ModelRuntime pipeline, per-stage aggregation, real/synthetic corpus specs, and baseline comparison.
  • src/vidxp/benchmarks/cli.pyvidxp benchmark index-latency command 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

# Synthetic baseline (default: 1 x 8s 320x180 clip, scene-only)
vidxp benchmark index-latency --run-id my-baseline

# Synthetic, multi-modality, 3 reps, regression check
vidxp benchmark index-latency \
  --run-id v2-compare \
  --modalities scene,actor,dialogue \
  --videos 2 --duration-seconds 12 --repetitions 3 \
  --baseline benchmark_runs/latency/synthetic/my-baseline/report.json

# Real DiDeMo media (prepare first, then smoke on one clip)
vidxp benchmark prepare didemo --split validation --annotation-indices 0 --yes
vidxp benchmark index-latency --run-id didemo-smoke \
  --corpus didemo --modalities scene,actor --videos 1

# Real dialogue over real audio (Whisper transcribes)
vidxp benchmark index-latency --run-id didemo-dialogue \
  --corpus didemo --modalities dialogue --input-mode transcribe --videos 2

Key design points

  • Baseline isolation: baseline comparison rejects a baseline whose corpus signature differs from the current run, so synthetic and real results never mix. Synthetic signatures include dimensions/duration/seed; real signatures include corpus name, clip count, bytes, duration range, containers, and media-override state.
  • Real transcripts: DiDeMo has no released transcripts, so dialogue on a real corpus requires --input-mode transcribe (real Whisper) — synthetic transcripts are never silently substituted for real media.
  • Overrides: --corpus didemo honors media-overrides.json written by vidxp benchmark prepare (e.g. the documented Wikimedia replacement clip).
  • Stable media IDs: real clips map official DiDeMo video names to stable benchmark media IDs, matching the rest of the benchmark infrastructure.
  • Runtime split: real-corpus runs use the real split in the run directory/generation ID, keeping them distinct from synthetic runs.

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.py39/39 pass.
  • Full suite (with test + benchmarks extras): 685 passed; 22 failures are the documented pre-existing missing-optional-deps (chromadb, cv2) on the local macOS x86_64 host where the actor extra cannot install (onnxruntime has 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.
  • A live end-to-end index-latency smoke could not be re-run here because the storage dependency chromadb is 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)

  • Synthetic testsrc2 has no semantic scene content and no actors; actor measures face-detection overhead with zero detections, and transcript mode measures embedding on a seeded synthetic transcript.
  • Real DiDeMo runs depend on what vidxp benchmark prepare didemo downloaded locally and on any recorded media overrides.
  • Peak RSS is whole-process (Python + models + Chroma), not a pure indexing-stage measurement.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant