Repository navigation
Fix normalization of singleton integer search spaces - #1644
Li Jiang (thinkall) merged 3 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The narrow guards address both zero-span calculations, with regression coverage and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes singleton integer search spaces so FLAML tuning avoids zero-span division errors.
Changes:
- Maps singleton, unquantized integers to the normalized midpoint.
- Skips FLOW2’s log-space step constraint for fixed integers.
- Adds normalization, tuning, and endpoint regression tests.
| File | Description |
|---|---|
| test/tune/test_singleton_integer.py | Tests singleton domains and ordinary/quantized endpoints. |
| flaml/tune/space.py | Handles singleton integer normalization. |
| flaml/tune/searcher/flow2.py | Skips nonexistent singleton log-space steps. |
Review effort: Balanced
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Overall review at e2bf1d2814e75e59682599af1b0346665ea92554: fix verified; this is not an approval.
I reassessed the complete three-file PR and connected normalize/denormalize and FLOW2 step-bound code. Singleton unquantized integers map to the finite midpoint and all checked inverse positions return the sole legal value; the log-step continue skips no other state update. All 49 targeted tests pass, including ordinary/quantized endpoint controls. Independent exact-main functions reproduce the original division/floating-point failures at negative, zero, positive and log bounds; four current offline mixed-space HPO cases make six evaluations each with variation in the live parameter. Fixed-only spaces return one valid trial under a bounded test budget and the direct FLOW2 log-step bound is finite. No blocking code issue was found. Separate Ray/distributed/platform and full optimizer-backend matrices were not run.
The Low review-code harness is CLEAN (actual gpt-6.1-sol), with audited input/model/read independence. Canonical evidence was committed locally after full all-file pre-commit passed. No contributor implementation was edited or pushed, and no other reviewer's thread was changed.
Approval is withheld: applicable check contexts are not all successful; actual Build: in_progress/None.
Posted by thinkall-agent-auto-reviewer
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Overall review of the complete current PR at e2bf1d2814e75e59682599af1b0346665ea92554: approved.
I freshly reread all production/test changes and the connected FLOW2 step-bound loop and normalization/inverse formulas. Singleton unquantized integer bounds now map to a finite midpoint, the inverse retains the sole legal integer, and the fixed log-space constraint no longer divides by zero. The continue skips no unrelated state update; ordinary and quantized endpoint behavior remains intact. No blocking issue found.
Validated unchanged-head review-code evidence was reused (Low, actual gpt-6.1-sol), including the prior 49 passing focused tests, exact-main failure comparisons, real six-evaluation mixed HPO cases, fixed-only exhaustion and inverse-position checks. These are unchanged-source results, not new model/test executions. Separate Ray/distributed/platform and optimizer-backend matrices are not claimed.
Fresh same-head gates confirm all discussions resolved, an explicit Balanced Copilot approval recommendation, every applicable check successful and actual Build/docs/formatting workflows successfully completed. The conditional gh-release skip is specifically justified by the unchanged workflow's pull_request exclusion.
Posted by thinkall-agent-auto-reviewer
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Re-reviewed commits e2bf1d2814e75e59682599af1b0346665ea92554 -> b33272c802011e7e21c5e4eaead62de0b0d3b66f. The only delta is main's website/yarn.lock update of follow-redirects 1.16.0 -> 1.16.1. One explicitly head-bound review-code Low execution (actual runtime gpt-6.1-sol) found no new issue in this identical inherited patch. Controller Git comparisons verify all non-lockfile tree entries are unchanged. This is a scoped merge-delta review, not a fresh clean signoff for unchanged feature code.
Version/URL/caret/SRI shape checks pass. No independent local registry/tarball verification, package smoke test or website rebuild is claimed. Previous feature findings and runtime validation limits remain preserved.
At the 2026-10-26T12:13:44.943946+00:00 gate snapshot, actual current-head workflows were: docs completed/success; Build in_progress/no conclusion; Code formatting completed/success. Copilot has Balanced review without an Approval recommended verdict; 1 review thread(s) remain unresolved. Gate approval is not successful CI completion, and no new PR approval is being submitted while required gates remain unmet.
Posted by thinkall-agent-auto-reviewer
Li Jiang (thinkall)
left a comment
There was a problem hiding this comment.
Overall review of the whole PR at 204d057ef5c2320b1833187886ab3d92e5f225ee: approved.
The complete PR was independently reviewed with review-code Low (actual runtime gpt-6.1-sol), with no source findings. Singleton integer normalization/denormalization preserves the sole legal value, and the new FLOW2 guard prevents a fixed uniform-integer dimension from imposing a discrete step floor on varying dimensions. The current native regression file passed all 15 cases. On the exact prior source, the three new floor cases produced one failure (uniform randint) and two passes (logarithmic/non-singleton controls); all three pass now. These results establish the specific correction, not a new change to logarithmic behavior. Local execution used existing Python 3.10.19/NumPy 1.26.4 and is not the entire supported matrix. Canonical evidence was committed on the exact inspected source parent after the full pre-commit run --all-files gate passed.
Immediately before submission, I verified the same current open, non-draft, non-self head, all review threads resolved, explicit current-head Balanced Copilot Approval recommended (review), and successful applicable check contexts. I also queried the actual Actions workflow runs directly: docs succeeded; Code formatting succeeded; Build succeeded. The deployment-only gh-release job is intentionally skipped for pull requests by its explicit event guard; it is not being counted as a passed validation.
Posted by thinkall-agent-auto-reviewer

Why are these changes needed?
A valid
tune.randint(7, 8)contains only the integer 7.normalize()subtracts one from the exclusive upper bound, then divides by the resulting zero span. This makestune.run()raiseZeroDivisionErrorbefore evaluating an objective when the singleton dimension is inlow_cost_partial_config.The corresponding
lograndint(7, 8)produces a NaN normalized value, and FLOW2's integer log-space step calculation also divides by zero.Map a singleton, unquantized integer domain to the center of the normalized interval and skip its nonexistent log-space step constraint. The regression tests exercise the actual offline HPO API alongside another varying parameter, and check ordinary and quantized integer endpoints.
Related issue number
None found in the issue/PR search. Reproduced on main at
12b0f15e4b2c00fe119d9224ed5333f8fc6bab34.Validation
ZeroDivisionError/FloatingPointError; 4 endpoint controls pass.test_singleton_integer.py,test_space.py,test_sample.py,test_searcher.py, andtest_zero_metric.py.Checks
AI assistance: implemented and tested with Codex.