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

· Source: cs.SE updates on arXiv.org · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Expert, extended

Summary

MEMCoder is a novel framework addressing Large Language Models' (LLMs) poor performance in private-library code generation, where proprietary APIs are absent from public training data. Traditional Retrieval-Augmented Generation (RAG) with static API documentation proves insufficient, yielding only a 1.55% Pass@1 gain for Qwen2.5-Coder-7B-Instruct on NumbaEval. This limitation stems from LLMs lacking task-level API coordination and API-level parameter understanding. MEMCoder introduces a Multi-dimensional Evolving Memory that autonomously accumulates and refines "Usage Guidelines" across task-level and API-level dimensions. It employs dual-source retrieval, combining static documentation with these evolving guidelines, and operates in a closed loop using execution feedback to update memory. Evaluations on NdonnxEval and NumbaEval benchmarks demonstrate MEMCoder provides an average absolute Pass@1 gain of 16.31% over existing RAG systems and superior domain adaptation compared to continual learning methods. The computational overhead for NumbaEval's 187 tasks is about 17,111 tokens, costing approximately \$0.46.

Key takeaway

For AI Engineers deploying LLMs for private-library code generation, relying on static API documentation alone is insufficient. This will lead to poor performance. You should integrate a self-evolving memory system like MEMCoder. It autonomously distills and applies task-level coordination patterns and API-level usage guidelines from execution feedback. This approach significantly improves code correctness and adaptability. It prevents repetitive invocation errors and enhances practical efficacy.

Key insights

LLMs can autonomously learn private library usage patterns and API constraints from execution feedback via a multi-dimensional evolving memory.

Principles

Method

MEMCoder uses dual-source retrieval (docs + multi-dimensional memory) for code generation. It then refines and updates memory via execution feedback, guideline extraction, and dynamic weight adjustment.

In practice

Topics

Best for: Research Scientist, AI Scientist, Machine Learning Engineer, AI Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.