[Paper Review] XLCoST: A Benchmark Dataset for Cross-lingual Code Intelligence
This paper introduces XLCoST, a large-scale benchmark dataset with 1 million parallel code snippets and 123,000 programs across 8 languages (7 programming languages and English), enabling 10 cross-lingual code tasks. It demonstrates that multilingual pretraining, sequence-to-sequence models, and snippet-level transfer learning significantly improve performance, especially for low-resource languages like C.
Recent advances in machine learning have significantly improved the understanding of source code data and achieved good performance on a number of downstream tasks. Open source repositories like GitHub enable this process with rich unlabeled code data. However, the lack of high quality labeled data has largely hindered the progress of several code related tasks, such as program translation, summarization, synthesis, and code search. This paper introduces XLCoST, Cross-Lingual Code SnippeT dataset, a new benchmark dataset for cross-lingual code intelligence. Our dataset contains fine-grained parallel data from 8 languages (7 commonly used programming languages and English), and supports 10 cross-lingual code tasks. To the best of our knowledge, it is the largest parallel dataset for source code both in terms of size and the number of languages. We also provide the performance of several state-of-the-art baseline models for each task. We believe this new dataset can be a valuable asset for the research community and facilitate the development and validation of new methods for cross-lingual code intelligence.
Motivation & Objective
- Address the scarcity of high-quality, multilingual, parallel code data for training and evaluating code intelligence models.
- Overcome limitations of existing datasets, which are small in size and limited to few languages or only program-level alignment.
- Enable rigorous evaluation of cross-lingual code models through fine-grained, snippet-level and program-level parallel data with aligned comments.
- Support diverse tasks including code translation, summarization, synthesis, and code search across multiple languages.
- Facilitate research in low-resource programming languages by providing balanced, high-quality parallel data.
Proposed method
- Collect and align code snippets and full programs across 8 languages: C++, Java, Python, C#, JavaScript, PHP, C, and English.
- Ensure fine-grained alignment at both snippet and program levels, with identical comments across all language variants.
- Construct 10 cross-lingual tasks: 3 generation tasks (code translation, code summarization, code synthesis) and 2 retrieval tasks (NL and XL code search), each at snippet and program levels.
- Preprocess data to ensure syntactic and semantic consistency across languages, using comments as cross-lingual supervision.
- Train and evaluate state-of-the-art models (CodeBERT, PLBART, CodeT5) on all 10 tasks using standard metrics like CodeBLEU.
- Apply transfer learning by first pretraining on snippet-level data before fine-tuning on program-level data to improve low-resource language performance.
Experimental results
Research questions
- RQ1Can multilingual pretraining and sequence-to-sequence architectures improve performance across diverse cross-lingual code tasks?
- RQ2How does model performance vary across high-resource and low-resource programming languages, particularly C?
- RQ3To what extent does transfer learning from snippet-level to program-level training improve model generalization and performance?
- RQ4What types of syntactic errors are most common in generated code, and how do they affect model reliability?
- RQ5How does the size and linguistic diversity of parallel data impact the robustness and scalability of code generation models?
Key findings
- XLCoST contains 1,002,296 parallel code snippets and 123,000 parallel programs across 8 languages, making it the largest known parallel code dataset in both size and language coverage.
- CodeT5 outperforms CodeBERT and PLBART across all generation tasks, especially when C is involved, indicating the benefit of broader multilingual pretraining.
- Models trained on snippet-level data and fine-tuned on program-level data show significant performance gains—especially for low-resource languages like C—demonstrating the effectiveness of transfer learning.
- Syntactic errors such as bracket mismatches, missing semicolons, and indentation issues are the most frequent compilation errors in generated code, highlighting structural learning gaps.
- Performance on C is consistently lower than on other languages due to its smaller training data size, confirming that low-resource languages remain a challenge.
- The use of CodeBLEU as a metric captures syntax and semantics, but future work should incorporate test-case validation for more robust evaluation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.