A Multi-Language Object-Oriented Programming Benchmark for Large Language Models

Shuai Wang, Liang Ding, Li Shen, Yong Luo, Han Hu, Lefei Zhang, Fu LinarXiv 2025

Abstract

Establishing fair and robust benchmarks is essential for evaluating intelligent code generation by large language models (LLMs). Our survey of 35 existing benchmarks uncovers three major imbalances: 85.7% focus on a single programming language; 94.3% target only function-level or statement-level tasks; and over 80% include fewer than ten test cases on average. To address these gaps, we propose MultiOOP, a multi-language object-oriented programming benchmark covering six popular languages (Python, PHP, C++, C#, Java, JavaScript) with 267 tasks per language. We design a translator that extends an existing single-language OOP benchmark and the pass@o metric to a multilingual setting. Moreover, we propose an automated framework for augmenting test cases to ensure the reliability of the evaluation results. We evaluate 14 mainstream LLMs under zero-shot prompting and report three key findings: 1) Substantial performance degradation: pass@1 scores on MultiOOP drop by up to 65.6 percentage points compared to function-level tasks (e.g., HumanEval). 2) Cross-language variability: GPT-4o mini achieves pass@1 of 48.06% in Python but only 0.12%-15.26% in other languages, indicating limited multilingual generalization. 3) Conceptual gaps: pass@o scores are consistently 1.1-19.2 points lower than pass@k, demonstrating that LLMs often generate executable code without fully capturing core OOP concepts. Our benchmark, metric extensions, and evaluation scripts will be publicly released to foster a more balanced and comprehensive assessment of LLMs in object-oriented code generation. Our code and data will be released at https://github.com/alphadl/OOP-eval and https://huggingface.co/datasets/codeai-dteam/MultiOOP respectively.

Introduction

While Large Language Models (LLMs) have shown remarkable proficiency in code generation, current evaluation methods often fail to capture the complexities of real-world software development. Most benchmarks focus on isolated functional snippets in a single language, creating a "performance mirage." MultiOOP is a new multilingual benchmark designed to evaluate LLMs on complex object-oriented programming (OOP) tasks across six major languages. Our study reveals a significant "performance cliff": while LLMs excel at simple functional snippets, their ability to maintain OOP principles like encapsulation and inheritance collapses when moving beyond Python.

The Limitations of Current Benchmarks

Most existing code generation benchmarks suffer from three major imbalances that paint an overly optimistic picture of LLM capabilities:

  1. Language Bias: Over 85% of benchmarks focus on a single language (usually Python).
  2. Low Complexity: Roughly 94% of tasks target only function-level or statement-level code, ignoring the architectural complexity of real-world software.
  3. Weak Validation: Over 80% of benchmarks use fewer than ten test cases per task, leading to "accidental passes" where buggy code happens to satisfy a few simple inputs.
Comparison of MultiOOP with 35 existing code generation benchmarks, highlighting gaps in language diversity and task granularity.

Methodology: The MultiOOP Framework

To bridge these gaps, we developed MultiOOP, which includes 267 independent tasks for each of six languages: Python, PHP, C++, C#, Java, and JavaScript. Our methodology involves three core innovations:

Multilingual Translation Pipeline

We designed a custom translator that converts Python-based OOP tasks into five other languages. This isn't just a simple text swap; it handles deep syntactic differences (like static vs. dynamic typing) and ensures semantic consistency across languages.

The MultiOOP construction pipeline, illustrating the automated translation of requirements and test cases across multiple programming languages.

Automated Test Case Augmentation

To ensure reliability, we built a framework that uses an LLM to generate new, unique test cases. These are validated against ground-truth code and then translated across the target languages, resulting in an average of 20 test cases per task.

The pass@o Metric

Standard pass@k only checks if code executes correctly. The new pass@o (pass at object-oriented) metric adds a requirement: the generated code must also match key OOP structural points defined in the natural language requirements, such as specific class names or private/public access modifiers.

Key Insights and Results

Our evaluation of 14 mainstream LLMs (including GPT-4o mini, Llama-3, and Qwen-2.5) revealed several critical insights:

  • The Python "Security Blanket": LLMs perform significantly better in Python than in any other language. For instance, GPT-4o mini's performance drops from ~48% in Python to as low as 0.77% in Java. This suggests that LLMs are heavily overfitted to Python-heavy training data.
  • Correct Logic, Wrong Architecture: Many models can generate code that passes functional tests but fails to follow OOP requirements. The pass@o scores were consistently 1.1 to 19.2 points lower than standard pass@k scores, highlighting a "conceptual gap" in how LLMs understand software design.
  • More Tests = Lower Scores: As the number of test cases increases, model scores drop and then stabilize. This confirms that low-test-case benchmarks likely overestimate model performance due to accidental passes.
  • Substantial Performance Degradation: Models showed up to a 65.6 percentage point drop in performance on MultiOOP compared to simpler function-level benchmarks.

Conclusion and Future Work

MultiOOP exposes the fragility of LLM performance when faced with architectural complexity and multilingual requirements. While models are proficient at generating functional snippets in Python, their grasp of object-oriented principles across diverse languages remains limited. Future work should expand the benchmark to repository-level generation and more complex design patterns to foster a more balanced and comprehensive era of LLM evaluation in software engineering.

Summary updated

BibTeX
@misc{wang2025multi,
  author = {Shuai Wang and Liang Ding and Li Shen and Yong Luo and Han Hu and Lefei Zhang and Fu Lin},
  title = {{A Multi-Language Object-Oriented Programming Benchmark for Large Language Models}},
  year = {2025},
  eprint = {2509.26111},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.26111},
}
Figure