Commit 441f5a3
committed
[algo] fix: remove dead code in GPG advantage estimator
`compute_gpg_outcome_advantage` builds an `id2std` dict (and the per-group
std/constant assignments that populate it) that is never read: the
normalization on the final line divides by `f_norm`, not by the group std.
It also accepts an `alpha` parameter that is unconditionally overwritten by
`alpha = bsz / count_nonzero(scores)` before its first use, so the
caller-supplied value can never take effect. No caller passes `alpha` (the
advantage dispatch in ray_trainer.py builds kwargs without it).
Remove the unused `id2std` dict and the no-op `alpha` parameter. Behavior is
unchanged; the function still applies the documented N/N_nonzero scaling to
group-centered scores. Add a CPU unit test covering the scaling and the
singleton-group case.
Addresses issue #6478 (Item B). Item A (clamp) is handled separately in #6538.1 parent 8a69493 commit 441f5a3
2 files changed
Lines changed: 61 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
772 | 772 | | |
773 | 773 | | |
774 | 774 | | |
775 | | - | |
776 | 775 | | |
777 | 776 | | |
778 | 777 | | |
| |||
788 | 787 | | |
789 | 788 | | |
790 | 789 | | |
791 | | - | |
792 | 790 | | |
793 | 791 | | |
794 | 792 | | |
| |||
801 | 799 | | |
802 | 800 | | |
803 | 801 | | |
804 | | - | |
805 | 802 | | |
806 | 803 | | |
807 | 804 | | |
| |||
814 | 811 | | |
815 | 812 | | |
816 | 813 | | |
817 | | - | |
818 | 814 | | |
819 | 815 | | |
820 | 816 | | |
821 | | - | |
822 | 817 | | |
823 | 818 | | |
824 | 819 | | |
| |||
0 commit comments