Automated Snippet-Alignment Data Augmentation for Code Translation

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Zhang, Zhiming, Zhu, Qingfu, Luo, Xianzhen, Wang, Yixuan, Li, Bohan, Che, Wanxiang
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866914097896882176
author Zhang, Zhiming
Zhu, Qingfu
Luo, Xianzhen
Wang, Yixuan
Li, Bohan
Che, Wanxiang
author_facet Zhang, Zhiming
Zhu, Qingfu
Luo, Xianzhen
Wang, Yixuan
Li, Bohan
Che, Wanxiang
contents Code translation aims to translate the code from its source language to the target language and is used in various software development scenarios. Recent developments in Large Language Models (LLMs) have showcased their capabilities in code translation, and parallel corpora play a crucial role in training models for code translation. Parallel corpora can be categorized into program-alignment (PA) and snippet-alignment (SA) data. Although PA data has complete context and is suitable for semantic alignment learning, it may not provide adequate fine-grained training signals due to its extended length, while the brevity of SA data enables more fine-grained alignment learning. Due to limited parallel corpora, researchers explore several augmentation methods for code translation. Previous studies mainly focus on augmenting PA data. In this paper, we propose a data augmentation method that leverages LLMs to generate SA data automatically. To fully leverage both PA data and SA data, we explore a simple yet effective two-stage training strategy, which consistently enhances model performance compared to fine-tuning solely on PA data. Experiments on TransCoder-test demonstrate that our augmented SA data combined with the two-stage training approach yields consistent improvements over the baseline, achieving a maximum gain of 3.78% on pass@k.
format Preprint
id arxiv_https___arxiv_org_abs_2510_15004
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Automated Snippet-Alignment Data Augmentation for Code Translation
Zhang, Zhiming
Zhu, Qingfu
Luo, Xianzhen
Wang, Yixuan
Li, Bohan
Che, Wanxiang
Software Engineering
Artificial Intelligence
Code translation aims to translate the code from its source language to the target language and is used in various software development scenarios. Recent developments in Large Language Models (LLMs) have showcased their capabilities in code translation, and parallel corpora play a crucial role in training models for code translation. Parallel corpora can be categorized into program-alignment (PA) and snippet-alignment (SA) data. Although PA data has complete context and is suitable for semantic alignment learning, it may not provide adequate fine-grained training signals due to its extended length, while the brevity of SA data enables more fine-grained alignment learning. Due to limited parallel corpora, researchers explore several augmentation methods for code translation. Previous studies mainly focus on augmenting PA data. In this paper, we propose a data augmentation method that leverages LLMs to generate SA data automatically. To fully leverage both PA data and SA data, we explore a simple yet effective two-stage training strategy, which consistently enhances model performance compared to fine-tuning solely on PA data. Experiments on TransCoder-test demonstrate that our augmented SA data combined with the two-stage training approach yields consistent improvements over the baseline, achieving a maximum gain of 3.78% on pass@k.
title Automated Snippet-Alignment Data Augmentation for Code Translation
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2510.15004