Conversation
…mmas `fix_number` rewrote every comma to a period to support European decimal commas, which misread US thousands separators: "3,080,000" became "3.080.000" (float() fails, answer scored 0) while "1,000" became 1.0 (1000x error, scored 1.0). The same logic is duplicated in evaluate_dicts.py and affects the dict evaluation path as well. Disambiguate the comma before parsing: multiple commas, or a single comma followed by exactly 3 digits, are thousands separators (commas removed); a single comma followed by 1-2 digits stays a decimal comma (comma turned into a period). Both call sites now share one helper in evaluate_utils/utils.py, with regression tests for the thousands separator, the decimal comma and the 1000x error cases. Fixes ServiceNow#404
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
fix_numberrewrites every comma to a period to support European decimal commas, which misreads US thousands separators:"3,080,000"becomes"3.080.000", whichfloat()rejects, so the answer falls back to string comparison and scores 0;"1,000"becomes1.0, a 1000x error that scores 1.0. The same logic is duplicated inevaluate_dicts.py, so the dict evaluation path is affected too (JSON value"1,000"against gold1000scores 0.5 instead of 1.0).Approach
Disambiguate the comma before the
float()attempt, in one shared helper (_fix_commainevaluation/evaluate_utils/utils.py) used by bothfix_numbercopies:The multiple-comma rule also handles grouping styles that aren't strict groups of three (e.g.
12,34,567), and a single comma followed by 4+ digits is intentionally left as before. Note this evaluator is a verbatim copy of the official AssistantBench leaderboard evaluator, so the same fix likely applies there.Verification
Before / after, calling
question_scorerdirectly:3,080,00030800001,010,00010100001,00010001,00011,0101.0114,214.2[{"price": "1,000"}]{"price": 1000}New regression tests in
tests/assistantbench/test_evaluation.pycover these cases. All 33 pinned rows keep their exact scores, and the full suite passes:pytest -m 'not pricy' tests/assistantbench→ 85 passed (79 before + 6 new).black --check .(24.2.0, same as CI) is clean.Fixes #404