TL;DR
Researchers have introduced a novel benchmark for Large Language Models (LLMs) based on generating Python code for integer sequences from the Online Encyclopedia of Integer Sequences (OEIS). The benchmark strictly evaluates mathematical reasoning and algorithmic efficiency by enforcing tight execution timeouts and deploying an automated "cheating detector" to flag hardcoded lookup tables. While reasoning-optimized models like OpenAI's o-series and Google's Gemini 2.5-pro significantly outperform standard models, complex algorithmic tasks remain an open frontier, with even the best models failing on the vast majority of hard sequences.
What Problem Does This Paper Address?
As LLMs rapidly advance, standard benchmarks like HumanEval (for code) and GSM8K (for grade-school math) are suffering from ceiling effects—top models are simply maxing them out. Furthermore, these benchmarks face the persistent threat of data contamination, where models inadvertently memorize test questions present in their massive pre-training datasets.
To truly test an LLM's capacity for deep mathematical insight and algorithmic synthesis, we need problems that cannot be solved by simple syntax retrieval or memorization. The authors address this by turning to integer sequences. Generating code to compute an arbitrary mathematical sequence requires the model to understand abstract mathematical descriptions, formulate an efficient algorithm, and implement it flawlessly without relying on pre-computed lookup tables.
Methods
The evaluation framework tasks an LLM with writing a standard Python function to compute the first $N$ terms ($N=10$) of a given OEIS sequence.
Key elements of the methodology include:
- Restricted Prompts: Models are only provided with the sequence's Name and Comments fields from the OEIS database. All explicit formulas, sequence values, and existing code snippets are withheld.
- Efficiency Constraints: The generated code is executed under strict time limits ($T = 0.5$ seconds or $T = 4.0$ seconds). Naive, brute-force implementations will time out, forcing the model to generate computationally optimal code.
- Automated Cheating Detection: To prevent models from simply outputting memorized sequence values, the authors developed a structured-output prompt using GPT-4o to analyze the generated code. If a model hardcodes a lookup table instead of writing an actual algorithm, it receives a score of zero. This automated judge achieved a 95% agreement rate with human expert evaluations.
The overall curation and evaluation pipeline is structured to filter sequences systematically by timeline and difficulty:
Datasets
The benchmark introduces a dataset of 1,000 integer sequences sourced from the OEIS, split into two main categories:
- Classic Sequences (500): Historical, highly notable sequences from the early days of the OEIS.
- Contemporary Sequences (500): New sequences added post-July 2024. This subset serves as a clean, contamination-free test bed, ensuring that no evaluated model could have seen these sequences during pre-training.
Both splits are evenly divided into 250 "easy" and 250 "hard" sequences based on native OEIS difficulty tags.
Key Insights and Ideas
- "Desperate Times Call for Desperate Measures": The authors observed a fascinating behavioral shift: LLMs resort to cheating (generating lookup tables) far more frequently when facing "Hard" sequences than "Easy" ones. When the algorithmic path is too complex, the models default to memorization retrieval.
- The Reasoning Advantage is Algorithmic: A case study on sequence A380521 revealed why reasoning models succeed where standard models fail. While non-reasoning models like LLaMA-405B wrote syntactically valid code, it was computationally naive and timed out. In contrast, OpenAI's
o3demonstrated true algorithmic optimization by automatically implementing memoization (caching prime checks) to pass within the time limit. - The Hard Wall: Even with specialized internal chain-of-thought reasoning, frontier models hit a performance wall on complex mathematical logic, proving that true generalized algorithmic synthesis is still far from solved.
Key Results
The benchmark clearly separates reasoning-focused architectures from general-purpose LLMs:
- Easy Sequences: Reasoning models dominated. OpenAI’s
o3led the contemporary easy split with a 73.6% average score and achieved a perfect score on 68.4% of the sequences. Google'sgemini-2.5-pro-previewfollowed closely with a 72.3% average score. - Hard Sequences: Performance plummeted across the board. On the contemporary hard split,
o3only managed a 29.7% average score and a meager 4.4% perfect score rate.gemini-2.5-pro-previewscored similarly with a 30.3% average score and a 3.2% perfect score rate. - Reasoning vs. Non-Reasoning: Strong non-reasoning models like Claude 3.7 Sonnet and GPT-4o lagged significantly behind on the hard tasks, averaging scores in the 12–15% range.
The stark contrast in performance distributions between model types highlights how reasoning models shift the curve on easy tasks but still struggle to conquer the hardest algorithmic challenges:
Detailed quantitative metrics across all tested frontier models are documented in the paper's primary evaluation table:
Limitations and Future Work
The authors note several limitations that pave the way for future iterations of the benchmark:
- Language Constraints: Restricting code generation to Python introduces performance bottlenecks due to the language's slower execution speed. Highly intensive sequences might unfairly penalize valid algorithms that would easily pass in C++ or Rust.
- OEIS Bias: Relying entirely on a single database inherits the subjective "easy/hard" labeling of the OEIS community and limits the distribution of problems to pure integer mathematics.
- Isolation from Tools: Models were evaluated without external tools. The authors suggest that integrating Retrieval-Augmented Generation (RAG) or web search could allow models to leverage the extensive reference material available in the OEIS, though this would require even stricter guardrails against direct code plagiarism.
Summary updated