TL;DR
When a Large Language Model (LLM) fails to generate correct code, is it because it couldn't figure out the underlying logic, or because it stumbled over the language's syntax? This paper introduces PseudoEval, a new benchmark that decouples these two stages by feeding LLMs clean pseudocode instead of natural language descriptions. The study reveals a fascinating divide: while Python generation is primarily bottlenecked by algorithmic problem-solving, lower-resource languages like Rust are heavily bottlenecked by the mechanics of language-specific coding.
What Problem Does This Paper Address?
Standard code generation benchmarks (like HumanEval or MBPP) evaluate LLMs in an end-to-end fashion: they provide a natural language prompt and check if the generated code passes a suite of tests. If the model fails, it operates as a black box. It remains unclear whether the LLM failed at problem-solving (the high-level logic and math) or language-coding (the syntax, type systems, and API calls).
Understanding where this bottleneck lies is crucial for targeted model development. If the issue is logic, we need better reasoning models; if the issue is syntax, we need better training data for specific programming languages.
Methods
The authors break down the traditional code generation pipeline into a two-step evaluation process:
- Step 1: Problem Solving – Analyzing the problem and reasoning out a solution.
- Step 2: Language Coding – Transforming that solution logic into compilable, executable code in a target language.
To isolate Step 2, the authors built an automated pipeline using a state-of-the-art reasoning model (DeepSeek-R1) to distill verified, user-submitted solutions into high-quality pseudocode. This pseudocode is strictly filtered to ensure it is complete (unambiguous), language-agnostic (free of language-specific libraries or type definitions), and concise.
They then evaluated 10 popular LLMs (including the Qwen-2.5-Coder series, Llama-3, Phi, and GPT-4o-mini) on their ability to translate this clean pseudocode into Python, C++, and Rust.
Datasets
The authors introduced PseudoEval, a multilingual benchmark consisting of 1,060 subjects split across three languages:
- Python: 357 tasks
- C++: 355 tasks
- Rust: 348 tasks
To prevent data contamination, the tasks were curated from the most recent algorithmic problems indexed by LiveCodeBench (originally sourced from LeetCode), ensuring they post-date the training cut-off points of the evaluated LLMs.
Key Insights and Ideas
- Language-Dependent Bottlenecks: The primary bottleneck for Python code generation is high-level problem-solving. When provided with pseudocode, even lightweight models can generate correct Python code. However, for C++ and Rust, models struggle significantly with the language-coding step itself due to strict type systems and lower resource availability in training corpora.
- Logic is Language-Agnostic: Algorithmic logic transfers seamlessly across languages. Pseudocode derived from a C++ solution is highly effective at guiding an LLM to write correct Python or Rust code, proving that the underlying "thought process" does not need to be language-specific.
- Machines Write Better Pseudocode Than Humans: Surprisingly, pseudocode automatically generated by DeepSeek-R1 led to higher code generation pass rates than human-annotated pseudocode. Reasoning models excel at structuring logic in a clean, concise format that downstream chat models prefer.
Key Results
Providing pseudocode yielded massive performance leaps across all models, languages, and difficulty tiers:
- Overall Pass@1 Gains: The average Pass@1 rate across all tested LLMs jumped from 0.38 to 0.75 for Python (+99% improvement), 0.35 to 0.66 for C++ (+87%), and 0.28 to 0.46 for Rust (+67%).
- Massive Leaps on Hard Tasks: The impact of isolating logic was most pronounced on difficult problems. On hard tasks, Python pass rates skyrocketed by 573%, C++ by 334%, and Rust by 370% when models were given pseudocode instead of raw problem descriptions.
- Cross-Language Dynamics: Pseudocode distilled from C++ source code proved to be the most robust baseline for cross-language generation. Conversely, pseudocode distilled from Python was less effective for C++ and Rust because Python solutions often rely on high-level, built-in libraries whose underlying logic cannot easily be extracted into language-agnostic steps.
Limitations and Future Work
- Single Pseudocode Sample: Due to API latency and the cost constraints of querying reasoning models, the benchmark currently evaluates only one pseudocode variant per problem.
- Algorithmic Bias: PseudoEval relies entirely on competitive programming puzzles (LeetCode). It remains unproven whether these insights hold true for real-world software engineering scenarios, such as writing business logic or configuring system architectures.
- Imperative Language Focus: The study is restricted to three popular imperative/object-oriented languages and does not explore functional programming paradigms (e.g., Haskell) or low-resource domain-specific languages.
Summary updated