Skip to content

fix(metrics): avoid overflow in finite fitness averages - #583

Merged
codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
Yushu-Li:fix/finite-metric-average
Nov 2, 2026
Merged

codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
Yushu-Li:fix/finite-metric-average

Conversation

@Yushu-Li

@Yushu-Li Yushu-Li commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

A fallback fitness made from finite metrics can become infinite because the intermediate sum overflows: averaging two 1e308 values currently returns inf, even though the correct average is 1e308. This can distort fitness comparison and prompt feedback.

I rescale the average only when its sum is non-finite but every input is finite. Ordinary averages keep their existing calculation; explicit infinity handling, boolean exclusion, feature filtering and combined_score precedence are unchanged.

Validation:

  • Five new regression/control methods; the original implementation fails three methods (16 failing subcases), with two control methods passing.
  • Full unittest discovery: 1032 tests run, 2 skipped, no failures.
  • Changed-file Black and whitespace checks passed.
  • No model/provider calls. This does not change the policy for explicit non-finite evaluator outputs or the sum utility.

I used Codex assistance for implementation and regression testing.

@codelion
codelion merged commit bdbbb9a into algorithmicsuperintelligence:main Nov 2, 2026
5 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.

2 participants