Skip to content

small features: add option to save cache in parquet, save judge input…#35

Open
geoalgo wants to merge 1 commit intomainfrom
small_features
Open

small features: add option to save cache in parquet, save judge input…#35
geoalgo wants to merge 1 commit intomainfrom
small_features

Conversation

@geoalgo
Copy link
Copy Markdown
Collaborator

@geoalgo geoalgo commented Apr 8, 2026

…, improve error handling of openrouter, remove compute_cohen_kappa

Reasons:

  • saving in parquet is better in term of storage
  • saving judge input allow to have all the context used to make the judge call and to be able to estimate the cost
  • the handling of errors in openrouter becomes a bit less whacky
  • cohen_kappa is available in scikit-learn, we should use this code instead (which produces the same values)

@geoalgo geoalgo requested a review from ErlisLushtaku April 8, 2026 09:50
completion_A: str # completion of the first model
completion_B: str # completion of the second model
judge_completion: str # output of the judge
judge_input: str | None = None # input that was passed to the judge
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be added to the estimate_elo_ratings.py workflow as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It uses judge_and_parse_prefs from this file so it is updated as well if I am not mistaken.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, but I think we are dropping it here because we are constructing the Dataframe manually

return x

for col in df.select_dtypes(include="object").columns:
df[col] = df[col].apply(_to_python).astype(str)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should be careful here if the dataframe can contain missing values. Calling .astype(str) on missing values (None or np.nan) converts them into strings "None" and "nan". When the parquet file is read back, they would be processed as strings instead of missing values.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes I agree but I dont see another way to serialize to parquet. I agree that this conversion is loosing the missingness information but I think all downstream code should probably exclude empty strings too when computing annotations.

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.

2 participants