LLM Retrieval Augmented Generation
short alias lrag
The original version of the NN RAG project was created by Waleed Khalid at the Computer Vision Laboratory, University of Würzburg, Germany.
📖 Overview
A minimal Retrieval-Augmented Generation (RAG) pipeline for code and dataset details.
This project aims to provide LLMs with additional context from the internet or local repos,
then optionally fine-tune the LLM for specific tasks.
Requirements
- Python 3.8+ recommended
- Pip or Conda for installing dependencies
- (Optional) GPU with CUDA if you plan to do large-scale training
Installing Dependencies
- Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows
-
Latest Development Version
Install the latest version directly from GitHub:
pip install git+https://github.com/ABrain-One/nn-rag --upgrade
Usage
Command Line Interface
The package provides a command-line interface for extracting neural network blocks:
# Correct way to run (recommended)
python3 -m ab.rag --help
# Extract a specific block
python3 -m ab.rag --block ResNet
# Extract multiple blocks
python3 -m ab.rag --blocks ResNet VGG DenseNet
# Extract from JSON file (default)
python3 -m ab.rag
# Note: Avoid running 'python3 -m ab.rag.extract_blocks' as it may show warnings
Python API
from ab.rag import BlockExtractor, BlockValidator
# Initialize extractor
extractor = BlockExtractor()
# Warm up the index (clones repos and indexes if needed)
extractor.warm_index_once()
# Extract a single block
result = extractor.extract_single_block("ResNet")
# Extract multiple blocks
results = extractor.extract_multiple_blocks(["ResNet", "VGG"])
# Extract from JSON file (uses default nn_block_names.json)
results = extractor.extract_blocks_from_file()
# Extract with limit
results = extractor.extract_blocks_from_file(limit=10)
# Extract with custom JSON file
results = extractor.extract_blocks_from_file("custom_blocks.json")
# Extract with start_from parameter
results = extractor.extract_blocks_from_file(start_from="ResNet", limit=5)
Citation
If you find this pipeline to be useful for your research, please consider citing our articles for extraction of algorithmic logic and architecture design with LLMs:
@article{ABrain.NN-RAG,
title={A Retrieval-Augmented Generation Approach to Extracting Algorithmic Logic from Neural Networks},
author={Khalid, Waleed and Ignatov, Dmitry and Timofte, Radu},
journal={arXiv preprint},
volume = {arXiv:2512.04329},
url = {https://arxiv.org/pdf/2512.04329},
year={2025}
}
@article{ABrain.Architect,
title={From Memorization to Creativity: LLM as a Designer of Novel Neural-Architectures},
author={Khalid, Waleed and Ignatov, Dmitry and Timofte, Radu},
journal={arXiv preprint},
volume = {arXiv:2601.02997},
url = {https://arxiv.org/pdf/2601.02997},
year={2026}
}
The idea and leadership of Dr. Ignatov
Metadata
Release files for nn-rag 2.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nn_rag-2.2.4.tar.gz | 84.9 kB | Without provenance | Details for nn_rag-2.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nn_rag-2.2.4-py3-none-any.whl | Python 3 | none | any | Details for nn_rag-2.2.4-py3-none-any.whl |
Total release size: 180.5 kB
Release files / nn_rag-2.2.4.tar.gz
| Download URL | nn_rag-2.2.4.tar.gz |
|---|---|
| Size | 84.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c288b57c75d9131b086d692bda2ba2cdeb483db4a033356894cc71553d85aa01
|
|
BLAKE2b-256 checksum How to use checksums |
65fcea3ec62a44f9a60bdb58b90c46fad770db1f027975a54d907600c54174aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / nn_rag-2.2.4-py3-none-any.whl
| Download URL | nn_rag-2.2.4-py3-none-any.whl |
|---|---|
| Size | 95.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
181081439341316253174aaf5f18f7bb4a94398bb1c85826da87474382f18367
|
|
BLAKE2b-256 checksum How to use checksums |
764fabe7c100df979a9313199c09b12f1bac7640cdd2b52e7c0ce7a63bffc73e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for nn-rag 2.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.