TL;DR
This paper explores whether large language models (LLMs) can solve research-level, NP-hard mathematical problems—specifically, determining if a multivariate polynomial can be expressed as a Sum of Squares (SoS). By introducing a new benchmark dataset (SoS-1K) and expert-designed reasoning prompts, the authors boost LLM accuracy from near-random guessing up to 81%. Remarkably, a lightweight 7B model fine-tuned on this data for just 4 hours outperforms massive 671B models like DeepSeek-V3 while requiring less than 2% of the computation time.
What Problem Does This Paper Address?
The authors tackle a fundamental and computationally intractable problem in mathematics: determining whether a given multivariate polynomial is nonnegative (meaning it never evaluates to a negative value for any real inputs). This problem is deeply connected to Hilbert’s Seventeenth Problem and is a cornerstone of global polynomial optimization, with vital applications in control theory, quantum computing, and fluid dynamics.
Because proving general nonnegativity is provably NP-hard, mathematicians typically look for a sufficient alternative condition: the Sum of Squares (SoS). If a polynomial can be rewritten as a sum of squared polynomials, it is guaranteed to be nonnegative. Traditional numerical software packages solve this by converting it into a Semidefinite Programming (SDP) problem. However, as the number of variables and the polynomial degree grow, the size of these SDP matrices explodes, rendering classical solvers useless for large-scale problems. This paper investigates whether reasoning-focused LLMs can offer a new way forward.
Methods
The authors designed three distinct prompting strategies to evaluate and guide LLMs through the SoS verification process:
- SoS Plain: A basic binary classification prompt ("Please analyze if this polynomial can be expressed as a Sum of Squares").
- SoS Simple: A prompt that classifies polynomials into five distinct groups using concise, one-line rules.
- SoS Reasoning: A highly structured, expert-annotated five-step mathematical verification framework. It guides the model to systematically check the polynomial's degree, verify nonnegativity via specific mathematical properties, analyze well-known special cases, look for direct square forms, and perform matrix decomposition ($Q$-matrix verification).
Beyond prompting, the authors performed Supervised Fine-Tuning (SFT) on a pre-trained Qwen2.5-7B-Instruct-1M model using their new dataset. The training took just 4 hours on two NVIDIA A100 GPUs, resulting in a specialized, highly efficient model named SoS-7B.
Datasets
The paper introduces SoS-1K, a meticulously curated dataset of approximately 1,000 polynomials. The dataset features:
- An even split between SoS and non-SoS polynomials.
- Variables and polynomial degrees ranging from 2 to 10.
- Five distinct difficulty subsets mapped directly to the five steps of the SoS Reasoning framework.
- Expert-annotated reasoning traces, theoretical proofs for certain classes, and labels verified by standard numerical solvers.
Key Insights and Ideas
- Plain Prompts Fall Flat: When given a plain question without structured guidance, state-of-the-art LLMs fail, hovering around 50% to 60% accuracy—barely better than a random coin flip on a binary task.
- Scaffolding Unlocks Latent Knowledge: Introducing the expert-designed SoS Reasoning prompt yields a massive performance leap (up to a 21% accuracy boost). This indicates that while LLMs possess the underlying mathematical knowledge, they require explicit logical scaffolding to retrieve and apply it correctly.
- The "Laziness" Phenomenon: The authors noticed that under the complex SoS Reasoning prompt, some models become "lazy" at Step 5 (Matrix Decomposition). Instead of grinding through the heavy matrix algebra, they try to guess the final answer based on clues from earlier, simpler steps.
- Capacity vs. Reasoning Length: Higher-capacity models (like DeepSeek-R1 and OpenAI o1-mini) actually require fewer thinking tokens to reach correct conclusions, whereas smaller models require longer, more explicit reasoning paths to hit peak accuracy.
Key Results
- Top Prompted Performance: DeepSeek-R1 combined with the SoS Reasoning prompt achieved the highest accuracy on valid samples at 81%.
- Small Model, Big Impact: The fine-tuned SoS-7B model achieved a total accuracy of 70%, outperforming the massive 671B DeepSeek-V3 (69%) and the 32B QwQ-32B-Preview (52%).
- Dramatic Speedups: SoS-7B achieved its high accuracy with a blistering response time of just 1.8 seconds—utilizing only 1.8% of the computation time required by DeepSeek-V3 (100 seconds) and 5% of OpenAI o1-mini (34.9 seconds).
Limitations and Future Work
- Context Window Limits: To prevent LLM degradation over long sequences, the authors capped polynomial lengths to 4,000 tokens. Consequently, most of the test cases still fall within the boundaries of what traditional numerical solvers can handle.
- Low-Rank Matrix Vulnerability: While LLMs excel at smaller polynomials, they consistently struggle when the underlying quadratic form of the polynomial requires a low-rank matrix decomposition.
- Future Outlook: The team plans to expand the dataset to include much larger, more complex polynomials that completely break traditional numerical solvers, testing whether LLMs can truly push the boundaries of unsolved NP-hard mathematical problems.
Summary updated