paper-with-me

홈 › Papers

Enhancing Cross-Language Code Translation via Task-Specific Embedding Alignment in Retrieval-Augmented Generation

2024-12-06 · Manish Bhattarai, Minh Vu, Javier E. Santos, Ismael Boureima, Daniel O' Malley

We introduce a novel method to enhance cross-language code translation from Fortran to C++ by integrating task-specific embedding alignment into a Retrieval-Augmented Generation (RAG) framework. Unlike conventional retrieval approaches that utilize generic embeddings agnostic to the downstream task, our strategy aligns the retrieval model directly with the objective of maximizing translation quality, as quantified by the CodeBLEU metric. This alignment ensures that the embeddings are semantically and syntactically meaningful for the specific code translation task. Our methodology involves constructing a dataset of 25,000 Fortran code snippets sourced from Stack-V2 dataset and generating their corresponding C++ translations using the LLaMA 3.1-8B language model. We compute pairwise CodeBLEU scores between the generated translations and ground truth examples to capture fine-grained similarities. These scores serve as supervision signals in a contrastive learning framework, where we optimize the embedding model to retrieve Fortran-C++ pairs that are most beneficial for improving the language model's translation performance. By integrating these CodeBLEU-optimized embeddings into the RAG framework, our approach significantly enhances both retrieval accuracy and code generation quality over methods employing generic embeddings. On the HPC Fortran2C++ dataset, our method elevates the average CodeBLEU score from 0.64 to 0.73, achieving a 14% relative improvement. On the Numerical Recipes dataset, we observe an increase from 0.52 to 0.60, marking a 15% relative improvement. Importantly, these gains are realized without any fine-tuning of the language model, underscoring the efficiency and practicality of our approach.

📄 PDF Abstract BibTeX arXiv:2412.05159

Code (0)

등록된 구현이 없습니다.

Tasks

Code GenerationCode TranslationContrastive LearningLanguage ModelingLanguage ModellingRAGRetrievalRetrieval-augmented GenerationTranslation

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
BPE Byte Pair Encoding, or BPE, is a subword segmentation algorithm that encodes rare and unknown words as sequences of subword units. The intuition is that various word…
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Linear Warmup With Linear Decay Linear Warmup With Linear Decay is a learning rate schedule in which we increase the learning rate linearly for $n$ updates and then linearly decay afterwards.
Multi-Head Attention 설명 없음
Weight Decay 설명 없음
WordPiece 설명 없음

Similar Papers 제목 키워드 기반

DUAL-REFLECT: Enhancing Large Language Models for Reflective Translation through Dual Learning Feedback Mechanisms

2024-06-11 · Andong Chen, Lianzhang Lou, Kehai Chen, Xuefeng Bai 외

Recently, large language models (LLMs) enhanced by self-reflection have achieved promising performance on machine translation. The key idea is guiding LLMs to generate translation with human-like feedback. However, exist…

Machine TranslationTranslation

Investigating Decoder-only Large Language Models for Speech-to-text Translation

2024-07-03 · Chao-Wei Huang, Hui Lu, Hongyu Gong, Hirofumi Inaguma 외

Large language models (LLMs), known for their exceptional reasoning capabilities, generalizability, and fluency across diverse domains, present a promising avenue for enhancing speech-related tasks. In this paper, we foc…

Decoderparameter-efficient fine-tuningSpeech-to-TextSpeech-to-Text Translation+1

InterTrans: Leveraging Transitive Intermediate Translations to Enhance LLM-based Code Translation

2024-11-01 · Marcos Macedo, Yuan Tian, Pengyu Nie, Filipe R. Cogo 외

Code translation aims to convert a program from one programming language (PL) to another. This long-standing software engineering task is crucial for modernizing legacy systems, ensuring cross-platform compatibility, enh…

Code TranslationHumanEvalTranslation

Exploring the Impact of the Output Format on the Evaluation of Large Language Models for Code Translation

2024-03-25 · Marcos Macedo, Yuan Tian, Filipe R. Cogo, Bram Adams

Code translation between programming languages is a long-existing and critical task in software engineering, facilitating the modernization of legacy systems, ensuring cross-platform compatibility, and enhancing software…

Code TranslationPrompt EngineeringTranslation

LLaMAX2: Your Translation-Enhanced Model also Performs Well in Reasoning

2025-10-10 · Changjiang Gao, Zixian Huang, Jingyang Gong, Shujian Huang 외 arxiv

General Large Language Models (LLMs) excel in reasoning, but those enhanced for translation struggle with reasoning tasks. To address this, we propose a novel translationenhanced recipe that begins with instruct models a…