Skip to main content

LLM Retrieval Augmented Generation

GitHub release
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

  1. Create and activate a virtual environment (recommended):
    python -m venv venv
    source venv/bin/activate   # Linux/Mac
    venv\Scripts\activate      # Windows
    
  2. 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 lrag 2.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lrag 2.2.4
File Size Uploaded
lrag-2.2.4.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lrag 2.2.4
File Interpreter ABI Platform
lrag-2.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / lrag-2.2.4.tar.gz

Download URL lrag-2.2.4.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3732bba656f57d240ec4091274385ce6c44fd13c46ef01efc0faef97f5d9b150
BLAKE2b-256 checksum
How to use checksums
a1af2fc136a4ffbeaeaeb93837a0847852475df2ce54c9f9537810b023011b20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / lrag-2.2.4-py3-none-any.whl

Download URL lrag-2.2.4-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4820f48ef81f0980f7d51ba6a6aff9782f1cc369da742007e140aa4e06aaa03
BLAKE2b-256 checksum
How to use checksums
8d8a0b29ad2998aa234f5db70ab56c1c45a9e3ec492af1e57cd59e4c95fcf30f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

2.2.4 This release

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.0.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page