Skip to content

Fix aggregation of ratings - #63

Merged
sjawhar merged 6 commits into
mainfrom
fix-aggregation
Aug 31, 2025
Merged

sjawhar merged 6 commits into
mainfrom
fix-aggregation

Conversation

@pipmc

@pipmc pipmc commented Aug 28, 2025 •

Copy link
Copy Markdown
Contributor

This PR:

  • correctly implements the aggregation behavior from flock triframe, where the ratings for each option are averaged across all raters and the highest one is then chosen
  • raises the minimum acceptable rating to -0.25, in line with flock triframe
  • moves aggregation from the rating phase to the aggregate phase, which is a more sensible place for it to be
  • adds some additional checks and mitigations for bad data (e.g. a rater generation calling rate_options more than once)

Closes #58.

Eval set (gpt-4.1 and claude): pip-triframe-ag-581d4f90bfe7-y6n6je3qawpca7rg

@pipmc pipmc self-assigned this Aug 28, 2025
@pipmc
pipmc marked this pull request as ready for review August 29, 2025 00:00
@pipmc
pipmc requested a review from tbroadley August 29, 2025 00:17
Comment thread triframe_inspect/phases/aggregate.py Outdated
Comment on lines +21 to +26
stats = {
"mean": statistics.mean(scores),
"range": f"({min(scores):.2f}, ({max(scores):.2f})",
"count": len(ratings),
}
summary = f"Option {option_id}: mean={stats['mean']:.2f}, range={stats['range']}, n={stats['count']}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This construction of a dictionary is weird, the dictionary is not actually used anywhere, it's entries are used for string interpolation on the next line. LLM downlift?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, maybe—I lifted it from here in the original triframe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn’t want a really long f-string but if I’d thought more about it I could have just used a loose collection of variables.

@tbroadley
tbroadley requested review from satojk and removed request for tbroadley August 29, 2025 17:15

@satojk satojk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left two comments but they're both nitpicks. I think it's worth quickly addressing them + Sami's comment about the dictionary, but looks good overall. Thanks Pip!

Comment thread triframe_inspect/phases/rating.py Outdated
f"Rater made {len(tool_calls)} calls to rate_options, using first ratings only",
)

ratings = parse_ratings(tool_calls[:1], actor_options)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for parse_ratings to still take a list of tool_calls, rather than just a single tool_call, right? Could change this to tool_calls[0], and simplify parse_ratings a bit.

Comment thread triframe_inspect/phases/aggregate.py Outdated
if entry.type == "final_ratings":
return entry
return None
if entry.type != "ratings":

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces the assumption that the most recent ratings are the most recent entries (rather than the most recent ratings being e.g. the second-to-last and third-to-last entries), which isn't an assumption that was there before. Probably this is fine, but I guess we could also add an and last_ratings so that we only break if we have found at least one entry of type ratings.

@sjawhar
sjawhar self-requested a review August 30, 2025 00:32
@sjawhar
sjawhar force-pushed the fix-aggregation branch 2 times, most recently from 3ce4fb8 to 8ef910c Compare August 31, 2025 01:37
@sjawhar
sjawhar requested a review from satojk August 31, 2025 01:38
@sjawhar

sjawhar commented Aug 31, 2025

Copy link
Copy Markdown
Contributor

I addressed the PR comments and ran an eval set with id sami-triframe-a-551be5c3f8e5-5i2l64lxtan9vgcb. Most of the tasks failed because I didn't pass secrets, but otherwise agent seems to be working correctly.

@sjawhar
sjawhar enabled auto-merge (squash) August 31, 2025 01:42
@sjawhar
sjawhar merged commit 368a43d into main Aug 31, 2025
3 checks passed
@sjawhar
sjawhar deleted the fix-aggregation branch August 31, 2025 01:42
Comment on lines +647 to +651
pytest.param(
[create_actor_options(), rating_entry, create_actor_options()],
[rating_entry],
id="one_rating_not_last_entry",
),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment here - I think this should have been

Suggested change
pytest.param(
[create_actor_options(), rating_entry, create_actor_options()],
[rating_entry],
id="one_rating_not_last_entry",
),
pytest.param(
[create_actor_options(), rating_entry, create_actor_options()],
[],
id="one_rating_not_last_entry",
),

Comment on lines +652 to +661
pytest.param(
[
create_actor_options(),
rating_entry,
rating_entry,
create_actor_options(),
],
[rating_entry, rating_entry],
id="multiple_ratings",
),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this should have been

Suggested change
pytest.param(
[
create_actor_options(),
rating_entry,
rating_entry,
create_actor_options(),
],
[rating_entry, rating_entry],
id="multiple_ratings",
),
pytest.param(
[
create_actor_options(),
rating_entry,
rating_entry,
create_actor_options(),
],
[],
id="multiple_ratings_not_last_entries",
),

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.

triframe_inspect does not aggregate ratings in the same way as flock triframe

3 participants