mlsanityData to 14 Oct 2026

Learning from Execution: Self-Evolving Memory for Private-Library Code Generation

arXiv 2604.24222 ↗First posted 27 Apr 2026cs.SE cs.AI cs.CLcited by 2

On the map: Retrieval-augmented generation → RAG for code

also in 1 more
Abstract (arXiv)

Large Language Models (LLMs) have achieved strong performance on general code generation, but their effectiveness drops sharply in enterprise settings where software development relies on internal private libraries absent from public pre-training corpora. Existing Retrieval-Augmented Generation (RAG) methods provide a training-free solution by retrieving static API documentation, but our analysis shows that documentation mainly helps models identify what APIs to use and remains insufficient for teaching how to use them correctly. Even with oracle API-document retrieval, LLMs still make recurring errors at the API, cross-API, and task levels, including API misuse or hallucination, flawed API composition, and incorrect solution strategies. To address this limitation, we propose MEMCoder, a training-free self-evolving memory framework for private-library code generation. MEMCoder augments existing RAG pipelines with a Multi-level Evolving Memory that continuously accumulates and reuses execution-derived Usage Guidelines at the API, cross-API, and task levels. During generation, MEMCoder retrieves both static API documentation and relevant historical memories to guide code generation; after execution, it analyzes feedback to refine memory through a closed loop of generation, execution, reflection, and update. Extensive experiments on NdonnxEval and NumbaEval show that MEMCoder consistently enhances different RAG backbones across LLMs of different scales, yielding an average absolute pass@1 improvement of 18.41 percentage points. Moreover, MEMCoder outperforms existing self-evolving memory methods and validates the effectiveness of organizing execution feedback into multi-level usage memories.

Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 22 of its 27 references that are in the map. First posted on arXiv 27 Apr 2026.

Builds on

22 of 27 references.

References · 22

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
  3. 2025Qwen3 Technical Reportcited by 8,820
  4. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  5. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  6. 2024ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Toolscited by 1,121
  7. 2023An Empirical Study of Catastrophic Forgetting in Large Language Models During Continual Fine-tuningcited by 639
  8. 2022CodeT: Code Generation with Generated Testscited by 384
  9. 2025Dynamic Cheatsheet: Test-Time Learning with Adaptive Memorycited by 163
  10. 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
  11. 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
  12. 2023Structured Chain-of-Thought Prompting for Code Generationcited by 138
10 more
  1. 2025Evo-Memory: Benchmarking LLM Agent Test-time Learning with Self-Evolving Memorycited by 136
  2. 2024Revisiting Catastrophic Forgetting in Large Language Model Tuningcited by 99
  3. 2022When Language Model Meets Private Librarycited by 54
  4. 2023On the Effectiveness of Large Language Models in Domain-Specific Code Generationcited by 44
  5. 2025Exploring the Potential of Diffusion Large Language Models in Code Generationcited by 16
  6. 2024ExploraCoder: Advancing code generation for multiple unseen APIs via planning and chained explorationcited by 11
  7. 2023Private-Library-Oriented Code Generation with Large Language Modelscited by 10
  8. 2024Compositional API Recommendation for Library-Oriented Code Generationcited by 10
  9. 2025AI-Driven Self-Evolving Software: A Promising Path Toward Software Automationcited by 3
  10. 2026To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generationcited by 3

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 2.

2 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026When LLMs Lag Behind: Knowledge Conflicts from Evolving APIs in Code Generation
  2. 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches
  3. 2023SelfEvolve: A Code Evolution Framework via Large Language Models
  4. 2025Towards Mitigating API Hallucination in Code Generated by LLMs with Hierarchical Dependency Aware
  5. 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
  6. 2026Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generation
  7. 2024A Comprehensive Framework for Evaluating API-oriented Code Generation in Large Language Models
  8. 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?