Respect the metric direction when building the memory block - #9
Merged
YoungDubbyDu merged 1 commit intoSep 4, 2026
Merged
Conversation
MetricValue carries a maximize flag and the rest of the engine honours it (conditions.py, evaluation.py), but fetch_child_memory hardcodes reverse=True and max(). On a minimize metric (RMSE, MAE, logloss) the model is therefore shown the worst sibling as Attempt InternScience#1 and told the worst score is the best.
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.
SearchNode.fetch_child_memorysorts siblings with a hard-codedreverse=Trueand afloat('-inf')fallback, and reports the best withmax(...).MetricValuecarries amaximizeflag and the rest of the engine honours it —engine/conditions.pyhas the direction-aware version of exactly this sort, 40 lines away — but this function does not read it.That block is what goes into the improve / debug / evolution prompts, so on any minimise metric the model is shown the worst sibling as "Attempt #1" and told the worst score is the best. MLE-bench is heavy on RMSE, MAE and logloss, so this is a large fraction of the benchmark.
Reproduced on
mainwith three RMSE siblings:0.1 is the best RMSE; the prompt says 0.9 is.
With the patch:
The change. Read the direction from the children's own
MetricValue.maximize— no signature change, so the three call sites are untouched — and fall back to maximise when unknown, matching the convention inconditions.py.maxbecomes direction-aware alongside the sort, so the summary line and the ordering agree.