Aditya Guntur commited on
Commit
5bcbe7f
·
1 Parent(s): 606e517

fix(reward): harsh -1.0 for zero JSON output, -0.30 for zero task completion

Browse files
Files changed (1) hide show
  1. training/rollout.py +24 -8
training/rollout.py CHANGED
@@ -351,18 +351,34 @@ def rollout_once(
351
  no_wrong_channels = 1.0
352
 
353
  read_runbook_reward = 1.0 if read_runbook_done else 0.0
354
- combined = (
355
- final_score * 0.45
356
- + no_wrong_channels * 0.15
357
- + valid_json_ratio * 0.15
358
- + read_runbook_reward * 0.15
359
- + efficiency * 0.10
360
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  print(
362
  f"[rollout] steps={step} final={final_score:.3f} "
363
  f"json={valid_json_ratio:.2f} runbook={read_runbook_reward:.0f} "
364
  f"no_wrong={no_wrong_channels:.2f} eff={efficiency:.2f} "
365
- f"→ combined={combined:.3f}"
366
  )
367
  return {
368
  "prompt_ids": prompt_ids,
 
351
  no_wrong_channels = 1.0
352
 
353
  read_runbook_reward = 1.0 if read_runbook_done else 0.0
354
+
355
+ # --- Reward gating ---
356
+ # If model never output valid JSON, it never actually tried anything.
357
+ # Strip all process rewards and apply a harsh penalty.
358
+ # Process rewards (runbook, no_wrong, efficiency) only matter if model acted.
359
+ if valid_action_count == 0:
360
+ combined = -1.0
361
+ elif final_score == 0.0:
362
+ # Model tried (valid JSON) but task failed — small process credit, no final bonus
363
+ combined = (
364
+ valid_json_ratio * 0.15
365
+ + read_runbook_reward * 0.10
366
+ - 0.30 # hard penalty for zero task completion
367
+ )
368
+ else:
369
+ combined = (
370
+ final_score * 0.45
371
+ + no_wrong_channels * 0.15
372
+ + valid_json_ratio * 0.15
373
+ + read_runbook_reward * 0.15
374
+ + efficiency * 0.10
375
+ )
376
+
377
  print(
378
  f"[rollout] steps={step} final={final_score:.3f} "
379
  f"json={valid_json_ratio:.2f} runbook={read_runbook_reward:.0f} "
380
  f"no_wrong={no_wrong_channels:.2f} eff={efficiency:.2f} "
381
+ f"valid_acts={valid_action_count} → combined={combined:.3f}"
382
  )
383
  return {
384
  "prompt_ids": prompt_ids,