# BigO(Bench): Can LLMs Generate Code with Controlled Time and Space Complexity?

- **ID:** 777
- **Kind:** paper
- **URL:** https://arxiv.org/abs/2503.15242
- **Authors:** Pierre Chambon, Baptiste Roziere, Benoit Sagot, Gabriel Synnaeve
- **Venue:** arXiv
- **Published:** 2025
- **Source:** arxiv
- **Language:** en
- **Access:** public
- **Tags:** benchmark, code-complexity, code-generation, big-o, code-contests
- **Topics:** code generation, complexity analysis, benchmarking
- **Added:** 2026-09-29
- **Verified:** 2026-09-29
- **Research status:** done
- **Page:** https://papers.projxon.ai/entries/777

## Summary

Introduces BigO(Bench), a benchmark for evaluating LLMs on understanding and generating code with specified time/space complexity. Includes tooling to infer algorithmic complexity of any Python function from profiling, plus 3,105 coding problems and 1,190,250 solutions from Code Contests annotated with inferred complexity labels, runtime, and memory footprints across input sizes. Finds token-space reasoning models are unrivaled at code generation but not at complexity understanding, hinting they may not generalize to tasks with no training-time reward.

## From the source (fetched 2026-10-03)

- **Published:** Mar 19, 2025 (arXiv)
- **Last revised:** Sep 22, 2026 (arXiv)
- **arXiv categories:** cs.CL, cs.AI, cs.CC (arXiv)
- **Citations:** 11 (Semantic Scholar)
- **References:** 0 (Semantic Scholar)

## Abstract

We introduce BigO(Bench), a novel coding benchmark designed to evaluate the capabilities of generative language models in understanding and generating code with specified time and space complexities. This benchmark addresses the gap in current evaluations that often overlook the ability of models to comprehend and produce code constrained by computational complexity. BigO(Bench) includes tooling to infer the algorithmic complexity of any Python function from profiling measurements, including human- or LLM-generated solutions. BigO(Bench) also includes of set of 3,105 coding problems and 1,190,250 solutions from Code Contests annotated with inferred (synthetic) time and space complexity labels from the complexity framework, as well as corresponding runtime and memory footprint values for a large set of input sizes. We present results from evaluating multiple state-of-the-art language models on this benchmark, highlighting their strengths and weaknesses in handling complexity requirements. In particular, token-space reasoning models are unrivaled in code generation but not in complexity understanding, hinting that they may not generalize well to tasks for which no reward was given at training time.

## Research notes

- Discovery: shared by Pierre Chambon (@PierreChambon6, FAIR/Meta AI & INRIA) in an X thread on 2026-09-29 presenting 3 papers on code optimization: https://x.com/PierreChambon6/status/2104966972043657560
- Method: complexity inference tooling from profiling measurements; evaluation of SOTA models on complexity-constrained generation.
- Submitted 2025-03-19 (v1), revised 2026-09-22 (v3).

## Similar entries

- [Astra vs. Fable 5.1 under a neutral Code quality panel | VulcanBench](https://papers.projxon.ai/entries/710) (benchmark, #710)
- [AI4AI-Bench: Benchmarking LLM Agents in Algorithmic Design for Recursive Self-Improvement](https://papers.projxon.ai/entries/691) (paper, #691)
- [AgentWorld: Benchmarking Long-Horizon Collaboration of Multi-agent LLMs](https://papers.projxon.ai/entries/862) (paper, #862)
- [AI4AI-Bench](https://papers.projxon.ai/entries/692) (code, #692)
- [ProgramDistill: From Interactive Web Apps to Verifiable Reference-Guided SWE Tasks](https://papers.projxon.ai/entries/729) (paper, #729)
- [The Illusion of What If: Evaluating the Breakdown of Counterfactual Reasoning in LLMs](https://papers.projxon.ai/entries/695) (paper, #695)
