Repository navigation
fix(evaluation): score CAR on groundtruth_eval.json concept recall - #634
Merged
Merged
Conversation
When a CAR scenario ships groundtruth_eval.json with required_terms, the static_json scorer now uses it. The answer earns 0 unless it is a single-key object whose key is the groundtruth.txt mode. Otherwise its credit is the fraction of required concepts covered, a concept being covered when any one of its any_of forms appears, on word boundaries, in the value under the key. The scenario passes at credit >= 0.5 (CAR_PASS_THRESHOLD). Precision, recall, f1 and the new car_score field all report the credit: with one matching key the model side holds exactly the gold entries, so an F1 reduces to coverage. CAR scenarios without required_terms keep the extracted-term F1 and the strict pass rule. Term matching also read structured values through json.dumps, which kept upper-case letters out of the a-z0-9 filter and turned a newline into "\n", gluing an "n" onto the next word. It now joins the structure's keys and scalars and lowercases the result. Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
A groundtruth_eval.json form now also matches its regular plural: an added s, es after s/x/z/ch/sh, or ies for a consonant + y. Before, "Which assets?" missed the form "asset". Plurals apply to the last word, so "failure type" matches "failure types". Terms extracted from the gold value, used when a scenario has no groundtruth_eval.json, still match exactly. Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
A CAR answer scored on groundtruth_eval.json concepts now reports recall as its score and pass criterion (recall >= 0.5). Precision and f1 are None: a free-text value gives no count of what the model asserted, so precision could only repeat recall and the f1 built from them was recall under another name. car_score duplicated recall and is removed, along with its report aggregate. Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
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.
Description
CAR scenarios ship
groundtruth_eval.jsonagain, butstatic_jsonnever read it: the loader put it onScenario.evaluation_metadataand the scorer ignored it. This PR scores CAR answers against itsrequired_terms.Fix Details
When a CAR scenario's
groundtruth_eval.jsonhasrequired_terms, the score is recall:groundtruth.txt. A multi-key answer counts as a mismatch.any_offorms, or a form's regular plural, appears in the value under the key. Matching is case-insensitive and on whole words.CAR_PASS_THRESHOLD).scoreand the Harborrewardare that recall.precisionandf1arenullfor these answers. A free-text value gives no count of what the model asserted, so precision could only repeat recall, and an F1 built from them would be recall under another name.Example with two required concepts,
asset(asset/equipment) andtime window(time window/date range):{"clarification": "Which equipment, over what date range?"}{"clarification": "Which assets?"}{"clarification": "Can you say more?"}{"abstain": "Which asset and time window?"}Other details:
s, anesafter s/x/z/ch/sh, oriesfor a consonant +y(asset→assets,switch→switches,battery→batteries). For multi-word forms the plural goes on the last word. Irregular plurals still have to be listed.modeandoptional_termsare not scored. Bare-stringrequired_termsentries are accepted as one-form concepts.json.dumps. That kept upper-case letters out of the[a-z0-9]filter and turned a newline into\n, gluing annonto the next word. It now joins the structure's keys and scalars and lowercases them.car_scoreaggregate is removed fromreport.py.required_termskeep the extracted-term F1 and strict pass rule, with exact matching (no plurals). Non-CAR scoring is unchanged.Impact on Benchmarking
Pooled re-score of 515 saved CAR answers (11 models), each through the loader and
StaticJsonScorer:aafeedback_changes: extracted-term F1, strict pass)Earlier CAR results are on a different scale and should be re-scored from saved answers.
Known limits of term matching: nothing penalises padding, so an answer that lists every form gets full recall. Negation is not detected.
Related Issues
Verification Steps
uv run pytest src/evaluation -q: 126 passed. In the fulluv run pytest src/ -v -k "not integration", the only failures are 2 insrc/observability/tests/test_file_exporter.py, which fail the same way on the base commit.f1isnull).uv run evaluateon one CAR scenario: the report hasf1_avg: nulland recall as thescore.Checklist