anhtld commited on
Commit
72bd06c
·
verified ·
1 Parent(s): 14e118d

Auto-sync: 2026-06-29 01:34:49 (part 3)

Browse files
scripts/build_paper_table_status.py CHANGED
@@ -505,6 +505,36 @@ SPECS = [
505
  story_role="strong train-source progress prior replacing typed no-op prior",
506
  pending_job="14894675/14894677",
507
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  ResultSpec(
509
  key="retrieval_residual_taskrelative_k4_mean_noopbonus003",
510
  label="K4 task-relative mean-by-type residual retrieval, scale 0.40, margin 0.20, no-op residual bonus 0.03",
 
505
  story_role="strong train-source progress prior replacing typed no-op prior",
506
  pending_job="14894675/14894677",
507
  ),
508
+ ResultSpec(
509
+ key="retrieval_residual_k4_mean_srcscorebonus0015",
510
+ label="K4 mean-by-type residual retrieval, scale 0.40, margin 0.20, source-score bonus 0.015",
511
+ path="h16_policy_ckpt_near_miss_policy_bc5_bestpt_retrieval_residual_k4s040_safe_margin0p20_mean_by_type_srcscorebonus0p015_summary.json",
512
+ clean_deployment="yes",
513
+ same_state_proposals="no",
514
+ expert_proposal="no",
515
+ story_role="train-source reward-score prior for sparse residual transport",
516
+ pending_job="14897123/14897126",
517
+ ),
518
+ ResultSpec(
519
+ key="retrieval_residual_k4_mean_srcscorebonus002",
520
+ label="K4 mean-by-type residual retrieval, scale 0.40, margin 0.20, source-score bonus 0.02",
521
+ path="h16_policy_ckpt_near_miss_policy_bc5_bestpt_retrieval_residual_k4s040_safe_margin0p20_mean_by_type_srcscorebonus0p02_summary.json",
522
+ clean_deployment="yes",
523
+ same_state_proposals="no",
524
+ expert_proposal="no",
525
+ story_role="train-source reward-score prior for sparse residual transport",
526
+ pending_job="14897124/14897127",
527
+ ),
528
+ ResultSpec(
529
+ key="retrieval_residual_k4_mean_srcscorebonus0025",
530
+ label="K4 mean-by-type residual retrieval, scale 0.40, margin 0.20, source-score bonus 0.025",
531
+ path="h16_policy_ckpt_near_miss_policy_bc5_bestpt_retrieval_residual_k4s040_safe_margin0p20_mean_by_type_srcscorebonus0p025_summary.json",
532
+ clean_deployment="yes",
533
+ same_state_proposals="no",
534
+ expert_proposal="no",
535
+ story_role="train-source reward-score prior for sparse residual transport",
536
+ pending_job="14897125/14897128",
537
+ ),
538
  ResultSpec(
539
  key="retrieval_residual_taskrelative_k4_mean_noopbonus003",
540
  label="K4 task-relative mean-by-type residual retrieval, scale 0.40, margin 0.20, no-op residual bonus 0.03",
scripts/eval_maniskill_policy_rollout.py CHANGED
@@ -143,6 +143,13 @@ def main(argv: list[str] | None = None) -> int:
143
  help="Scale for adding a train-source progress prior to each retrieved residual "
144
  "candidate before field selection. The policy_residual fallback receives zero.",
145
  )
 
 
 
 
 
 
 
146
  parser.add_argument(
147
  "--retrieval-residual-scale",
148
  type=float,
@@ -238,6 +245,9 @@ def main(argv: list[str] | None = None) -> int:
238
  retrieval_residual_source_progress_bonus_scale=(
239
  args.retrieval_residual_source_progress_bonus_scale
240
  ),
 
 
 
241
  retrieval_residual_scale=args.retrieval_residual_scale,
242
  retrieval_residual_scales=retrieval_residual_scales,
243
  retrieval_residual_anchor=args.retrieval_residual_anchor,
 
143
  help="Scale for adding a train-source progress prior to each retrieved residual "
144
  "candidate before field selection. The policy_residual fallback receives zero.",
145
  )
146
+ parser.add_argument(
147
+ "--retrieval-residual-source-score-bonus-scale",
148
+ type=float,
149
+ default=0.0,
150
+ help="Scale for adding a train-source reward-score prior to each retrieved residual "
151
+ "candidate before field selection. Score is progress plus terminal success.",
152
+ )
153
  parser.add_argument(
154
  "--retrieval-residual-scale",
155
  type=float,
 
245
  retrieval_residual_source_progress_bonus_scale=(
246
  args.retrieval_residual_source_progress_bonus_scale
247
  ),
248
+ retrieval_residual_source_score_bonus_scale=(
249
+ args.retrieval_residual_source_score_bonus_scale
250
+ ),
251
  retrieval_residual_scale=args.retrieval_residual_scale,
252
  retrieval_residual_scales=retrieval_residual_scales,
253
  retrieval_residual_anchor=args.retrieval_residual_anchor,
scripts/slurm/eval_maniskill_policy_rollout.sbatch CHANGED
@@ -55,6 +55,7 @@ RETRIEVAL_METRIC="${RETRIEVAL_METRIC:-raw}"
55
  RETRIEVAL_TYPE_MIN_SUCCESS="${RETRIEVAL_TYPE_MIN_SUCCESS:-0.0}"
56
  RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS="${RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS:-0.0}"
57
  RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE="${RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE:-0.0}"
 
58
  RETRIEVAL_RESIDUAL_SCALE="${RETRIEVAL_RESIDUAL_SCALE:-1.0}"
59
  RETRIEVAL_RESIDUAL_SCALES="${RETRIEVAL_RESIDUAL_SCALES:-}"
60
  if [[ -n "${RETRIEVAL_RESIDUAL_SCALES_COLON:-}" ]]; then
@@ -122,6 +123,7 @@ apptainer exec --nv \
122
  --retrieval-type-min-success "$RETRIEVAL_TYPE_MIN_SUCCESS" \
123
  --retrieval-residual-min-source-progress "$RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS" \
124
  --retrieval-residual-source-progress-bonus-scale "$RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE" \
 
125
  --retrieval-residual-scale "$RETRIEVAL_RESIDUAL_SCALE" \
126
  --retrieval-residual-scales "$RETRIEVAL_RESIDUAL_SCALES" \
127
  --retrieval-residual-anchor "$RETRIEVAL_RESIDUAL_ANCHOR" \
 
55
  RETRIEVAL_TYPE_MIN_SUCCESS="${RETRIEVAL_TYPE_MIN_SUCCESS:-0.0}"
56
  RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS="${RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS:-0.0}"
57
  RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE="${RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE:-0.0}"
58
+ RETRIEVAL_RESIDUAL_SOURCE_SCORE_BONUS_SCALE="${RETRIEVAL_RESIDUAL_SOURCE_SCORE_BONUS_SCALE:-0.0}"
59
  RETRIEVAL_RESIDUAL_SCALE="${RETRIEVAL_RESIDUAL_SCALE:-1.0}"
60
  RETRIEVAL_RESIDUAL_SCALES="${RETRIEVAL_RESIDUAL_SCALES:-}"
61
  if [[ -n "${RETRIEVAL_RESIDUAL_SCALES_COLON:-}" ]]; then
 
123
  --retrieval-type-min-success "$RETRIEVAL_TYPE_MIN_SUCCESS" \
124
  --retrieval-residual-min-source-progress "$RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS" \
125
  --retrieval-residual-source-progress-bonus-scale "$RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE" \
126
+ --retrieval-residual-source-score-bonus-scale "$RETRIEVAL_RESIDUAL_SOURCE_SCORE_BONUS_SCALE" \
127
  --retrieval-residual-scale "$RETRIEVAL_RESIDUAL_SCALE" \
128
  --retrieval-residual-scales "$RETRIEVAL_RESIDUAL_SCALES" \
129
  --retrieval-residual-anchor "$RETRIEVAL_RESIDUAL_ANCHOR" \
scripts/slurm/eval_maniskill_policy_rollout_cpu_smoke.sbatch CHANGED
@@ -54,6 +54,7 @@ RETRIEVAL_METRIC="${RETRIEVAL_METRIC:-raw}"
54
  RETRIEVAL_TYPE_MIN_SUCCESS="${RETRIEVAL_TYPE_MIN_SUCCESS:-0.0}"
55
  RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS="${RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS:-0.0}"
56
  RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE="${RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE:-0.0}"
 
57
  RETRIEVAL_RESIDUAL_SCALE="${RETRIEVAL_RESIDUAL_SCALE:-1.0}"
58
  RETRIEVAL_RESIDUAL_SCALES="${RETRIEVAL_RESIDUAL_SCALES:-}"
59
  if [[ -n "${RETRIEVAL_RESIDUAL_SCALES_COLON:-}" ]]; then
@@ -118,6 +119,7 @@ apptainer exec \
118
  --retrieval-type-min-success "$RETRIEVAL_TYPE_MIN_SUCCESS" \
119
  --retrieval-residual-min-source-progress "$RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS" \
120
  --retrieval-residual-source-progress-bonus-scale "$RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE" \
 
121
  --retrieval-residual-scale "$RETRIEVAL_RESIDUAL_SCALE" \
122
  --retrieval-residual-scales "$RETRIEVAL_RESIDUAL_SCALES" \
123
  --retrieval-residual-anchor "$RETRIEVAL_RESIDUAL_ANCHOR" \
 
54
  RETRIEVAL_TYPE_MIN_SUCCESS="${RETRIEVAL_TYPE_MIN_SUCCESS:-0.0}"
55
  RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS="${RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS:-0.0}"
56
  RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE="${RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE:-0.0}"
57
+ RETRIEVAL_RESIDUAL_SOURCE_SCORE_BONUS_SCALE="${RETRIEVAL_RESIDUAL_SOURCE_SCORE_BONUS_SCALE:-0.0}"
58
  RETRIEVAL_RESIDUAL_SCALE="${RETRIEVAL_RESIDUAL_SCALE:-1.0}"
59
  RETRIEVAL_RESIDUAL_SCALES="${RETRIEVAL_RESIDUAL_SCALES:-}"
60
  if [[ -n "${RETRIEVAL_RESIDUAL_SCALES_COLON:-}" ]]; then
 
119
  --retrieval-type-min-success "$RETRIEVAL_TYPE_MIN_SUCCESS" \
120
  --retrieval-residual-min-source-progress "$RETRIEVAL_RESIDUAL_MIN_SOURCE_PROGRESS" \
121
  --retrieval-residual-source-progress-bonus-scale "$RETRIEVAL_RESIDUAL_SOURCE_PROGRESS_BONUS_SCALE" \
122
+ --retrieval-residual-source-score-bonus-scale "$RETRIEVAL_RESIDUAL_SOURCE_SCORE_BONUS_SCALE" \
123
  --retrieval-residual-scale "$RETRIEVAL_RESIDUAL_SCALE" \
124
  --retrieval-residual-scales "$RETRIEVAL_RESIDUAL_SCALES" \
125
  --retrieval-residual-anchor "$RETRIEVAL_RESIDUAL_ANCHOR" \
scripts/slurm/smoke_retrieval_metric_unit.sbatch CHANGED
@@ -172,14 +172,23 @@ case_task_relative = _RolloutCase(
172
  )
173
  assert task_relative_attached.candidate_source_group_id == "train_actor_match", task_relative_attached
174
 
175
- def record_progress(group_id, candidate_type, action_value, progress, feature):
 
 
 
 
 
 
 
 
 
176
  return SimpleNamespace(
177
  group_id=group_id,
178
  task_id="PickCube-v1",
179
  candidate_type=candidate_type,
180
  record_id=f"{group_id}-{candidate_type}-{action_value}",
181
  observation_inline={"features": feature},
182
- reward=SimpleNamespace(progress=progress, terminal_success=progress >= 1.0),
183
  action_chunk=ActionChunk(
184
  representation="continuous",
185
  horizon=1,
@@ -190,13 +199,27 @@ def record_progress(group_id, candidate_type, action_value, progress, feature):
190
  groups_progress = {
191
  "train_a": [
192
  record_progress("train_a", "expert", 1.0, 1.0, [0.0, 0.0]),
193
- record_progress("train_a", "no_op", 1.2, 0.8, [0.0, 0.0]),
 
 
 
 
 
 
 
194
  record_progress("train_a", "wrong_gripper", 1.4, 0.2, [0.0, 0.0]),
195
  ],
196
  "train_b": [
197
  record_progress("train_b", "expert", 2.0, 1.0, [10.0, 0.0]),
198
  record_progress("train_b", "no_op", 2.2, 0.8, [10.0, 0.0]),
199
- record_progress("train_b", "wrong_gripper", 2.4, 0.8, [10.0, 0.0]),
 
 
 
 
 
 
 
200
  ],
201
  "heldout_a": [record_progress("heldout_a", "expert", 9.0, 1.0, [0.0, 0.0])],
202
  "heldout_b": [record_progress("heldout_b", "expert", 9.0, 1.0, [10.0, 0.0])],
@@ -232,6 +255,7 @@ progress_attached = _attach_retrieved_residual_candidates(
232
  retrieval_neighbors=1,
233
  retrieval_residual_min_source_progress=0.5,
234
  retrieval_residual_source_progress_bonus_scale=0.1,
 
235
  )
236
  assert [len(case.candidate_action_values) for case in progress_attached] == [3, 3], progress_attached
237
  assert progress_attached[0].candidate_types == [
@@ -244,8 +268,8 @@ assert progress_attached[1].candidate_types == [
244
  "residual_no_op",
245
  "residual_wrong_gripper",
246
  ], progress_attached[1].candidate_types
247
- assert np.allclose(progress_attached[0].candidate_score_bonuses, [0.0, 0.08, 0.0])
248
- assert np.allclose(progress_attached[1].candidate_score_bonuses, [0.0, 0.08, 0.08])
249
  print({
250
  "status": "ok",
251
  "raw": raw_attached.candidate_source_group_id,
 
172
  )
173
  assert task_relative_attached.candidate_source_group_id == "train_actor_match", task_relative_attached
174
 
175
+ def record_progress(
176
+ group_id,
177
+ candidate_type,
178
+ action_value,
179
+ progress,
180
+ feature,
181
+ terminal_success=None,
182
+ ):
183
+ if terminal_success is None:
184
+ terminal_success = progress >= 1.0
185
  return SimpleNamespace(
186
  group_id=group_id,
187
  task_id="PickCube-v1",
188
  candidate_type=candidate_type,
189
  record_id=f"{group_id}-{candidate_type}-{action_value}",
190
  observation_inline={"features": feature},
191
+ reward=SimpleNamespace(progress=progress, terminal_success=terminal_success),
192
  action_chunk=ActionChunk(
193
  representation="continuous",
194
  horizon=1,
 
199
  groups_progress = {
200
  "train_a": [
201
  record_progress("train_a", "expert", 1.0, 1.0, [0.0, 0.0]),
202
+ record_progress(
203
+ "train_a",
204
+ "no_op",
205
+ 1.2,
206
+ 0.8,
207
+ [0.0, 0.0],
208
+ terminal_success=True,
209
+ ),
210
  record_progress("train_a", "wrong_gripper", 1.4, 0.2, [0.0, 0.0]),
211
  ],
212
  "train_b": [
213
  record_progress("train_b", "expert", 2.0, 1.0, [10.0, 0.0]),
214
  record_progress("train_b", "no_op", 2.2, 0.8, [10.0, 0.0]),
215
+ record_progress(
216
+ "train_b",
217
+ "wrong_gripper",
218
+ 2.4,
219
+ 0.8,
220
+ [10.0, 0.0],
221
+ terminal_success=True,
222
+ ),
223
  ],
224
  "heldout_a": [record_progress("heldout_a", "expert", 9.0, 1.0, [0.0, 0.0])],
225
  "heldout_b": [record_progress("heldout_b", "expert", 9.0, 1.0, [10.0, 0.0])],
 
255
  retrieval_neighbors=1,
256
  retrieval_residual_min_source_progress=0.5,
257
  retrieval_residual_source_progress_bonus_scale=0.1,
258
+ retrieval_residual_source_score_bonus_scale=0.05,
259
  )
260
  assert [len(case.candidate_action_values) for case in progress_attached] == [3, 3], progress_attached
261
  assert progress_attached[0].candidate_types == [
 
268
  "residual_no_op",
269
  "residual_wrong_gripper",
270
  ], progress_attached[1].candidate_types
271
+ assert np.allclose(progress_attached[0].candidate_score_bonuses, [0.0, 0.17, 0.0])
272
+ assert np.allclose(progress_attached[1].candidate_score_bonuses, [0.0, 0.12, 0.17])
273
  print({
274
  "status": "ok",
275
  "raw": raw_attached.candidate_source_group_id,
scripts/slurm/summarize_h16_policy_ckpt.sbatch CHANGED
@@ -76,6 +76,9 @@ for result_path in sorted(base_dir.glob(f"seed_*/{out_name}")):
76
  "retrieval_residual_source_progress_bonus_scale": data.get(
77
  "retrieval_residual_source_progress_bonus_scale", 0.0
78
  ),
 
 
 
79
  "retrieval_residual_scale": data.get("retrieval_residual_scale", 0.0),
80
  "retrieval_residual_scales": data.get("retrieval_residual_scales", []),
81
  "retrieval_residual_anchor": data.get("retrieval_residual_anchor", "none"),
@@ -142,14 +145,14 @@ lines = [
142
  f"Mean progress: {summary['mean_progress']:.2%}",
143
  f"Mean action MSE to best: {summary['mean_action_mse_to_best']:.3f}",
144
  "",
145
- "| seed | mode | k | policy cand | retrieval K | retrieval metric | residual anchor | residual reduce | min type success | min source progress | source progress bonus | residual scale | residual scales | margin | sigma | opt steps | trust | success | progress | oracle | action MSE |",
146
- "|---:|---|---:|---|---:|---|---|---|---:|---:|---:|---:|---|---:|---:|---:|---:|---:|---:|---:|---:|",
147
  ]
148
  for row in rows:
149
  scales = row.get("retrieval_residual_scales") or []
150
  scale_grid = ",".join(f"{float(scale):.2f}" for scale in scales) if scales else "none"
151
  lines.append(
152
- "| {seed} | {mode} | {k} | {policy_cand} | {retrieval} | {metric} | {anchor} | {reduce} | {min_success:.2f} | {min_source_progress:.2f} | {source_progress_bonus:.3f} | {scale:.2f} | {scale_grid} | {margin:.3f} | {sigma:.2f} | {steps} | {trust:.2f} | "
153
  "{success:.2%} | {progress:.2%} | {oracle:.2%} | {mse:.3f} |".format(
154
  seed=row["seed"],
155
  mode=row.get("selection_mode") or "policy",
@@ -165,6 +168,10 @@ for row in rows:
165
  "retrieval_residual_source_progress_bonus_scale"
166
  )
167
  or 0.0,
 
 
 
 
168
  scale=row.get("retrieval_residual_scale") or 0.0,
169
  scale_grid=scale_grid,
170
  margin=row.get("selection_margin") or 0.0,
 
76
  "retrieval_residual_source_progress_bonus_scale": data.get(
77
  "retrieval_residual_source_progress_bonus_scale", 0.0
78
  ),
79
+ "retrieval_residual_source_score_bonus_scale": data.get(
80
+ "retrieval_residual_source_score_bonus_scale", 0.0
81
+ ),
82
  "retrieval_residual_scale": data.get("retrieval_residual_scale", 0.0),
83
  "retrieval_residual_scales": data.get("retrieval_residual_scales", []),
84
  "retrieval_residual_anchor": data.get("retrieval_residual_anchor", "none"),
 
145
  f"Mean progress: {summary['mean_progress']:.2%}",
146
  f"Mean action MSE to best: {summary['mean_action_mse_to_best']:.3f}",
147
  "",
148
+ "| seed | mode | k | policy cand | retrieval K | retrieval metric | residual anchor | residual reduce | min type success | min source progress | source progress bonus | source score bonus | residual scale | residual scales | margin | sigma | opt steps | trust | success | progress | oracle | action MSE |",
149
+ "|---:|---|---:|---|---:|---|---|---|---:|---:|---:|---:|---:|---|---:|---:|---:|---:|---:|---:|---:|---:|",
150
  ]
151
  for row in rows:
152
  scales = row.get("retrieval_residual_scales") or []
153
  scale_grid = ",".join(f"{float(scale):.2f}" for scale in scales) if scales else "none"
154
  lines.append(
155
+ "| {seed} | {mode} | {k} | {policy_cand} | {retrieval} | {metric} | {anchor} | {reduce} | {min_success:.2f} | {min_source_progress:.2f} | {source_progress_bonus:.3f} | {source_score_bonus:.3f} | {scale:.2f} | {scale_grid} | {margin:.3f} | {sigma:.2f} | {steps} | {trust:.2f} | "
156
  "{success:.2%} | {progress:.2%} | {oracle:.2%} | {mse:.3f} |".format(
157
  seed=row["seed"],
158
  mode=row.get("selection_mode") or "policy",
 
168
  "retrieval_residual_source_progress_bonus_scale"
169
  )
170
  or 0.0,
171
+ source_score_bonus=row.get(
172
+ "retrieval_residual_source_score_bonus_scale"
173
+ )
174
+ or 0.0,
175
  scale=row.get("retrieval_residual_scale") or 0.0,
176
  scale_grid=scale_grid,
177
  margin=row.get("selection_margin") or 0.0,
tests/test_maniskill_policy_rollout.py CHANGED
@@ -1093,14 +1093,17 @@ def test_retrieval_residual_source_progress_threshold_filters_individual_residua
1093
  candidate_type: str,
1094
  action_value: float,
1095
  progress: float,
 
1096
  ):
 
 
1097
  return SimpleNamespace(
1098
  group_id=group_id,
1099
  task_id="PickCube-v1",
1100
  candidate_type=candidate_type,
1101
  record_id=f"{group_id}-{candidate_type}-{action_value}",
1102
  observation_inline={"features": [0.0, 0.0]},
1103
- reward=SimpleNamespace(progress=progress, terminal_success=progress >= 1.0),
1104
  action_chunk=ActionChunk(
1105
  representation="continuous",
1106
  horizon=1,
@@ -1111,7 +1114,7 @@ def test_retrieval_residual_source_progress_threshold_filters_individual_residua
1111
  groups = {
1112
  "train_a": [
1113
  record("train_a", "expert", 1.0, 1.0),
1114
- record("train_a", "no_op", 1.2, 0.8),
1115
  record("train_a", "wrong_gripper", 1.4, 0.2),
1116
  ],
1117
  "heldout": [
@@ -1148,10 +1151,11 @@ def test_retrieval_residual_source_progress_threshold_filters_individual_residua
1148
  retrieval_neighbors=1,
1149
  retrieval_residual_min_source_progress=0.5,
1150
  retrieval_residual_source_progress_bonus_scale=0.1,
 
1151
  )
1152
 
1153
  assert attached.candidate_types == ["policy_residual", "residual_no_op"]
1154
- assert np.allclose(attached.candidate_score_bonuses, [0.0, 0.08])
1155
  assert np.allclose(
1156
  np.asarray(attached.candidate_action_values, dtype=np.float32),
1157
  np.asarray([[[0.0, 0.0]], [[0.2, 0.0]]]),
@@ -1165,14 +1169,17 @@ def test_retrieval_residual_source_progress_padding_keeps_batches_rectangular()
1165
  action_value: float,
1166
  progress: float,
1167
  feature: list[float],
 
1168
  ):
 
 
1169
  return SimpleNamespace(
1170
  group_id=group_id,
1171
  task_id="PickCube-v1",
1172
  candidate_type=candidate_type,
1173
  record_id=f"{group_id}-{candidate_type}-{action_value}",
1174
  observation_inline={"features": feature},
1175
- reward=SimpleNamespace(progress=progress, terminal_success=progress >= 1.0),
1176
  action_chunk=ActionChunk(
1177
  representation="continuous",
1178
  horizon=1,
@@ -1183,13 +1190,20 @@ def test_retrieval_residual_source_progress_padding_keeps_batches_rectangular()
1183
  groups = {
1184
  "train_a": [
1185
  record("train_a", "expert", 1.0, 1.0, [0.0, 0.0]),
1186
- record("train_a", "no_op", 1.2, 0.8, [0.0, 0.0]),
1187
  record("train_a", "wrong_gripper", 1.4, 0.2, [0.0, 0.0]),
1188
  ],
1189
  "train_b": [
1190
  record("train_b", "expert", 2.0, 1.0, [10.0, 0.0]),
1191
  record("train_b", "no_op", 2.2, 0.8, [10.0, 0.0]),
1192
- record("train_b", "wrong_gripper", 2.4, 0.8, [10.0, 0.0]),
 
 
 
 
 
 
 
1193
  ],
1194
  "heldout_a": [record("heldout_a", "expert", 9.0, 1.0, [0.0, 0.0])],
1195
  "heldout_b": [record("heldout_b", "expert", 9.0, 1.0, [10.0, 0.0])],
@@ -1227,6 +1241,7 @@ def test_retrieval_residual_source_progress_padding_keeps_batches_rectangular()
1227
  retrieval_neighbors=1,
1228
  retrieval_residual_min_source_progress=0.5,
1229
  retrieval_residual_source_progress_bonus_scale=0.1,
 
1230
  )
1231
 
1232
  assert [len(case.candidate_action_values) for case in attached] == [3, 3]
@@ -1240,5 +1255,5 @@ def test_retrieval_residual_source_progress_padding_keeps_batches_rectangular()
1240
  "residual_no_op",
1241
  "residual_wrong_gripper",
1242
  ]
1243
- assert np.allclose(attached[0].candidate_score_bonuses, [0.0, 0.08, 0.0])
1244
- assert np.allclose(attached[1].candidate_score_bonuses, [0.0, 0.08, 0.08])
 
1093
  candidate_type: str,
1094
  action_value: float,
1095
  progress: float,
1096
+ terminal_success: bool | None = None,
1097
  ):
1098
+ if terminal_success is None:
1099
+ terminal_success = progress >= 1.0
1100
  return SimpleNamespace(
1101
  group_id=group_id,
1102
  task_id="PickCube-v1",
1103
  candidate_type=candidate_type,
1104
  record_id=f"{group_id}-{candidate_type}-{action_value}",
1105
  observation_inline={"features": [0.0, 0.0]},
1106
+ reward=SimpleNamespace(progress=progress, terminal_success=terminal_success),
1107
  action_chunk=ActionChunk(
1108
  representation="continuous",
1109
  horizon=1,
 
1114
  groups = {
1115
  "train_a": [
1116
  record("train_a", "expert", 1.0, 1.0),
1117
+ record("train_a", "no_op", 1.2, 0.8, terminal_success=True),
1118
  record("train_a", "wrong_gripper", 1.4, 0.2),
1119
  ],
1120
  "heldout": [
 
1151
  retrieval_neighbors=1,
1152
  retrieval_residual_min_source_progress=0.5,
1153
  retrieval_residual_source_progress_bonus_scale=0.1,
1154
+ retrieval_residual_source_score_bonus_scale=0.05,
1155
  )
1156
 
1157
  assert attached.candidate_types == ["policy_residual", "residual_no_op"]
1158
+ assert np.allclose(attached.candidate_score_bonuses, [0.0, 0.17])
1159
  assert np.allclose(
1160
  np.asarray(attached.candidate_action_values, dtype=np.float32),
1161
  np.asarray([[[0.0, 0.0]], [[0.2, 0.0]]]),
 
1169
  action_value: float,
1170
  progress: float,
1171
  feature: list[float],
1172
+ terminal_success: bool | None = None,
1173
  ):
1174
+ if terminal_success is None:
1175
+ terminal_success = progress >= 1.0
1176
  return SimpleNamespace(
1177
  group_id=group_id,
1178
  task_id="PickCube-v1",
1179
  candidate_type=candidate_type,
1180
  record_id=f"{group_id}-{candidate_type}-{action_value}",
1181
  observation_inline={"features": feature},
1182
+ reward=SimpleNamespace(progress=progress, terminal_success=terminal_success),
1183
  action_chunk=ActionChunk(
1184
  representation="continuous",
1185
  horizon=1,
 
1190
  groups = {
1191
  "train_a": [
1192
  record("train_a", "expert", 1.0, 1.0, [0.0, 0.0]),
1193
+ record("train_a", "no_op", 1.2, 0.8, [0.0, 0.0], terminal_success=True),
1194
  record("train_a", "wrong_gripper", 1.4, 0.2, [0.0, 0.0]),
1195
  ],
1196
  "train_b": [
1197
  record("train_b", "expert", 2.0, 1.0, [10.0, 0.0]),
1198
  record("train_b", "no_op", 2.2, 0.8, [10.0, 0.0]),
1199
+ record(
1200
+ "train_b",
1201
+ "wrong_gripper",
1202
+ 2.4,
1203
+ 0.8,
1204
+ [10.0, 0.0],
1205
+ terminal_success=True,
1206
+ ),
1207
  ],
1208
  "heldout_a": [record("heldout_a", "expert", 9.0, 1.0, [0.0, 0.0])],
1209
  "heldout_b": [record("heldout_b", "expert", 9.0, 1.0, [10.0, 0.0])],
 
1241
  retrieval_neighbors=1,
1242
  retrieval_residual_min_source_progress=0.5,
1243
  retrieval_residual_source_progress_bonus_scale=0.1,
1244
+ retrieval_residual_source_score_bonus_scale=0.05,
1245
  )
1246
 
1247
  assert [len(case.candidate_action_values) for case in attached] == [3, 3]
 
1255
  "residual_no_op",
1256
  "residual_wrong_gripper",
1257
  ]
1258
+ assert np.allclose(attached[0].candidate_score_bonuses, [0.0, 0.17, 0.0])
1259
+ assert np.allclose(attached[1].candidate_score_bonuses, [0.0, 0.12, 0.17])