#!/bin/bash # Diagnose why CCD-DS shows no speedup: measure |I^c_t| and the stability rate # that together decide Eq. (20)'s budget. 3 Trip examples only -- a few GPU minutes. set -uo pipefail pip install -q "transformers==4.46.2" "huggingface_hub<1.0" "datasets<4" "accelerate" 2>&1 | tail -1 python -c " from huggingface_hub import snapshot_download snapshot_download('ashishk1331/ccd-repro-code', repo_type='dataset', local_dir='/work')" cd /work && mkdir -p outputs python scripts/run_eval.py --task trip --method ccd_ds --limit 3 --out outputs/diag_ds.json python - <<'EOF' import json import numpy as np r = json.load(open("outputs/diag_ds.json")) print("\n=============== Eq. (20) BUDGET DIAGNOSTICS ===============") print(f"mean steps {r['mean_steps']:.1f} (uniform baseline = 256) speedup {r['speedup_vs_uniform']:.2f}x") print(f"fallback steps (|I^c_t| = 0): {r['fallback_steps']}") ic = np.array(sum(r["ic_sizes"], [])) st = np.array(sum(r["n_stable"], [])) bud = np.array(sum(r["budgets"], [])) print(f"\n|I^c_t| : mean={ic.mean():.2f} hist={np.bincount(ic, minlength=5)[:5]} (V=4)") print(f"n_stable : mean={st.mean():.2f} hist={np.bincount(st, minlength=5)[:5]}") print(f"budget : mean={bud.mean():.2f} hist={np.bincount(bud, minlength=5)[:5]}") nz = ic > 0 print(f"\nAmong steps with |I^c_t|>0: mean |I^c_t| = {ic[nz].mean():.2f}, " f"mean stable = {st[nz].mean():.2f}, stable fraction = {st[nz].sum()/ic[nz].sum():.3f}") print("\nIf |I^c_t| is large but n_stable ~ 0, the argmax-stability heuristic is the") print("bottleneck. If |I^c_t| itself is ~1, the top-V intersection is the bottleneck.") print("===========================================================") EOF