Large Language Models for Code Generation from Multilingual Prompts: A Curated Benchmark and a Study on Code Quality

· Source: Takara TLDR - Daily AI Papers · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Expert, quick

Summary

A study investigated language bias in Large Language Models (LLMs) for code generation, specifically how different natural languages in prompts affect code quality. Researchers analyzed GPT-4o mini, DeepSeek, and Claude across 460 coding tasks (230 Python, 230 Java). They manually translated English prompts into Chinese, Hindi, Spanish, and Italian, preserving technical meaning. Evaluation covered functional correctness via test pass rates, structural quality using code metrics, static analysis issues, and lexical characteristics like identifier and comment languages. Key findings indicate that English prompts do not consistently produce the best functional correctness or code quality, the impact of prompt language varies by programming language and LLM, and generated code often mixes English with the prompt language in comments and string literals.

Key takeaway

For Machine Learning Engineers developing multilingual code generation systems, you should not assume English prompts will consistently deliver optimal code quality or functional correctness. Your LLM's performance is sensitive to the prompt's natural language, varying by programming language and model. Test your systems with diverse prompt languages relevant to your user base to ensure robust and high-quality code output across all supported languages.

Key insights

Prompt language significantly influences LLM code generation quality, with English not always yielding superior results.

Principles

Method

Manually curate and translate 460 English coding prompts into four other languages, then evaluate LLM-generated Python and Java code across multiple quality dimensions.

In practice

Topics

Best for: Research Scientist, AI Engineer, AI Scientist, Machine Learning Engineer, NLP Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Takara TLDR - Daily AI Papers.