arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.04329cs.CVcs.SE
收藏

一种基于检索增强生成的方法用于从神经网络中提取算法逻辑

A Retrieval-Augmented Generation Approach to Extracting Algorithmic Logic from Neural Networks

Computer Vision Lab, CAIDAS, University of Würzburg, Germany(计算机视觉实验室,CAIDAS,乌尔姆大学,德国)

Waleed Khalid, Dmitry Ignatov, Radu Timofte

AI总结:

本文提出NN-RAG方法,通过检索增强生成技术从神经网络代码库中提取并验证模块,实现了跨仓库的架构迁移与重复检测,提升了神经网络架构的可复现性和多样性。

摘要:

重用现有神经网络组件对研究效率至关重要,但发现、提取和验证这些模块仍面临困难。我们引入NN-RAG,一种检索增强生成系统,将大规模异构PyTorch代码库转换为可搜索和执行的验证神经模块库。与传统代码搜索或克隆检测工具不同,NN-RAG执行范围感知的依赖解析、保留导入的重建以及验证门控提升,确保每个检索块都是范围封闭、可编译和可运行的。应用于19个主要仓库,流程提取了1,289个候选块,验证了941个(73.0%),并证明超过80%的块在结构上是唯一的。通过多层次去重(精确、词汇、结构),我们发现NN-RAG为LEMUR数据集贡献了绝大多数独特的架构,提供了约72%的所有新网络结构。除了数量,NN-RAG独特地使跨仓库的架构迁移成为可能,自动在一个项目中识别可重用的模块并在另一个上下文中重新生成,依赖完整。据我们所知,没有其他开源系统能以这种规模提供这种能力。框架的中性规范进一步允许可选地与语言模型集成,用于合成或数据集注册,而无需重新分发第三方代码。总体而言,NN-RAG将碎片化的视觉代码转化为可复现、可追溯的子基质,为算法发现提供了一个首个开源解决方案,既量化又扩展了跨仓库的可执行神经架构的多样性。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑