Remove incorrect logistic (sigmoid) convexity rule - #124
Merged
ChrisRackauckas merged 1 commit intoJul 12, 2026
Merged
Conversation
logistic (the sigmoid 1/(1+exp(-x)) from LogExpFunctions) was registered as Convex, but the sigmoid is not globally convex: its second derivative s(1-s)(1-2s) is positive for x<0, zero at x=0, negative for x>0 (inflection at the origin). The rule appears to confuse the sigmoid with the logistic loss / softplus log(1+exp(x)), which is convex. The rule is dead today (logistic(x) expands to a `/` expression, so it never fires and analyze already returns UnknownCurvature) but is a latent trap: hasdcprule(logistic) is true, so preserving logistic as a symbolic atom later would silently activate a false Convex certification. Remove the rule and its docs row. Part of SciML#121. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR should be ignored until reviewed by @ChrisRackauckas.
Surfaced by the trace-coverage spike in #121.
logistic(the sigmoid1/(1+exp(-x)), from LogExpFunctions) was registered asConvex, but the sigmoid is not globally convex: its second derivatives(1-s)(1-2s)is positive forx<0, zero atx=0, and negative forx>0(inflection at the origin). Verified numerically:The rule looks like a sigmoid-vs-softplus mix-up (the logistic loss / softplus
log(1+exp(x))is convex; the sigmoid is not). The rule is dead today —logistic(x)expands to a/expression during tracing, so it never fires andanalyzealready returnsUnknownCurvature— but it is a latent trap:hasdcprule(logistic)istrue, so anyone later preservinglogisticas a symbolic atom would silently activate a falseConvexcertification.Removes the rule (
src/atoms.jl) and its docs row (docs/src/atoms.md). Behavior-preserving foranalyzeoutput (stillUnknownCurvature); it removes the trap. Test asserts!hasdcprule(logistic)(fails before, passes after) and the honestUnknownCurvatureresult. Full suite passes.Part of #121.
🤖 Generated with Claude Code