Specification-Driven Code Translation Powered by Large Language Models: How Far Are We?

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Saha, Soumit Kanti, Rabbi, Fazle, Wang, Song, Yang, Jinqiu
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866911639044882432
author Saha, Soumit Kanti
Rabbi, Fazle
Wang, Song
Yang, Jinqiu
author_facet Saha, Soumit Kanti
Rabbi, Fazle
Wang, Song
Yang, Jinqiu
contents Large Language Models (LLMs) are increasingly being applied across various domains, including code-related tasks such as code translation. Previous studies have explored using LLMs for translating code between different programming languages. Since LLMs are more effective with natural language, using natural language as an intermediate representation in code translation tasks is an intuitively appealing approach. However, whether this benefit is general or highly context-dependent remains unclear. In this work, we investigate using NL-specification as an intermediate representation for code translation. We evaluate our method using three datasets, five popular programming languages, and 29 language pair permutations. Our results show that using NL-specification alone does not lead to performance improvements. However, when combined with source code, it provides gains in certain language pairs (notably with Python and C++ as source languages), while offering no consistent improvement overall. Besides analyzing the performance of code translation, we also investigate the quality of the translated code and provide insights into the issues present in the translated code.
format Preprint
id arxiv_https___arxiv_org_abs_2412_04590
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Specification-Driven Code Translation Powered by Large Language Models: How Far Are We?
Saha, Soumit Kanti
Rabbi, Fazle
Wang, Song
Yang, Jinqiu
Software Engineering
Large Language Models (LLMs) are increasingly being applied across various domains, including code-related tasks such as code translation. Previous studies have explored using LLMs for translating code between different programming languages. Since LLMs are more effective with natural language, using natural language as an intermediate representation in code translation tasks is an intuitively appealing approach. However, whether this benefit is general or highly context-dependent remains unclear. In this work, we investigate using NL-specification as an intermediate representation for code translation. We evaluate our method using three datasets, five popular programming languages, and 29 language pair permutations. Our results show that using NL-specification alone does not lead to performance improvements. However, when combined with source code, it provides gains in certain language pairs (notably with Python and C++ as source languages), while offering no consistent improvement overall. Besides analyzing the performance of code translation, we also investigate the quality of the translated code and provide insights into the issues present in the translated code.
title Specification-Driven Code Translation Powered by Large Language Models: How Far Are We?
topic Software Engineering
url https://arxiv.org/abs/2412.04590