Repository navigation
Fix LiveCodeBench scoring of single-quoted __main__ guards - #230
Merged
yl231 merged 1 commit intoOct 29, 2026
Merged
Conversation
run_test_std only treated a completion as a script when it contained the exact string __name__ == "__main__". A program using the equally valid single-quoted form, if __name__ == '__main__':, was exec'd with __name__ bound to builtins, so its entry point never ran, it printed nothing and every stdin test failed even for a correct solution. Match the guard with either quote style and either operand order. Completions without a guard, and double-quoted guards, run exactly as before.
Contributor
|
Thanks, @iziz, and thanks for disclosing the link to #229. Merged. We checked it with our own test programs: single-quoted guards now run, and code without a guard, double-quoted guards, a guard that can never be true, and wrong answers behave as before. This matches upstream LiveCodeBench, which normalises the guard with |
This was referenced Oct 29, 2026
XM-Dong
pushed a commit
to XM-Dong/RouterArena
that referenced
this pull request
Oct 30, 2026
Every prediction file behind a leaderboard row was re-graded on GitHub's runners (workflow run 40971464215, main at 5a342c5) with the LiveCodeBench fixes (RouteWorks#230, RouteWorks#234, RouteWorks#239), the METEOR cap (RouteWorks#216) and the current price table. The re-graded files keep their original JSON formatting. README Arena, accuracy, cost and optimality columns are updated and the table re-ranked; robustness does not depend on grading and is unchanged. Divyam moves to RouteWorks#1 (77.22) and BizRouter to RouteWorks#2 (77.08). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
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.
Problem
run_test_stdinllm_evaluation/livecodebench_util.pytreats a completion as a script (it prepends__name__ = "__main__"beforeexec) only when the completion contains the exact string__name__ == "__main__". A program that uses the equally valid single-quoted formis
exec'd with__name__bound tobuiltins, so its entry point never runs, it prints nothing, and every stdin test fails, even when the solution is correct.Reproduction
(
run_test_stdreplacessys.stdout; restore it before printing the result.) With the current code, the single-quoted guard and the reversed form'__main__' == __name__fail; the double-quoted guard and code without a guard pass.Impact
LiveCodeBench rows in
router_inference/predictions/(main, 04c99fd) that were scored 0 and whose last code block uses a single-quoted guard:Open submissions: #229 (BizRouter) has 74 such rows and #228 (dalpha-llm-router) has 7.
To check that these are real solutions and not just a formatting difference, we re-scored the 74 rows of #229 inside the evaluation image with no network: the current code scores all 74 as 0 (reproduced), and with this patch 60 of them pass the tests.
Disclosure: we submitted #229, which is the submission most affected by this bug, because its main model habitually writes the single-quoted guard. The change applies the same rule to every submission; whether and how to re-evaluate existing entries is up to the maintainers.
Fix
Match the guard with either quote style and either operand order (a regex instead of a fixed substring). Completions without a guard, and completions with the double-quoted guard, are executed exactly as before. A guard that can never be true (for example
if __name__ == '__other__':) still does not run.Checked with the pinned pre-commit hooks (ruff v0.11.7, ruff-format, codespell v2.4.1).