BigO(Bench): Can LLMs Generate Code with Controlled Time and Space Complexity?
cs.CL, cs.AI, cs.CC
Submitted: 2025-03-19
Updated: 2026-09-22
Code: https://github.com/facebookresearch/bigobench
Project page: https://facebookresearch.github.io/BigOBench
License: http://creativecommons.org/licenses/by/4.0/
The gist: 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.
Terminology
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.
Sources
- DeepSeek-V3 Technical Report
- Program Synthesis with Large Language Models
- CodeComplex: Dataset for Worst-Case Time Complexity Prediction
- Evaluating Large Language Models Trained on Code
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
- The Llama 3 Herd of Models
- Qwen2.5-Coder Technical Report
- TASTY: A Transformer based Approach to Space and Time complexity
- OctoPack: Instruction Tuning Code Large Language Models
- OpenAI o1 System Card
- GPT-4 Technical Report
- Learning based Methods for Code Runtime Complexity Prediction
Related papers
- Exploring Solution Divergence and Its Effect on Large Language Model Problem Solving
- Ishigaki-IDS-Bench: A Benchmark for Generating Information Delivery Specification from BIM Information Requirements
- Subliminal Steering: Stronger Encoding of Hidden Signals
- MedStruct-S: A Benchmark for Key Discovery, Key-Conditioned QA and Semi-Structured Extraction from OCR Clinical Reports
- The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures
- Untangling the Mechanisms of Misleading Context in Medical Question Answering