Skip to content

FIX: Reject non-binary objective labels in CSV datasets - #3414

Open
Jacqueline122 wants to merge 1 commit into
microsoft:mainfrom
Jacqueline122:fix/validate-objective-csv-labels
Open

Jacqueline122 wants to merge 1 commit into
microsoft:mainfrom
Jacqueline122:fix/validate-objective-csv-labels

Conversation

@Jacqueline122

Copy link
Copy Markdown

Description

Fixes #3413.

The OBJECTIVE CSV loader previously converted human labels using bool(int(score)) without validating their original values. This silently changed labels such as 2 and -1 to True, and 0.9 to False.

This change validates every human-score column before conversion and raises a ValueError identifying the column when a label is outside 0/1.

Valid integer, float, and boolean representations of 0/1 remain supported. HARM dataset scoring is unchanged.

OpenAI Codex assisted with reproduction, implementation, regression tests, and local validation.

Tests and Documentation

Added 14 regression cases covering:

  • Non-binary integers and fractional labels.
  • Positive and negative infinity.
  • Valid integer, float, and boolean labels.
  • Invalid labels in a second human-rater column.

Before the fix, the new tests report 8 failures and 6 passes. After the fix, all 107 tests in test_human_labeled_dataset.py pass, including the 93 existing tests.

The targeted test module was run with --noconftest, bypassing database-wide fixtures. Ruff lint, formatting, and git diff checks pass. The full repository suite was not run.

Updated the CSV validation method's docstring. JupyText was not run; no notebooks were changed.

@Jacqueline122

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

BUG: Objective CSV labels outside 0/1 are silently converted to booleans

1 participant