feat(eval): classify a2ui_scorer failures and add failure_distribution metric (#2200) - #2251
feat(eval): classify a2ui_scorer failures and add failure_distribution metric (#2200)#2251Varun-S10 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces failure classification and distribution metrics to the A2UI evaluation framework, allowing for detailed categorization of validation, parse, integrity, and compilation errors during scoring. It also updates the ANTLR parser generation hook to fallback to existing files on failure. A critical issue was identified in eval/a2ui_eval/scorers.py where setting ExpressCompilerError = () as an import fallback causes a runtime TypeError during isinstance checks, as nested tuples are not permitted. It is recommended to define a dummy exception class instead.
| try: | ||
| from a2ui.inference_formats.experimental.express.errors import ExpressCompilerError | ||
| except ImportError: | ||
| ExpressCompilerError = () # type: ignore[misc,assignment] |
There was a problem hiding this comment.
Setting ExpressCompilerError = () as a fallback when the import fails will cause a runtime TypeError inside classify_exception on line 102. In Python, isinstance(e, (A2uiCompileError, A2uiCompilationError, ExpressCompilerError)) will evaluate to isinstance(e, (A2uiCompileError, A2uiCompilationError, ())). Since () is a tuple and not a type, isinstance raises a TypeError when encountering a nested tuple.
To fix this, define ExpressCompilerError as a dummy exception class in the except ImportError block so that it remains a valid type for isinstance checks.
| try: | |
| from a2ui.inference_formats.experimental.express.errors import ExpressCompilerError | |
| except ImportError: | |
| ExpressCompilerError = () # type: ignore[misc,assignment] | |
| try: | |
| from a2ui.inference_formats.experimental.express.errors import ExpressCompilerError | |
| except ImportError: | |
| class ExpressCompilerError(Exception): # type: ignore[no-redef] | |
| pass |
There was a problem hiding this comment.
Applied the suggested change.
|
Hi @ditman, Could you please take a look? |
|
Thanks for picking this up. Keeping One question on scope: the I ask because I hit that same ANTLR failure setting In my case the underlying cause was If you would rather keep the fallback, would it be worth gating it on the generated files being newer than |
Description
Overview
This PR adds failure categorization and a distribution metric to
a2ui_scorerso that evaluation runs provide clearer insights into why samples did not pass.What is Changing
Failure Categorization (
classify_exception):validation_error:missing_field,validation_error:type_mismatch,validation_error:extra_field,integrity_error,parse_error).no_model_output,solver_step_compilation_failure, andno_a2ui_payload_found.Score Metadata:
Score.metadata(failure_category,coarse_category,error_type, and error details where available).Additive Metric (
failure_distribution):@metric failure_distributiontoa2ui_scorerto show counts and proportions of each failure reason across an evaluation run.Backwards Compatibility:
Score.valuecontinues to return1.0or0.0, and theaccuracy()metric is unchanged so existing baselines and reporting tools stay fully compatible.Tests:
eval/tests/test_scorers.pycovering all failure categories and the metric calculation.Fixes #2200
Pre-launch Checklist
One time:
For this PR:
If you need help, consider asking for advice on the discussion board.