anhtld commited on
Commit
2dcb0bb
·
verified ·
1 Parent(s): c5c2cb0

auto-sync 2026-07-03T05:15:49Z workspace

Browse files
.gitattributes CHANGED
@@ -332,3 +332,4 @@ workspace/.ruff_cache/0.11.0/12081128191645237323 filter=lfs diff=lfs merge=lfs
332
  workspace/.ruff_cache/0.11.0/745700607099193584 filter=lfs diff=lfs merge=lfs -text
333
  workspace/results/generator_v2_positive_tangent_targets.json filter=lfs diff=lfs merge=lfs -text
334
  workspace/outputs/hf_verify_latest/final_pdf/workspace/latex/main.pdf filter=lfs diff=lfs merge=lfs -text
 
 
332
  workspace/.ruff_cache/0.11.0/745700607099193584 filter=lfs diff=lfs merge=lfs -text
333
  workspace/results/generator_v2_positive_tangent_targets.json filter=lfs diff=lfs merge=lfs -text
334
  workspace/outputs/hf_verify_latest/final_pdf/workspace/latex/main.pdf filter=lfs diff=lfs merge=lfs -text
335
+ workspace/outputs/hf_verify_latest/context_turn/workspace/latex/main.pdf filter=lfs diff=lfs merge=lfs -text
workspace/outputs/hf_sync/hf_push_daemon_login.out CHANGED
@@ -1476,3 +1476,55 @@ Uploading... 256/28,292 files checked, 0/0 uploaded (0.00B transferred), 0 commi
1476
  Uploading... 1,280/28,292 files checked, 17/17 uploaded (0.00B transferred), 601 committed in 1 commit(s)
1477
  Uploading... 5,888/28,292 files checked, 115/115 uploaded (0.00B transferred), 5,038 committed in 1 commit(s)
1478
  Uploading... 12,032/28,292 files checked, 120/120 uploaded (0.00B transferred), 11,343 committed in 1 commit(s)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1476
  Uploading... 1,280/28,292 files checked, 17/17 uploaded (0.00B transferred), 601 committed in 1 commit(s)
1477
  Uploading... 5,888/28,292 files checked, 115/115 uploaded (0.00B transferred), 5,038 committed in 1 commit(s)
1478
  Uploading... 12,032/28,292 files checked, 120/120 uploaded (0.00B transferred), 11,343 committed in 1 commit(s)
1479
+ Uploading... 22,272/28,292 files checked, 129/129 uploaded (0.00B transferred), 21,725 committed in 1 commit(s)
1480
+ Upload completed in 4 commits.
1481
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1482
+ [2026-07-03T04:59:44Z] upload /scratch/knguy52/dovla/experiments/dovla_h16_policy_ckpt_runs -> anhtld/vla/scratch/experiments/dovla_h16_policy_ckpt_runs
1483
+ Found 1,276 files to upload
1484
+ Uploading... 256/1,276 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1485
+ No files have been modified since last commit. Skipping to prevent empty commit.
1486
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1487
+ [2026-07-03T05:00:11Z] upload /scratch/knguy52/dovla/experiments/dovla_h16_rollout_runs -> anhtld/vla/scratch/experiments/dovla_h16_rollout_runs
1488
+ Found 51 files to upload
1489
+ Uploading... 51/51 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1490
+ No files have been modified since last commit. Skipping to prevent empty commit.
1491
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1492
+ [2026-07-03T05:00:14Z] upload /scratch/knguy52/dovla/experiments/h16_merged_dataset -> anhtld/vla/scratch/experiments/h16_merged_dataset
1493
+ Found 49 files to upload
1494
+ Uploading... 49/49 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1495
+ No files have been modified since last commit. Skipping to prevent empty commit.
1496
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1497
+ [2026-07-03T05:00:18Z] upload /scratch/knguy52/dovla/experiments/six_task_h16_collection -> anhtld/vla/scratch/experiments/six_task_h16_collection
1498
+ Found 77 files to upload
1499
+ Uploading... 77/77 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1500
+ No files have been modified since last commit. Skipping to prevent empty commit.
1501
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1502
+ [2026-07-03T05:00:22Z] upload /scratch/knguy52/dovla/experiments/embedding_cache -> anhtld/vla/scratch/experiments/embedding_cache
1503
+ Found 0 files to upload
1504
+ No files have been modified since last commit. Skipping to prevent empty commit.
1505
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1506
+ [2026-07-03T05:00:23Z] upload /scratch/knguy52/dovla/cache -> anhtld/vla/scratch/cache
1507
+ Found 10 files to upload
1508
+ Uploading... 10/10 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1509
+ No files have been modified since last commit. Skipping to prevent empty commit.
1510
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1511
+ [2026-07-03T05:00:38Z] upload /scratch/knguy52/dovla/caches -> anhtld/vla/scratch/caches
1512
+ Found 3 files to upload
1513
+ Uploading... 3/3 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1514
+ No files have been modified since last commit. Skipping to prevent empty commit.
1515
+ url=https://huggingface.co/anhtld/vla/commit/551d8423bd0984fe9129cae561f74edd62357a01
1516
+ [2026-07-03T05:00:41Z] upload /lustre09/project/6037638/knguy52/vla/outputs/hf_sync/last_manifest.json -> anhtld/vla/manifests/hf_sync_last_manifest.json
1517
+ /lustre09/project/6037638/knguy52/vla/.venv/lib/python3.11/site-packages/huggingface_hub/cli/upload.py:189: UserWarning: Ignoring --exclude since a single file is uploaded.
1518
+ warnings.warn("Ignoring --exclude since a single file is uploaded.")
1519
+ url=https://huggingface.co/anhtld/vla/commit/c5c2cb0ee0b928cee1bcd90b2b8952f7a05162a8
1520
+ [2026-07-03T05:00:43Z] sync complete
1521
+ [2026-07-03T05:00:43Z] sync cycle succeeded
1522
+ [2026-07-03T05:15:43Z] checking Hugging Face auth
1523
+ [2026-07-03T05:15:49Z] sync start repo=anhtld/vla type=model dry_run=0
1524
+ [2026-07-03T05:15:49Z] upload /lustre09/project/6037638/knguy52/vla -> anhtld/vla/workspace
1525
+ Found 28,301 files to upload
1526
+ Uploading... 256/28,301 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1527
+ Uploading... 256/28,301 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1528
+ Uploading... 256/28,301 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1529
+ Uploading... 256/28,301 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
1530
+ Uploading... 256/28,301 files checked, 0/0 uploaded (0.00B transferred), 0 committed in 0 commit(s)
workspace/outputs/hf_sync/hf_sync.log CHANGED
@@ -302,3 +302,15 @@
302
  [2026-07-03T04:52:00Z] checking Hugging Face auth
303
  [2026-07-03T04:52:03Z] sync start repo=anhtld/vla type=model dry_run=0
304
  [2026-07-03T04:52:04Z] upload /lustre09/project/6037638/knguy52/vla -> anhtld/vla/workspace
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  [2026-07-03T04:52:00Z] checking Hugging Face auth
303
  [2026-07-03T04:52:03Z] sync start repo=anhtld/vla type=model dry_run=0
304
  [2026-07-03T04:52:04Z] upload /lustre09/project/6037638/knguy52/vla -> anhtld/vla/workspace
305
+ [2026-07-03T04:59:44Z] upload /scratch/knguy52/dovla/experiments/dovla_h16_policy_ckpt_runs -> anhtld/vla/scratch/experiments/dovla_h16_policy_ckpt_runs
306
+ [2026-07-03T05:00:11Z] upload /scratch/knguy52/dovla/experiments/dovla_h16_rollout_runs -> anhtld/vla/scratch/experiments/dovla_h16_rollout_runs
307
+ [2026-07-03T05:00:14Z] upload /scratch/knguy52/dovla/experiments/h16_merged_dataset -> anhtld/vla/scratch/experiments/h16_merged_dataset
308
+ [2026-07-03T05:00:18Z] upload /scratch/knguy52/dovla/experiments/six_task_h16_collection -> anhtld/vla/scratch/experiments/six_task_h16_collection
309
+ [2026-07-03T05:00:22Z] upload /scratch/knguy52/dovla/experiments/embedding_cache -> anhtld/vla/scratch/experiments/embedding_cache
310
+ [2026-07-03T05:00:23Z] upload /scratch/knguy52/dovla/cache -> anhtld/vla/scratch/cache
311
+ [2026-07-03T05:00:38Z] upload /scratch/knguy52/dovla/caches -> anhtld/vla/scratch/caches
312
+ [2026-07-03T05:00:41Z] upload /lustre09/project/6037638/knguy52/vla/outputs/hf_sync/last_manifest.json -> anhtld/vla/manifests/hf_sync_last_manifest.json
313
+ [2026-07-03T05:00:43Z] sync complete
314
+ [2026-07-03T05:15:43Z] checking Hugging Face auth
315
+ [2026-07-03T05:15:49Z] sync start repo=anhtld/vla type=model dry_run=0
316
+ [2026-07-03T05:15:49Z] upload /lustre09/project/6037638/knguy52/vla -> anhtld/vla/workspace
workspace/outputs/hf_sync/hf_sync_daemon.log CHANGED
@@ -30,3 +30,4 @@
30
  [2026-07-03T03:35:36Z] sync cycle succeeded
31
  [2026-07-03T04:03:51Z] sync cycle succeeded
32
  [2026-07-03T04:37:00Z] sync cycle succeeded
 
 
30
  [2026-07-03T03:35:36Z] sync cycle succeeded
31
  [2026-07-03T04:03:51Z] sync cycle succeeded
32
  [2026-07-03T04:37:00Z] sync cycle succeeded
33
+ [2026-07-03T05:00:43Z] sync cycle succeeded
workspace/outputs/hf_sync/last_manifest.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "generated_utc": "2026-07-03T04:52:04.076391+00:00",
3
  "repo_id": "anhtld/vla",
4
  "project_dir": "/lustre09/project/6037638/knguy52/vla",
5
  "scratch_root": "/scratch/knguy52/dovla",
 
1
  {
2
+ "generated_utc": "2026-07-03T05:15:49.742426+00:00",
3
  "repo_id": "anhtld/vla",
4
  "project_dir": "/lustre09/project/6037638/knguy52/vla",
5
  "scratch_root": "/scratch/knguy52/dovla",
workspace/outputs/hf_verify_latest/context_turn/workspace/latex/main.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2b75eef021b3ac7bc0a4a1108c1382d591610a7f0c0c6d8099456925e776453
3
+ size 334898
workspace/outputs/hf_verify_latest/context_turn/workspace/latex/main.tex ADDED
@@ -0,0 +1,573 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ \documentclass[10pt]{article}
2
+
3
+ \usepackage[margin=1in]{geometry}
4
+ \usepackage{booktabs}
5
+ \usepackage{amsmath}
6
+ \usepackage{amssymb}
7
+ \usepackage{amsthm}
8
+ \usepackage{graphicx}
9
+ \usepackage{xcolor}
10
+ \usepackage{hyperref}
11
+ \hypersetup{
12
+ pdftitle={Counterfactual Action Atlas: Learning Local Causal Geometry for Vision-Language-Action Control},
13
+ pdfauthor={DoVLA-CIL Working Draft},
14
+ pdfsubject={CIL-Atlas diagnostic draft with measured CTT rollout and utility-energy selector diagnostics},
15
+ }
16
+
17
+ \title{Counterfactual Action Atlas: Learning Local Causal Geometry for Vision-Language-Action Control}
18
+ \author{DoVLA-CIL Working Draft}
19
+ \date{\today}
20
+
21
+ \newcommand{\cil}{\textsc{CIL}}
22
+ \newcommand{\atlas}{\textsc{CIL-Atlas}}
23
+ \newcommand{\ctt}{\textsc{CTT}}
24
+ \newcommand{\bench}{\textsc{CILBench}}
25
+ \newcommand{\dovla}{\textsc{DoVLA}}
26
+ \newcommand{\pptc}{\ensuremath{\mathrm{PPTC}}}
27
+ \newcommand{\outcomeptr}{\ensuremath{\mathrm{OutcomePTR}}}
28
+
29
+ \newtheorem{definition}{Definition}
30
+ \newtheorem{theorem}{Theorem}
31
+ \newtheorem{proposition}{Proposition}
32
+
33
+ \begin{document}
34
+ \maketitle
35
+
36
+ \begin{abstract}
37
+ Vision-language-action policies are usually trained from demonstrations that
38
+ show what the robot did, but not what would have happened under nearby actions.
39
+ We introduce the Counterfactual Action Atlas, a same-state interventional
40
+ framework for measuring, learning, generating, and evaluating local causal
41
+ action tangents. A \bench{} chart restores the identical state and instruction,
42
+ executes multiple action chunks, and measures which tangents cause recovery,
43
+ progress, failure, collision, or success. The current six-task diagnostic shows
44
+ why this object matters: direct h=16 behavior cloning reaches 29.74\% success,
45
+ deployment-clean residual transport reaches 38.90\%, its top-8 proposal oracle
46
+ reaches 44.35\%, and the hidden same-state no-expert chart reaches 56.99\%.
47
+ This decomposes failure into proposal-support and selector gaps. The current
48
+ \atlas{} instance implements Causal Tangent Transport (\ctt{}), which starts
49
+ from measured train positive tangents and learns
50
+ $T_{\phi}(z_s,z_t,\xi_s^+)\rightarrow \xi_t^+$, transporting a positive
51
+ do-action tangent from a nearby source chart into the current target chart.
52
+ Measured validation and test rollouts confirm the support story but not yet a
53
+ final deployment method: on test charts, the generated proposal oracle reaches
54
+ 50.69\% success and \outcomeptr{}@8 reaches 52.78\%, while the selected action
55
+ falls to 22.22\%, exposing an unsolved calibrated-dominance problem. We keep
56
+ the metric boundary explicit: \outcomeptr{} is reported only after generated
57
+ candidates are rolled out, while distance-only support diagnostics are
58
+ \pptc{}. These runs are therefore diagnostic evidence for the Atlas thesis and
59
+ the next selector/generator gate, not an unqualified SOTA claim.
60
+ \end{abstract}
61
+
62
+ \section{Introduction}
63
+
64
+ Standard imitation collapses a state into one demonstrated action. For
65
+ manipulation this is the wrong unit of supervision. The same visual state and
66
+ instruction may admit a successful lateral correction, a smooth no-op, a
67
+ collision, a wrong-object move, and a recovery tangent. The missing information
68
+ is not merely more demonstrations or a larger decoder; it is measured
69
+ same-state interventional geometry:
70
+ \[
71
+ \text{for the same }(s,\ell),\quad
72
+ \text{which } do(a_i) \text{ causally improves or destroys the outcome?}
73
+ \]
74
+
75
+ The current diagnostic makes this geometry visible. Clean residual transport
76
+ improves success by 9.16 points over the direct h=16 policy. However, the
77
+ proposal oracle inside the clean top-8 prefix is only 5.45 points above the
78
+ deployed selector, while the gap from that proposal oracle to the hidden
79
+ same-state no-expert chart is 12.64 points. The bottleneck is therefore support:
80
+ the method must generate actions that lie on positive causal tangent support,
81
+ not merely rescore a fixed candidate set.
82
+
83
+ This draft follows one spine. \atlas{} turns robot action learning from one
84
+ demonstrated action per state into local causal action geometry: for the same
85
+ visual state and instruction, what action tangents actually cause recovery,
86
+ progress, failure, collision, or success? \bench{} defines the chart primitive.
87
+ Causal Action Regret decomposes deployment failure into proposal support and
88
+ selector terms. \ctt{} is the current transport generator inside the Atlas: it
89
+ transports measured train positive tangents into target charts. Baselines such
90
+ as residual retrieval, generic CVAE/flow generation, and Gaussian field search
91
+ are kept as diagnostics for why noise-initialized or off-manifold proposal
92
+ search is insufficient.
93
+
94
+ \paragraph{Contributions.}
95
+ \begin{itemize}
96
+ \item We define \bench{}, a same-state interventional chart format for VLA
97
+ manipulation, with train-only outcome visibility and evaluator-only
98
+ validation/test outcomes.
99
+ \item We implement canonical metrics that separate measured outcomes from
100
+ geometry proxies: BranchCAR, \outcomeptr{}@K, SelectorRegret@K,
101
+ SupportGap, \pptc{}@K, NegativeNear, and proxy support distance.
102
+ \item We introduce \atlas{}, an object-centric representation hypothesis for
103
+ local causal action geometry. The current implementation is \ctt{}, a
104
+ transport operator
105
+ $T_{\phi}(z_s,z_t,\xi_s^+)\rightarrow\xi_t^+$ that starts from measured
106
+ positive source tangents rather than ambient noise.
107
+ \item We provide leakage-audited chart exports, data accounting, local
108
+ positive-memory baselines, residual/gated \ctt{} proxy comparisons, and
109
+ measured validation/test generated-candidate rollouts. We report them
110
+ honestly as geometry and gate evidence, not as final deployment success.
111
+ \end{itemize}
112
+
113
+ \section{Related Work}
114
+
115
+ \paragraph{VLA policies and fine-tuning.}
116
+ OpenVLA demonstrates that open VLA backbones can be fine-tuned for generalist
117
+ manipulation from large robot datasets~\cite{kim2024openvla}. OpenVLA-OFT
118
+ shows that parallel decoding, action chunking, continuous actions, and simple
119
+ regression objectives substantially improve fine-tuning efficiency and LIBERO
120
+ performance~\cite{kim2025openvlaoft}. These methods improve the base policy
121
+ that produces $a_b$ in our framework. They do not by themselves provide
122
+ same-state alternatives or measured do-action contrasts.
123
+
124
+ \paragraph{Test-time sampling, verification, and abstention.}
125
+ RoboMonkey scales VLA inference by sampling candidate actions and selecting
126
+ with a VLM-based verifier~\cite{kwok2025robomonkey}. VeriSpace adds 3D-aware
127
+ scene encoding and spatially grounded action reasoning for verifier-based
128
+ selection~\cite{zhao2026verispace}. BOKBO highlights a safety failure of
129
+ best-of-$K$: when all candidates are bad, the verifier-best action can still be
130
+ unsafe, motivating calibrated abstention~\cite{singh2026bokbo}. \ctt{} is
131
+ orthogonal: it targets proposal support by transporting measured positive
132
+ tangents before scoring or abstention.
133
+
134
+ \paragraph{Counterfactual robot data and benchmarks.}
135
+ CAST uses counterfactual language/action labels to improve instruction
136
+ following without new intervention rollouts~\cite{glossop2025cast}. In
137
+ contrast, \bench{} measures $Y\mid do(a),s,\ell$ through same-state action
138
+ execution. ManiSkill3 supplies GPU-parallel simulation and rendering for
139
+ scalable manipulation experiments~\cite{tao2024maniskill3}; VLABench stresses
140
+ long-horizon language-conditioned manipulation~\cite{zhang2024vlabench};
141
+ RoboTwin~2.0 targets scalable bimanual data generation~\cite{chen2025robotwin2};
142
+ and LIBERO studies lifelong transfer across language-conditioned manipulation
143
+ suites~\cite{liu2023libero}. These benchmarks motivate broader evaluation once
144
+ the current CTT support gate is passed.
145
+
146
+ \section{CILBench}
147
+
148
+ \subsection{Same-State Charts}
149
+
150
+ A \bench{} group is a local chart
151
+ \[
152
+ C(s,\ell)=\{(o,\ell,a_i,y_i)\}_{i=1}^{K},
153
+ \]
154
+ where every branch executes $do(a_i)$ from the same restored simulator state
155
+ $s$, observation $o$, and instruction $\ell$. Because the state is fixed, a
156
+ within-chart difference
157
+ \[
158
+ Y(a_i)-Y(a_j)
159
+ \]
160
+ is a same-state causal contrast between interventions $do(a_i)$ and $do(a_j)$.
161
+ This is not subjective preference data. It is measured intervention data for
162
+ robot action chunks.
163
+
164
+ Each branch stores an action chunk, branch family, rollout trace reference, and
165
+ outcome vector
166
+ \[
167
+ y_i=[s_i,p_i,c_i,v_i,q_i,e_i,r_i],
168
+ \]
169
+ for terminal success, dense progress, contact quality, safety violation,
170
+ task-stage quality, smoothness, and recovery. A scalar utility $U(y_i)$ is used
171
+ for ranking and CAR, while reports should keep the components visible.
172
+
173
+ \subsection{Splits and Leakage Contract}
174
+
175
+ The train split is the only split allowed to expose outcomes to retrieval,
176
+ generation, and utility training. Validation and test chart DBs are
177
+ evaluator-only: their outcomes may be loaded by metric scripts, but their
178
+ indexes are not retrieval indexes and must not be loaded by deployment-time
179
+ proposal or selection code. This is the contract required for a
180
+ deployment-clean method: no same-state validation rewards at inference, no
181
+ expert proposals, and no hidden simulator state at selection time.
182
+
183
+ \begin{table}[t]
184
+ \centering
185
+ \caption{Scripted chart data accounting. Counts are generated by
186
+ \texttt{scripts/build\_data\_accounting.py}. Train rows expose outcomes for
187
+ training; validation/test rows expose outcomes only to evaluator scripts.}
188
+ \label{tab:data-accounting}
189
+ \scriptsize
190
+ \input{../runs/data_accounting/table}
191
+ \end{table}
192
+
193
+ The current leakage audit over \texttt{data/cil\_charts/\{train,val,test\}}
194
+ passes with zero violations. The train index contains 2,044 charts and 32,704
195
+ rows; the complete split export contains 2,873 charts and 45,968 rows.
196
+
197
+ \section{Metrics}
198
+
199
+ For one chart, let $a_b$ be the base action and let $U(\cdot)$ be measured
200
+ utility when outcomes are available. Branch Causal Action Regret is
201
+ \[
202
+ \mathrm{BranchCAR}=U(a^*_{\mathcal A})-U(a_m),
203
+ \qquad
204
+ a^*_{\mathcal A}=\arg\max_{a\in\mathcal A} U(a).
205
+ \]
206
+
207
+ \paragraph{Measured proposal metrics.}
208
+ Generated candidates may be called successful only after they are rolled out or
209
+ otherwise evaluated by the benchmark. Outcome-positive proposal recall is
210
+ \[
211
+ \outcomeptr@K=
212
+ \mathbb{1}\left[\exists \hat a_k\in P_K:
213
+ U(\hat a_k)>U(a_b)+\epsilon\right].
214
+ \]
215
+ Selector Regret inside the measured proposal prefix is
216
+ \[
217
+ \mathrm{SelectorRegret@K}
218
+ =U(a^*_{P_K})-U(a_{\mathrm{selected}}).
219
+ \]
220
+ Support Gap is
221
+ \[
222
+ \mathrm{SupportGap}
223
+ =U(a^*_{\mathrm{hidden\ chart}})-U(a^*_{P_K}).
224
+ \]
225
+ These metrics are invalid for distance-only candidates.
226
+
227
+ \paragraph{Proxy geometry metrics.}
228
+ When generated candidates have not been rolled out, this draft reports support
229
+ geometry as \pptc{}:
230
+ \[
231
+ \pptc@K(\tau)=
232
+ \mathbb{1}\left[
233
+ \min_{\hat\xi_k\in P_K,\xi^+\in \Xi^+}
234
+ d_{\mathrm{RMS}}(\hat\xi_k,\xi^+) \le \tau
235
+ \right].
236
+ \]
237
+ NegativeNear@K reports the fraction of generated tangents within threshold of a
238
+ measured negative tangent. PosCloserThanNeg and proxy support distance summarize
239
+ whether the generated set lies nearer to positive support than to negative
240
+ support. These are geometry diagnostics, not outcome success.
241
+
242
+ \section{Counterfactual Action Atlas}
243
+
244
+ \atlas{} is the local causal geometry learned from same-state charts. Its
245
+ deployment object is not a single action label, but a field over candidate
246
+ tangents: which nearby action corrections are positive, negative, recoverable,
247
+ unsafe, or unsupported for the current observation and instruction. The current
248
+ implemented generator is \ctt{}, a positive-tangent transport method. It does
249
+ not start from Gaussian noise and then optimize a learned field off-manifold.
250
+ It starts from measured train positives:
251
+ \[
252
+ \Delta U_i = U(a_i)-U(a_b),\qquad
253
+ \xi_i^+=\psi(a_i-a_b)\quad \text{if } \Delta U_i>\epsilon .
254
+ \]
255
+ For a source chart token $z_s$, target chart token $z_t$, and measured source
256
+ positive tangent $\xi_s^+$, the model predicts
257
+ \[
258
+ \hat\xi_t^+=T_{\phi}(z_s,z_t,\xi_s^+).
259
+ \]
260
+ The implemented residual and gated residual \ctt{} variants are
261
+ \[
262
+ \hat\xi_t = \xi_s^+ + \Delta_{\phi}(z_s,z_t,\xi_s^+),
263
+ \]
264
+ \[
265
+ \hat\xi_t =
266
+ g_{\phi}(z_s,z_t,\xi_s^+)\odot\xi_s^+
267
+ +(1-g_{\phi}(z_s,z_t,\xi_s^+))\odot
268
+ \Delta_{\phi}(z_s,z_t,\xi_s^+).
269
+ \]
270
+
271
+ \paragraph{Training loss.}
272
+ The current implementation trains on outcome-visible train charts. For each
273
+ nearby same-task source-target pair, it minimizes one-sided positive alignment,
274
+ a negative boundary penalty, and a cycle consistency term:
275
+ \[
276
+ \mathcal L =
277
+ \lambda_+\min_{\xi_t^+\in\Xi_t^+}\|\hat\xi_t-\xi_t^+\|_2^2
278
+ + \lambda_-\max(0,m-d(\hat\xi_t,\Xi_t^-))
279
+ + \lambda_c\|T_{\phi}(z_t,z_s,\hat\xi_t)-\xi_s^+\|_2^2.
280
+ \]
281
+ The first implementation uses exported base-action summaries as chart features.
282
+ This is an engineering limitation, not the intended Atlas representation. The
283
+ next chart export should include visual-language tokens, target/distractor
284
+ object tokens, robot/contact-region tokens, and object-centric tangent frames.
285
+
286
+ \paragraph{Deployment plan.}
287
+ At test time, \atlas{} should sample or retrieve positive tangents, decode them
288
+ into candidate action chunks, score their causal utility, and execute only if a
289
+ calibrated lower confidence bound says the best tangent dominates the base
290
+ action. The current \ctt{} implementation retrieves nearby train positive source
291
+ tangents, transports them into the current chart, and decodes the public 21D
292
+ tangent summary as three residual keyframes with linear interpolation into an
293
+ action chunk. This is an auditable engineering decoder, not a lossless
294
+ reconstruction of the hidden branch action.
295
+
296
+ \input{../paper/sections/theory}
297
+
298
+ \section{Current Evidence}
299
+
300
+ We evaluate six ManiSkill manipulation diagnostics with clean rows that do not
301
+ use same-state validation proposals, same-state validation rewards, or expert
302
+ proposals at deployment. Same-state rows are diagnostic oracles that reveal
303
+ local chart geometry.
304
+
305
+ \input{tables/main_results}
306
+ \input{tables/car_decomposition}
307
+
308
+ Table~\ref{tab:car-decomposition} is the central diagnostic. It says that the
309
+ current residual baseline learns a useful local utility field, but the larger
310
+ remaining bottleneck is proposal support.
311
+
312
+ \subsection{Baselines and Failure Modes}
313
+
314
+ \input{tables/source_score_sweep}
315
+ \input{tables/selector_calibration}
316
+
317
+ Residual transport V0, utility-weighted residual retrieval V1, negative-margin
318
+ reranking, barycentric chart synthesis, CVAE generators, and flow generators are
319
+ diagnostic baselines. V1 does not beat V0. Negative-margin reranking does not
320
+ replace local positive support. Raw-action CVAE and spline flow variants can be
321
+ safe under NegativeNear, but collapse strict positive support. These failures
322
+ motivate \ctt{}: positive support should be transported from measured positive
323
+ chart tangents, with negative tangents defining boundaries, rather than sampled
324
+ from ambient noise.
325
+
326
+ Previous distance-only memory and local-atlas diagnostics must be read as
327
+ \pptc{}, not \outcomeptr{}. The train-only positive memory reaches 11.83\%
328
+ \pptc{}@16 at threshold 0.20 and 41.94\% at threshold 0.40. Local-atlas
329
+ retrieval reaches 23.66\% \pptc{}@16 at threshold 0.20 and 52.69\% at threshold
330
+ 0.40, with 5.33\% NegativeNear at threshold 0.20. These numbers support the
331
+ local organization of positive tangents, but they are not measured rollout
332
+ success.
333
+
334
+ \subsection{CTT Smoke Artifact}
335
+
336
+ \begin{table}[t]
337
+ \centering
338
+ \caption{First residual \ctt{} proxy smoke on train self-target charts. This
339
+ table is an artifact check, not validation/test performance and not
340
+ \outcomeptr{}. The 0.20 NegativeNear value exceeds the current safety gate, so
341
+ the run should not be claimed as method success.}
342
+ \label{tab:ctt-smoke}
343
+ \scriptsize
344
+ \input{../runs/ctt_residual_smoke_proxy/table}
345
+ \end{table}
346
+
347
+ The first residual \ctt{} smoke trains on 16 train charts and evaluates
348
+ train self-target proxy geometry. It reaches perfect \pptc{} in this small
349
+ self-target setting, but NegativeNear@16 at threshold 0.20 is 10.10\%, above
350
+ the local-atlas reference of 5.33\% by more than one point. Therefore the gate
351
+ for rollout is not passed. The correct conclusion is that the code path and
352
+ artifact contract now exist; the method still needs a safer validation-scale
353
+ transport run before any outcome claim.
354
+
355
+ A gated residual smoke run is safer in this same tiny setting
356
+ (50.00\% \pptc{}@16 at threshold 0.20 and 5.73\% NegativeNear@16 at threshold
357
+ 0.20), but it is still train self-target proxy evidence. It is a candidate for
358
+ the next validation-scale proxy sweep, not a paper result.
359
+
360
+ \subsection{Validation Proxy Gate}
361
+
362
+ \begin{table}[t]
363
+ \centering
364
+ \caption{Validation proxy comparison on 69 validation charts with measured
365
+ positive tangents, using train-only source positives. The gate column is
366
+ proxy-only: it requires no more than one point higher NegativeNear@0.20 than
367
+ local-atlas and improvement on \pptc{}@0.20, \pptc{}@0.40, or mean positive
368
+ distance. Passing this gate permits rollout evaluation; it is not
369
+ \outcomeptr{} or measured success.}
370
+ \label{tab:ctt-val-proxy}
371
+ \scriptsize
372
+ \resizebox{\linewidth}{!}{\input{../runs/ctt_val_proxy_comparison/table}}
373
+ \end{table}
374
+
375
+ Table~\ref{tab:ctt-val-proxy} is the first three-seed validation support-geometry
376
+ artifact. Residual \ctt{} lowers mean positive distance relative to local-atlas
377
+ and keeps NegativeNear@0.20 within the one-point safety slack, but it does not
378
+ beat local-atlas on \pptc{} coverage. Gated residual \ctt{} lowers mean positive
379
+ distance further, but the three-seed NegativeNear@0.20 average exceeds the
380
+ safety slack, so it fails the proxy gate. The honest interpretation is that
381
+ residual \ctt{} is eligible for measured rollout, while the support/safety
382
+ tradeoff remains unresolved.
383
+
384
+ \subsection{Measured Rollout Harness}
385
+
386
+ The first measured \ctt{} rollout artifact now exists:
387
+ \texttt{scripts/eval\_ctt\_generated\_rollout.py} generates train-positive
388
+ transport candidates, decodes them into action chunks, restores the validation
389
+ state, executes base plus generated candidates in ManiSkill, and writes measured
390
+ rows consumable by \texttt{scripts/eval\_metrics.py}. On CPU backends it falls
391
+ back to sequential same-state restores because ManiSkill does not allow
392
+ multi-environment CPU vectorization.
393
+
394
+ A one-chart smoke run at K=2 verifies the measured path and restore accuracy
395
+ (\texttt{runs/ctt\_residual\_rollout\_direct\_smoke\_seed0\_v3}), but it does
396
+ not support a method-success claim: \outcomeptr{}@2 is 0.0000 and the generated
397
+ candidates underperform the measured base action on that chart. This negative
398
+ smoke is useful because it protects the paper from reclassifying \pptc{} proxy
399
+ evidence as outcome success.
400
+
401
+ \begin{table}[t]
402
+ \centering
403
+ \caption{Measured residual \ctt{} rollout on 69 validation positive-support
404
+ charts across three train seeds, K=8. Generated candidates are decoded and
405
+ executed from restored simulator states; these are measured outcome metrics,
406
+ not \pptc{} proxies.}
407
+ \label{tab:ctt-val-rollout}
408
+ \scriptsize
409
+ \resizebox{\linewidth}{!}{\input{../runs/ctt_val_rollout_comparison/table}}
410
+ \end{table}
411
+
412
+ Table~\ref{tab:ctt-val-rollout} is the first non-proxy \ctt{} validation
413
+ evidence. Across 207 measured rows, \outcomeptr{}@8 is 0.4589 with a 95\%
414
+ bootstrap interval of [0.3913, 0.5314]. This shows that transported positive
415
+ tangents often find actions that beat the base action. At the same time,
416
+ selected success is only 24.15\%, below the measured base success of 28.50\%.
417
+ The proposal oracle is 37.68\%, the hidden same-state chart oracle is 66.67\%,
418
+ the success support gap is 29.47 points, and the success selector gap is 13.53
419
+ points. The validation result supports the paper's support-gap story more than
420
+ it supports an unqualified deployment claim.
421
+
422
+ \begin{table}[t]
423
+ \centering
424
+ \caption{Measured residual \ctt{} rollout on 48 test positive-support charts
425
+ across three train seeds, K=8. The generated proposal oracle crosses the
426
+ internal 50\% support target, but the selected action fails because the current
427
+ score/dominance rule chooses poor candidates.}
428
+ \label{tab:ctt-test-rollout}
429
+ \scriptsize
430
+ \resizebox{\linewidth}{!}{\input{../runs/ctt_test_rollout_comparison/table}}
431
+ \end{table}
432
+
433
+ Table~\ref{tab:ctt-test-rollout} gives the current clean test gate. Across 144
434
+ measured rows, \outcomeptr{}@8 is 52.78\% with a 95\% bootstrap interval of
435
+ [44.44, 60.42], proposal-oracle success is 50.69\%, and hidden chart oracle
436
+ success is 72.92\%. This is the strongest evidence so far that learned
437
+ positive-tangent transport can improve proposal support. However, selected
438
+ success is 22.22\%, below the measured base success of 28.47\%, and the success
439
+ selector gap is 28.47 points. The immediate next method step is therefore not
440
+ another proxy generator claim; it is calibrated causal dominance and utility
441
+ selection that refuse to execute generated actions unless they confidently
442
+ dominate the base.
443
+
444
+ \begin{table}[t]
445
+ \centering
446
+ \caption{Validation-calibrated dominance fallback evaluated on the measured
447
+ test rollout. The threshold and conformal residual quantile are fit on
448
+ validation rows only; test outcomes are used only for reporting. The fallback
449
+ reduces coverage but does not yet repair selector transfer.}
450
+ \label{tab:ctt-dominance}
451
+ \scriptsize
452
+ \resizebox{\linewidth}{!}{\input{../runs/ctt_dominance_val_to_test/table}}
453
+ \end{table}
454
+
455
+ Table~\ref{tab:ctt-dominance} tests the decision rule requested by the method:
456
+ execute a generated tangent only when a calibrated lower confidence bound on
457
+ $F(a)-F(a_b)$ exceeds a threshold. On validation, the auto threshold improves
458
+ selected success from 24.15\% to 30.92\% at 39.61\% coverage. On test, however,
459
+ the same calibrated rule reaches only 25.00\% selected success at 39.58\%
460
+ coverage, still below the 28.47\% base success. A stricter fixed $\tau=0$
461
+ variant falls back 87.50\% of the time and reaches 27.78\%, nearly the base
462
+ rate but still not an improvement. This makes the next failure mode precise:
463
+ the proposal set contains useful actions, but the current utility-energy margin
464
+ does not transfer as a reliable dominance certificate.
465
+
466
+ \begin{table}[t]
467
+ \centering
468
+ \caption{Learned dominance fallback trained on validation measured rows and
469
+ evaluated on held-out test rows. Features are deployment-visible candidate
470
+ features: utility-energy scores, score margins to base, rank, and tangent
471
+ norms. This improves over the base test success but remains far below the
472
+ paper gate.}
473
+ \label{tab:ctt-learned-dominance}
474
+ \scriptsize
475
+ \resizebox{\linewidth}{!}{\input{../runs/ctt_learned_dominance_val_to_test/table}}
476
+ \end{table}
477
+
478
+ Table~\ref{tab:ctt-learned-dominance} asks whether a small learned calibrator
479
+ can repair the selector without new rollouts. A ridge dominance model trained
480
+ only on validation measured rows reaches 30.56\% held-out test selected success
481
+ at 24.31\% coverage, improving over the 28.47\% base policy and the 22.22\%
482
+ score-only selector. This is a real selector improvement, but it is still far
483
+ from the 47--50\% target and leaves a 25.69-point success selector gap. The
484
+ evidence therefore narrows the bottleneck: transported proposals contain useful
485
+ actions, and lightweight dominance helps, but the final method needs a stronger
486
+ train-only utility-energy model and richer visual/object-centric chart tokens.
487
+ Additional validation-selected ridge variants that fit success, success-weighted
488
+ utility margin, or the transported 21D tangent code are logged as diagnostics;
489
+ their held-out test selected success ranges from 29.17\% to 29.86\%, so they do
490
+ not replace the best learned-dominance row. Deployment-visible context features
491
+ based on task id, instruction hashes, source task id, and same-task flags also
492
+ reach only 29.17\% held-out selected success. Full train-only utility-energy
493
+ checkpoints are negative across three seeds: when
494
+ \texttt{eval\_dominance\_selector.py} recomputes candidate scores from
495
+ \texttt{runs/utility\_energy\_full\_seed\{0,1,2\}}, held-out selected success is
496
+ 27.08\%, 28.47\%, and 23.61\%, below the learned ridge selector.
497
+
498
+ \section{Reproducibility Artifacts}
499
+
500
+ The current draft is backed by explicit artifacts:
501
+ \begin{itemize}
502
+ \item \texttt{cil/metrics.py} and \texttt{scripts/eval\_metrics.py} enforce
503
+ the measured/proxy metric split.
504
+ \item \texttt{scripts/export\_cil\_charts.py},
505
+ \texttt{scripts/build\_data\_accounting.py}, and
506
+ \texttt{scripts/audit\_cil\_charts.py} produce split indexes, accounting, and
507
+ leakage reports.
508
+ \item \texttt{cil/models/ctt.py}, \texttt{scripts/train\_ctt.py}, and
509
+ \texttt{scripts/eval\_ctt\_proxy.py} implement the first transport path.
510
+ \item \texttt{scripts/eval\_ctt\_generated\_rollout.py} and
511
+ \texttt{scripts/slurm/eval\_ctt\_generated\_rollout.sbatch} implement the
512
+ measured generated-candidate rollout path.
513
+ \item \texttt{scripts/build\_ctt\_rollout\_comparison.py} aggregates
514
+ measured validation/test rollouts and reports selected success, proposal
515
+ oracle success, hidden chart oracle success, success support gap, and success
516
+ selector gap.
517
+ \item \texttt{scripts/eval\_dominance\_selector.py} calibrates a dominance
518
+ fallback rule on validation measured rows and evaluates it on held-out test
519
+ measured rows; it can use rollout row scores or recompute scores from a
520
+ train-only utility-energy checkpoint.
521
+ \item \texttt{scripts/eval\_learned\_dominance\_selector.py} trains a small
522
+ validation-calibrated dominance model over deployment-visible candidate
523
+ features and evaluates it on held-out measured test rows; it also logs
524
+ feature/target ablations, including context metadata and tangent-code
525
+ variants, for selector diagnostics.
526
+ \item \texttt{scripts/eval\_chart\_positive\_memory\_proxy.py} and
527
+ \texttt{scripts/build\_ctt\_proxy\_comparison.py} generate the local-atlas
528
+ baseline and validation proxy gate table.
529
+ \item \texttt{scripts/check\_tangent\_reconstruction.py} verifies that the
530
+ exported 21D tangent codes are deterministic summaries of \texttt{delta\_action}.
531
+ \item \texttt{scripts/train\_utility\_energy.py} and
532
+ \texttt{scripts/calibrate\_dominance.py} implement the utility/scoring and
533
+ dominance-calibration path.
534
+ \item \texttt{scripts/summarize\_ctt\_runs.py} generates
535
+ \texttt{runs/summary\_ctt.csv} and \texttt{runs/summary\_ctt.md}.
536
+ \item \texttt{paper/notes/theory\_ctt.md} and
537
+ \texttt{paper/sections/theory.tex} state the theory obligations.
538
+ \end{itemize}
539
+
540
+ \section{Limitations and Next Steps}
541
+
542
+ This draft is not an unqualified SOTA claim. The current \ctt{} evidence
543
+ includes validation and test measured generated-candidate rollouts, but the
544
+ selected action fails the internal paper gate even when the test proposal oracle
545
+ passes 50\%. The missing method component is calibrated dominance and a better
546
+ utility selector, not another proxy-only support plot. The first standalone
547
+ train-only utility-energy checkpoints and context-metadata ridge variants do
548
+ not solve this transfer problem, so the chart token must move beyond base-action
549
+ summaries and coarse task metadata toward exported visual-language and
550
+ object-centric geometry. Related work experiments, external benchmarks, real
551
+ robot near-miss recovery, unsafe-contact measurement, and a dominance rule that
552
+ approaches the internal success gate remain to be completed before submission.
553
+
554
+ The next experimental step is concrete: replace the current weak train-only
555
+ utility-energy selector with visual-language/object-centric chart features,
556
+ rerun held-out measured dominance selection, and add unsafe execution and
557
+ fallback-rate metrics. Proxy evidence may open the rollout gate; it cannot
558
+ replace rollout measurement.
559
+
560
+ \section{Conclusion}
561
+
562
+ Same-state counterfactual charts reveal a support gap that ordinary
563
+ demonstration learning and verifier-only candidate selection cannot see.
564
+ Counterfactual Action Atlas turns that observation into a method program: learn
565
+ local causal action geometry, generate positive do-action tangents on support,
566
+ select them only under calibrated dominance, keep the metric boundary between
567
+ outcome and proxy evidence explicit, and evaluate deployment-clean improvements
568
+ only after generated candidates are measured.
569
+
570
+ \bibliographystyle{plain}
571
+ \bibliography{references}
572
+
573
+ \end{document}
workspace/outputs/hf_verify_latest/context_turn/workspace/reports/2026-07-03.md ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Daily Report: 2026-07-03
2
+
3
+ ## Completed Code Changes
4
+
5
+ - Re-exported `data/cil_charts/{val,test}` with evaluator-only outcomes so validation/test proxy metrics can use measured positive/negative support without making those splits retrieval indexes.
6
+ - Updated `scripts/audit_cil_charts.py` to allow non-train outcomes only when `audience=evaluator_only`, `retrieval_index_allowed=false`, and `deployment_must_not_read_outcomes=true`.
7
+ - Added public proxy geometry metrics in `cil/metrics.py`: mean nearest distance, candidate diversity, and collapse rate.
8
+ - Updated `scripts/eval_ctt_proxy.py` to enforce train-only source retrieval, evaluator-outcome target indexes, real per-seed export, mean positive/negative distance, diversity, and collapse metrics.
9
+ - Added `scripts/eval_chart_positive_memory_proxy.py` for train-only local-atlas/task-memory baselines on the same chart DB format as CTT.
10
+ - Added `scripts/build_ctt_proxy_comparison.py` to generate the validation proxy gate table from run logs.
11
+ - Added full proxy sweep configs and Slurm array: `configs/ctt/{residual_full,gated_residual_full}.yaml` and `scripts/slurm/train_ctt_proxy_sweep.sbatch`.
12
+ - Updated `scripts/summarize_ctt_runs.py` to include positive-memory proxy baselines and seed counts.
13
+ - Added measured CTT rollout path: `scripts/eval_ctt_generated_rollout.py` generates residual-CTT candidates, decodes the 21D start/mid/end keyframe tangent code into action chunks, restores validation states, executes base plus generated candidates, and writes `candidates_evaluated=true` rows for `scripts/eval_metrics.py`.
14
+ - Added `scripts/slurm/eval_ctt_generated_rollout.sbatch` for ManiSkill/Apptainer rollout jobs.
15
+ - Fixed the CTT rollout loader to avoid repeated `.npz` decompression, and added a CPU sequential fallback because ManiSkill `physx_cpu` does not allow `num_envs > 1`.
16
+ - Updated measured rollout metrics and summaries to report base/selected/proposal-oracle/hidden-oracle success, utility gaps, success support gap, success selector gap, outcome-vector schema, and internal paper-gate pass/fail.
17
+ - Extended `scripts/eval_learned_dominance_selector.py` with logged `--feature-set` and `--target` variants, including success-weighted and tangent-code diagnostics, while keeping the original utility-margin default unchanged.
18
+ - Extended `scripts/eval_learned_dominance_selector.py` again with deployment-visible `context` and `context_tangent` feature sets using target task id, instruction hash, source task id, and source-target task match. These features do not read evaluator-only val/test outcomes.
19
+ - Extended `scripts/eval_dominance_selector.py` with `--score-source checkpoint`, cached chart embeddings/base scores, and single-thread torch scoring so a standalone train-only utility-energy checkpoint can be used for dominance evaluation.
20
+ - Updated `scripts/train_utility_energy.py` to save `chart_dim` in checkpoints.
21
+ - Added `scripts/slurm/train_utility_energy_selector.sbatch` to train full train-only utility energy and evaluate validation-calibrated dominance on held-out test measured rows.
22
+
23
+ ## Jobs Submitted
24
+
25
+ - Submitted Slurm array `15084163` with 6 jobs:
26
+ - residual CTT, seeds 0/1/2
27
+ - gated residual CTT, seeds 0/1/2
28
+ - each job trains on train split, evaluates validation proxy, and refreshes `runs/summary_ctt.*`
29
+ - Final scheduler state: all 6 array tasks completed with exit code `0:0`.
30
+ - Submitted measured CTT rollout smoke jobs:
31
+ - `15084966`: canceled after it started before progress logging/loader fixes.
32
+ - `15085113`: failed as expected on the old vectorized CPU path with ManiSkill `Cannot set the sim backend to 'cpu' and have multiple environments`; fixed by sequential CPU fallback.
33
+ - `15085273`: submitted residual CTT measured validation rollout, seed 0, `K=8`, 16 target charts, CPU sequential fallback.
34
+ - Submitted full positive-support validation measured rollouts:
35
+ - `15085609`: residual CTT seed 0, 69 validation charts, `K=8`
36
+ - `15085610`: residual CTT seed 1, 69 validation charts, `K=8`
37
+ - `15085611`: residual CTT seed 2, 69 validation charts, `K=8`
38
+ - Slurm full jobs hit Apptainer mount instability:
39
+ - `15085609`/`15085610` were canceled after hanging before Python entry.
40
+ - `15085611` failed with `squashfuse_ll failed to mount ... in 10s`.
41
+ - `15085648` seed-2 retry was canceled after choosing direct Apptainer execution.
42
+ - Submitted utility-energy selector job:
43
+ - `15094333`: trains full train-only `scripts/train_utility_energy.py`, then evaluates `scripts/eval_dominance_selector.py --score-source checkpoint` on validation-to-test measured CTT rows.
44
+ - final scheduler state: completed with empty stderr.
45
+ - Submitted utility-energy seed-variance array:
46
+ - `15094777_[1-2]`: repeats the same train-only utility-energy and checkpoint-scored dominance path for seeds 1 and 2.
47
+ - final scheduler state: both array tasks completed with exit code `0:0` and empty stderr.
48
+
49
+ ## Jobs Completed
50
+
51
+ - Re-exported validation chart DB: 419 charts, 6,704 rows, content hash `fa0fe0e3881ee70ce91492445871614d01b3a47fc7c576659c53ff17ddee4e42`.
52
+ - Re-exported test chart DB: 410 charts, 6,560 rows, content hash `1710ede7c73d8f72479fd63dd9941a0e8bb55211d3ea0267963abc9e7a043b91`.
53
+ - Leakage audit rerun: `runs/leakage_audit/report.md`, status `pass`, 0 violations.
54
+ - Validation proxy runs completed:
55
+ - `runs/local_atlas_val_proxy`
56
+ - `runs/task_memory_val_proxy`
57
+ - `runs/ctt_residual_val_proxy`
58
+ - `runs/ctt_gated_residual_val_proxy`
59
+ - Proxy gate comparison completed: `runs/ctt_val_proxy_comparison`.
60
+ - Full CTT proxy sweep completed:
61
+ - `runs/ctt_residual_full_seed{0,1,2}`
62
+ - `runs/ctt_residual_full_seed{0,1,2}_val_proxy`
63
+ - `runs/ctt_gated_residual_full_seed{0,1,2}`
64
+ - `runs/ctt_gated_residual_full_seed{0,1,2}_val_proxy`
65
+ - Summary refreshed: `runs/summary_ctt.csv` and `runs/summary_ctt.md`.
66
+ - Direct measured rollout smoke completed: `runs/ctt_residual_rollout_direct_smoke_seed0_v3`.
67
+ - target rows: 1 validation chart
68
+ - K: 2 generated CTT candidates
69
+ - restore error: `1.49e-08`
70
+ - OutcomePTR@2: `0.0000`
71
+ - SupportGap@2: `0.1798`
72
+ - interpretation: rollout harness is real, but this smoke does not support a method-success claim because generated candidates underperform the measured base action on this chart.
73
+ - Measured residual CTT val16 subset completed: `runs/ctt_residual_rollout_val16_seed0` and aggregate `runs/ctt_val16_rollout_comparison`.
74
+ - rows: 16 validation positive-support charts
75
+ - K: 8 generated CTT candidates
76
+ - OutcomePTR@8: `0.3750` with 95% CI `[0.1250, 0.6250]`
77
+ - SelectorRegret@8 / BranchCAR@8: `0.2645`
78
+ - SupportGap@8: `0.5139`
79
+ - pairwise causal calibration ECE: `0.1330`
80
+ - max restore error: `1.49e-08`
81
+ - interpretation: first non-proxy evidence has nonzero measured improvement opportunities, but selector/support gaps remain too high for a final method-success claim.
82
+ - Full measured residual CTT validation rollout completed via direct Apptainer execution:
83
+ - seed runs: `runs/ctt_residual_rollout_val69_seed{0,1,2}`
84
+ - aggregate: `runs/ctt_val_rollout_comparison`
85
+ - rows: 207 measured rows = 69 validation positive-support charts x 3 train seeds
86
+ - OutcomePTR@8: `0.4589` with 95% CI `[0.3913, 0.5266]`
87
+ - SelectorRegret@8 / BranchCAR@8: `0.2936`
88
+ - SupportGap@8: `0.5283`
89
+ - pairwise causal calibration ECE: `0.1618`
90
+ - per-seed OutcomePTR@8: seed0 `0.4348`, seed1 `0.4348`, seed2 `0.5072`
91
+ - interpretation: CTT generates measured improvements over base often enough to be a real method result, but the large support/selector gaps mean it is not yet a clean SOTA claim.
92
+ - Full measured residual CTT test rollout completed via direct Apptainer execution:
93
+ - seed runs: `runs/ctt_residual_rollout_test_seed{0,1,2}`
94
+ - aggregate: `runs/ctt_test_rollout_comparison`
95
+ - rows: 144 measured rows = 48 test positive-support charts x 3 train seeds
96
+ - OutcomePTR@8: `0.5278` with 95% CI `[0.4444, 0.6042]`
97
+ - proposal-oracle success: `0.5069`
98
+ - selected success: `0.2222`
99
+ - base success: `0.2847`
100
+ - hidden same-state chart oracle success: `0.7292`
101
+ - success support gap: `0.2639`
102
+ - success selector gap: `0.2847`
103
+ - pairwise causal calibration ECE: `0.1730`
104
+ - max restore error: `1.49e-08`
105
+ - interpretation: test proposals cross the internal 50% proposal-oracle target, but current score-only selection is worse than base. This supports the CIL-Atlas proposal-support story and makes calibrated dominance the next required method step.
106
+ - Dominance-calibrated selector diagnostics completed:
107
+ - auto threshold run: `runs/ctt_dominance_val_to_test`
108
+ - fixed tau=0 run: `runs/ctt_dominance_val_to_test_tau0`
109
+ - learned ridge dominance run: `runs/ctt_learned_dominance_val_to_test`
110
+ - learned ridge ablations: `runs/ctt_learned_dominance_success_val_to_test`, `runs/ctt_learned_dominance_success_weighted_val_to_test`, `runs/ctt_learned_dominance_margin_ext_val_to_test`, and `runs/ctt_learned_dominance_tangent_val_to_test`
111
+ - calibration split: validation measured rollout rows only
112
+ - held-out eval split: test measured rollout rows
113
+ - auto threshold: validation selected success `0.3092` at coverage `0.3961`; test selected success `0.2500` at coverage `0.3958`
114
+ - fixed tau=0: test selected success `0.2778` at coverage `0.1250`, fallback `0.8750`
115
+ - learned ridge dominance: test selected success `0.3056` at coverage `0.2431`, fallback `0.7569`
116
+ - success/tangent ablations: held-out test selected success ranges from `0.2917` to `0.2986`, so none beats the original learned ridge utility-margin run.
117
+ - interpretation: learned validation-calibrated dominance beats the base test success `0.2847` and the score-only selector `0.2222`, but remains far below the 47.45/50.00 target and leaves a large selector gap; simply changing the ridge target or exposing the tangent code is not enough.
118
+ - Utility-energy checkpoint scorer smoke completed locally: `runs/ctt_dominance_utility_energy_smoke_val_to_test`.
119
+ - selected success `0.2222`, coverage `0.2847`, fallback `0.7153`
120
+ - interpretation: 32-chart smoke checkpoint is not useful; the submitted full train-only utility-energy job is needed before judging this path.
121
+ - Full train-only utility-energy selector job `15094333` completed:
122
+ - train artifact: `runs/utility_energy_full_seed0`
123
+ - held-out dominance artifact: `runs/ctt_dominance_utility_energy_val_to_test_seed0`
124
+ - train diagnostics: pairwise accuracy `0.6793`, pairwise causal calibration ECE `0.1237`, mean absolute outcome error `0.0346`, mean absolute utility error `1.4158`
125
+ - held-out test selector: selected success `0.2708`, coverage `0.1181`, fallback `0.8819`, proposal oracle `0.5069`, OutcomePTR@8 `0.5278`
126
+ - interpretation: the standalone train-only utility-energy checkpoint does not beat the base test success `0.2847` or the learned ridge dominance row `0.3056`; it is a negative selector diagnostic, not a method-success claim.
127
+ - Utility-energy seed-variance array `15094777_[1-2]` completed:
128
+ - seed1 train: pairwise accuracy `0.6889`, ECE `0.1300`, mean absolute utility error `1.2335`
129
+ - seed1 held-out selector: selected success `0.2847`, coverage `0.0972`, fallback `0.9028`
130
+ - seed2 train: pairwise accuracy `0.6898`, ECE `0.1296`, mean absolute utility error `0.9672`
131
+ - seed2 held-out selector: selected success `0.2361`, coverage `0.2708`, fallback `0.7292`
132
+ - interpretation: improving train diagnostics across seeds does not translate into held-out dominance. The checkpoint-scored utility-energy selector is now a stable negative result across seeds 0/1/2.
133
+ - Learned dominance context diagnostics completed:
134
+ - `runs/ctt_learned_dominance_context_val_to_test`: selected success `0.2917`, coverage `0.1806`
135
+ - `runs/ctt_learned_dominance_context_success_weighted_val_to_test`: selected success `0.2917`, coverage `0.1736`
136
+ - `runs/ctt_learned_dominance_context_tangent_val_to_test`: selected success `0.2917`, coverage `0.0903`
137
+ - interpretation: task/instruction/source-task metadata and transported tangent codes do not beat the best learned ridge selector. The missing representation is not just coarse context metadata; it must expose richer visual/object-centric chart geometry.
138
+
139
+ ## Failed Jobs And Log Excerpts
140
+
141
+ - Initial validation proxy rerun failed before producing metrics due to an indentation error introduced in `cil/metrics.py`:
142
+ `IndentationError: expected an indented block after 'if' statement`.
143
+ - Fix: corrected indentation, added/updated metrics tests, and reran successfully.
144
+ - A parallel `cat runs/ctt_val_proxy_comparison/table.tex` raced before the comparison script created the file; rerun succeeded. No artifact corruption.
145
+ - First measured CTT Slurm smoke `15085113` failed before the CPU fallback fix:
146
+ `RuntimeError: Cannot set the sim backend to 'cpu' and have multiple environments.`
147
+ - Fix: added sequential per-candidate same-state restores for `physx_cpu`; direct Apptainer smoke passed after the fix.
148
+ - Full val69 Slurm attempts exposed Apptainer mount flakiness, not model/evaluator failures. Direct Apptainer runs completed all three seeds with the same command path.
149
+
150
+ ## Best Metric Table
151
+
152
+ | Method | Seeds | Rows | PPTC@0.20 | PPTC@0.40 | NegativeNear@0.20 | Mean positive dist | Diversity | Gate |
153
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- |
154
+ | local-atlas | 1 | 69 | 0.4058 | 0.6812 | 0.0368 | 0.7203 | 0.8219 | baseline |
155
+ | task-memory | 1 | 69 | 0.3188 | 0.5362 | 0.0175 | 0.9616 | 0.9751 | baseline |
156
+ | CTT residual full | 3 | 207 | 0.1981 | 0.6087 | 0.0296 | 0.4509 | 0.2703 | proxy pass |
157
+ | CTT gated residual full | 3 | 207 | 0.2319 | 0.6135 | 0.0527 | 0.4337 | 0.1164 | proxy fail |
158
+
159
+ Interpretation: residual CTT beats local-atlas on mean positive distance while staying within the one-point NegativeNear@0.20 slack; it does not beat local-atlas on PPTC. Gated CTT improves mean positive distance but fails the safety slack in the three-seed aggregate. Residual CTT is eligible for rollout evaluation, but this is not OutcomePTR or measured success.
160
+
161
+ ## Measured Rollout Gate Table
162
+
163
+ | Split | Seeds | Rows | Base success | Selected success | Proposal oracle | Hidden oracle | OutcomePTR@8 | Success support gap | Success selector gap | Gate |
164
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- |
165
+ | validation | 3 | 207 | 0.2850 | 0.2415 | 0.3768 | 0.6667 | 0.4589 | 0.2947 | 0.1353 | fail: selected/oracle/support/selector |
166
+ | test | 3 | 144 | 0.2847 | 0.2222 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.2847 | fail: selected/support/selector |
167
+ | test + dominance auto | 3 | 144 | 0.2847 | 0.2500 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.2917 | fail: selected/support/selector |
168
+ | test + dominance tau0 | 3 | 144 | 0.2847 | 0.2778 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.2778 | fail: selected/support/selector |
169
+ | test + utility-energy checkpoint seed0 | 1 | 144 | 0.2847 | 0.2708 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.2917 | fail: selected/support/selector |
170
+ | test + utility-energy checkpoint seed1 | 1 | 144 | 0.2847 | 0.2847 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.2847 | fail: selected/support/selector |
171
+ | test + utility-energy checkpoint seed2 | 1 | 144 | 0.2847 | 0.2361 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.3056 | fail: selected/support/selector |
172
+ | test + learned dominance context | 3 | 144 | 0.2847 | 0.2917 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.2778 | fail: selected/support/selector |
173
+ | test + learned dominance | 3 | 144 | 0.2847 | 0.3056 | 0.5069 | 0.7292 | 0.5278 | 0.2639 | 0.2569 | fail: selected/support/selector |
174
+
175
+ Interpretation: the test proposal oracle clears the internal 50% support target, and learned ridge dominance now beats the base policy, but the method is still far below the selected-success gate. Standalone train-only utility-energy checkpoints do not transfer well enough across three seeds, and adding coarse deployment-visible context metadata to the ridge selector does not beat the best basic ridge row. The next paper-critical work is richer visual/object-centric chart representation plus a stronger train-only utility/dominance model, not another proxy-only generator result.
176
+
177
+ ## Leakage Audit Status
178
+
179
+ - `data/cil_charts/train`: outcomes visible, retrieval allowed.
180
+ - `data/cil_charts/val`: outcomes visible only to evaluator, retrieval forbidden.
181
+ - `data/cil_charts/test`: outcomes visible only to evaluator, retrieval forbidden.
182
+ - Cross-split chart/state overlap audit: pass.
183
+ - Expert branches remain excluded from deployment candidates by index contract.
184
+
185
+ ## Data Accounting Status
186
+
187
+ - Existing data accounting table remains valid:
188
+ - train: 2,044 charts, 32,704 branches, 1,156 positives
189
+ - val: 419 charts, 6,704 branches, 245 positives
190
+ - test: 410 charts, 6,560 branches, 159 positives
191
+ - Split hash remains `aaa857b92cbe5d455009f3ca3380e8b124908aa6c4c99fc1da408f738ed2dcf6`.
192
+
193
+ ## Paper Changes
194
+
195
+ - Updated `latex/main.tex` to describe evaluator-only val/test outcomes accurately.
196
+ - Added validation proxy gate table via `\input{../runs/ctt_val_proxy_comparison/table}`.
197
+ - Added measured rollout harness paragraph and negative one-chart smoke status.
198
+ - Replaced val16 subset table with full three-seed validation measured rollout table via `\input{../runs/ctt_val_rollout_comparison/table}`.
199
+ - Added full three-seed test measured rollout table via `\input{../runs/ctt_test_rollout_comparison/table}`.
200
+ - Added validation-calibrated dominance fallback table via `\input{../runs/ctt_dominance_val_to_test/table}`.
201
+ - Added learned dominance selector table via `\input{../runs/ctt_learned_dominance_val_to_test/table}`.
202
+ - Added a short negative-result note that success-weighted/tangent ridge variants do not beat the best learned-dominance row.
203
+ - Added full train-only utility-energy checkpoint seed variance as a negative selector diagnostic: held-out selected success `27.08%`, `28.47%`, and `23.61%`, below the learned ridge dominance row.
204
+ - Added context learned-dominance diagnostics as negative selector diagnostics: all three context variants reach only `29.17%` held-out selected success.
205
+ - Added utility-energy checkpoint scorer support to the reproducibility artifact path.
206
+ - Reframed the title/abstract around `Counterfactual Action Atlas`; CTT is now the current transport generator inside the Atlas, not the whole novelty.
207
+ - Updated limitations: current evidence includes validation/test measured rollout, but the selected action fails the acceptance gate; real-robot recovery, unsafe-contact measurement, and dominance-calibrated deployment remain missing.
208
+ - Added local-atlas/proxy-comparison scripts to the reproducibility artifact list.
209
+ - Added generated-rollout script and Slurm wrapper to the reproducibility artifact list.
210
+
211
+ ## Next Actions
212
+
213
+ 1. Replace the current weak train-only utility-energy/dominance model with richer visual-language/object-centric chart tokens; checkpoint scorers reached only `23.61%`--`28.47%` selected success across three seeds, and context metadata reached only `29.17%`.
214
+ 2. Add unsafe execution rate and calibrated fallback rate to measured rollout artifacts.
215
+ 3. Improve chart token from base-action summary to visual-language/object-centric geometry to reduce SupportGap and SelectorRegret.
216
+ 4. Rerun validation/test measured rollouts after the selector is changed, not only proxy support sweeps.
workspace/outputs/hf_verify_latest/context_turn/workspace/reports/draft_audit_ctt.md ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Draft Audit: Counterfactual Action Atlas / Causal Tangent Transport
2
+
3
+ Generated: 2026-07-03
4
+
5
+ Scope: current `latex/main.tex`, current metric/data artifacts, and the advisor
6
+ requirements for making the paper a real Counterfactual Action Atlas method
7
+ paper rather than a stack of diagnostics.
8
+
9
+ ## Executive Status
10
+
11
+ The draft has now been reframed around the advisor's spine: Counterfactual
12
+ Action Atlas turns robot action learning from one demonstrated action per state
13
+ into local same-state causal action geometry. CTT is the current transport
14
+ generator inside the Atlas, not the whole novelty. The diagnostic foundation is
15
+ strong: direct h=16 success is 29.74%, the best deployment-clean V0 residual
16
+ field is 38.90%, the clean proposal oracle is 44.35%, and the hidden same-state
17
+ no-expert chart is 56.99%. This correctly exposes a larger support gap (12.64
18
+ points) than selector gap (5.45 points).
19
+
20
+ The current implementation adds the metric split, data accounting, leakage
21
+ audit, CTT modules, residual/gated CTT proxy runs, validation proxy comparison,
22
+ and measured validation/test generated-candidate rollouts. Validation measured
23
+ rollout over 69 positive-support charts and three train seeds gives
24
+ OutcomePTR@8 = 0.4589, selected success = 0.2415, proposal-oracle success =
25
+ 0.3768, hidden chart oracle success = 0.6667, success support gap = 0.2947,
26
+ and success selector gap = 0.1353. Test measured rollout over 48
27
+ positive-support charts and three train seeds gives OutcomePTR@8 = 0.5278,
28
+ proposal-oracle success = 0.5069, and hidden chart oracle success = 0.7292.
29
+ This is the first real support-side win against the internal 50% proposal
30
+ target. However, selected test success is only 0.2222 versus base success
31
+ 0.2847, with a 0.2847 success selector gap. The current paper therefore has a
32
+ strong Atlas/support story but still fails the selected-action deployment gate.
33
+ A first validation-calibrated dominance fallback artifact now exists:
34
+ `runs/ctt_dominance_val_to_test`. It improves validation selected success to
35
+ 0.3092 at 39.61% coverage, but held-out test selected success is only 0.2500.
36
+ The stricter `runs/ctt_dominance_val_to_test_tau0` falls back 87.50% of the time
37
+ and reaches 0.2778 test success, nearly the base but still not better. The
38
+ learned ridge selector in `runs/ctt_learned_dominance_val_to_test` trains on
39
+ validation measured rows and reaches 0.3056 held-out test success at 24.31%
40
+ coverage. This finally beats the base test success of 0.2847, but remains far
41
+ below the 47.45/50.00 selected-success gate. Additional validation-selected
42
+ ridge variants that fit success, success-weighted utility margin, or the 21D
43
+ tangent code reach only 0.2917--0.2986 held-out test success, so they are logged
44
+ as negative selector diagnostics rather than promoted into the main method. The
45
+ full train-only utility-energy checkpoint in `runs/utility_energy_full_seed0`
46
+ also fails to repair transfer: its held-out checkpoint-scored dominance artifact
47
+ `runs/ctt_dominance_utility_energy_val_to_test_seed0` reaches only 0.2708
48
+ selected test success at 0.1181 coverage, below both the base policy and the
49
+ learned ridge row. Seed-variance repeats in
50
+ `runs/ctt_dominance_utility_energy_val_to_test_seed{1,2}` reach 0.2847 and
51
+ 0.2361 selected success, respectively, so the checkpoint-scored utility-energy
52
+ path is a stable negative diagnostic. Deployment-visible context features
53
+ (`task_id`, instruction hash, source task id, same-task flag) in
54
+ `runs/ctt_learned_dominance_context*` reach only 0.2917 selected success and do
55
+ not beat the best learned ridge row. The required next method step is therefore
56
+ richer visual/object-centric chart representation plus a stronger train-only
57
+ utility/dominance model, not just another fallback wrapper.
58
+
59
+ Current artifact evidence:
60
+
61
+ - Phase-0 reproduce bundle exists: `runs/reproduce_v0/`.
62
+ - Split chart DBs exist under `data/cil_charts/{train,val,test}`.
63
+ - `runs/data_accounting/` records split/task/seed/branch/label counts.
64
+ - `runs/leakage_audit/report.md` passes with zero violations.
65
+ - `cil/metrics.py` and `scripts/eval_metrics.py` separate measured
66
+ OutcomePTR/SupportGap/SelectorRegret from proxy PPTC metrics.
67
+ - `cil/models/ctt.py`, `scripts/train_ctt.py`, and
68
+ `scripts/eval_ctt_proxy.py` implement the first residual/gated residual CTT
69
+ path.
70
+ - `scripts/eval_ctt_generated_rollout.py` and
71
+ `scripts/slurm/eval_ctt_generated_rollout.sbatch` implement measured
72
+ generated-candidate rollout rows for OutcomePTR/SupportGap/SelectorRegret.
73
+ - `runs/ctt_residual_rollout_val69_seed{0,1,2}` and
74
+ `runs/ctt_val_rollout_comparison` contain the first full validation measured
75
+ rollout results for residual CTT.
76
+ - `runs/ctt_residual_rollout_test_seed{0,1,2}` and
77
+ `runs/ctt_test_rollout_comparison` contain the first full test measured
78
+ rollout results for residual CTT.
79
+ - `runs/ctt_dominance_val_to_test` and
80
+ `runs/ctt_dominance_val_to_test_tau0` contain the first validation-calibrated
81
+ dominance fallback diagnostics.
82
+ - `runs/ctt_learned_dominance_val_to_test` contains the first learned
83
+ validation-calibrated dominance selector diagnostic.
84
+ - `runs/ctt_learned_dominance_{success,success_weighted,margin_ext,tangent}_val_to_test`
85
+ contain additional selector ablations; none beats the original learned ridge
86
+ utility-margin diagnostic.
87
+ - `runs/utility_energy_full_seed0` and
88
+ `runs/ctt_dominance_utility_energy_val_to_test_seed{0,1,2}` contain the first
89
+ full train-only utility-energy checkpoints and held-out checkpoint-scored
90
+ dominance diagnostics; they are negative because selected success is only
91
+ 0.2361--0.2847.
92
+ - `runs/ctt_learned_dominance_context*` contain deployment-visible context
93
+ learned-dominance diagnostics; they are negative because selected success is
94
+ 0.2917.
95
+ - `paper/sections/theory.tex` and `paper/notes/theory_ctt.md` now state the
96
+ current theorem/proposition obligations.
97
+
98
+ ## Required Fixes By Advisor Comment
99
+
100
+ ### A1. Abstract Overclaim
101
+
102
+ The old text made CTT sound like the whole contribution and risked implying a
103
+ finished deployment method. The new paper should claim Counterfactual Action
104
+ Atlas as the same-state causal-geometry object, then present CTT as the current
105
+ transport generator inside it. The measured test proposal oracle is now strong
106
+ enough to support a proposal-support claim, but selected success is below base,
107
+ so deployment success remains unclaimed.
108
+
109
+ Required fix:
110
+
111
+ - The abstract now says CIL-Atlas measures local causal action geometry and CTT
112
+ is the current transport instance.
113
+ - Keep the test result phrased as support evidence: proposal oracle passes
114
+ 50%, selected action fails, calibrated dominance is required next.
115
+
116
+ ### A2. Generic Generator Instead Of CTT
117
+
118
+ Current method text defines `q_phi(delta a | o,l)`, which is a generic
119
+ state-conditioned tangent generator. The requested central method is:
120
+
121
+ ```text
122
+ T_phi(z_source, z_target, xi_source_positive) -> xi_target_positive
123
+ ```
124
+
125
+ Required fix:
126
+
127
+ - Replace the main method section with Counterfactual Action Atlas, with CTT as
128
+ the current positive-tangent transport implementation.
129
+ - Keep V0/V1/CVAE/flow as baselines or failed diagnostics.
130
+ - Implement `cil/models/ctt.py`, `tangent_encoder.py`, `chart_encoder.py`,
131
+ and CTT train/eval scripts before claiming CTT as a contribution.
132
+
133
+ ### A3. PTR Terminology Is Wrong
134
+
135
+ Current draft says "PTR proxy" and sometimes reports distance-based coverage as
136
+ PTR. This is not acceptable.
137
+
138
+ Required terminology:
139
+
140
+ - `OutcomePTR@K`: candidate was rolled out/evaluated and measured
141
+ `U(candidate) > U(base)+epsilon`.
142
+ - `ProxyPositiveTangentCoverage@K` / `PPTC@K`: generated tangent is within an
143
+ RMS-L2 threshold of a measured positive tangent. This is proxy geometry, not
144
+ an outcome metric.
145
+
146
+ Required fix:
147
+
148
+ - Rename all distance proxy tables and prose from PTR to PPTC.
149
+ - Add metrics/eval code that refuses to compute OutcomePTR, SelectorRegret, or
150
+ SupportGap without measured outcomes.
151
+
152
+ ### A4. Data Accounting Is Incomplete
153
+
154
+ Current numbers appear in prose:
155
+
156
+ - 575 validation groups/seed.
157
+ - 2,873 charts.
158
+ - 43,095 measured tangent targets.
159
+ - 45,968 NPZ rows including base branches.
160
+
161
+ Only the train chart DB count is currently verified by `index.json`. There is no
162
+ required accounting table with split/task/seed/base/expert/label counts.
163
+
164
+ Required artifact:
165
+
166
+ - `runs/data_accounting/table.json`
167
+ - `runs/data_accounting/table.tex`
168
+ - `runs/data_accounting/report.md`
169
+
170
+ The counts must come from scripts, not hand-entered prose.
171
+
172
+ ### A5. Submission Draft Contains Internal Acceptance Language
173
+
174
+ Current `Roadmap to the Full Paper` includes "A*/Q1" and acceptance bars.
175
+ This must not appear in the submission draft.
176
+
177
+ Required fix:
178
+
179
+ - Move A*/Q1 and acceptance-bar language to internal notes/reports.
180
+ - Keep the paper limited to measured results, method definition, and honest
181
+ limitations.
182
+
183
+ ### A6. V0/V1/V3 Are Mispositioned
184
+
185
+ Current draft calls V0 the "current system" and discusses V1/V3 in method-like
186
+ language. The advisor requires:
187
+
188
+ - V0 = diagnostic baseline.
189
+ - V1 = failed support-side reweighting baseline.
190
+ - V3 flow = failed noise-initialized generator baseline.
191
+ - CTT = main method to implement/evaluate.
192
+
193
+ Required fix:
194
+
195
+ - Rewrite method section around CTT transport.
196
+ - Move V0/V1/V3 to experiments/baselines.
197
+
198
+ ### A7. Theory Section Missing
199
+
200
+ No AAAI-level theory exists in the LaTeX.
201
+
202
+ Required artifacts:
203
+
204
+ - `paper/notes/theory_ctt.md`
205
+ - `paper/sections/theory.tex`
206
+
207
+ Required theorem statements:
208
+
209
+ - Same-state causal contrast identifiability.
210
+ - CAR = SupportGap + SelectorGap.
211
+ - Noise-vs-transport support sample-complexity argument.
212
+ - Positive tangent bundle smoothness.
213
+ - CTT support regret bound.
214
+
215
+ ## Missing Code Artifacts
216
+
217
+ Resolved in this pass:
218
+
219
+ - `scripts/eval_metrics.py`
220
+ - `tests/test_metrics.py`
221
+ - `tests/test_ctt.py`
222
+ - `scripts/audit_cil_charts.py`
223
+ - `runs/data_accounting/*`
224
+ - `runs/leakage_audit/report.md`
225
+ - `cil/models/ctt.py`
226
+ - `cil/models/tangent_encoder.py`
227
+ - `cil/models/chart_encoder.py`
228
+ - `cil/models/utility_energy.py`
229
+ - `scripts/train_ctt.py`
230
+ - `scripts/eval_ctt_proxy.py`
231
+ - `scripts/eval_ctt_rollout.py` measured-output wrapper
232
+ - `scripts/eval_ctt_generated_rollout.py`
233
+ - `scripts/slurm/eval_ctt_generated_rollout.sbatch`
234
+ - `scripts/train_utility_energy.py`
235
+ - `scripts/calibrate_dominance.py`
236
+ - `scripts/check_tangent_reconstruction.py`
237
+ - `scripts/summarize_ctt_runs.py`
238
+ - `configs/ctt/*.yaml`
239
+ - `paper/sections/theory.tex`
240
+ - `paper/notes/theory_ctt.md`
241
+ - `runs/tangent_reconstruction/*`
242
+ - `runs/utility_energy_smoke/*`
243
+ - `runs/ctt_gated_residual_smoke/*`
244
+ - `runs/ctt_gated_residual_smoke_proxy/*`
245
+ - `scripts/eval_chart_positive_memory_proxy.py`
246
+ - `scripts/build_ctt_proxy_comparison.py`
247
+ - `runs/local_atlas_val_proxy/*`
248
+ - `runs/task_memory_val_proxy/*`
249
+ - `runs/ctt_residual_val_proxy/*`
250
+ - `runs/ctt_gated_residual_val_proxy/*`
251
+ - `runs/ctt_val_proxy_comparison/*`
252
+ - `runs/summary_ctt.csv`
253
+ - `runs/summary_ctt.md`
254
+
255
+ Still missing before a full method paper:
256
+
257
+ - unsafe execution/fallback calibration metrics
258
+ - simulator-integrated dominance-calibrated rollout collection
259
+ - visual-language/object-centric chart tokens that make train-only utility
260
+ energy transfer beyond the current negative checkpoint result
261
+
262
+ ## Current Evidence That Must Be Reclassified
263
+
264
+ The following rows are diagnostic/baseline evidence, not the main method:
265
+
266
+ - V0 K6 transported residual field + small train-source prior: 38.90%.
267
+ - V1 utility-weighted residual retrieval: does not beat V0.
268
+ - Task-level positive memory: distance proxy only.
269
+ - Local-atlas positive memory: distance proxy only.
270
+ - Chart synthesis/barycentric mean: distance proxy only.
271
+ - Raw CVAE, spline-CVAE, vanilla flow, guided spline flow: all distance proxy
272
+ diagnostics, not successful measured generators.
273
+
274
+ ## Leakage Status
275
+
276
+ Current pass:
277
+
278
+ - Train/validation/test chart DB audit passes with zero violations.
279
+ - Validation/test indexes are evaluator-only and retrieval-forbidden. They now
280
+ contain measured outcomes for metric scripts; deployment-time proposal and
281
+ selection code must not load those fields.
282
+ - Cross-split chart/state hash overlap is audited by `scripts/audit_cil_charts.py`.
283
+
284
+ Current missing:
285
+
286
+ - Unsafe-contact/fallback-rate audit.
287
+ - Real robot near-miss recovery audit.
288
+ - A dominance model that approaches the selected-success paper gate. The current
289
+ learned ridge row only marginally beats the base, and the full train-only
290
+ utility-energy checkpoints do not beat base. Coarse context metadata also
291
+ does not beat the best learned ridge row.
292
+
293
+ ## Immediate Fix Order
294
+
295
+ Completed:
296
+
297
+ 1. Fix metric names/API and add `scripts/eval_metrics.py`.
298
+ 2. Build scripted data accounting and `runs/leakage_audit/report.md`.
299
+ 3. Implement CTT residual/gated residual transport over train-positive source
300
+ tangents.
301
+ 4. Run a small train self-target CTT proxy smoke.
302
+ 5. Rewrite LaTeX around Counterfactual Action Atlas and move unmeasured claims
303
+ to limitations.
304
+ 6. Run measured residual CTT rollout on validation and test positive-support
305
+ charts.
306
+
307
+ Next:
308
+
309
+ 1. Replace the weak train-only utility-energy selector with richer
310
+ visual-language/object-centric chart tokens and rerun held-out measured
311
+ selection.
312
+ 2. Add unsafe execution/fallback metrics.
313
+ 3. Improve chart tokens from base-action summaries to visual-language and
314
+ object-centric geometry.
workspace/outputs/hf_verify_latest/context_turn/workspace/runs/ctt_dominance_utility_energy_val_to_test_seed2/report.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dominance-Calibrated CTT Selector
2
+
3
+ Calibration rows: `207`
4
+ Eval rows: `144`
5
+ Alpha: `0.1`
6
+ Residual quantile: `1.960328`
7
+ Tau: `-1.666549` (`auto`)
8
+
9
+ The threshold is fit on calibration rows only. Eval outcomes are used only for reporting.
10
+
11
+ | Split | Coverage | Fallback | Base success | Selected success | Proposal oracle | OutcomePTR | Success support gap | Success selector gap |
12
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
13
+ | calibration | 0.2029 | 0.7971 | 0.2850 | 0.2899 | 0.3768 | 0.4589 | 0.2947 | 0.1594 |
14
+ | eval | 0.2708 | 0.7292 | 0.2847 | 0.2361 | 0.5069 | 0.5278 | 0.2639 | 0.3056 |
15
+
16
+ This is a calibrated fallback diagnostic. It is not a final safety claim because unsafe-contact labels are not measured yet.
workspace/outputs/hf_verify_latest/context_turn/workspace/runs/ctt_learned_dominance_context_val_to_test/report.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learned Dominance-Calibrated CTT Selector
2
+
3
+ Calibration rows: `207`
4
+ Eval rows: `144`
5
+ Selected ridge lambda: `1000.0`
6
+ Tau: `-0.097211`
7
+ Feature set: `context`
8
+ Target: `utility_margin`
9
+
10
+ The ridge calibrator and threshold are fit on calibration measured rows only. Eval outcomes are used only for reporting.
11
+
12
+ | Split | Coverage | Fallback | Base success | Selected success | Proposal oracle | OutcomePTR | Success support gap | Success selector gap |
13
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
14
+ | calibration | 0.2512 | 0.7488 | 0.2850 | 0.3188 | 0.3768 | 0.4589 | 0.2947 | 0.1353 |
15
+ | eval | 0.1806 | 0.8194 | 0.2847 | 0.2917 | 0.5069 | 0.5278 | 0.2639 | 0.2778 |
16
+
17
+ This is a selector diagnostic over already measured candidates, not a new rollout.
workspace/outputs/hf_verify_latest/context_turn/workspace/runs/summary_ctt.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CTT Summary
2
+
3
+ | Method | Status | Base | Selected | Proposal oracle | Hidden oracle | Utility support gap | Utility selector gap | Success support gap | Success selector gap | OutcomePTR | PPTC@0.20 | PPTC@0.40 | NegativeNear@0.20 | Calibration ECE | Run |
4
+ | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- |
5
+ | V0 residual transport diagnostic | measured diagnostic baseline; gate: legacy diagnostic | 0.2974 | 0.3890 | 0.4435 | n/a | 0.1264 | 0.0545 | 0.1264 | 0.0545 | n/a | 0.2366 | 0.5269 | 0.0533 | n/a | `runs/reproduce_v0` |
6
+ | CTT gated residual | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_gated_residual_full_seed0` |
7
+ | CTT gated residual | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.2319 | 0.5797 | 0.0512 | n/a | `runs/ctt_gated_residual_full_seed0_val_proxy` |
8
+ | CTT gated residual | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_gated_residual_full_seed1` |
9
+ | CTT gated residual | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.2174 | 0.6232 | 0.0644 | n/a | `runs/ctt_gated_residual_full_seed1_val_proxy` |
10
+ | CTT gated residual | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_gated_residual_full_seed2` |
11
+ | CTT gated residual | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.2464 | 0.6377 | 0.0424 | n/a | `runs/ctt_gated_residual_full_seed2_val_proxy` |
12
+ | CTT gated residual | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_gated_residual_smoke` |
13
+ | CTT gated residual | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.5000 | 0.7500 | 0.0573 | n/a | `runs/ctt_gated_residual_smoke_proxy` |
14
+ | CTT gated residual | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.1739 | 0.5362 | 0.0281 | n/a | `runs/ctt_gated_residual_val_proxy` |
15
+ | CTT residual train | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_residual_full_seed0` |
16
+ | CTT residual proxy | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.2029 | 0.5797 | 0.0289 | n/a | `runs/ctt_residual_full_seed0_val_proxy` |
17
+ | CTT residual train | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_residual_full_seed1` |
18
+ | CTT residual proxy | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.2319 | 0.5942 | 0.0410 | n/a | `runs/ctt_residual_full_seed1_val_proxy` |
19
+ | CTT residual train | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_residual_full_seed2` |
20
+ | CTT residual proxy | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.1594 | 0.6522 | 0.0189 | n/a | `runs/ctt_residual_full_seed2_val_proxy` |
21
+ | CTT residual validation measured | measured rollout K=2; gate: fail:selected<47.45,oracle<50,OutcomePTR<=V0oracle,seeds<3 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.1798 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | n/a | n/a | n/a | 0.4932 | `runs/ctt_residual_rollout_direct_smoke_seed0_v3` |
22
+ | CTT residual test measured | measured rollout K=8; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2917 | 0.3125 | 0.5208 | 0.7292 | 0.4438 | 0.4304 | 0.2500 | 0.2083 | 0.4792 | n/a | n/a | n/a | 0.1774 | `runs/ctt_residual_rollout_test_seed0` |
23
+ | CTT residual test measured | measured rollout K=8; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2708 | 0.2292 | 0.5417 | 0.7292 | 0.4287 | 0.6263 | 0.2292 | 0.3125 | 0.5417 | n/a | n/a | n/a | 0.1691 | `runs/ctt_residual_rollout_test_seed1` |
24
+ | CTT residual test measured | measured rollout K=8; gate: fail:selected<47.45,oracle<50,support_gap>7,selector_gap>3 | 0.2917 | 0.1250 | 0.4583 | 0.7292 | 0.5775 | 0.6247 | 0.3125 | 0.3333 | 0.5625 | n/a | n/a | n/a | 0.1725 | `runs/ctt_residual_rollout_test_seed2` |
25
+ | CTT residual validation measured | measured rollout K=8; gate: fail:selected<47.45,oracle<50,support_gap>7,selector_gap>3,OutcomePTR<=V0oracle | 0.3125 | 0.2500 | 0.3750 | 0.6250 | 0.5139 | 0.2645 | 0.2500 | 0.1250 | 0.3750 | n/a | n/a | n/a | 0.1330 | `runs/ctt_residual_rollout_val16_seed0` |
26
+ | CTT residual validation measured | measured rollout K=8; gate: fail:selected<47.45,oracle<50,support_gap>7,selector_gap>3,OutcomePTR<=V0oracle | 0.2754 | 0.2754 | 0.3913 | 0.6667 | 0.5108 | 0.2539 | 0.2899 | 0.1159 | 0.4348 | n/a | n/a | n/a | 0.1505 | `runs/ctt_residual_rollout_val69_seed0` |
27
+ | CTT residual validation measured | measured rollout K=8; gate: fail:selected<47.45,oracle<50,support_gap>7,selector_gap>3,OutcomePTR<=V0oracle | 0.2899 | 0.1884 | 0.3188 | 0.6667 | 0.5993 | 0.3240 | 0.3478 | 0.1304 | 0.4348 | n/a | n/a | n/a | 0.1583 | `runs/ctt_residual_rollout_val69_seed1` |
28
+ | CTT residual validation measured | measured rollout K=8; gate: fail:selected<47.45,oracle<50,support_gap>7,selector_gap>3 | 0.2899 | 0.2609 | 0.4203 | 0.6667 | 0.4747 | 0.3029 | 0.2464 | 0.1594 | 0.5072 | n/a | n/a | n/a | 0.1765 | `runs/ctt_residual_rollout_val69_seed2` |
29
+ | CTT residual train | train; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | `runs/ctt_residual_smoke` |
30
+ | CTT residual proxy | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 1.0000 | 1.0000 | 0.1010 | n/a | `runs/ctt_residual_smoke_proxy` |
31
+ | CTT residual proxy | proxy; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.3478 | 0.7101 | 0.0397 | n/a | `runs/ctt_residual_val_proxy` |
32
+ | CTT residual test measured aggregate | measured rollout K=8; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2222 | 0.5069 | 0.7292 | 0.4833 | 0.5605 | 0.2639 | 0.2847 | 0.5278 | n/a | n/a | n/a | 0.1730 | `runs/ctt_test_rollout_comparison` |
33
+ | CTT residual validation measured aggregate | measured rollout K=8; gate: fail:selected<47.45,oracle<50,support_gap>7,selector_gap>3,OutcomePTR<=V0oracle,seeds<3 | n/a | n/a | n/a | n/a | 0.5139 | 0.2645 | n/a | n/a | 0.3750 | n/a | n/a | n/a | 0.1330 | `runs/ctt_val16_rollout_comparison` |
34
+ | CTT residual validation measured aggregate | measured rollout K=8; gate: fail:selected<47.45,oracle<50,support_gap>7,selector_gap>3 | 0.2850 | 0.2415 | 0.3768 | 0.6667 | 0.5283 | 0.2936 | 0.2947 | 0.1353 | 0.4589 | n/a | n/a | n/a | 0.1618 | `runs/ctt_val_rollout_comparison` |
35
+ | task memory | proxy baseline; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.3188 | 0.5362 | 0.0175 | n/a | `runs/task_memory_val_proxy` |
36
+ | local atlas | proxy baseline; gate: not measured | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.4058 | 0.6812 | 0.0368 | n/a | `runs/local_atlas_val_proxy` |
37
+ | ctt residual full | proxy aggregate gate=True; gate: proxy=True | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.1981 | 0.6087 | 0.0296 | n/a | `runs/ctt_val_proxy_comparison` |
38
+ | ctt gated residual full | proxy aggregate gate=False; gate: proxy=False | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.2319 | 0.6135 | 0.0527 | n/a | `runs/ctt_val_proxy_comparison` |
39
+ | Utility energy smoke | calibration diagnostic; gate: not deployment | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | 0.1316 | `runs/utility_energy_smoke` |
40
+ | CTT residual test utility-energy dominance | measured dominance K=8 coverage=0.2847 fallback=0.7153; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2222 | 0.5069 | 0.7292 | 0.4833 | 0.5744 | 0.2639 | 0.3264 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_dominance_utility_energy_smoke_val_to_test` |
41
+ | CTT residual test utility-energy dominance | measured dominance K=8 coverage=0.1181 fallback=0.8819; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2708 | 0.5069 | 0.7292 | 0.4833 | 0.5024 | 0.2639 | 0.2917 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_dominance_utility_energy_val_to_test_seed0` |
42
+ | CTT residual test utility-energy dominance | measured dominance K=8 coverage=0.0972 fallback=0.9028; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2847 | 0.5069 | 0.7292 | 0.4833 | 0.4872 | 0.2639 | 0.2847 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_dominance_utility_energy_val_to_test_seed1` |
43
+ | CTT residual test utility-energy dominance | measured dominance K=8 coverage=0.2708 fallback=0.7292; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2361 | 0.5069 | 0.7292 | 0.4833 | 0.5295 | 0.2639 | 0.3056 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_dominance_utility_energy_val_to_test_seed2` |
44
+ | CTT residual test dominance auto | measured dominance K=8 coverage=0.3958 fallback=0.6042; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2500 | 0.5069 | 0.7292 | 0.4833 | 0.5025 | 0.2639 | 0.2917 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_dominance_val_to_test` |
45
+ | CTT residual test dominance tau0 | measured dominance K=8 coverage=0.1250 fallback=0.8750; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2778 | 0.5069 | 0.7292 | 0.4833 | 0.4734 | 0.2639 | 0.2778 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_dominance_val_to_test_tau0` |
46
+ | CTT residual test learned dominance (context, success_weighted_margin) | measured dominance K=8 coverage=0.1736 fallback=0.8264 target=success_weighted_margin features=context; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2917 | 0.5069 | 0.7292 | 0.4833 | 0.4885 | 0.2639 | 0.2778 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_context_success_weighted_val_to_test` |
47
+ | CTT residual test learned dominance (context_tangent, utility_margin) | measured dominance K=8 coverage=0.0903 fallback=0.9097 target=utility_margin features=context_tangent; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2917 | 0.5069 | 0.7292 | 0.4833 | 0.4732 | 0.2639 | 0.2778 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_context_tangent_val_to_test` |
48
+ | CTT residual test learned dominance (context, utility_margin) | measured dominance K=8 coverage=0.1806 fallback=0.8194 target=utility_margin features=context; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2917 | 0.5069 | 0.7292 | 0.4833 | 0.4882 | 0.2639 | 0.2778 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_context_val_to_test` |
49
+ | CTT residual test learned dominance (basic, utility_margin) | measured dominance K=8 coverage=0.1944 fallback=0.8056 target=utility_margin features=basic; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2986 | 0.5069 | 0.7292 | 0.4833 | 0.4864 | 0.2639 | 0.2708 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_margin_ext_val_to_test` |
50
+ | CTT residual test learned dominance (basic, success) | measured dominance K=8 coverage=0.2708 fallback=0.7292 target=success features=basic; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2917 | 0.5069 | 0.7292 | 0.4833 | 0.4494 | 0.2639 | 0.2639 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_success_val_to_test` |
51
+ | CTT residual test learned dominance (basic, success_weighted_margin) | measured dominance K=8 coverage=0.1944 fallback=0.8056 target=success_weighted_margin features=basic; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2986 | 0.5069 | 0.7292 | 0.4833 | 0.4794 | 0.2639 | 0.2708 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_success_weighted_val_to_test` |
52
+ | CTT residual test learned dominance (tangent, utility_margin) | measured dominance K=8 coverage=0.1042 fallback=0.8958 target=utility_margin features=tangent; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.2986 | 0.5069 | 0.7292 | 0.4833 | 0.4597 | 0.2639 | 0.2708 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_tangent_val_to_test` |
53
+ | CTT residual test learned dominance (basic, utility_margin) | measured dominance K=8 coverage=0.2431 fallback=0.7569; gate: fail:selected<47.45,support_gap>7,selector_gap>3 | 0.2847 | 0.3056 | 0.5069 | 0.7292 | 0.4833 | 0.4730 | 0.2639 | 0.2569 | 0.5278 | n/a | n/a | n/a | n/a | `runs/ctt_learned_dominance_val_to_test` |
54
+
55
+ `n/a` means the required measured artifact does not exist yet. Measured gates use selected >=47.45%, proposal oracle >=50%, success support gap <=7 points, success selector gap <=3 points, OutcomePTR above the V0 proposal oracle reference, and at least three train seeds.
workspace/outputs/hf_verify_latest/context_turn/workspace/scripts/eval_learned_dominance_selector.py ADDED
@@ -0,0 +1,692 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import hashlib
6
+ import json
7
+ import math
8
+ import re
9
+ import subprocess
10
+ import sys
11
+ from collections import defaultdict
12
+ from pathlib import Path
13
+ from typing import Any
14
+
15
+ PROJECT_ROOT = Path(__file__).resolve().parents[1]
16
+ if str(PROJECT_ROOT) not in sys.path:
17
+ sys.path.insert(0, str(PROJECT_ROOT))
18
+
19
+ import numpy as np # noqa: E402
20
+
21
+ from cil.metrics import macro_micro_summary # noqa: E402
22
+ from scripts.eval_dominance_selector import _DominanceScorer, _chart_map, _rows # noqa: E402
23
+
24
+
25
+ BASIC_FEATURE_NAMES = [
26
+ "bias",
27
+ "candidate_score",
28
+ "candidate_score_minus_base_score",
29
+ "row_score_z",
30
+ "candidate_index",
31
+ "is_top_score_candidate",
32
+ "source_chart_rank",
33
+ "tangent_rms_norm",
34
+ "tangent_linf_norm",
35
+ "num_candidates",
36
+ ]
37
+ FEATURE_NAMES = BASIC_FEATURE_NAMES
38
+ CONTEXT_HASH_WIDTH = 8
39
+
40
+
41
+ def main(argv: list[str] | None = None) -> int:
42
+ parser = argparse.ArgumentParser(
43
+ description=(
44
+ "Train a lightweight dominance calibrator on measured calibration "
45
+ "rollouts and evaluate deployment-clean fallback on held-out rollouts."
46
+ )
47
+ )
48
+ parser.add_argument("--calibration-input", type=Path, required=True)
49
+ parser.add_argument("--calibration-target-index", type=Path, required=True)
50
+ parser.add_argument("--eval-input", type=Path, required=True)
51
+ parser.add_argument("--eval-target-index", type=Path, required=True)
52
+ parser.add_argument(
53
+ "--checkpoint-template",
54
+ default="runs/ctt_residual_full_seed{seed}/model.pt",
55
+ )
56
+ parser.add_argument("--out-dir", type=Path, default=Path("runs/ctt_learned_dominance_val_to_test"))
57
+ parser.add_argument("--k", type=int, default=8)
58
+ parser.add_argument("--ridge-lambdas", default="0,0.01,0.1,1,10,100")
59
+ parser.add_argument(
60
+ "--feature-set",
61
+ choices=("basic", "tangent", "context", "context_tangent"),
62
+ default="basic",
63
+ help="Deployment-visible feature family for candidate-level dominance fitting.",
64
+ )
65
+ parser.add_argument(
66
+ "--target",
67
+ choices=("utility_margin", "success", "success_weighted_margin"),
68
+ default="utility_margin",
69
+ help=(
70
+ "Calibration target. success_weighted_margin fits utility margin plus "
71
+ "candidate success to prioritize the lexicographic success/progress utility."
72
+ ),
73
+ )
74
+ parser.add_argument("--bootstrap-samples", type=int, default=1000)
75
+ args = parser.parse_args(argv)
76
+
77
+ if args.k <= 0:
78
+ parser.error("--k must be positive")
79
+ lambdas = [float(item.strip()) for item in args.ridge_lambdas.split(",") if item.strip()]
80
+ if not lambdas or any(value < 0.0 for value in lambdas):
81
+ parser.error("--ridge-lambdas must contain non-negative values")
82
+
83
+ out_dir = args.out_dir
84
+ out_dir.mkdir(parents=True, exist_ok=True)
85
+ _write_provenance(out_dir, args)
86
+
87
+ scorer = _DominanceScorer(args.checkpoint_template)
88
+ calibration_rows = _rows(json.loads(args.calibration_input.read_text()))
89
+ eval_rows = _rows(json.loads(args.eval_input.read_text()))
90
+ calibration_charts, calibration_index = _chart_map(args.calibration_target_index)
91
+ eval_charts, eval_index = _chart_map(args.eval_target_index)
92
+
93
+ calibration_dataset = _candidate_dataset(
94
+ calibration_rows,
95
+ calibration_charts,
96
+ scorer=scorer,
97
+ k=args.k,
98
+ feature_set=args.feature_set,
99
+ target=args.target,
100
+ )
101
+ eval_dataset = _candidate_dataset(
102
+ eval_rows,
103
+ eval_charts,
104
+ scorer=scorer,
105
+ k=args.k,
106
+ feature_set=args.feature_set,
107
+ target=args.target,
108
+ )
109
+ best = _fit_select_ridge(calibration_dataset, lambdas=lambdas)
110
+ eval_cases = _evaluate_dataset(eval_dataset, best["weights"], best["mean"], best["std"], tau=best["tau"])
111
+ calibration_cases = _evaluate_dataset(
112
+ calibration_dataset,
113
+ best["weights"],
114
+ best["mean"],
115
+ best["std"],
116
+ tau=best["tau"],
117
+ )
118
+ metric_names = sorted(
119
+ {
120
+ key
121
+ for row in eval_cases
122
+ for key, value in row.items()
123
+ if key not in {"chart_id", "task_id", "seed", "train_seed"}
124
+ and isinstance(value, (int, float))
125
+ and math.isfinite(float(value))
126
+ }
127
+ )
128
+ summary = {
129
+ name: macro_micro_summary(
130
+ eval_cases,
131
+ name,
132
+ bootstrap_samples=args.bootstrap_samples,
133
+ confidence=0.95,
134
+ )
135
+ for name in metric_names
136
+ }
137
+ metrics = {
138
+ "report_type": "learned_dominance_selector_eval",
139
+ "schema_version": 1,
140
+ "k": args.k,
141
+ "feature_set": args.feature_set,
142
+ "target": args.target,
143
+ "feature_names": _feature_names(args.feature_set),
144
+ "ridge_lambdas": lambdas,
145
+ "selected_lambda": best["lambda"],
146
+ "tau": best["tau"],
147
+ "weights": best["weights"].tolist(),
148
+ "feature_mean": best["mean"].tolist(),
149
+ "feature_std": best["std"].tolist(),
150
+ "calibration_input": str(args.calibration_input),
151
+ "eval_input": str(args.eval_input),
152
+ "calibration_target_content_hash": calibration_index.get("content_hash"),
153
+ "calibration_target_split_hash": calibration_index.get("split_hash"),
154
+ "eval_target_content_hash": eval_index.get("content_hash"),
155
+ "eval_target_split_hash": eval_index.get("split_hash"),
156
+ "num_calibration_rows": len(calibration_rows),
157
+ "num_eval_rows": len(eval_rows),
158
+ "num_calibration_candidates": len(calibration_dataset["samples"]),
159
+ "num_eval_candidates": len(eval_dataset["samples"]),
160
+ "calibration_model_selection": best["selection"],
161
+ "calibration_summary": _simple_summary(calibration_cases),
162
+ "eval_summary": _simple_summary(eval_cases),
163
+ "summary": summary,
164
+ "rows": eval_cases,
165
+ }
166
+ (out_dir / "metrics.json").write_text(json.dumps(metrics, indent=2, sort_keys=True) + "\n")
167
+ (out_dir / "metrics_by_task.json").write_text(
168
+ json.dumps(_group_means(eval_cases, "task_id", metric_names), indent=2, sort_keys=True)
169
+ + "\n"
170
+ )
171
+ (out_dir / "metrics_by_seed.json").write_text(
172
+ json.dumps(_group_means(eval_cases, "seed", metric_names), indent=2, sort_keys=True)
173
+ + "\n"
174
+ )
175
+ (out_dir / "table.tex").write_text(_table(metrics) + "\n")
176
+ (out_dir / "report.md").write_text(_report(metrics) + "\n")
177
+ (out_dir / "train.log").write_text(
178
+ "trained ridge dominance calibrator on calibration measured rows only\n"
179
+ f"selected_lambda={best['lambda']}\n"
180
+ f"tau={best['tau']:.6f}\n"
181
+ f"calibration_input={args.calibration_input}\n"
182
+ )
183
+ (out_dir / "eval.log").write_text(
184
+ "evaluated learned fallback rule on held-out measured rollout rows\n"
185
+ f"eval_input={args.eval_input}\n"
186
+ f"num_eval_rows={len(eval_rows)}\n"
187
+ )
188
+ print(
189
+ json.dumps(
190
+ {
191
+ "out_dir": str(out_dir),
192
+ "lambda": best["lambda"],
193
+ "tau": best["tau"],
194
+ "selected_success": metrics["eval_summary"]["selected_success"],
195
+ },
196
+ indent=2,
197
+ )
198
+ )
199
+ return 0
200
+
201
+
202
+ def _candidate_dataset(
203
+ rows: list[dict[str, Any]],
204
+ charts: dict[str, Any],
205
+ *,
206
+ scorer: _DominanceScorer,
207
+ k: int,
208
+ feature_set: str = "basic",
209
+ target: str = "utility_margin",
210
+ ) -> dict[str, Any]:
211
+ samples: list[dict[str, Any]] = []
212
+ by_row: dict[int, list[int]] = defaultdict(list)
213
+ for row_index, row in enumerate(rows):
214
+ chart_id = str(row.get("chart_id", row.get("group_id", "")))
215
+ if chart_id not in charts:
216
+ raise KeyError(f"chart_id {chart_id!r} not found in target index")
217
+ base_score = scorer.base_score(row, charts[chart_id])
218
+ scores = [float(value) for value in row.get("predicted_scores", [])[:k]]
219
+ utilities = [float(value) for value in row.get("generated_utilities", [])[:k]]
220
+ successes = [float(bool(value)) for value in row.get("candidate_success", [])[:k]]
221
+ tangents = row.get("generated_tangents", [])[:k]
222
+ candidate_types = row.get("candidate_types", [])[:k]
223
+ source_task_ids = row.get("candidate_source_task_ids", [])[:k]
224
+ if not scores or len(scores) != len(utilities):
225
+ continue
226
+ score_mean = sum(scores) / len(scores)
227
+ score_std = math.sqrt(sum((score - score_mean) ** 2 for score in scores) / len(scores)) + 1.0e-6
228
+ for candidate_index, score in enumerate(scores):
229
+ tangent = np.asarray(
230
+ tangents[candidate_index] if candidate_index < len(tangents) else [],
231
+ dtype=float,
232
+ )
233
+ feature = _candidate_feature(
234
+ score=score,
235
+ base_score=base_score,
236
+ score_mean=score_mean,
237
+ score_std=score_std,
238
+ candidate_index=candidate_index,
239
+ candidate_type=candidate_types[candidate_index] if candidate_index < len(candidate_types) else "",
240
+ context={
241
+ "target_task_id": row.get("task_id", ""),
242
+ "instruction": row.get("instruction", ""),
243
+ "source_task_id": source_task_ids[candidate_index]
244
+ if candidate_index < len(source_task_ids)
245
+ else "",
246
+ },
247
+ tangent=tangent,
248
+ num_candidates=len(scores),
249
+ feature_set=feature_set,
250
+ )
251
+ sample_index = len(samples)
252
+ by_row[row_index].append(sample_index)
253
+ base_utility = float(row["base_utility"])
254
+ base_success = float(bool(row.get("base_success", False)))
255
+ hidden = [float(value) for value in row.get("hidden_chart_utilities", [])]
256
+ target_margin = utilities[candidate_index] - base_utility
257
+ samples.append(
258
+ {
259
+ "row_index": row_index,
260
+ "candidate_index": candidate_index,
261
+ "feature": feature,
262
+ "target_margin": _target_value(
263
+ target,
264
+ utility_margin=target_margin,
265
+ candidate_success=successes[candidate_index],
266
+ ),
267
+ "measured_utility_margin": target_margin,
268
+ "candidate_utility": utilities[candidate_index],
269
+ "candidate_success": successes[candidate_index],
270
+ "base_utility": base_utility,
271
+ "base_success": base_success,
272
+ "proposal_oracle_utility": max(utilities),
273
+ "proposal_oracle_success": float(any(successes)),
274
+ "hidden_chart_oracle_utility": max(hidden) if hidden else math.nan,
275
+ "hidden_chart_oracle_success": float(any(value >= 1.0 for value in hidden)) if hidden else math.nan,
276
+ "outcome_ptr": float(any(value > base_utility for value in utilities)),
277
+ "chart_id": chart_id,
278
+ "task_id": str(row.get("task_id", "unknown")),
279
+ "seed": str(row.get("seed", "unknown")),
280
+ "train_seed": str(row.get("train_seed", "unknown")),
281
+ }
282
+ )
283
+ return {"samples": samples, "by_row": dict(by_row), "num_rows": len(rows)}
284
+
285
+
286
+ def _feature_names(feature_set: str) -> list[str]:
287
+ if feature_set == "basic":
288
+ return list(BASIC_FEATURE_NAMES)
289
+ context_names = [
290
+ *[f"target_task_hash_{index:02d}" for index in range(CONTEXT_HASH_WIDTH)],
291
+ *[f"source_task_hash_{index:02d}" for index in range(CONTEXT_HASH_WIDTH)],
292
+ *[f"instruction_hash_{index:02d}" for index in range(CONTEXT_HASH_WIDTH)],
293
+ "source_target_same_task",
294
+ "instruction_chars_per_128",
295
+ "instruction_words_per_32",
296
+ ]
297
+ tangent_names = [
298
+ *[f"tangent_{index:02d}" for index in range(21)],
299
+ *[f"abs_tangent_{index:02d}" for index in range(21)],
300
+ ]
301
+ if feature_set == "tangent":
302
+ return [*BASIC_FEATURE_NAMES, *tangent_names]
303
+ if feature_set == "context":
304
+ return [*BASIC_FEATURE_NAMES, *context_names]
305
+ if feature_set == "context_tangent":
306
+ return [*BASIC_FEATURE_NAMES, *context_names, *tangent_names]
307
+ raise ValueError(f"unknown feature_set: {feature_set}")
308
+
309
+
310
+ def _candidate_feature(
311
+ *,
312
+ score: float,
313
+ base_score: float,
314
+ score_mean: float,
315
+ score_std: float,
316
+ candidate_index: int,
317
+ candidate_type: Any,
318
+ tangent: np.ndarray,
319
+ num_candidates: int,
320
+ feature_set: str,
321
+ context: dict[str, Any] | None = None,
322
+ ) -> np.ndarray:
323
+ tangent = np.asarray(tangent, dtype=float).reshape(-1)
324
+ if tangent.size < 21:
325
+ tangent = np.pad(tangent, (0, 21 - tangent.size))
326
+ elif tangent.size > 21:
327
+ tangent = tangent[:21]
328
+ tangent_rms = float(np.linalg.norm(tangent) / math.sqrt(max(1, tangent.size)))
329
+ tangent_linf = float(np.max(np.abs(tangent))) if tangent.size else 0.0
330
+ basic = np.asarray(
331
+ [
332
+ 1.0,
333
+ float(score),
334
+ float(score) - float(base_score),
335
+ (float(score) - float(score_mean)) / float(score_std),
336
+ float(candidate_index),
337
+ float(candidate_index == 0),
338
+ _source_rank(candidate_type),
339
+ tangent_rms,
340
+ tangent_linf,
341
+ float(num_candidates),
342
+ ],
343
+ dtype=float,
344
+ )
345
+ if feature_set == "basic":
346
+ return basic
347
+ if feature_set == "tangent":
348
+ return np.concatenate([basic, tangent.astype(float), np.abs(tangent).astype(float)])
349
+ if feature_set == "context":
350
+ return np.concatenate([basic, _context_feature(context or {})])
351
+ if feature_set == "context_tangent":
352
+ return np.concatenate(
353
+ [
354
+ basic,
355
+ _context_feature(context or {}),
356
+ tangent.astype(float),
357
+ np.abs(tangent).astype(float),
358
+ ]
359
+ )
360
+ raise ValueError(f"unknown feature_set: {feature_set}")
361
+
362
+
363
+ def _context_feature(context: dict[str, Any]) -> np.ndarray:
364
+ target_task = str(context.get("target_task_id", ""))
365
+ source_task = str(context.get("source_task_id", ""))
366
+ instruction = str(context.get("instruction", ""))
367
+ return np.asarray(
368
+ [
369
+ *_stable_hash_features(target_task, CONTEXT_HASH_WIDTH),
370
+ *_stable_hash_features(source_task, CONTEXT_HASH_WIDTH),
371
+ *_stable_hash_features(instruction.lower(), CONTEXT_HASH_WIDTH),
372
+ float(bool(target_task) and target_task == source_task),
373
+ min(len(instruction) / 128.0, 4.0),
374
+ min(len(instruction.split()) / 32.0, 4.0),
375
+ ],
376
+ dtype=float,
377
+ )
378
+
379
+
380
+ def _stable_hash_features(text: str, width: int) -> list[float]:
381
+ digest = hashlib.sha256(text.encode("utf-8")).digest()
382
+ return [((digest[index] / 127.5) - 1.0) for index in range(width)]
383
+
384
+
385
+ def _target_value(
386
+ target: str,
387
+ *,
388
+ utility_margin: float,
389
+ candidate_success: float,
390
+ ) -> float:
391
+ if target == "utility_margin":
392
+ return float(utility_margin)
393
+ if target == "success":
394
+ return float(candidate_success)
395
+ if target == "success_weighted_margin":
396
+ return float(utility_margin) + float(candidate_success)
397
+ raise ValueError(f"unknown target: {target}")
398
+
399
+
400
+ def _fit_select_ridge(dataset: dict[str, Any], *, lambdas: list[float]) -> dict[str, Any]:
401
+ samples = dataset["samples"]
402
+ if not samples:
403
+ raise ValueError("cannot fit learned dominance selector without candidates")
404
+ x = np.stack([sample["feature"] for sample in samples], axis=0)
405
+ y = np.asarray([float(sample["target_margin"]) for sample in samples], dtype=float)
406
+ mean = np.zeros(x.shape[1], dtype=float)
407
+ std = np.ones(x.shape[1], dtype=float)
408
+ mean[1:] = x[:, 1:].mean(axis=0)
409
+ std[1:] = x[:, 1:].std(axis=0) + 1.0e-6
410
+ x_norm = (x - mean) / std
411
+ x_norm[:, 0] = 1.0
412
+ best: dict[str, Any] | None = None
413
+ for ridge_lambda in lambdas:
414
+ penalty = ridge_lambda * np.eye(x_norm.shape[1], dtype=float)
415
+ penalty[0, 0] = 0.0
416
+ weights = np.linalg.pinv(x_norm.T @ x_norm + penalty) @ (x_norm.T @ y)
417
+ predictions = x_norm @ weights
418
+ tau, selection = _choose_tau(dataset, predictions)
419
+ key = (
420
+ float(selection["selected_success"]),
421
+ float(selection["selected_utility"]),
422
+ float(selection["coverage"]),
423
+ -float(ridge_lambda),
424
+ )
425
+ if best is None or key > best["key"]:
426
+ best = {
427
+ "key": key,
428
+ "lambda": ridge_lambda,
429
+ "weights": weights,
430
+ "mean": mean,
431
+ "std": std,
432
+ "tau": tau,
433
+ "selection": selection,
434
+ }
435
+ assert best is not None
436
+ return best
437
+
438
+
439
+ def _choose_tau(dataset: dict[str, Any], predictions: np.ndarray) -> tuple[float, dict[str, float | None]]:
440
+ candidates = sorted(float(value) for value in predictions)
441
+ thresholds = [min(candidates) - 1.0, *candidates, max(candidates) + 1.0]
442
+ best_tau = thresholds[0]
443
+ best_summary: dict[str, float | None] | None = None
444
+ best_key: tuple[float, float, float] | None = None
445
+ for tau in thresholds:
446
+ cases = _evaluate_predictions(dataset, predictions, tau=tau)
447
+ summary = _simple_summary(cases)
448
+ key = (
449
+ float(summary.get("selected_success") or 0.0),
450
+ float(summary.get("selected_utility") or 0.0),
451
+ float(summary.get("coverage") or 0.0),
452
+ )
453
+ if best_key is None or key > best_key:
454
+ best_key = key
455
+ best_tau = float(tau)
456
+ best_summary = summary
457
+ assert best_summary is not None
458
+ return best_tau, best_summary
459
+
460
+
461
+ def _evaluate_dataset(
462
+ dataset: dict[str, Any],
463
+ weights: np.ndarray,
464
+ mean: np.ndarray,
465
+ std: np.ndarray,
466
+ *,
467
+ tau: float,
468
+ ) -> list[dict[str, Any]]:
469
+ x = np.stack([sample["feature"] for sample in dataset["samples"]], axis=0)
470
+ x_norm = (x - mean) / std
471
+ x_norm[:, 0] = 1.0
472
+ return _evaluate_predictions(dataset, x_norm @ weights, tau=tau)
473
+
474
+
475
+ def _evaluate_predictions(dataset: dict[str, Any], predictions: np.ndarray, *, tau: float) -> list[dict[str, Any]]:
476
+ samples = dataset["samples"]
477
+ rows: list[dict[str, Any]] = []
478
+ for row_index, sample_indices in sorted(dataset["by_row"].items()):
479
+ best_index = max(sample_indices, key=lambda index: float(predictions[index]))
480
+ sample = samples[best_index]
481
+ predicted_margin = float(predictions[best_index])
482
+ execute = predicted_margin > float(tau)
483
+ selected_utility = (
484
+ float(sample["candidate_utility"]) if execute else float(sample["base_utility"])
485
+ )
486
+ selected_success = (
487
+ float(sample["candidate_success"]) if execute else float(sample["base_success"])
488
+ )
489
+ hidden_utility = float(sample["hidden_chart_oracle_utility"])
490
+ hidden_success = float(sample["hidden_chart_oracle_success"])
491
+ rows.append(
492
+ {
493
+ "chart_id": sample["chart_id"],
494
+ "task_id": sample["task_id"],
495
+ "seed": sample["seed"],
496
+ "train_seed": sample["train_seed"],
497
+ "selected_candidate_index": int(sample["candidate_index"]),
498
+ "predicted_margin": predicted_margin,
499
+ "tau": float(tau),
500
+ "execute_generated": float(execute),
501
+ "coverage": float(execute),
502
+ "fallback_rate": float(not execute),
503
+ "base_utility": float(sample["base_utility"]),
504
+ "base_success": float(sample["base_success"]),
505
+ "selected_utility": selected_utility,
506
+ "selected_success": selected_success,
507
+ "selected_utility_gain_over_base": selected_utility - float(sample["base_utility"]),
508
+ "selected_success_gain_over_base": selected_success - float(sample["base_success"]),
509
+ "proposal_oracle_utility": float(sample["proposal_oracle_utility"]),
510
+ "proposal_oracle_success": float(sample["proposal_oracle_success"]),
511
+ "hidden_chart_oracle_utility": hidden_utility,
512
+ "hidden_chart_oracle_success": hidden_success,
513
+ "outcome_ptr": float(sample["outcome_ptr"]),
514
+ "selector_regret": max(0.0, float(sample["proposal_oracle_utility"]) - selected_utility),
515
+ "success_selector_gap": max(0.0, float(sample["proposal_oracle_success"]) - selected_success),
516
+ "support_gap": max(0.0, hidden_utility - float(sample["proposal_oracle_utility"]))
517
+ if math.isfinite(hidden_utility)
518
+ else math.nan,
519
+ "success_support_gap": max(0.0, hidden_success - float(sample["proposal_oracle_success"]))
520
+ if math.isfinite(hidden_success)
521
+ else math.nan,
522
+ }
523
+ )
524
+ return rows
525
+
526
+
527
+ def _simple_summary(rows: list[dict[str, Any]]) -> dict[str, float | None]:
528
+ keys = [
529
+ "base_success",
530
+ "selected_success",
531
+ "proposal_oracle_success",
532
+ "hidden_chart_oracle_success",
533
+ "selected_success_gain_over_base",
534
+ "coverage",
535
+ "fallback_rate",
536
+ "outcome_ptr",
537
+ "success_support_gap",
538
+ "success_selector_gap",
539
+ "base_utility",
540
+ "selected_utility",
541
+ "proposal_oracle_utility",
542
+ "hidden_chart_oracle_utility",
543
+ "support_gap",
544
+ "selector_regret",
545
+ ]
546
+ return {key: _mean([row.get(key) for row in rows]) for key in keys}
547
+
548
+
549
+ def _group_means(
550
+ rows: list[dict[str, Any]],
551
+ key: str,
552
+ metric_names: list[str],
553
+ ) -> dict[str, dict[str, float]]:
554
+ grouped: dict[str, list[dict[str, Any]]] = defaultdict(list)
555
+ for row in rows:
556
+ grouped[str(row.get(key, "unknown"))].append(row)
557
+ output: dict[str, dict[str, float]] = {}
558
+ for group, group_rows in sorted(grouped.items()):
559
+ payload: dict[str, float] = {}
560
+ for metric in metric_names:
561
+ value = _mean([row.get(metric) for row in group_rows])
562
+ if value is not None:
563
+ payload[metric] = value
564
+ output[group] = payload
565
+ return output
566
+
567
+
568
+ def _mean(values: list[Any]) -> float | None:
569
+ clean = [
570
+ float(value)
571
+ for value in values
572
+ if isinstance(value, (int, float)) and math.isfinite(float(value))
573
+ ]
574
+ return sum(clean) / len(clean) if clean else None
575
+
576
+
577
+ def _source_rank(value: Any) -> float:
578
+ match = re.search(r"rank(\d+)", str(value))
579
+ return float(match.group(1)) if match else 0.0
580
+
581
+
582
+ def _table(metrics: dict[str, Any]) -> str:
583
+ summary = metrics["eval_summary"]
584
+ lines = [
585
+ "% Auto-generated by scripts/eval_learned_dominance_selector.py",
586
+ "\\begin{tabular}{lrrrrrrrr}",
587
+ "\\toprule",
588
+ "Rows & Coverage & Fallback & Base succ. & Selected succ. & Oracle succ. & OutcomePTR & Succ. support gap & Succ. selector gap \\\\",
589
+ "\\midrule",
590
+ f"{metrics['num_eval_rows']} & {_fmt(summary.get('coverage'))} & "
591
+ f"{_fmt(summary.get('fallback_rate'))} & {_fmt(summary.get('base_success'))} & "
592
+ f"{_fmt(summary.get('selected_success'))} & {_fmt(summary.get('proposal_oracle_success'))} & "
593
+ f"{_fmt(summary.get('outcome_ptr'))} & {_fmt(summary.get('success_support_gap'))} & "
594
+ f"{_fmt(summary.get('success_selector_gap'))} \\\\",
595
+ "\\bottomrule",
596
+ "\\end{tabular}",
597
+ ]
598
+ return "\n".join(lines)
599
+
600
+
601
+ def _report(metrics: dict[str, Any]) -> str:
602
+ summary = metrics["eval_summary"]
603
+ calibration = metrics["calibration_summary"]
604
+ lines = [
605
+ "# Learned Dominance-Calibrated CTT Selector",
606
+ "",
607
+ f"Calibration rows: `{metrics['num_calibration_rows']}`",
608
+ f"Eval rows: `{metrics['num_eval_rows']}`",
609
+ f"Selected ridge lambda: `{metrics['selected_lambda']}`",
610
+ f"Tau: `{metrics['tau']:.6f}`",
611
+ f"Feature set: `{metrics['feature_set']}`",
612
+ f"Target: `{metrics['target']}`",
613
+ "",
614
+ "The ridge calibrator and threshold are fit on calibration measured rows only. Eval outcomes are used only for reporting.",
615
+ "",
616
+ "| Split | Coverage | Fallback | Base success | Selected success | Proposal oracle | OutcomePTR | Success support gap | Success selector gap |",
617
+ "| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |",
618
+ f"| calibration | {_fmt(calibration.get('coverage'))} | {_fmt(calibration.get('fallback_rate'))} | "
619
+ f"{_fmt(calibration.get('base_success'))} | {_fmt(calibration.get('selected_success'))} | "
620
+ f"{_fmt(calibration.get('proposal_oracle_success'))} | {_fmt(calibration.get('outcome_ptr'))} | "
621
+ f"{_fmt(calibration.get('success_support_gap'))} | {_fmt(calibration.get('success_selector_gap'))} |",
622
+ f"| eval | {_fmt(summary.get('coverage'))} | {_fmt(summary.get('fallback_rate'))} | "
623
+ f"{_fmt(summary.get('base_success'))} | {_fmt(summary.get('selected_success'))} | "
624
+ f"{_fmt(summary.get('proposal_oracle_success'))} | {_fmt(summary.get('outcome_ptr'))} | "
625
+ f"{_fmt(summary.get('success_support_gap'))} | {_fmt(summary.get('success_selector_gap'))} |",
626
+ "",
627
+ "This is a selector diagnostic over already measured candidates, not a new rollout.",
628
+ ]
629
+ return "\n".join(lines)
630
+
631
+
632
+ def _write_provenance(out_dir: Path, args: argparse.Namespace) -> None:
633
+ (out_dir / "config.yaml").write_text(
634
+ "\n".join(f"{key}: {value}" for key, value in sorted(vars(args).items())) + "\n"
635
+ )
636
+ (out_dir / "command.txt").write_text(
637
+ "python scripts/eval_learned_dominance_selector.py " + " ".join(sys.argv[1:]) + "\n"
638
+ )
639
+ (out_dir / "git_hash.txt").write_text(_run(["git", "rev-parse", "HEAD"]) + "\n")
640
+ hashes = {
641
+ "calibration_input": _sha256(args.calibration_input),
642
+ "calibration_target_index": _sha256(args.calibration_target_index),
643
+ "eval_input": _sha256(args.eval_input),
644
+ "eval_target_index": _sha256(args.eval_target_index),
645
+ }
646
+ (out_dir / "data_hash.txt").write_text(json.dumps(hashes, indent=2, sort_keys=True) + "\n")
647
+ (out_dir / "split_hash.txt").write_text(
648
+ json.dumps(
649
+ {
650
+ "calibration_target_index": _index_hash(args.calibration_target_index),
651
+ "eval_target_index": _index_hash(args.eval_target_index),
652
+ },
653
+ indent=2,
654
+ sort_keys=True,
655
+ )
656
+ + "\n"
657
+ )
658
+
659
+
660
+ def _index_hash(path: Path) -> dict[str, Any]:
661
+ payload = json.loads(path.read_text())
662
+ return {
663
+ "split": payload.get("split"),
664
+ "content_hash": payload.get("content_hash"),
665
+ "split_hash": payload.get("split_hash"),
666
+ "retrieval_index_allowed": payload.get("retrieval_index_allowed"),
667
+ }
668
+
669
+
670
+ def _sha256(path: Path) -> str:
671
+ import hashlib
672
+
673
+ h = hashlib.sha256()
674
+ h.update(path.read_bytes())
675
+ return h.hexdigest()
676
+
677
+
678
+ def _fmt(value: Any) -> str:
679
+ if not isinstance(value, (int, float)) or not math.isfinite(float(value)):
680
+ return "n/a"
681
+ return f"{float(value):.4f}"
682
+
683
+
684
+ def _run(command: list[str]) -> str:
685
+ try:
686
+ return subprocess.check_output(command, cwd=PROJECT_ROOT, text=True).strip()
687
+ except (subprocess.CalledProcessError, FileNotFoundError):
688
+ return ""
689
+
690
+
691
+ if __name__ == "__main__":
692
+ raise SystemExit(main())
workspace/outputs/hf_verify_latest/context_turn/workspace/tests/test_dominance_selector.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import numpy as np
4
+
5
+ from scripts.eval_dominance_selector import _choose_tau, _conformal_quantile, _evaluate_case
6
+ from scripts.eval_learned_dominance_selector import (
7
+ _candidate_feature,
8
+ _evaluate_dataset,
9
+ _feature_names,
10
+ _fit_select_ridge,
11
+ _target_value,
12
+ )
13
+
14
+
15
+ def test_conformal_quantile_and_fallback_selection() -> None:
16
+ quantile = _conformal_quantile([0.0, 0.2, 0.4, 0.6], alpha=0.25)
17
+ assert quantile == 0.6
18
+
19
+ case = {
20
+ "chart_id": "c0",
21
+ "task_id": "pick",
22
+ "seed": "0",
23
+ "train_seed": "0",
24
+ "predicted_margin": 0.5,
25
+ "measured_margin": 0.4,
26
+ "base_utility": 0.3,
27
+ "base_success": 0.0,
28
+ "top_generated_utility": 1.2,
29
+ "top_generated_success": 1.0,
30
+ "proposal_oracle_utility": 1.2,
31
+ "proposal_oracle_success": 1.0,
32
+ "hidden_chart_oracle_utility": 1.5,
33
+ "hidden_chart_oracle_success": 1.0,
34
+ "outcome_ptr": 1.0,
35
+ }
36
+ executed = _evaluate_case(case, residual_quantile=0.1, tau=0.0)
37
+ assert executed["execute_generated"] == 1.0
38
+ assert executed["selected_success"] == 1.0
39
+
40
+ fallback = _evaluate_case(case, residual_quantile=0.6, tau=0.0)
41
+ assert fallback["execute_generated"] == 0.0
42
+ assert fallback["fallback_to_base"] == 1.0
43
+ assert fallback["selected_utility"] == 0.3
44
+
45
+
46
+ def test_choose_tau_prefers_success_then_utility_then_coverage() -> None:
47
+ cases = [
48
+ {
49
+ "predicted_margin": 2.0,
50
+ "base_utility": 0.5,
51
+ "base_success": 0.0,
52
+ "top_generated_utility": 1.0,
53
+ "top_generated_success": 1.0,
54
+ "proposal_oracle_utility": 1.0,
55
+ "proposal_oracle_success": 1.0,
56
+ "hidden_chart_oracle_utility": 1.0,
57
+ "hidden_chart_oracle_success": 1.0,
58
+ "outcome_ptr": 1.0,
59
+ },
60
+ {
61
+ "predicted_margin": -1.0,
62
+ "base_utility": 0.8,
63
+ "base_success": 1.0,
64
+ "top_generated_utility": 0.1,
65
+ "top_generated_success": 0.0,
66
+ "proposal_oracle_utility": 0.1,
67
+ "proposal_oracle_success": 0.0,
68
+ "hidden_chart_oracle_utility": 1.0,
69
+ "hidden_chart_oracle_success": 1.0,
70
+ "outcome_ptr": 0.0,
71
+ },
72
+ ]
73
+ tau = _choose_tau(cases, residual_quantile=0.0)
74
+ evaluated = [_evaluate_case(case, residual_quantile=0.0, tau=tau) for case in cases]
75
+ assert sum(row["selected_success"] for row in evaluated) == 2.0
76
+
77
+
78
+ def test_learned_dominance_ridge_prefers_positive_candidate() -> None:
79
+ def sample(row: int, candidate: int, score: float, margin: float, success: float) -> dict:
80
+ feature = np.zeros(10, dtype=float)
81
+ feature[0] = 1.0
82
+ feature[1] = score
83
+ feature[2] = margin
84
+ feature[4] = float(candidate)
85
+ return {
86
+ "row_index": row,
87
+ "candidate_index": candidate,
88
+ "feature": feature,
89
+ "target_margin": success - 0.2,
90
+ "candidate_utility": success,
91
+ "candidate_success": success,
92
+ "base_utility": 0.2,
93
+ "base_success": 0.0,
94
+ "proposal_oracle_utility": success,
95
+ "proposal_oracle_success": success,
96
+ "hidden_chart_oracle_utility": 1.0,
97
+ "hidden_chart_oracle_success": 1.0,
98
+ "outcome_ptr": success,
99
+ "chart_id": f"c{row}",
100
+ "task_id": "pick",
101
+ "seed": "0",
102
+ "train_seed": "0",
103
+ }
104
+
105
+ dataset = {
106
+ "samples": [
107
+ sample(0, 0, 2.0, 2.0, 1.0),
108
+ sample(0, 1, -1.0, -1.0, 0.0),
109
+ sample(1, 0, 2.0, 2.0, 1.0),
110
+ sample(1, 1, -1.0, -1.0, 0.0),
111
+ ],
112
+ "by_row": {0: [0, 1], 1: [2, 3]},
113
+ "num_rows": 2,
114
+ }
115
+ fit = _fit_select_ridge(dataset, lambdas=[0.1])
116
+ rows = _evaluate_dataset(dataset, fit["weights"], fit["mean"], fit["std"], tau=fit["tau"])
117
+ assert [row["selected_success"] for row in rows] == [1.0, 1.0]
118
+
119
+
120
+ def test_learned_dominance_tangent_features_and_success_weighted_target() -> None:
121
+ tangent = np.arange(21, dtype=float)
122
+ basic = _candidate_feature(
123
+ score=1.0,
124
+ base_score=0.25,
125
+ score_mean=0.5,
126
+ score_std=0.5,
127
+ candidate_index=1,
128
+ candidate_type="ctt_transport_rank3",
129
+ tangent=tangent,
130
+ num_candidates=8,
131
+ feature_set="basic",
132
+ )
133
+ expanded = _candidate_feature(
134
+ score=1.0,
135
+ base_score=0.25,
136
+ score_mean=0.5,
137
+ score_std=0.5,
138
+ candidate_index=1,
139
+ candidate_type="ctt_transport_rank3",
140
+ tangent=tangent,
141
+ num_candidates=8,
142
+ feature_set="tangent",
143
+ )
144
+ context = _candidate_feature(
145
+ score=1.0,
146
+ base_score=0.25,
147
+ score_mean=0.5,
148
+ score_std=0.5,
149
+ candidate_index=1,
150
+ candidate_type="ctt_transport_rank3",
151
+ tangent=tangent,
152
+ num_candidates=8,
153
+ feature_set="context",
154
+ context={
155
+ "target_task_id": "PickCube-v1",
156
+ "source_task_id": "PickCube-v1",
157
+ "instruction": "Pick up the cube.",
158
+ },
159
+ )
160
+ context_tangent = _candidate_feature(
161
+ score=1.0,
162
+ base_score=0.25,
163
+ score_mean=0.5,
164
+ score_std=0.5,
165
+ candidate_index=1,
166
+ candidate_type="ctt_transport_rank3",
167
+ tangent=tangent,
168
+ num_candidates=8,
169
+ feature_set="context_tangent",
170
+ context={
171
+ "target_task_id": "PickCube-v1",
172
+ "source_task_id": "PickCube-v1",
173
+ "instruction": "Pick up the cube.",
174
+ },
175
+ )
176
+ assert len(basic) == len(_feature_names("basic")) == 10
177
+ assert len(expanded) == len(_feature_names("tangent")) == 52
178
+ assert len(context) == len(_feature_names("context")) == 37
179
+ assert len(context_tangent) == len(_feature_names("context_tangent")) == 79
180
+ assert basic[2] == 0.75
181
+ assert basic[6] == 3.0
182
+ assert context[-3] == 1.0
183
+ assert _target_value("success_weighted_margin", utility_margin=0.2, candidate_success=1.0) == 1.2