# Cambrian-W Benchmark - Shuffled Correct Order **Version**: 2.0 (Shuffled Correct Order) **Date**: 2025-02-28 **Total Videos**: 466 (40 long + 426 short) **Total Eval Items**: 60,687 --- ## Critical Fix: Shuffled Temporal Order **Problem**: In the original format, `subset_concepts` and `correct_order` had the same sequence, allowing models to answer "ABCD" based on position bias rather than true temporal understanding. **Solution**: Now `correct_order` (temporal sequence) is **randomly shuffled**, while `subset_concepts` maintains fixed label order (A, B, C, D). ### Example **Before (Flawed)**: ```json { "subset_concepts": ["signpost", "shipping container", "fire hydrant", "tower"], "correct_order": ["signpost", "shipping container", "fire hydrant", "tower"], "answer": "ABCD" } // Model can answer "ABCD" by position bias → CORRECT (undeserved) ``` **After (Fixed)**: ```json { "subset_concepts": ["signpost", "shipping container", "fire hydrant", "tower"], "correct_order": ["shipping container", "tower", "signpost", "fire hydrant"], "answer": "BDAC" } // Model must understand: B→D→A→C, not just output "ABCD" ``` **Label Mapping (Fixed)**: - A = signpost - B = shipping container - C = fire hydrant - D = tower **Temporal Sequence (Shuffled)**: shipping container → tower → signpost → fire hydrant **Answer**: "BDAC" (must map temporal order to fixed labels) --- ## Data Files | File | Size | Videos | Eval Items | Description | |------|------|--------|------------|-------------| | `part1_long_videos_all.json` | 26MB | 40 | 20,705 | Long videos, all tasks, dual format | | `part2_short_place_motion.json` | 37MB | 426 | 18,154 | Short videos, spatial & motion tasks | | `part3_short_objects.json` | 14MB | 426 | 21,828 | Short videos, object tasks, dual format | --- ## Data Structure ### Part 1: Long Videos (40 videos, 111.9 hours) **Source**: `new_long_video/corrected_json_2` (fully rechecked) **Tasks**: | Task | Format | Eval Items | Metric | |------|--------|------------|--------| | Object Counting | Fill-in-blank | 3,799 | MRA | | First Appearance Recall | **Choice + Direct** | 1,559 × 2 | Acc / Exact Match | | Last Appearance Recall | **Choice + Direct** | 1,506 × 2 | Acc / Exact Match | | Frame Recall (Baseline) | Multiple Choice | 4,770 | Accuracy | | Frame Recall (Rotated) | Multiple Choice | 4,770 | Accuracy | | Motion Direction | Multiple Choice | 1,236 | Accuracy | ### Part 2: Short Videos - Place & Motion (426 videos) **Tasks**: | Task | Format | Eval Items | Metric | |------|--------|------------|--------| | Frame Recall (Baseline) | Multiple Choice | 8,040 | Accuracy | | Frame Recall (Rotated) | Multiple Choice | 8,040 | Accuracy | | Motion Direction | Multiple Choice | 2,074 | Accuracy | ### Part 3: Short Videos - Objects (426 videos) **⚠️ Note**: Partially rechecked **Tasks**: | Task | Format | Eval Items | Metric | |------|--------|------------|--------| | Object Counting | Fill-in-blank | 7,396 | MRA | | First Appearance Recall | **Choice + Direct** | 3,608 × 2 | Acc / Exact Match | | Last Appearance Recall | **Choice + Direct** | 3,608 × 2 | Acc / Exact Match | --- ## Appearance Task Format Details ### Direct Order Format (`*_direct`) ```json { "task_type": "first_appearance_recall_direct", "question_format": "direct_order", "evaluation_metric": "exact_match", "subset_concepts": ["signpost", "shipping container", "fire hydrant", "tower"], "correct_order": ["shipping container", "tower", "signpost", "fire hydrant"], "original_order": ["signpost", "shipping container", "fire hydrant", "tower"], "shuffled": true, "question": "[Direct-Order] Arrange by first appearance: signpost, shipping container, fire hydrant, tower", "checkpoints": [{ "checkpoint": 10, "answer": "BDAC", "concepts_seen": ["shipping container", "tower", "signpost", "fire hydrant"] }] } ``` **Label Mapping**: - A → signpost - B → shipping container - C → fire hydrant - D → tower **Temporal Order**: B → D → A → C **Prompt Template**: ``` Arrange objects by first appearance: Objects: A) signpost B) shipping container C) fire hydrant D) tower Output the order as a sequence of 4 letters. Answer with only the 4 letters in order, nothing else. ``` **Expected Answer**: "BDAC" **Why this prevents bias**: Model cannot simply output "ABCD". It must understand that "shipping container" (B) appears first, then "tower" (D), etc. ### Choice Format (`*_choice`) ```json { "task_type": "first_appearance_recall_choice", "question_format": "single_choice", "evaluation_metric": "accuracy", "subset_concepts": ["signpost", "shipping container", "fire hydrant", "tower"], "question": "[Single-Choice] Arrange by first appearance: signpost, shipping container, fire hydrant, tower", "checkpoints": [{ "options": [ "A) signpost → shipping container → fire hydrant → tower", "B) shipping container → tower → signpost → fire hydrant", "C) fire hydrant → signpost → tower → shipping container", "D) tower → fire hydrant → shipping container → signpost" ], "answer": "B" }] } ``` **Correct Option**: "B) shipping container → tower → signpost → fire hydrant" --- ## Evaluation Guide ### Loading Data ```python import json # Load Part 1 (long videos) with open('benchmark_shuffled/part1_long_videos_all.json') as f: part1 = json.load(f) # Access a video video = part1['videos'][0] task = video['tasks'][0] # First task if 'first_appearance_recall_direct' in task['task_type']: # Direct order format concepts = task['subset_concepts'] # Fixed order label_map = {c: chr(ord('A')+i) for i, c in enumerate(concepts)} for cp in task['checkpoints']: if cp.get('answer'): correct_order = cp['correct_order'] # Shuffled temporal order answer = cp['answer'] # Sequence like "BDAC" # Verify expected = ''.join([label_map[c] for c in correct_order]) assert answer == expected, "Answer mismatch!" ``` ### Direct Format Evaluation ```python def evaluate_direct(model, task, video_path=None): """Evaluate direct order format task.""" results = [] concepts = task['subset_concepts'] # Fixed order # Build concept list for prompt concept_list = '\n'.join([f"{chr(ord('A')+i)}) {c}" for i, c in enumerate(concepts)]) n = len(concepts) for cp in task['checkpoints']: if cp.get('answer') is None: continue # Build prompt prompt = f"""{task['question']} Objects: {concept_list} Output the order as a sequence of {n} letters. Answer with only the {n} letters in order, nothing else.""" # Get prediction pred = model.generate(prompt, video_path) pred_seq = parse_sequence(pred) # Check correctness (exact match) is_correct = (pred_seq == cp['answer']) results.append({ 'gt': cp['answer'], 'pred': pred_seq, 'correct': is_correct }) return results def parse_sequence(text): """Parse sequence like 'BDAC' from model output.""" import re text = text.upper() text = text.replace('→', '').replace('->', '').replace(' ', '').replace(',', '') match = re.search(r'[ABCD]{2,4}', text) if match: return match.group(0) return '' ``` ### Choice Format Evaluation ```python def evaluate_choice(model, task, video_path=None): """Evaluate choice format task.""" results = [] for cp in task['checkpoints']: if cp.get('answer') is None: continue # Build prompt prompt = f"""{task['question']} Options: {chr(10).join(cp['options'])} Answer with only the letter (A, B, C, or D).""" # Get prediction pred = model.generate(prompt, video_path) pred_letter = extract_letter(pred) # Check correctness is_correct = (pred_letter == cp['answer']) results.append({ 'gt': cp['answer'], 'pred': pred_letter, 'correct': is_correct }) return results def extract_letter(text): """Extract A/B/C/D from model output.""" text = text.upper() for letter in ['A', 'B', 'C', 'D']: if letter in text: return letter return 'A' ``` ### Object Counting Evaluation ```python def evaluate_counting(model, task, video_path=None): """Evaluate object counting task.""" results = [] for cp in task['checkpoints']: if cp.get('answer') is None: continue prompt = f"""{task['question']} You are at checkpoint {cp['checkpoint']} of {cp['checkpoint_of']}. Answer with only a single integer number.""" pred = model.generate(prompt, video_path) nums = re.findall(r'\d+', pred) pred_val = int(nums[0]) if nums else 0 gt_val = cp['answer'] # MRA metric mra = max(0.0, 1.0 - abs(pred_val - gt_val) / max(gt_val, 1)) results.append({ 'gt': gt_val, 'pred': pred_val, 'mra': mra }) return results ``` --- ## Metrics Calculation ### Accuracy (Choice tasks) ```python accuracy = sum(r['correct'] for r in results) / len(results) * 100 ``` ### Exact Match (Direct tasks) ```python exact_match = sum(r['correct'] for r in results) / len(results) * 100 ``` ### MRA (Counting tasks) ```python mra = sum(r['mra'] for r in results) / len(results) * 100 ``` --- ## Dual Format Comparison Run both formats on same checkpoints: ```python # Load both formats choice_task = load_task('first_appearance_recall_choice') direct_task = load_task('first_appearance_recall_direct') # Evaluate choice_results = evaluate_choice(model, choice_task, video_path) direct_results = evaluate_direct(model, direct_task, video_path) # Compare choice_acc = sum(r['correct'] for r in choice_results) / len(choice_results) direct_acc = sum(r['correct'] for r in direct_results) / len(direct_results) print(f"Choice: {choice_acc:.2%}") print(f"Direct: {direct_acc:.2%}") print(f"Gap: {choice_acc - direct_acc:.2%}") ``` **Expected Gap**: - First Appearance: ~40% (60% → 20%) - Last Appearance: ~44% (55% → 11%) Large gap → model relies on bias/heuristics Small gap → model truly understands temporal order --- ## Data Quality | Part | Quality | Recommendation | |------|---------|----------------| | Part 1 | ✅ Fully rechecked | Publication-ready | | Part 2 | ✅ Standard | Publication-ready | | Part 3 | ⚠️ Partially rechecked | Development only | --- ## Migration to Other Clusters ### 1. Transfer Package ```bash tar -czf benchmark_shuffled.tar.gz benchmark_shuffled/ scp benchmark_shuffled.tar.gz user@cluster:/data/benchmarks/ ssh user@cluster "cd /data/benchmarks/ && tar -xzf benchmark_shuffled.tar.gz" ``` ### 2. Install Dependencies ```bash pip install transformers>=4.40.0 torch>=2.0.0 qwen-vl-utils ``` ### 3. Run Evaluation ```bash python your_eval_script.py --data benchmark_shuffled/part1_long_videos_all.json ``` --- ## Citation ```bibtex @dataset{cambrian_w_2025, title={Cambrian-W: Panoramic Video Understanding Benchmark}, year={2025}, note={Shuffled Correct Order, Dual Format Version} } ``` --- ## File Manifest ``` benchmark_shuffled/ ├── README.md # This file ├── part1_long_videos_all.json # 40 videos ├── part2_short_place_motion.json # 426 videos └── part3_short_objects.json # 426 videos ``` --- ## Key Points for Implementation 1. **Fixed Labels**: `subset_concepts` order determines A, B, C, D labels 2. **Shuffled Order**: `correct_order` is temporal sequence (randomized) 3. **Answer Mapping**: Answer is sequence of labels based on `correct_order` 4. **No Position Bias**: Model cannot simply output "ABCD" **Example Verification**: ```python concepts = ['signpost', 'shipping container', 'fire hydrant', 'tower'] # Labels: A=signpost, B=shipping container, C=fire hydrant, D=tower correct_order = ['shipping container', 'tower', 'signpost', 'fire hydrant'] # Temporal: B → D → A → C answer = 'BDAC' # Expected answer # Verify label_map = {c: chr(ord('A')+i) for i, c in enumerate(concepts)} expected = ''.join([label_map[c] for c in correct_order]) assert answer == expected # 'BDAC' == 'BDAC' ✓ ``` --- **Ready for cluster deployment! 🚀**