Repository navigation
Conversation
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.
Fix Non-Finite and Negative Numeric Scoring in AssistantBench
Closes #420
Summary
distance_function_login AssistantBench evaluation now includes guards for non-finite values (-inf,inf,nan), negative input pairs, and opposite-sign numbers. This guarantees all numerical accuracy scores are strictly bounded in[0, 1]and prevents run-level average scores from becoming infinite or inflated.Motivation
As described in #420,
distance_function_loginevaluate_numbers.pyassumedpredandgoldwere strictly positive numbers. In practice, agent outputs and task inputs broke this assumption in three ways:"-inf") producesscore = inf"-inf"parses to float. For positive gold,gold / pred = 20 / -inf = -0.0. Thenlog(-0.0) = -inf, yielding1 - (-inf) = +inf.infdestroys the aggregate run metrics, making mean accuracy across the benchmark infinite.pred > goldevaluates toFalse(e.g.-5000 > -5isFalse). Theelsebranch selectsgold / pred = -5 / -5000 = 0.001 < 1.np.log(0.001)is negative, yielding a score of7.91. An answer with an error of 3 orders of magnitude scores better than a perfect match (1.0).log(ratio)to evaluate toNaN.NaNin downstream scoring.Key Changes
Non-finite Guard:
Safely catches
inf,-inf, andNaNbefore division or logarithm evaluation.Negative Pair Normalization:
Normalizes negative pairs to positive magnitudes so
pred > goldcorrectly identifies the larger magnitude and computes the appropriate log ratio.Opposite-Sign Guard:
Immediately returns
0when signs mismatch or when one input is zero and the other is negative.Backward Compatibility
pred > gold: return max(0, 1 - np.log(pred / gold))andelse: return max(0, 1 - np.log(gold / pred))) are kept intact.1 - abs(np.log(pred / gold))alters the least significant float bits due to IEEE 754 division ordering; keeping the two branches ensures exact, bit-for-bit equality against all existing benchmark baselines. All 63 existing tests pass unchanged.Verification
Repro Script:
Pytest:
Proof of Work