paper-with-me

홈 › Papers

Enhancing Code Translation in Language Models with Few-Shot Learning via Retrieval-Augmented Generation

2024-07-29 · Manish Bhattarai, Javier E. Santos, Shawn Jones, Ayan Biswas, Boian Alexandrov, Daniel O'Malley

The advent of large language models (LLMs) has significantly advanced the field of code translation, enabling automated translation between programming languages. However, these models often struggle with complex translation tasks due to inadequate contextual understanding. This paper introduces a novel approach that enhances code translation through Few-Shot Learning, augmented with retrieval-based techniques. By leveraging a repository of existing code translations, we dynamically retrieve the most relevant examples to guide the model in translating new code segments. Our method, based on Retrieval-Augmented Generation (RAG), substantially improves translation quality by providing contextual examples from which the model can learn in real-time. We selected RAG over traditional fine-tuning methods due to its ability to utilize existing codebases or a locally stored corpus of code, which allows for dynamic adaptation to diverse translation tasks without extensive retraining. Extensive experiments on diverse datasets with open LLM models such as Starcoder, Llama3-70B Instruct, CodeLlama-34B Instruct, Granite-34B Code Instruct, and Mixtral-8x22B, as well as commercial LLM models like GPT-3.5 Turbo and GPT-4o, demonstrate our approach's superiority over traditional zero-shot methods, especially in translating between Fortran and CPP. We also explored varying numbers of shots i.e. examples provided during inference, specifically 1, 2, and 3 shots and different embedding models for RAG, including Nomic-Embed, Starencoder, and CodeBERT, to assess the robustness and effectiveness of our approach.

📄 PDF Abstract BibTeX arXiv:2407.19619

Code (0)

등록된 구현이 없습니다.

Tasks

Code TranslationFew-Shot LearningRAGRetrievalRetrieval-augmented GenerationTranslation

Methods 이 논문이 사용한 방법론

Refunds@Expedia|||How do I get a full refund from Expedia? “How do I get a full refund from Expedia? How do I get a full refund from Expedia? – Call ☎️ +1-(888) 829 (0881) or +1-805-330-4056 or +1-805-330-4056 for Quick Help &…
15 Ways to Contact How can i speak to someone at Delta Airlines 설명 없음
Attention 설명 없음
Dropout Dropout is a regularization technique for neural networks that drops a unit (along with connections) at training time with a specified probability $p$ (a common value is…
WordPiece 설명 없음
Cosine Annealing Cosine Annealing is a type of learning rate schedule that has the effect of starting with a large learning rate that is relatively rapidly decreased to a minimum value before…
BART BART is a denoising autoencoder for pretraining sequence-to-sequence models. It is trained by (1) corrupting text…
Attention Dropout Attention Dropout is a type of dropout used in attention-based architectures, where elements are randomly dropped out of the…

Similar Papers 제목 키워드 기반

Enhancing E-commerce Product Title Translation with Retrieval-Augmented Generation and Large Language Models

2024-09-19 · Bryan Zhang, Taichi Nakatani, Stephan Walter

E-commerce stores enable multilingual product discovery which require accurate product title translation. Multilingual large language models (LLMs) have shown promising capacity to perform machine translation tasks, and …

Machine TranslationRAGRetrievalRetrieval-augmented Generation+1

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 외

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 retri…

Code GenerationCode TranslationContrastive LearningLanguage Modeling+5

CLIRudit: Cross-Lingual Information Retrieval of Scientific Documents

2025-04-22 · Francisco Valentini, Diego Kozlowski, Vincent Larivière

Cross-lingual information retrieval (CLIR) consists in finding relevant documents in a language that differs from the language of the queries. This paper presents CLIRudit, a new dataset created to evaluate cross-lingual…

BenchmarkingCross-Lingual Information RetrievalDocument TranslationInformation Retrieval+3

Enhancing Automatic Term Extraction with Large Language Models via Syntactic Retrieval

2025-06-26 · YongChan Chun, Minhyuk Kim, Dongjun Kim, Chanjun Park 외

Automatic Term Extraction (ATE) identifies domain-specific expressions that are crucial for downstream tasks such as machine translation and information retrieval. Although large language models (LLMs) have significantly…

Information RetrievalMachine TranslationRetrievalSemantic Similarity+3

A Komi-Yazva--Russian Parallel Corpus and Evaluation Protocol for Zero- and Few-Shot LLM Translation

2026-06-04 · Petr Parshakov arxiv

We present the first Komi-Yazva--Russian parallel corpus together with an explicit evaluation protocol for studying LLM translation in an endangered, extremely low-resource setting. The dataset contains 457 aligned sente…

Machine Translation