| # World Embedding Benchmark |
|
|
| Bidirectional text-video retrieval for PhysicsBench, with faithful |
| LCO-Embedding inference through Transformers and vLLM. |
|
|
| The benchmark uses `parsed_text` as the default text prompt and the embedded |
| Parquet `video` field as video input. It reports text-to-video and video-to-text |
| Recall, MRR, and nDCG globally and per family, and can save embeddings, |
| similarity matrices, checkpoints, and family-confusion tables. |
|
|
| ## Quick start (standard x86_64 CUDA server) |
| |
| ```bash |
| sudo apt-get update |
| sudo apt-get install -y ffmpeg python3.12-venv |
| python3.12 -m venv .venv |
| source .venv/bin/activate |
| python -m pip install --upgrade pip setuptools wheel |
| python -m pip install -r requirements.txt |
| huggingface-cli login |
| ``` |
| |
| Use official prebuilt PyTorch/vLLM wheels on x86_64. Do not repeat the DGX |
| Spark ARM64 source-build procedure described in `ENVIRONMENT.md`. |
|
|
| Place datasets under: |
|
|
| ```text |
| datasets/physics-bench-solid-eval |
| datasets/physics-bench-optics-eval |
| datasets/physics-bench-fluid-eval |
| datasets/physics-bench-dynamics-eval |
| ``` |
|
|
| Each family is a directory containing Parquet shards with `query_id`, `case_id`, |
| `raw_text`, `parsed_text`, and `video` columns. |
|
|
| ## Smoke test |
|
|
| ```bash |
| python run_retrieval.py \ |
| --dataset-dir datasets/physics-bench-solid-eval \ |
| --model lco-omni-3b --model-name ./models/LCO-Embedding-Omni-3B \ |
| --backend vllm \ |
| --vllm-max-model-len 32768 --vllm-gpu-memory-utilization 0.7 \ |
| --video-sampling processor --fps 2 --max-frames 128 \ |
| --batch-size 4 --video-prefetch-batches 2 \ |
| --video-decode-workers 8 --video-decoder torchcodec --no-vllm-enforce-eager \ |
| --text-column parsed_text --limit-videos-per-family 1 \ |
| --output results/solid_lco_3b_smoke.json |
| ``` |
|
|
| Remove the limit for a full run. On the dual RTX 6000D server, start with batch 4, prefetch 2, and |
| eight TorchCodec decode workers. Run one independent job per GPU; then |
| benchmark larger values on the target server. Registered model keys are `lco-omni-3b` and |
| `lco-omni-7b`; `--model-name` overrides their Hugging Face checkpoints. |
|
|
| ## Video regression |
|
|
| `run_regression.py` evaluates a frozen video representation with a deterministic |
| nested cross-validated ridge probe. Outer folds produce out-of-sample |
| predictions; ridge strength is selected only within each outer training fold. |
| It reports MAE, RMSE, R², Pearson and Spearman correlations, and target-range normalized |
| MAE/RMSE. |
|
|
| ```bash |
| python run_regression.py \ |
| --dataset-dir datasets/physics-bench-regression-500 \ |
| --subset pendulum \ |
| --model lco-omni-3b --model-name ./models/LCO-Embedding-Omni-3B \ |
| --backend vllm \ |
| --vllm-max-model-len 32768 --vllm-gpu-memory-utilization 0.7 \ |
| --video-sampling processor --fps 2 --max-frames 128 \ |
| --batch-size 4 --video-prefetch-batches 2 \ |
| --video-decode-workers 8 --video-decoder torchcodec --no-vllm-enforce-eager \ |
| --embedding-output-dir results/regression/pendulum/embeddings \ |
| --output results/regression/pendulum/result.json |
| ``` |
|
|
| The embedding directory makes encoding resumable and stores |
| `video_embeddings.npz`. Per-example out-of-fold predictions are saved beside |
| the result as `predictions.csv`. |
|
|
| ### Fixed test set and scaling protocol |
|
|
| Create the permanent 100-example test split and five nested training orders for |
| all subsets once: |
|
|
| ```bash |
| python prepare_regression_splits.py |
| ``` |
|
|
| Manifests under `regression_splits/physics-bench-regression-500/` use stable |
| example IDs, ten equal-count target-rank strata, seed 42, training sizes |
| `25, 50, 100, 200, 300, 400`, and repetition seeds `1000` through `1004`. |
| Existing manifests are validated and are never silently overwritten. |
|
|
| Run a scaling experiment with one video-encoding pass: |
|
|
| ```bash |
| python run_regression_scaling.py \ |
| --subset pendulum \ |
| --model lco-omni-3b --model-name ./models/LCO-Embedding-Omni-3B \ |
| --backend vllm --vllm-max-model-len 32768 \ |
| --vllm-gpu-memory-utilization 0.7 \ |
| --video-sampling processor --fps 2 --max-frames 128 \ |
| --batch-size 4 --video-prefetch-batches 2 \ |
| --video-decode-workers 8 --video-decoder torchcodec --no-vllm-enforce-eager \ |
| --embedding-output-dir results/regression-scaling/pendulum/embeddings \ |
| --output results/regression-scaling/pendulum/result.json |
| ``` |
|
|
| Every size is tuned only on its selected training subset. The same fixed 100 |
| examples are then used for test metrics across all sizes and repetitions. |
|
|
| ## Fidelity and sampling |
|
|
| - Processor mode reproduces Qwen Omni FPS sampling while decoding only selected |
| frames; fixed mode uniformly selects exactly `--num-frames N` frames. |
| - Both backends preserve LCO's compression prompts, LAST-token pooling, and L2 |
| normalization. |
| - `compare_lco_backends.py` validates Transformers/vLLM embedding parity. |
|
|
| ## Main files |
|
|
| - `run_retrieval.py`: evaluation CLI. |
| - `run_regression.py`: video-representation regression CLI. |
| - `run_regression_scaling.py`: fixed-test regression scaling CLI. |
| - `prepare_regression_splits.py`: deterministic split-manifest generator. |
| - `run_retrieval.sh`: readable full-run examples. |
| - `world_embedding_benchmark/retrieval.py`: loading, caching, scoring, metrics. |
| - `world_embedding_benchmark/regression.py`: regression loading, probing, and metrics. |
| - `world_embedding_benchmark/models/`: Transformers/vLLM LCO adapters. |
| - `world_embedding_benchmark/embedding_artifacts.py`: resumable artifacts. |
| - `compare_lco_backends.py`: backend parity. |
| - `benchmark_lco_video_throughput.py`: throughput tuning. |
| - `debug_lco_retrieval.py`: retrieval diagnostics. |
| - `visualize_similarity_matrices.py`: embedding visualization. |
| - `merge_fluid_eval_captions.py`: legacy fluid reconstruction. |
| - `HANDOFF.md`: project state and next steps. |
| - `ENVIRONMENT.md`: x86_64 setup and historical ARM64 notes. |
| |
| Datasets, weights, results, caches, environments, and local build trees are |
| intentionally excluded from Git. |
| |