File size: 5,797 Bytes
d84195e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Experiments

Experiments in DoVLA-CIL focus on whether same-state counterfactual interventions improve action
selection, effect prediction, language controllability, and robustness.

## CausalStress

CausalStress generates controlled toy-backend groups across:

- `minimal_language_change`
- `wrong_target_distractor`
- `near_miss_boundary`
- `physics_shift_placeholder`
- `effect_query`
- `counterfactual_ranking`
- `similar_distractors`
- `spatial_relation_minimal_pairs`
- `negation_and_avoidance`
- `sequential_tasks`
- `irreversible_failure`
- `physics_perturbation_placeholders`

Harder families include red mug vs red cup, blue bowl vs blue plate, same category/different color,
same color/different category, left/right, inside/next-to, behind/front, negation, sequential
skills, out-of-workspace failures, low friction, heavy objects, and sticky drawers.

Metrics:

- `task_success_rate`
- `instruction_switch_accuracy`
- `pairwise_ranking_accuracy`
- `top1_action_selection`
- `ndcg_at_k`
- `effect_prediction_mae`
- `success_prediction_accuracy`
- `regret_calibration_error`
- per-category success, instruction switch, and failure rate
- target-selection confusion matrices

Run:

```bash
python scripts/eval_causalstress.py \
  --checkpoint runs/dovla_toy/best.pt \
  --backend toy \
  --out runs/dovla_toy/causalstress.json \
  --num-tasks 20 \
  --k 16
```

## Scaling Over K

Scaling experiments keep total record budget fixed as `B = N * K`. For each `K`, the runner chooses
`N = total_records // K`, generates a toy CIL dataset, trains DoVLA, evaluates CausalStress, writes
per-run metrics, aggregates CSVs, creates plots, and fits:

```text
score = alpha + beta_log_k * log(K)
```

Run:

```bash
python scripts/run_scaling.py \
  --backend toy \
  --tasks builtins \
  --out runs/scaling_toy \
  --total-records 4096 \
  --k-values 1,2,4,8,16,32 \
  --epochs 3 \
  --seed 0
```

## Baselines

```bash
python scripts/run_baseline.py \
  --baseline expert_only_bc \
  --dataset data/cil_toy \
  --out runs/baselines/expert_only_bc
```

Modes:

- `expert_only_bc`: one best/expert action per group; no ranking/regret.
- `more_independent_demos`: K=1-style independent demonstration comparison.
- `random_negatives`: structured candidates replaced by random-negative labels.
- `cross_state_negatives`: matched-budget reward-ordered pairs from different states of the same
  task; this tests whether exact same-state cancellation matters.
- `label_only_counterfactual`: heuristic labels without measured outcomes.
- `world_model_auxiliary`: effect/progress/success auxiliary losses without ranking/regret.
- `no_effect_head`: effect loss removed.
- `no_rank_regret`: ranking and regret removed.

## Reports

Dataset report:

```bash
python scripts/report_dataset.py --dataset data/cil_toy --out reports/cil_toy
```

Evaluation report:

```bash
python scripts/report_eval.py \
  --inputs "runs/scaling_toy/*/metrics.json" \
  --out reports/scaling_toy
```

Paper artifacts:

```bash
python scripts/make_paper_artifacts.py --runs runs --out paper_artifacts
```

The paper artifact script writes scaling, baseline, ablation, and per-category tables, plus figures
for performance vs K, same-state vs cross-state ranking, physical-outcome vs label-only, success by
failure category, and regret calibration.

## Optional TransferCritic Studies

TransferCritic is a secondary data-curation module for selecting CIL records or groups under a
budget. It compares random, top-reward, task-balanced, and set-conditioned utility selections. See
`docs/transfercritic.md`.

## Optional Retrieval Studies

Critic-gated retrieval is an inference-time extension for retrieving successful, near-miss, and
partial-success CIL exemplars. It compares no retrieval, nearest-neighbor, success-only,
success/failure contrastive, and critic-gated retrieval. See `docs/retrieval.md`.

## Configs

Reproducible YAML configs live under:

- `configs/toy/`
- `configs/baselines/`
- `configs/large/`

The loader supports environment expansion, CLI overrides, and saving resolved configs into run
directories.

## Large-Scale Manifests

Large multi-stage experiment manifests live under `manifests/`:

- `cil_160m.yaml`
- `cil_1b_template.yaml`
- `scaling_k_sweep.yaml`
- `baselines_full.yaml`

Plan a manifest without executing jobs:

```bash
python scripts/run_manifest.py manifests/scaling_k_sweep.yaml --dry-run
```

Emit generic Slurm scripts and save a resolved manifest:

```bash
python scripts/run_manifest.py \
  manifests/cil_160m.yaml \
  --dry-run \
  --emit-slurm \
  --out runs/cil_160m_plan
```

The manifest runner redacts secret-looking fields and never emits API keys into planned commands.
Manifests are validated before any files are written: positive record counts, training duration,
loss weights, and unique positive K values are checked locally. Slurm resources use the optional
`scheduler` manifest section and may be overridden while emitting scripts with
`DOVLA_PARTITION`, `DOVLA_ACCOUNT`, `DOVLA_CPUS_PER_TASK`, `DOVLA_GPUS_PER_TASK`,
`DOVLA_MEM`, `DOVLA_TIME`, and `DOVLA_LOG_DIR`. These values are resolved into literal
`#SBATCH` directives because Slurm does not expand shell expressions in directive lines.

Backend planning is explicit. Toy manifests call `generate_cil.py` and may be run with
`--execute-local`. ManiSkill manifests call `generate_maniskill_lattice.py`, multiply
`num_tasks * num_states_per_task` into the physical state-group count, and require
`simulator_params.demo_path` (normally supplied through `MANISKILL_DEMO_PATH`). Genesis remains
a visible placeholder until a task-specific measured-intervention adapter exists. Training loss
weights are forwarded as repeated `--loss-weight NAME=VALUE` arguments and are saved again in the
trainer's resolved config.