ConvexBench: Can LLMs Recognize Convex Functions?
Abstract
Lay Summary
Mathematicians often need to know whether a function is convex - a property, shaped like a valley, that makes optimization problems far easier to solve reliably. As AI systems begin assisting with real mathematical research, we wanted to know: can today's most advanced language models correctly identify this property when functions are built up by layering many simple pieces together, the way they arise in practice? To test this, we created ConvexBench, a tool that automatically generates such layered functions with known, verified answers and a tunable difficulty level. We discovered a striking weakness: leading models like GPT-5 answer perfectly when functions have only a few layers, but their accuracy collapses as the layers pile up, even though each individual step stays easy and the problem comfortably fits within the model's memory. The models either lose track of the structure or give up and guess. To fix this, we built a system that hands the parsing to a dedicated tool and then forces the model to reason through one layer at a time, seeing only what each step needs. This restored near-perfect accuracy even on the deepest problems, pointing toward more reliable AI for mathematics and science.