fix: VES ratio always 1.0 due to gold_sql used for both operands in iterated_execution#42
Open
nimaboubanian wants to merge 1 commit intopremAI-io:mainfrom
Open
Conversation
The denominator was mistakenly using gold_sql for both operands, making the ratio always 1.0. Changed to predicted_sql so the efficiency score actually reflects how fast the predicted query runs relative to the gold standard.
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.
What's wrong
In
premsql/executors/base.py, theiterated_executionmethod computes the efficiency ratio for VES (Valid Efficiency Score) like this:Both the numerator and denominator call
execute_sqlwithgold_sql, so the ratio is alwaysgold_time / gold_time = 1.0regardless of how efficient or slow the predicted query actually is. This makes VES a flat constant (100.0 for every matching prediction), giving no useful signal whatsoever.Fix
Change the denominator to use
predicted_sqlinstead ofgold_sql:The ratio
gold_time / predicted_timecorrectly reflects efficiency: a value > 1.0 means the predicted query is faster than the gold standard, < 1.0 means it's slower. The downstreammean(sqrt(ratio)) × 100aggregation then produces a meaningful score.A short inline comment has been added to the fixed line to document the original bug for future readers.
Impact
Without this fix,
iterated_executionsilently returns1.0for every matching prediction. Any benchmark or leaderboard numbers produced with the existing code are not measuring execution efficiency at all.No API changes, no new dependencies.