cs.AINov 6, 2026

Assessing the Impact of Retrieval-Augmented Generation on Algorithmic Problem-Solving

Authors: Gabriel Souza Baggio, Gabriel Machado Lunardi, Guilherme Medeiros Machado, Subhankar Maity, Faiza Belbachir, José Palazzo Moreira de Oliveira

Organizations: Federal University of Santa Maria, Roraima Avenue, 1000, Santa Maria, 97105-800, Rio Grande do Sul, Brazil · LyRIDS lab, ECE Engineering School, 10 Rue Sextius Michel, Paris, 75015, Île-de-France, France · Federal University of Rio Grande do Sul, Informatics Institute, Bento Gonçalves Avenue, 9500, Porto Alegre, 91501-970, Rio Grande do Sul, Brazil

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.

Figures & tables

Explore similar work

CardsList
  1. Solvita: Enhancing Large Language Models for Competitive Programming via Agentic Evolution

    May 14, 2026Han Li, Jinyu Tian, Rili Feng +10RL for Code GenerationContinual Learning for LLM Agents

  2. Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval

    Oct 1, 2026Nickil Maveli, Antonio Vergari, Shay B. CohenCode Generation EvaluationCode Generation Benchmarks

  3. Large Language Models for Programming: Actually Fixing or Reimplementing Incorrect Code?

    Sep 24, 2026Alexandru Stefan Stoica, Traian Rebedea, Marian Cristian MihaescuLLM EvaluationAutomated Program Repair