Pith. sign in

REVIEW 2 cited by

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

Not yet reviewed by Pith; the record is open.

This paper has not been read by Pith yet. Machine review is queued; the pith claim, tier, and objections will appear here once it completes.

SPECIMEN: schema-true, not a live event

T0 review · schema-true

One-sentence machine reading of the paper's core claim.

pith:XXXXXXXX · record.json · timestamp

arxiv 2407.19619 v1 pith:TV36JKRY submitted 2024-07-29 cs.AI cs.SE

classification cs.AIcs.SE
keywords codetranslationmodelsapproachexamplesinstructcontextualdiverse
verification ladder T0 review T1 audit T2 compute T3 formal
0 comments
read the original abstract

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.

Discussion (0). Continue with ORCID to comment.

Forward citations

Cited by 2 Pith papers

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score. Full citation record

  1. Performance Evaluation of General Purpose Large Language Models for Basic Linear Algebra Subprograms Code Generation

    cs.LG 2025-07 conditional novelty 5.0 of 10

    GPT-4.1 and o4-mini can generate correct plain BLAS C code for most of 20 routines from routine names alone, but optimized generations fail often and performance claims rest on best-of-10 selection with no error bars.

  2. Context-Aware Search and Retrieval Over Erasure Channels

    cs.IR 2025-07 conditional novelty 4.0 of 10

    A bivariate Gaussian approximation yields a formula for the retrieval error probability in two-document TF-IDF search over an erasure channel with repetition coding.

Pith tools