Commit f5ad884
feat: add monotonic progress bias and pluggable alignment strategy to DemoLibrary (#176)
Add three major improvements to demo-guided alignment:
1. Pluggable AlignmentStrategy protocol with PHashAlignmentStrategy (default),
CLIPAlignmentStrategy (optional, requires open-clip-torch), and
HybridAlignmentStrategy (pHash top-K + CLIP re-rank).
2. Monotonic progress bias that penalizes backward jumps in step matching
to prevent oscillating alignment. Configurable via backward_penalty
parameter (default 0.3).
3. Adaptive guidance disabling that turns off demo guidance after N
consecutive low-confidence alignments (default 3 at threshold 0.3),
preventing the "demo hurts" failure mode.
Also adds AlignmentTraceEntry dataclass for post-hoc analysis of alignment
quality, stored in DemoGuidance.metadata["alignment_trace"].
DemoGuidedAgent now calls reset_alignment_state() on task change and
episode reset to clear monotonic progress tracking.
All 77 tests pass (20 existing + 31 enrichment + 26 new).
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f6d02cb commit f5ad884
0 file changed
0 commit comments