arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2311.00317cs.CLcs.LGcs.SE
收藏

基于可比语料库与多重参考的代码翻译数据增强

Data Augmentation for Code Translation with Comparable Corpora and Multiple References

Carnegie Mellon University(卡内基梅隆大学);Language Technologies Institute(语言技术研究所)

Yiqing Xie, Atharva Naik, Daniel Fried, Carolyn Rose

AI总结:

本文提出两种代码翻译数据增强方法:构建可比语料库和生成多重参考翻译,并通过单元测试过滤,使 CodeT5 在 Java、Python 和 C++ 间的翻译计算准确率平均提升 7.5%。

摘要:

在不同编程语言之间进行代码翻译的一个主要挑战是平行训练数据往往有限。为克服这一挑战,我们提出了两种数据增强技术:一种构建可比语料库(即功能相似的代码对),另一种利用多重参考翻译来增强现有的平行数据。具体而言,我们构建并分析了多种类型的可比语料库,包括使用代码生成模型从自然语言文档生成的程序。此外,为了减少对单一参考翻译的过拟合,我们自动为可用的平行数据生成额外的翻译参考,并通过单元测试过滤这些翻译,从而增加目标翻译的多样性。实验表明,我们的数据增强技术显著提升了 CodeT5 在 Java、Python 和 C++ 之间翻译的性能,计算准确率(CA@1)平均提高了 7.5%,该指标通过执行来验证翻译的正确性。代码可在 https://github.com/Veronicium/CMTrans 获取。

英文摘要:

One major challenge of translating code between programming languages is that parallel training data is often limited. To overcome this challenge, we present two data augmentation techniques, one that builds comparable corpora (i.e., code pairs with similar functionality), and another that augments existing parallel data with multiple reference translations. Specifically, we build and analyze multiple types of comparable corpora, including programs generated from natural language documentation using a code generation model. Furthermore, to reduce overfitting to a single reference translation, we automatically generate additional translation references for available parallel data and filter the translations by unit tests, which increases variation in target translations. Experiments show that our data augmentation techniques significantly improve CodeT5 for translation between Java, Python, and C++ by an average of 7.5% Computational Accuracy (CA@1), which verifies the correctness of translations by execution. The code is available at https://github.com/Veronicium/CMTrans.

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

↑