A Retrieval-Augmented Generation Approach to Extracting Algorithmic Logic from Neural Networks
On the map: Retrieval-augmented generation → RAG pipeline design and evaluation
Abstract (arXiv)
Reusing existing neural-network components is central to research efficiency, yet discovering, extracting, and validating such modules across thousands of open-source repositories remains difficult. We introduce NN-RAG, a retrieval-augmented generation system that converts large, heterogeneous PyTorch codebases into a searchable and executable library of validated neural modules. Unlike conventional code search or clone-detection tools, NN-RAG performs scope-aware dependency resolution, import-preserving reconstruction, and validator-gated promotion -- ensuring that every retrieved block is scope-closed, compilable, and runnable. Applied to 19 major repositories, the pipeline extracted 1,289 candidate blocks, validated 941 (73.0%), and demonstrated that over 80% are structurally unique. Through multi-level de-duplication (exact, lexical, structural), we find that NN-RAG contributes the overwhelming majority of unique architectures to the LEMUR dataset, supplying approximately 72% of all novel network structures. Beyond quantity, NN-RAG uniquely enables cross-repository migration of architectural patterns, automatically identifying reusable modules in one project and regenerating them, dependency-complete, in another context. To our knowledge, no other open-source system provides this capability at scale. The framework's neutral specifications further allow optional integration with language models for synthesis or dataset registration without redistributing third-party code. Overall, NN-RAG transforms fragmented vision code into a reproducible, provenance-tracked substrate for algorithmic discovery, offering a first open-source solution that both quantifies and expands the diversity of executable neural architectures across repositories.
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Placed in RAG pipeline design and evaluation, one of 15 directions in Retrieval-augmented generation. Builds on 26 of its 84 references that are in the map. First posted on arXiv 3 Dec 2025.
Builds on
26 of 84 references.
References · 26
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2017mixup: Beyond Empirical Risk Minimizationcited by 5,183
- 2017Squeeze-and-Excitation Networkscited by 4,789
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2019CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Featurescited by 2,884
- 2019RandAugment: Practical automated data augmentation with a reduced search spacecited by 2,269
- 2016Identity Mappings in Deep Residual Networkscited by 1,965
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,737
- 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,601
- 2019MMDetection: Open MMLab Detection Toolbox and Benchmarkcited by 1,385
- 2016Deep Networks with Stochastic Depthcited by 979
- 2019Making Convolutional Networks Shift-Invariant Againcited by 391
14 more
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2020Improving Reproducibility in Machine Learning Research (A Report from the NeurIPS 2019 Reproducibility Program)cited by 322
- 2024SWE-bench Multimodal: Do AI Systems Generalize to Visual Software Domains?cited by 203
- 2022Do Users Write More Insecure Code with AI Assistants?cited by 192
- 2024SWE-Bench+: Enhanced Coding Benchmark for LLMscited by 99
- 2024CodeR: Issue Resolving with Multi-Agent and Task Graphscited by 91
- 2025Paper2Code: Automating Code Generation from Scientific Papers in Machine Learningcited by 70
- 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
- 2025GitTaskBench: A Benchmark for Code Agents Solving Real-World Tasks Through Code Repository Leveragingcited by 25
- 2025Optuna vs Code Llama: Are LLMs a New Paradigm for Hyperparameter Tuning?cited by 21
- 2025LEMUR Neural Network Dataset: Towards Seamless AutoMLcited by 20
- 2025Preparation of Fractal-Inspired Computational Architectures for Advanced Large Language Model Analysiscited by 11
- 2025AugmentGest: Can Random Data Cropping Augmentation Boost Gesture Recognition Performance?cited by 10
- 2021Manas: Mining Software Repositories to Assist AutoMLcited by 5
Built on by
Citing papers per year: 2025: 2; 2026: 9.
11 papers.
- 2025Enhancing LLM-Based Neural Network Generation: Few-Shot Prompting and Efficient Validation for Automated Architecture Designcited by 10
- 2026From Memorization to Creativity: LLM as a Designer of Novel Neural Architecturescited by 10
- 2025LLM as a Neural Architect: Controlled Generation of Image Captioning Models Under Strict API Contractscited by 9
- 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMscited by 7
- 2026Resource-Efficient Iterative LLM-Based NAS with Feedback Memorycited by 7
- 2026Closed-Loop LLM Discovery of Non-Standard Channel Priors in Vision Modelscited by 6
- 2026Delta-Based Neural Architecture Search: LLM Fine-Tuning via Code Diffscited by 3
- 2026LEMUR 2: Unlocking Neural Network Diversity for AIcited by 2
- 2026Systematic Exploration of 4-Expert Heterogeneous Mixture-of-Experts via Automated Pipeline Searchcited by 1
- 2026Towards Robust Training in NNGPT AutoML Pipeline: A Loss-Optimizer Pairing Selection Studycited by 0
- 2026Systematic Evaluation of Learning Rate Scheduling Strategies Across Heterogeneous Architecturescited by 0
- 2026Systematic Evaluation of Learning Rate Scheduling Strategies Across Heterogeneous Architectures9 Jul 2026
- 2026LEMUR 2: Unlocking Neural Network Diversity for AI7 Jul 2026
- 2026Systematic Exploration of 4-Expert Heterogeneous Mixture-of-Experts via Automated Pipeline Search21 Jun 2026
- 2026Towards Robust Training in NNGPT AutoML Pipeline: A Loss-Optimizer Pairing Selection Study18 Jun 2026
- 2026Delta-Based Neural Architecture Search: LLM Fine-Tuning via Code Diffs6 May 2026
- 2026Resource-Efficient Iterative LLM-Based NAS with Feedback Memory12 Mar 2026
- 2026Closed-Loop LLM Discovery of Non-Standard Channel Priors in Vision Models13 Jan 2026
- 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMs7 Jan 2026
- 2026From Memorization to Creativity: LLM as a Designer of Novel Neural Architectures6 Jan 2026
- 2025Enhancing LLM-Based Neural Network Generation: Few-Shot Prompting and Efficient Validation for Automated Architecture Design30 Dec 2025
- 2025LLM as a Neural Architect: Controlled Generation of Image Captioning Models Under Strict API Contracts7 Dec 2025
Similar, not cited
Close in wording, no citation either way
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2025RAG Without the Lag: Interactive Debugging for Retrieval-Augmented Generation Pipelines
- 2026NeSy-RAG: Neuro-Symbolic RAG for Explainable Question Answering
- 2025On The Reproducibility Limitations of RAG Systems
- 2024EVOR: Evolving Retrieval for Code Generation
- 2026LLM as a Tool, Not an Agent: Code-Mined Tree Transformations for Neural Architecture Search
- 2024Toward General Instruction-Following Alignment for Retrieval-Augmented Generation
- 2026Reason and Verify: A Framework for Faithful Retrieval-Augmented Generation