Skip to content

fix: keep group and trajectory provenance in ruler_score_group - #1143

Open
salma2vec wants to merge 1 commit into
OpenPipe:mainfrom
salma2vec:fix/ruler-keeps-group-provenance
Open

salma2vec wants to merge 1 commit into
OpenPipe:mainfrom
salma2vec:fix/ruler-keeps-group-provenance

Conversation

@salma2vec

Copy link
Copy Markdown

Summary

Closes #1142

ruler_score_group copies the group before scoring it, but the copy kept only the trajectories' messages, tools, reward, metrics, metadata and logs. Every RULER-scored group therefore lost its exceptions, metadata, metrics and logs. Each trajectory lost initial_policy_version, final_policy_version and _policy_token_counts, and had its start_time reset. Downstream, model.log derives exception_rate from group.exceptions and the metrics taxonomy reads scenario_id from group metadata, so both went silent for RULER users. PipelineTrainer's policy-age accounting lost the trajectory versions.

Changes

  • src/art/rewards/ruler.py: the copied trajectories also carry the policy versions, start time and a copy of _policy_token_counts. The returned group is built with the original exceptions and copies of metadata, metrics and logs.
  • The input group is still not mutated. Scores, independent_reward, ruler_score and the explanation log line are unchanged.
  • tests/unit/test_ruler_score_group_preserves_group.py: stubs the judge and checks the group fields, the per-trajectory provenance, the new rewards, and that the input group is untouched.

Test plan

  • The new test fails on main (assert [] == ['third rollout failed']) and passes here.
  • The repro in ruler_score_group drops group exceptions, metadata and metrics, and trajectory policy versions #1142 prints [] {} {} / None None on main, and the exception, metadata, metrics and 3 5 with this change.
  • test_ruler_metrics, test_auto_trajectory, test_metrics_builder, test_trajectory_copy, test_metrics_taxonomy + the new test: 72 passed.
  • ruff format / ruff check (0.15.11) clean.
  • Full prek run --all-files / ty not run (no CUDA backend deps on macOS).

Found and fixed with Claude Code. The checks above were executed locally.

🤖 Generated with Claude Code

ruler_score_group rebuilt the group from its trajectories alone. It
dropped the group's exceptions, metadata, metrics and logs, and each
trajectory's policy versions, policy token counts and start time. So
exception_rate, scenario_id and group metrics were lost after RULER
scoring, and trajectory policy age was reset.

Copy those fields onto the scored group, which stays a new object.

Closes OpenPipe#1142

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ruler_score_group drops group exceptions, metadata and metrics, and trajectory policy versions

1 participant