Skip to content

LLaMEA-HPO: ask the LLM for the configuration space - #264

Merged
nikivanstein merged 7 commits into
mainfrom
ai/fix-methods
Dec 1, 2026
Merged

nikivanstein merged 7 commits into
mainfrom
ai/fix-methods

Conversation

@nikivanstein

Copy link
Copy Markdown
Contributor

Problem

LLaMEA-HPO in BLADE never tuned anything, with either variant: hpo or HPO: true.

LLaMEA asks for a SMAC configuration space only when it is given no output format prompt (llamea.py: the HPO format is set only in the output_format_prompt is None branch). BLADE always passes the problem's format_prompt, so the request was dropped:

  • the LLM was never asked for a space;
  • LLM.extract_configspace found nothing;
  • solution.configspace stayed empty, and the problem's tune = cs is not None and self.hpo was always false.

A leaderboard trial showed this. All 60 solutions of 5 LLaMEA-HPO runs on the BBOB groups had configspace: '', and no prompt mentioned a configuration space.

Fix

  • iohblade/methods/llamea.py: new HPO_FORMAT_PROMPT, appended to the problem's format prompt when the method uses HPO (uses_hpo). It asks for the hyperparameters as a SMAC3 configuration space (a Python dict): ranges as (lower, upper) tuples and options as lists. The hyperparameters must be __init__ keyword arguments with defaults, since that is where tuned values are passed. The example uses the Space: + fenced block format that _DEFAULT_CS_PATTERN parses.
  • Without HPO, the prompt is unchanged.

Checked in a real run

The same trial, rerun with the fix (5 runs, budget 12):

  • all 59 evaluations had a configuration space;
  • the successful ones were scored after SMAC tuning ("HPO used (SMAC, 100 trials); scored with incumbent={…}");
  • the remaining failures were ordinary errors in the generated code.

Tests

In tests/unit/test_hpo.py:

  • for both variant: hpo and HPO: true, every prompt contains the request and the problem's own format prompt, and the problem receives the parsed space;
  • without HPO, there is no request;
  • the example in the prompt parses with _DEFAULT_CS_PATTERN into a valid ConfigurationSpace.

The new tests fail without the fix. test_hpo, test_llamea_variants, test_hpo_benchmarks and test_llamea_feature_guidance: 69 passed.

Note

Earlier LLaMEA-HPO results produced with BLADE are plain LLaMEA (5+5) with the HPO mutation prompt, without tuning.


Generated by Claude Code

nikivanstein and others added 7 commits December 1, 2026 13:20
EoH calls random.seed(2024) on Python's global random module when it
starts, so its parent selection was identical for every run seed, and in
parallel runs it reset the random state of other methods. EoH's modules
now use a per-run random.Random seeded from BLADE's run seed (or the new
`seed` option), and EoH's reseed is ignored.

ReEvo asks for temperature + 0.3 for its initial population; BLADE's
adapter dropped it. LLM.query_at_temperature passes a per-call
temperature to providers that accept one (LLM.accepts_temperature), and
ReEvo's base temperature is now the LLM's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiY2guDd9wWLKRWPoa16yy
MCTS-AHD:
- Progressive widening as in the paper (Eq. 4) and the reference: every
  node on the selection path with int(N ** alpha) > #children gets a new
  child (e1 at the root, e2 elsewhere). The dead is_fully_expanded helper
  is removed; the root starts with 0 visits; max_children is an optional
  cap (default none).
- Selection stops at max_depth (10); a node there is expanded again.
- Exploration: lambda = lambda_0 * (1 - t / budget) (Eq. 7) and the bonus
  sqrt(ln(N_parent + 1) / N).
- An LLM failure while generating a node uses one evaluation, is logged
  as a failed candidate, and the search continues. Failed candidates are
  discarded from the tree and the operator retried (max 3 tries), as in
  the reference. Nodes are evaluated and back-propagated one at a time,
  in the reference's operator order; s1 is skipped at depth 1.
- 4 initial nodes (initial_node_count), as in the paper.

LHNS:
- Use the evaluated candidate returned by the problem (the current
  solution never moved before).
- Temperature cools: T = cooling_rate * (1 - (t - 1) / budget); relative
  worsening in the acceptance probability.
- Adaptive VNS destruction ratio (ini_ratio, reset on accept, +0.1 per
  reject, wrap after 1.0); ceil(r * n) lines drawn with replacement and
  deleted by index (trailing-whitespace lines were never deleted);
  def/class/import lines kept, comments dropped.
- ILS/TS destroy with ini_ratio and perturb after 10 non-improving
  iterations in a row (ILS from the best so far, TS merging a tabu entry).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiY2guDd9wWLKRWPoa16yy
tree-sitter-language-pack 1.x downloads grammars at first use; on a
Windows CI runner the download returned invalid JSON and
test_moeh_evaluates_exactly_budget failed. Pass the grammar of the
tree-sitter-python dependency to codebleu instead (same scores, no
network access needed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiY2guDd9wWLKRWPoa16yy
codebleu expects a list of references per candidate. Given a bare code
string it iterated over its characters, so MoEH's code similarity was
about 0 for every pair of real programs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiY2guDd9wWLKRWPoa16yy
- MCTS-AHD e2: one rank-weighted node of the elite set (10 best distinct
  nodes) followed by the parent, as the e2 prompt text already assumed.
- MCTS-AHD e1: one random node per root-child subtree, then randint(2, 5)
  of those with replacement.
- LHNS: an LLM failure costs one evaluation, is logged as a failed
  candidate and rejected; the search continues. A failed initial
  generation is retried within the budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiY2guDd9wWLKRWPoa16yy
LLaMEA adds its request for a SMAC configuration space to the output
format only when it is given no format prompt, and BLADE always passes the
problem's. With variant hpo or HPO: true the LLM was never asked for a
space, so no solution had one and nothing was tuned. Append the request
(in the format LLM.extract_configspace parses) to the problem's format
prompt when the method uses HPO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiY2guDd9wWLKRWPoa16yy
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T18:08:21.818041Z 0c17e0f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@nikivanstein
nikivanstein merged commit 5587a8a into main Dec 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant