CodeFuse-13B: A Pretrained Multi-lingual Code Large Language Model

Peng Di, Jianguo Li, Hang Yu, Wei Jiang, Wenting Cai, Yang Cao, Chaoyu Chen, Dajun Chen, Hongwei Chen, Liang Chen, Gang Fan, Jie Gong, Zi Gong, Wen Hu, Tingting Guo, Zhichao Lei, Ting Li, Zheng Li, Ming Liang, Cong Liao, Bingchang Liu, Jiachen Liu, Zhiwei Liu, Shaojun Lu, Min Shen, Guangpei Wang, Huan Wang, Zhi Wang, Zhaogui Xu, Jiawei Yang, Qing Ye, Gehao Zhang, Yu Zhang, Zelin Zhao, Xunjin Zheng, Hailian Zhou, Lifu Zhu, Xianying Zhu

TL;DR

This paper introduces CodeFuse-13B, a new open-source, 13-billion parameter large language model specifically designed for code-related tasks, with a strong emphasis on multi-lingual support, particularly for Chinese prompts. It achieves impressive performance on benchmarks like HumanEval-X and demonstrates practical utility in real-world software development scenarios, outperforming existing models when using Chinese instructions.

What Problem Does This Paper Address?

The rapid advancement of Large Language Models (LLMs) for code has revolutionized software engineering. However, a significant gap exists in their ability to effectively understand and process non-English prompts, especially for tasks involving languages like Chinese. While many existing code LLMs excel with English instructions, their performance degrades when faced with multi-lingual inputs, limiting their applicability in global software development environments. This paper aims to bridge this gap by developing and releasing CodeFuse-13B, a model explicitly trained to handle both English and Chinese prompts across a wide range of programming languages.

Methods

CodeFuse-13B is built upon a Transformer architecture, similar to GPT-3, with a few key modifications. It utilizes Rotary Positional Embeddings (RoPE) for better positional encoding and employs parallel attention and feed-forward network (FFN) layers, which the authors claim improves computational throughput. The model is pre-trained on a massive dataset and then fine-tuned using supervised instruction fine-tuning (SFT) and multi-task instruction fine-tuning (MFT). A crucial aspect of their methodology is the extensive data preparation, which involves sophisticated program analysis for filtering and cleaning code data, alongside techniques for data detoxification and deduplication. They also developed extensions for popular IDEs to integrate CodeFuse seamlessly into developer workflows.

Datasets

The training dataset for CodeFuse consists of approximately 200 TB of data, including 196 TB of code, 1.75 TB of Chinese raw data, and 1.7 TB of English raw data, tokenized into 800 billion tokens. For evaluation, the paper uses standard benchmarks like HumanEval and HumanEval-X. Crucially, they introduce a new benchmark called CodeFuseEVAL, designed to address the limitations of existing benchmarks for Chinese prompts. CodeFuseEVAL covers five programming languages (Python, Java, C++, Go, and JavaScript) and includes scenarios for code completion, generation, translation, commenting, and test case generation, specifically catering to Chinese inputs.

Key Insights and Ideas

  • The Importance of Multi-lingual Data Filtering: The authors emphasize that simply having multi-lingual data isn't enough; it needs careful filtering and optimization. Their use of program analyzers to filter code for syntax correctness and quality is a key differentiator.
  • Chinese Prompts are a Real Challenge: The paper highlights that existing code LLMs struggle with Chinese prompts, underscoring the need for models like CodeFuse that are specifically trained for this.
  • IDE Integration is Key for Adoption: By developing IDE extensions, the authors aim to make CodeFuse readily usable by developers, which is crucial for real-world impact.
  • Code-Specific Data Processing is Crucial: Unlike general LLMs, code LLMs require specialized data processing pipelines that account for code structure, semantics, and potential risks.

Key Results

CodeFuse-13B achieved a HumanEval pass@1 score of 37.10%, positioning it among the top multi-lingual code LLMs of similar size. In practical scenarios, especially when using Chinese prompts for tasks like code generation, translation, commenting, and test case generation, CodeFuse demonstrated superior performance compared to other models. The paper also presents results showing CodeFuse-13B's effectiveness in code translation, outperforming other models in several conversion scenarios.

Limitations and Future Work

The authors acknowledge that while mono-lingual models like CodeLlama-Python, WizardCoder, and PanGu-Coder2 show stronger performance on Python-specific evaluations due to specialized optimizations, CodeFuse aims for broader multi-lingual applicability. Future work includes further open-sourcing components like the CodeFuseEVAL benchmark and the Sparrow program query system. They also plan to extend their multi-task fine-tuning (MFT) framework to support other open-source code LLMs and have already demonstrated this by fine-tuning StarCoder and CodeLLaMA models.

Summary updated

BibTeX
@inproceedings{di2024codefuse,
  author = {Peng Di and Jianguo Li and Hang Yu and Wei Jiang and Wenting Cai and Yang Cao and Chaoyu Chen and Dajun Chen and Hongwei Chen and Liang Chen and Gang Fan and Jie Gong and Zi Gong and Wen Hu and Tingting Guo and Zhichao Lei and Ting Li and Zheng Li and Ming Liang and Cong Liao and Bingchang Liu and Jiachen Liu and Zhiwei Liu and Shaojun Lu and Min Shen and Guangpei Wang and Huan Wang and Zhi Wang and Zhaogui Xu and Jiawei Yang and Qing Ye and Gehao Zhang and Yu Zhang and Zelin Zhao and Xunjin Zheng and Hailian Zhou and Lifu Zhu and Xianying Zhu},
  title = {{CodeFuse-13B: A Pretrained Multi-lingual Code Large Language Model}},
  booktitle = {ICSE-SEIP},
  year = {2024},
  doi = {10.1145/3639477.3639719},
}
Figure