{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/arxiv-2604-24222","title":"Learning from Execution: Self-Evolving Memory for Private-Library Code Generation","arxiv_id":"2604.24222","date":"2026-04-27","proceeding":null,"authors":["Mofei Li","Taozhi Chen","Guowei Yang","Jia Li"],"abstract":"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.","url_abs":"https://arxiv.org/abs/2604.24222","url_pdf":"https://arxiv.org/pdf/2604.24222","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2604.24222","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2604.24222"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/THU-Agent/MEMCoder","reach":null}],"summary":{"ran":10},"by_repo_kind":{"found_in_text":{"samples":10,"ran":10,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":10,"samples":[{"code_sha256_prefix":"5e810a6e835adfd3","entry":"csv_arg","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"main_memcoder.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/main_memcoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5e810a6e835adfd3"}},{"code_sha256_prefix":"d02ebfbb8aeeeb41","entry":"csv_arg","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"baseline_rag/generate_api_retrievals.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/baseline_rag/generate_api_retrievals.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d02ebfbb8aeeeb41"}},{"code_sha256_prefix":"5dbfead948604b9a","entry":"ensure_inference_usage","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"agents/token_accounting.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/agents/token_accounting.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5dbfead948604b9a"}},{"code_sha256_prefix":"e53eba20f6405757","entry":"load_gold_docs","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"main_memcoder.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/main_memcoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e53eba20f6405757"}},{"code_sha256_prefix":"b2240fc5dd3775bf","entry":"model_label","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"main_memcoder_api.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/main_memcoder_api.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b2240fc5dd3775bf"}},{"code_sha256_prefix":"7ee503d9c35a86f0","entry":"parse_benchmark_specs","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"main_memcoder.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/main_memcoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7ee503d9c35a86f0"}},{"code_sha256_prefix":"1edf04e636a0e0bb","entry":"parse_benchmark_specs","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"main_memcoder_api.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/main_memcoder_api.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1edf04e636a0e0bb"}},{"code_sha256_prefix":"5a0da967c3c64879","entry":"parse_benchmark_specs","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"baseline_rag/generate_api_subtasks.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/baseline_rag/generate_api_subtasks.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5a0da967c3c64879"}},{"code_sha256_prefix":"a54b6050f196eff4","entry":"parse_path_specs","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"baseline_rag/generate_api_retrievals.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/baseline_rag/generate_api_retrievals.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a54b6050f196eff4"}},{"code_sha256_prefix":"9052fa53b55e233a","entry":"usage_from_response","repo":"THU-Agent/MEMCoder","repo_kind":"found_in_text","path":"agents/token_accounting.py","file_url":"https://github.com/THU-Agent/MEMCoder/blob/HEAD/agents/token_accounting.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9052fa53b55e233a"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.CL","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}