arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.09701cs.CL
收藏

弥合语言差距:通过零样本跨语言迁移增强 LLM 中基于多语言提示的代码生成

Bridging the Language Gap: Enhancing Multilingual Prompt-Based Code Generation in LLMs via Zero-Shot Cross-Lingual Transfer

Department of Statistics and Data Science, Yale University(耶鲁大学统计与数据科学系);School of Information, University of Texas at Austin(德克萨斯大学奥斯汀分校信息学院)

Mingda Li, Abhijit Mishra, Utkarsh Mujumdar

AI总结:

针对非英语提示下 LLM 代码生成质量不均的问题,提出结合 LASER 与神经投影的零样本跨语言迁移方法,仅用英语训练即可提升多语言代码生成质量。

摘要:

使用大型语言模型(LLM)生成程序代码已受到广泛关注,但其对非英语提示的偏见和限制对全球包容性构成挑战。本文研究了基于多语言提示的代码生成的复杂性。我们对包括 CODELLAMA 和 CODEGEMMA 在内的 LLM 进行评估,结果揭示非英语提示在代码质量方面存在显著差异;我们还证明了提示翻译、自举数据增强和微调等简单方法的不足。为解决该问题,我们提出一种零样本跨语言方法,采用神经投影技术,集成 LASER 等跨语言编码器,将来自该编码器的多语言嵌入映射到 LLM 的 token 空间。该方法只需在英语数据上训练,即可有效扩展到其他语言。在经过翻译和质量检查的 MBPP 数据集上的结果显示,代码质量显著提升。本研究通过赋予 LLM 多语言能力以支持编程中多样的语言谱系,推动更具包容性的代码生成格局。

英文摘要:

The use of Large Language Models (LLMs) for program code generation has gained substantial attention, but their biases and limitations with non-English prompts challenge global inclusivity. This paper investigates the complexities of multilingual prompt-based code generation. Our evaluations of LLMs, including CODELLAMA and CODEGEMMA, reveal significant disparities in code quality for non-English prompts; we also demonstrate the inadequacy of simple approaches like prompt translation, bootstrapped data augmentation, and fine-tuning. To address this, we propose a zero-shot cross-lingual approach using a neural projection technique, integrating a cross-lingual encoder like LASER to map multilingual embeddings from it into the LLM's token space. This method requires training only on English data and scales effectively to other languages. Results on a translated and quality-checked MBPP dataset show substantial improvements in code quality. This research promotes a more inclusive code generation landscape by empowering LLMs with multilingual capabilities to support the diverse linguistic spectrum in programming.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑