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

利用自动化单元测试进行无监督代码翻译

Leveraging Automated Unit Tests for Unsupervised Code Translation

Facebook AI Research(脸书人工智能研究院);Paris-Dauphine University(巴黎第九大学);University College London(伦敦大学学院);Facebook(脸书)

Baptiste Roziere, Jie M. Zhang, Francois Charton, Mark Harman, Gabriel Synnaeve, Guillaume Lample

摘要:

由于程序设计语言几乎没有并行数据,无监督方法非常适合源代码翻译。然而,大多数无监督机器翻译方法依赖于回译,这是在自然语言翻译的背景下开发的一种方法,并且本质上涉及对噪声输入的训练。不幸的是,源代码对微小的变化非常敏感;单个标记可能导致编译失败或错误的程序,这与自然语言不同,在自然语言中,微小的不准确可能不会改变句子的含义。为了解决这个问题,我们建议利用一个自动化的单元测试系统来过滤掉无效的翻译,从而创建一个完全测试的并行语料库。我们发现,使用此过滤数据集对无监督模型进行微调,可以显著降低如此生成的翻译中的噪声,对于所研究的所有语言对,其表现都优于最先进的技术。特别是,对于Java $\to$ Python和Python $\to$ C++,我们的性能分别比以前最好的方法高出16%和24%以上,出错率降低了35%以上。

英文摘要:

With little to no parallel data available for programming languages, unsupervised methods are well-suited to source code translation. However, the majority of unsupervised machine translation approaches rely on back-translation, a method developed in the context of natural language translation and one that inherently involves training on noisy inputs. Unfortunately, source code is highly sensitive to small changes; a single token can result in compilation failures or erroneous programs, unlike natural languages where small inaccuracies may not change the meaning of a sentence. To address this issue, we propose to leverage an automated unit-testing system to filter out invalid translations, thereby creating a fully tested parallel corpus. We found that fine-tuning an unsupervised model with this filtered data set significantly reduces the noise in the translations so-generated, comfortably outperforming the state-of-the-art for all language pairs studied. In particular, for Java $\to$ Python and Python $\to$ C++ we outperform the best previous methods by more than 16% and 24% respectively, reducing the error rate by more than 35%.

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

↑