Skip to content

Count repeated tokens in F1 scores - #1443

Open
salma2vec wants to merge 1 commit into
huggingface:mainfrom
salma2vec:codex/count-repeated-tokens-in-f1
Open

salma2vec wants to merge 1 commit into
huggingface:mainfrom
salma2vec:codex/count-repeated-tokens-in-f1

Conversation

@salma2vec

Copy link
Copy Markdown

Fixes #1441.

F1_score converted answers to sets, so repeated words disappeared before scoring. For example, reference red blue and prediction red red red blue received 1.0 instead of 2/3.

Count matching token occurrences with Counter and use the original token lengths for precision and recall. Normalization and aggregation over references/predictions stay in place. Empty answers retain their current behavior; this does not address #1354.

The new tests cover repeated tokens on either side, normalization, multiple references/predictions, and unchanged exact-match, disjoint and empty cases. Five regression cases fail on main and pass with this change.

Tests: base metrics, normalization tests and the existing f1_score.json fixture: 24 passed, 1 skipped, 2 deselected. The skip is the existing pass-at-k placeholder; the two deselected dynamic metric tests require the optional multilingual extra, which is not installed locally. Repository-wide make quality and changed-file pre-commit checks pass. No full benchmark run was performed.

Codex assisted with the fix, regression tests and review.

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] Token F1 ignores repeated words in predictions and references

1 participant