[논문 리뷰] Exploring and Unleashing the Power of Large Language Models in Automated Code Translation
이 논문은 테스트 케이스 생성, 실행 기반 증강, 반복적 수리 기법을 활용하여 대규모 언어 모델(Large Language Models, LLMs)의 자동 코드 번역 성능을 향상시키는 통합 프레임워크 UniTrans를 제안한다. 파이썬, 자바, C++ 번역을 대상으로 평가한 결과, 피팅 튜닝 없이도 GPT-3.5 및 LLaMA 변종을 포함한 다양한 LLMs에서 계산 정확도와 정확 일치 정확도가 크게 향상됨을 확인하였다.
Code translation tools (transpilers) are developed for automatic source-to-source translation. Although learning-based transpilers have shown impressive enhancement against rule-based counterparts, owing to their task-specific pre-training on extensive monolingual corpora. Their current performance still remains unsatisfactory for practical deployment, and the associated training resources are also prohibitively expensive. LLMs pre-trained on huge amounts of human-written code/text have shown remarkable performance in many code intelligence tasks due to their powerful generality, even without task-specific training. Thus, LLMs can potentially circumvent the above limitations, but they have not been exhaustively explored yet. This paper investigates diverse LLMs and learning-based transpilers for automated code translation tasks, finding that: although certain LLMs have outperformed current transpilers, they still have some accuracy issues, where most of the failures are induced by a lack of comprehension of source programs, missing clear instructions on I/O types in translation, and ignoring discrepancies between source and target programs. Enlightened by the above findings, we further propose UniTrans, a Unified code Translation framework, applicable to various LLMs, for unleashing their power in this field. Specifically, UniTrans first crafts a series of test cases for target programs with the assistance of source programs. Next, it harnesses the above auto-generated test cases to augment the code translation and then evaluate their correctness via execution. Afterward, UniTrans further (iteratively) repairs incorrectly translated programs prompted by test case execution results. Extensive experiments are conducted on six settings of translation datasets between Python, Java, and C++. Three recent LLMs of diverse sizes are tested with UniTrans, and all achieve substantial improvements.
연구 동기 및 목표
- 대규모 언어 모델(LLMs)이 학습 기반 번역기(transpilers)의 대안으로 자동 코드 번역에 활용될 수 있는지 탐구하는 것.
- LLM 기반 코드 번역에서 실패하는 주요 원인, 특히 이해 능력, 입출력 사양, 구조적 불일치 처리 문제를 규명하고 분석하는 것.
- 피팅 튜닝 없이도 LLM 성능을 향상시킬 수 있는 통합형 프ompt 기반 프레임워크—UniTrans—를 설계하는 것.
- 다양한 LLM과 번역 설정에서 프레임워크를 평가하여 일반화 가능성과 실용적 유용성을 입증하는 것.
제안 방법
- UniTrans는 소스 코드를 활용해 대상 프로그램의 입력-출력 요구사항과 프로그램 동작을 인코딩함으로써 대상 프로그램용 테스트 케이스를 생성한다.
- LLM이 요구되는 입출력 유형과 프로그램 의미를 더 잘 이해할 수 있도록, 테스트 케이스 정보를 프롬프트에 통합하여 코드 번역을 증강한다.
- 생성된 테스트 케이스를 자동으로 실행하여 번역된 코드의 정확성을 평가한다.
- 테스트 케이스 실행 실패를 분석하여 잘못된 번역을 수리하며, 정밀화를 위해 선택적 반복 수리 루프를 제공한다.
- 모델에 종속되지 않는 설계를 하여, GPT-3.5, LLaMA-7B/13B/33B, CodeGen-6B 등 다양한 LLMs를 지원한다.
- 프롬프트 엔지니어링과 실행 피드백에 기반한 세 단계 파이프라인—테스트 케이스 생성, 번역 증강, 번역 수리—로 구성되어 있다.

실험 결과
연구 질문
- RQ1최신 기술 수준의 LLMs가 자동 코드 번역 작업에서 겪는 주요 실패 유형은 무엇인가?
- RQ2특정 작업에 맞는 피팅 튜닝 없이도 LLMs가 기존의 학습 기반 번역기보다 코드 번역에서 뛰어난 성능을 낼 수 있는가?
- RQ3테스트 케이스와 실행 피드백를 효과적으로 활용하여 LLM 기반 코드 번역을 향상시킬 수 있는가?
- RQ4통합형 프롬프트 기반 프레임워크가 다양한 프로그래밍 언어 쌍에서 다양한 LLMs를 얼마나 효과적으로 향상시킬 수 있는가?
- RQ5LLM을 활용한 일반 목적의 피팅 튜닝 없음 코드 번역 시스템을 구축하기 위한 핵심 설계 원칙은 무엇인가?
주요 결과
- GPT-3.5와 같은 LLMs는 현재의 학습 기반 번역기보다 코드 번역 정확도에서 뛰어나지만, 여전히 높은 실패율을 보인다.
- LLM에서 발생하는 주요 실패 원인은: 소스 프로그램 이해 부족(38.51%), 입출력 유형 지시어 누락(14.94%), 구조적 불일치 忽시(41.38%)이다.
- UniTrans는 모든 테스트된 LLM과 번역 설정에서 계산 정확도와 정확 일치 정확도를 향상시키며, GPT-3.5 및 LLaMA 모델에서 뚜렷한 향상이 관찰된다.
- 모델 피팅 튜닝 없이도 일관된 성능 향상을 달성하여 실용성과 확장성을 입증한다.
- UniTrans의 반복 수리 메커니즘은 복잡한 번역 시나리오에서 특히 번역 정확도를 향상시킨다.
- 오픈소스(LLaMA) 및 비공개소스(GPT-3.5) 모델을 포함한 다양한 LLM 패밀리와 크기에서 효과적이며, 그 보편성을 입증한다.

이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.