Skip to content

Fix Sophia callback early stopping - #1430

Open
sean0407 wants to merge 1 commit into
SciML:masterfrom
sean0407:codex/sophia-callback-stop-1414
Open

sean0407 wants to merge 1 commit into
SciML:masterfrom
sean0407:codex/sophia-callback-stop-1414

Conversation

@sean0407

@sean0407 sean0407 commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

+halted = false
for epoch in 1:maxiters
  for d in data
    if callback(state)
+     halted = true
      break # exit the data loop
    end
  end
+ halted && break # exit the epoch loop
end

A callback returning true currently exits only the inner data loop, so later Sophia epochs continue. This change propagates that halt to the outer epoch loop.

Evidence

  • Before: isolated Julia 1.12.4 reproduction reached halt calls=50 retcode=Success with a callback that returned true on call 5.
  • After: Pkg.test() for lib/OptimizationSophia passed (5 passed, 0 failed), including a regression test that stops at callback 5 with maxiters = 50.

Merge Danger

Door: Two-way

Blast Radius: Sophia

The change affects early termination in the Sophia solver loop; reverting the commit restores the prior behavior.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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