TY - JOUR
T1 - HMPT
T2 - a human–machine cooperative program translation method
AU - Zhang, Xin
AU - Yu, Zhiwen
AU - Liu, Jiaqi
AU - Wang, Hui
AU - Wang, Liang
AU - Guo, Bin
N1 - Publisher Copyright:
© 2023, The Author(s).
PY - 2023/11
Y1 - 2023/11
N2 - Program translation aims to translate one kind of programming language to another, e.g., from Python to Java. Due to the inefficiency of translation rules construction with pure human effort (software engineer) and the low quality of machine translation results with pure machine effort, it is suggested to implement program translation in a human–machine cooperative way. However, existing human–machine program translation methods fail to utilize the human’s ability effectively, which require human to post-edit the results (i.e., statically modified directly on the model generated code). To solve this problem, we propose HMPT (Human-Machine Program Translation), a novel method that achieves program translation based on human–machine cooperation. It can (1) reduce the human effort by introducing a prefix-based interactive protocol that feeds the human’s edit into the model as the prefix and regenerates better output code, and (2) reduce the interactive response time resulted by excessive program length in the regeneration process from two aspects: avoiding duplicate prefix generation with cache attention information, as well as reducing invalid suffix generation by splicing the suffix of the results. The experiments are conducted on two real datasets. Results show compared to the baselines, our method reduces the human effort up to 73.5% at the token level and reduces the response time up to 76.1%.
AB - Program translation aims to translate one kind of programming language to another, e.g., from Python to Java. Due to the inefficiency of translation rules construction with pure human effort (software engineer) and the low quality of machine translation results with pure machine effort, it is suggested to implement program translation in a human–machine cooperative way. However, existing human–machine program translation methods fail to utilize the human’s ability effectively, which require human to post-edit the results (i.e., statically modified directly on the model generated code). To solve this problem, we propose HMPT (Human-Machine Program Translation), a novel method that achieves program translation based on human–machine cooperation. It can (1) reduce the human effort by introducing a prefix-based interactive protocol that feeds the human’s edit into the model as the prefix and regenerates better output code, and (2) reduce the interactive response time resulted by excessive program length in the regeneration process from two aspects: avoiding duplicate prefix generation with cache attention information, as well as reducing invalid suffix generation by splicing the suffix of the results. The experiments are conducted on two real datasets. Results show compared to the baselines, our method reduces the human effort up to 73.5% at the token level and reduces the response time up to 76.1%.
KW - Human–machine cooperation
KW - Interactive machine learning
KW - Neural machine translation
KW - Program translation
KW - Transformer
UR - http://www.scopus.com/inward/record.url?scp=85168419790&partnerID=8YFLogxK
U2 - 10.1007/s10515-023-00395-9
DO - 10.1007/s10515-023-00395-9
M3 - 文章
AN - SCOPUS:85168419790
SN - 0928-8910
VL - 30
JO - Automated Software Engineering
JF - Automated Software Engineering
IS - 2
M1 - 27
ER -