Skip to content

fix(evoprompt): avoid overflow when counting prompt combinations - #288

Open
liuzhengyang699 wants to merge 1 commit into
ANative-Lab:mainfrom
liuzhengyang699:fix/evoprompt-combination-overflow
Open

liuzhengyang699 wants to merge 1 commit into
ANative-Lab:mainfrom
liuzhengyang699:fix/evoprompt-combination-overflow

Conversation

@liuzhengyang699

Copy link
Copy Markdown

EvoPrompt counts the prompt combinations with np.prod, so the search-space size can overflow a fixed-width integer even when only a few candidates are requested. With 16 nodes and 16 prompts per node the count wraps to zero and no candidates are produced. With 19 nodes and 10 prompts per node it wraps negative, causing the sampler to enter the full Cartesian-product branch.

Use math.prod to keep the count exact while preserving the existing sampling limits. The regression tests cover both overflow cases with default and explicit sample sizes, as well as small and empty populations. The large-space tests reject full enumeration immediately.

Validation: pytest tests/src/optimizers/test_evoprompt_combinations.py tests/src/optimizers/test_evoprompt_state_isolation.py tests/src/optimizers/test_optimizer_package_imports.py -q — 10 passed. Ruff passed for the new test file; git diff --check passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T15:28:18.288792Z 814c9cf 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.

This branch has not been deployed

No deployments
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