Assessing the Impact of Retrieval-Augmented Generation on Algorithmic Problem-Solving
Gabriel Souza Baggio, Gabriel Machado Lunardi, Guilherme Medeiros Machado, Subhankar Maity, Faiza Belbachir, Jos\'e Palazzo Moreira de Oliveira
Key points
From the paper's conclusion- We conducted an evaluation using the CodeContests dataset, focusing on the test split problems that exhibit similarity to instances from the training split.
Abstract
Competitive programming problems pose distinctive challenges for Large Language Models, as they demand not only proficient code generation but also advanced algorithmic reasoning. This study presents a Retrieval-Augmented Generation approach specifically designed to enhance the capacity of Large Language Models to address such problems. Our approach integrates an embedding-based retrieval mechanism and a similarity search algorithm to identify analogous problems within a knowledge database, employing a dynamically adjusted threshold to mitigate retrieval noise. We conducted an evaluation using the CodeContests dataset, focusing on the test split problems that exhibit similarity to instances from the training split. The experimental framework considered three conditions: (i) problems provided solely with their original descriptions, (ii) problems supplemented with randomly selected examples from the training split, and (iii) problems augmented with similar examples retrieved through the proposed method. In addition, we incorporated a Min-K membership inference analysis to examine whether the generated code solutions were influenced by potential memorization of training data within the evaluated Large Language Models. This complementary perspective enables a deeper understanding of model behavior by distinguishing genuine generalization through retrieval from implicit recall of pretraining samples. Performance was assessed using both pass rates and the CodeForces Elo rating of the problems. The results provide empirical evidence that similarity-based retrieval substantially enhances Large Language Models performance in competitive programming scenarios, offering an scalable framework for improving code generation in algorithmic problem-solving contexts.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Large Language Models for Programming: Actually Fixing or Reimplementing Incorrect Code?arXiv · 2026
- InteractBench: Benchmarking LLMs on Competitive Programming under Unrevealed InformationarXiv · 2026
- Consensus Ensembles for Zero-Shot Algorithm Classification with Large Language ModelsElectronics · 2026
- DivAlgo: A systematic evaluation of algorithmic diversity for code generation modelsarXiv · 2026
- Large-Scale Comparison of Metaheuristic Algorithms via Behavioral Verification of Large Language Model-Generated CodesMathematics · 2026
- Analyzing Code Provenance in LLMs for Programming EducationarXiv · 2026