File size: 19,994 Bytes
cca436c 627e5d7 cca436c c614c4e d9be7c0 cca436c c614c4e cca436c 627e5d7 d9be7c0 cca436c c614c4e d9be7c0 c614c4e d9be7c0 c614c4e d9be7c0 cca436c c614c4e cca436c a8124a8 cca436c d9be7c0 c614c4e cca436c cf07180 cca436c a8124a8 cca436c 45c1706 cca436c 04c0bde cca436c d9be7c0 cca436c cf07180 627e5d7 cf07180 627e5d7 45c1706 cca436c 627e5d7 fc9e8cf cca436c 627e5d7 cca436c 627e5d7 cca436c 627e5d7 cca436c d9be7c0 cca436c d9be7c0 627e5d7 d9be7c0 cca436c a8124a8 cca436c 04c0bde cca436c d9be7c0 cca436c d9be7c0 cca436c d9be7c0 c614c4e cca436c cf07180 cca436c cf07180 cca436c 627e5d7 cca436c 627e5d7 cca436c 627e5d7 cca436c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | #!/usr/bin/env python3
"""Build the evaluation protocol docs from committed metric artifacts."""
from __future__ import annotations
import json
from datetime import datetime, timezone
from pathlib import Path
from task_display import task_display_name
ROOT = Path(__file__).resolve().parents[1]
SUMMARY_PATH = ROOT / "docs/data/summary_metrics.json"
TIER2_PATH = ROOT / "docs/data/tier2_task_suite.json"
TASK_SUITE_20_PATH = ROOT / "docs/data/task_suite_20.json"
OUTPUT_JSON = ROOT / "docs/data/evaluation_protocol.json"
OUTPUT_MD = ROOT / "EVALUATION_PROTOCOL.md"
TASK_PROTOCOL = {
"timeline_action": {
"family": "supervised classification",
"unit": "single window",
"input": "current 20-frame all-feature window",
"target": "current action label",
"primary_metric": "macro_f1",
"higher_is_better": True,
"leakage_rule": "No future labels enter the input. Chronological split exposes unseen later action labels.",
},
"timeline_subtask": {
"family": "supervised classification",
"unit": "single window",
"input": "current 20-frame all-feature window",
"target": "current subtask label",
"primary_metric": "macro_f1",
"higher_is_better": True,
"leakage_rule": "No future labels enter the input. Chronological split exposes unseen later subtask labels.",
},
"transition_detection": {
"family": "temporal diagnostic",
"unit": "single window",
"input": "current 20-frame all-feature window",
"target": "action boundary versus steady",
"primary_metric": "macro_f1",
"higher_is_better": True,
"leakage_rule": "Boundary labels are targets only. Boundary timing is evaluated after prediction.",
},
"next_action": {
"family": "short-horizon prediction",
"unit": "single window",
"input": "current 20-frame all-feature window at time t",
"target": "action label at t + 20 frames",
"primary_metric": "macro_f1",
"higher_is_better": True,
"leakage_rule": "Future labels are shifted into targets only; model inputs remain current-window features.",
},
"hand_trajectory_forecast": {
"family": "trajectory regression",
"unit": "single window",
"input": "current all-feature window",
"target": "future left/right hand 3D joints for 10 frames",
"primary_metric": "mpjpe",
"higher_is_better": False,
"leakage_rule": "Future mocap coordinates are targets only, not inputs.",
},
"contact_prediction": {
"family": "binary classification",
"unit": "single window",
"input": "non-contact and non-caption feature blocks",
"target": "any body contact",
"primary_metric": "macro_f1",
"higher_is_better": True,
"leakage_rule": "Contact-derived fields and caption labels are excluded from inputs.",
},
"object_relevance": {
"family": "multi-label classification",
"unit": "single window",
"input": "non-caption feature blocks",
"target": "current relevant object set",
"primary_metric": "micro_f1",
"higher_is_better": True,
"leakage_rule": "Caption/object-label fields are excluded from inputs.",
},
"caption_grounding": {
"family": "retrieval",
"unit": "caption query",
"input": "caption object/interaction query plus candidate sensor windows",
"target": "matching time window",
"primary_metric": "mrr",
"higher_is_better": True,
"leakage_rule": "Queries are ranked against held-out candidate windows; reported ranks are computed after model scoring.",
},
"cross_modal_retrieval": {
"family": "retrieval",
"unit": "sensor query",
"input": "motion, IMU, and camera query features",
"target": "matching depth/video window",
"primary_metric": "top5_accuracy",
"higher_is_better": True,
"leakage_rule": "Query-side and candidate-side feature blocks are split before projection/ranking.",
},
"modality_reconstruction": {
"family": "cross-modal regression",
"unit": "single window",
"input": "motion, IMU, and camera features",
"target": "depth/video feature vector",
"primary_metric": "r2",
"higher_is_better": True,
"leakage_rule": "Target feature blocks are excluded from the input side.",
},
"temporal_order": {
"family": "pairwise diagnostic",
"unit": "adjacent window pair",
"input": "two adjacent windows",
"target": "correct versus reversed order",
"primary_metric": "f1",
"higher_is_better": True,
"leakage_rule": "Pairs are built after windowing; labels are synthetic order labels, not input features.",
},
"misalignment_detection": {
"family": "pairwise diagnostic",
"unit": "paired modality window",
"input": "motion side plus visual/depth side",
"target": "aligned versus shifted by 8 windows",
"primary_metric": "f1",
"higher_is_better": True,
"leakage_rule": "Shift labels are synthetic targets; shifted visual/depth blocks are generated after feature splitting.",
},
}
def metric_value(metrics: dict, metric_name: str) -> float | None:
if metric_name == "top5_accuracy":
return metrics.get("top5_accuracy")
return metrics.get(metric_name)
def count_record(metrics: dict) -> dict:
keys = [
"num_windows",
"num_samples",
"num_queries",
"num_train_windows",
"num_test_windows",
"num_train_samples",
"num_test_samples",
]
return {key: metrics[key] for key in keys if key in metrics}
def build_payload() -> dict:
summary = json.loads(SUMMARY_PATH.read_text(encoding="utf-8"))
tier2 = json.loads(TIER2_PATH.read_text(encoding="utf-8")) if TIER2_PATH.exists() else None
suite = summary["suite"]
minimal_tasks = suite["tasks"]
neural_tasks = suite.get("neural_tasks", {})
task_rows = []
for task_name, protocol in TASK_PROTOCOL.items():
minimal = minimal_tasks.get(task_name, {})
neural = neural_tasks.get(task_name, {})
primary = protocol["primary_metric"]
task_rows.append(
{
"task": task_name,
"task_display_name": task_display_name(task_name),
"origin": "original_public_sample_tasks",
**protocol,
"counts": count_record(minimal),
"minimal_primary_metric": metric_value(minimal, primary),
"neural_primary_metric": metric_value(neural, primary) if neural else None,
"minimal_metric_source": f"results/episode_task_suite/{task_name}/metrics.json",
"neural_metric_source": f"results/episode_task_suite/neural_mlp/{task_name}/metrics.json",
}
)
source_files = [
"docs/data/summary_metrics.json",
"results/episode_task_suite/summary_report.json",
"results/episode_task_suite/windows.csv",
"results/episode_task_suite/feature_manifest.json",
]
if tier2:
source_files.extend(
[
"docs/data/task_suite_20.json",
"docs/data/tier2_task_suite.json",
"results/episode_task_suite/tier2_task_suite/tier2_task_suite_results.json",
]
)
tier2_rows = []
if tier2:
for task_name, spec in tier2.get("task_specs", {}).items():
result = tier2.get("tasks", {}).get(task_name, {})
minimal = result.get("minimal") or {}
neural = result.get("neural_mlp") or {}
primary = spec.get("metric_key")
tier2_rows.append(
{
"task": task_name,
"task_display_name": spec.get("name", task_name),
"origin": "additional_public_sample_tasks",
"family": spec.get("family"),
"unit": "single aligned window" if spec.get("family") != "retrieval" else "held-out query window",
"input": spec.get("input"),
"target": spec.get("target"),
"primary_metric": primary,
"higher_is_better": spec.get("metric_direction") == "higher",
"minimal_primary_metric": minimal.get("primary_score", minimal.get(primary)),
"neural_primary_metric": neural.get("primary_score", neural.get(primary)),
"minimal_metric_source": f"results/episode_task_suite/tier2_task_suite/{task_name}/metrics.json",
"neural_metric_source": f"results/episode_task_suite/tier2_task_suite/neural_mlp/{task_name}/metrics.json",
"meaning": spec.get("meaning"),
}
)
all_task_rows = task_rows + tier2_rows
for idx, row in enumerate(all_task_rows, start=1):
row["task_number"] = idx
row["suite_label"] = f"Task {idx:02d}"
return {
"title": "Ropedia Xperience-10M Task Suite Evaluation Protocol",
"status": "pass",
"version": "2026-06-01",
"generated_at_utc": datetime.now(timezone.utc).isoformat(timespec="seconds"),
"source_files": source_files,
"scope": {
"validated_episode_count": 1,
"annotation": suite["annotation"],
"num_frames": suite["num_frames"],
"num_windows": suite["num_windows"],
"feature_dim": suite["feature_dim"],
"window_frames": suite["window_frames"],
"stride_frames": suite["stride_frames"],
"audio_featurized": True,
"raw_data_redistributed": False,
},
"task_suite": {
"status": "unified_public_sample_suite",
"task_count": len(all_task_rows),
"original_public_sample_tasks": len(task_rows),
"additional_public_sample_tasks": len(tier2_rows),
"unified_results": "docs/data/task_suite_20.json" if TASK_SUITE_20_PATH.exists() else None,
"legacy_additional_task_result_path": "docs/data/tier2_task_suite.json",
"legacy_path_note": "The tier2_task_suite path is retained for stable links only; tasks 13-20 are presented as part of the same 20-task suite.",
},
"split_policy": {
"name": "single_episode_chronological",
"train_fraction": 0.7,
"test_fraction": 0.3,
"why": "The split preserves time order so future episode segments are not mixed randomly into the train set.",
"limitation": "It is still one episode; cross-episode generalization is evaluated in the multi-episode stage.",
},
"feature_policy": {
"input_contract": f"{suite['feature_dim']:,}-dimensional current feature vector",
"source_manifest": "results/episode_task_suite/feature_manifest.json",
"normalization": "Scalers are fit on train windows only for the baseline heads.",
"audio_status": "Audio is represented in the current feature vector.",
},
"baselines": [
{
"name": "minimal",
"heads": ["softmax", "binary logistic", "multi-label logistic", "ridge regression", "ridge projection plus cosine ranking"],
"purpose": "Keep each task contract interpretable and easy to inspect.",
},
{
"name": "neural_mlp",
"heads": ["PyTorch MLP classifier", "PyTorch MLP regressor", "PyTorch MLP multi-label head"],
"purpose": "Check nonlinear gains before larger omni-model fine-tuning.",
"config": suite.get("neural_model", {}),
},
],
"task_protocols": all_task_rows,
"global_leakage_controls": [
"Use chronological train/test splits instead of random window shuffling.",
"Fit scalers and learned projections on train windows only.",
"Keep future labels, future mocap, contact labels, object labels, and caption labels on the target side unless a task explicitly treats language as the query.",
"For cross-modal tasks, split query-side and candidate-side feature blocks before training and ranking.",
"Report unseen test classes when the chronological split exposes labels absent from the train segment.",
],
"current_limitations": [
"Cross-episode generalization for Qwen3-Omni has a first verified diagnostic pilot, but strong model quality is not yet shown.",
"Feature-vector reconstruction is separate from pixel depth, mesh, NeRF, or Gaussian reconstruction.",
"The final verified Qwen3-Omni diagnostic result meets the strict-JSON target, but action/subtask held-out quality remains weak and needs error analysis before larger model-quality claims.",
"Full audio-visual representation learning still needs multi-episode training; the current report includes single-episode audio/no-audio ablations.",
],
"scale_up_gate": {
"required_before_next_omni_quality_pilot": [
"selected prepared Xperience-10M episodes",
"held-out episode split with no train/test episode leakage",
"validation samples during training",
"manifest, training metadata, progress logs, metrics, predictions, and run report",
"held-out evaluation on test episodes rather than train windows",
],
"current_status": "verified diagnostic result; strict-JSON quality target met, action/subtask quality still weak",
"evidence": [
"docs/data/omni_finetune_verified_result.json",
"results/omni_finetune/verified_public/",
],
},
}
def markdown_table(rows: list[dict]) -> list[str]:
lines = [
"| # | Task | Artifact id | Origin | Family | Unit | Input -> target | Primary metric | Minimal | Neural |",
"| ---: | --- | --- | --- | --- | --- | --- | --- | ---: | ---: |",
]
for row in rows:
metric = row["primary_metric"]
minimal = row["minimal_primary_metric"]
neural = row["neural_primary_metric"]
minimal_text = "n/a" if minimal is None else f"{minimal:.4f}"
neural_text = "n/a" if neural is None else f"{neural:.4f}"
direction = "higher better" if row["higher_is_better"] else "lower better"
lines.append(
"| {number} | {task} | `{artifact}` | {origin} | {family} | {unit} | {input} -> {target} | {metric} ({direction}) | {minimal} | {neural} |".format(
number=row.get("task_number", ""),
task=row["task_display_name"],
artifact=row["task"],
origin="original" if row.get("origin") == "original_public_sample_tasks" else "additional",
family=row["family"],
unit=row["unit"],
input=row["input"],
target=row["target"],
metric=metric,
direction=direction,
minimal=minimal_text,
neural=neural_text,
)
)
return lines
def render_markdown(payload: dict) -> str:
scope = payload["scope"]
split = payload["split_policy"]
feature = payload["feature_policy"]
lines = [
"# Evaluation Protocol",
"",
"This file defines how the public Xperience-10M sample episode is turned",
"into benchmark-style tasks, how the baselines are evaluated, and what the",
"reported metrics are allowed to mean.",
"",
"## Protocol At A Glance",
"",
"| Item | Current protocol |",
"| --- | --- |",
f"| Source scope | {scope['validated_episode_count']} public Xperience-10M sample episode |",
f"| Frames | {scope['num_frames']:,} |",
f"| Sliding windows | {scope['num_windows']:,} windows, {scope['window_frames']} frames each, stride {scope['stride_frames']} frames |",
f"| Current feature vector | {scope['feature_dim']:,} dimensions |",
f"| Split | chronological {int(split['train_fraction'] * 100)}/{int(split['test_fraction'] * 100)} train/test by time |",
"| Baselines | minimal interpretable heads plus compact neural MLP heads |",
"| Audio | AAC stream extracted from the sample MP4 and included in the current baseline vector |",
"| Raw data | not redistributed |",
"",
"## Data Unit",
"",
"The basic unit is a 20-frame aligned window built from one synchronized",
"public episode. Feature blocks are documented in",
"`results/episode_task_suite/feature_manifest.json`; the committed window",
"table is `results/episode_task_suite/windows.csv`.",
"",
"## Split Policy",
"",
f"The current suite uses `{split['name']}`: {split['why']} {split['limitation']}",
"",
"This makes some classification metrics intentionally harsh: later test",
"segments can contain action or subtask labels not present in the train",
"segment. Those cases are recorded in the task metrics as `unseen_test_classes`.",
"",
"## Feature And Head Policy",
"",
f"- Input contract: {feature['input_contract']}.",
f"- Source manifest: `{feature['source_manifest']}`.",
f"- Normalization: {feature['normalization']}",
f"- Audio status: {feature['audio_status']}",
"",
"Minimal heads are used first because they make task contracts easy to inspect.",
"Neural MLP heads reuse the same windows, splits, and feature tensors; they",
"are not foundation models.",
"",
"## Unified 20-Task Contracts",
"",
"Tasks 1-12 are the original public-sample task contracts. Tasks 13-20",
"are additional sample-supported contracts attached to the same 20-frame",
"window, feature, chronological split, leakage-control, and minimal/neural",
"baseline setup. Historical `tier2_task_suite` paths are retained only as",
"stable artifact locations for tasks 13-20.",
"",
*markdown_table(payload["task_protocols"]),
"",
"## Leakage Controls",
"",
]
lines.extend(f"- {item}" for item in payload["global_leakage_controls"])
lines.extend([
"",
"## Current Limitations",
"",
])
lines.extend(f"- {item}" for item in payload["current_limitations"])
lines.extend([
"",
"## Scale-Up Gate",
"",
"The next Qwen3-Omni quality pilot requires all of the following before",
"claiming improved held-out model quality:",
"",
])
lines.extend(f"- {item}" for item in payload["scale_up_gate"]["required_before_next_omni_quality_pilot"])
lines.extend([
"",
"Current status: verified diagnostic result; strict-JSON quality target met, action/subtask quality still weak. Read",
"`docs/data/omni_finetune_verified_result.json` before interpreting any",
"Qwen3-Omni metric.",
"",
"## Machine-Readable Copy",
"",
"The JSON mirror is `docs/data/evaluation_protocol.json`.",
"",
])
return "\n".join(lines)
def main() -> int:
payload = build_payload()
OUTPUT_JSON.parent.mkdir(parents=True, exist_ok=True)
OUTPUT_JSON.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
OUTPUT_MD.write_text(render_markdown(payload), encoding="utf-8")
print(f"PASS: wrote {OUTPUT_JSON}")
print(f"PASS: wrote {OUTPUT_MD}")
return 0
if __name__ == "__main__":
raise SystemExit(main())
|