Skip to content

About

Retrieval-augmented generation engineering labs

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RAG Systems Lab

Fifteen focused Python projects for the engineering choices that shape retrieval-augmented systems. Every project is independently packaged under projects/, includes tests, has its own command, and documents the contract and limitations of its implementation. Model and hosted-service dependencies are injected; the checked-in fixtures run locally.

Project map

# Project Runnable focus
01 Chunking Stable IDs, token windows, overlap and source metadata
02 Embedding Models Adapter protocol, dimensions, normalization and cache scope
03 Vector Databases SQLite upsert, namespace isolation and cosine search
04 Metadata Filtering Allowlisted nested filter expressions
05 Query Rewriting Bounded conservative query variants
06 HyDE Hypothetical-document retrieval with an injected generator
07 Query Decomposition Bounded subquestions and per-part evidence
08 Hybrid Search Reciprocal-rank fusion of lexical and vector lists
09 Reranking Two-stage candidate scoring through an injected scorer
10 Small-to-Big Retrieval Child matching and parent-context expansion under budget
11 GraphRAG Explicit triple graph and bounded neighborhood traversal
12 Context Compression Extractive query-relevant sentence selection
13 Agentic RAG Bounded retrieve-observe-answer loop
14 Faithfulness Citation validity and lexical support diagnostics
15 Context Precision & Recall Precision@k and Recall@k against explicit gold IDs

Run the suite

Requires Python 3.11 or newer. From PowerShell:

py -3.11 -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -e ".[test]"
python -m pytest -q
python scripts\verify_projects.py

Root pytest runs the cross-project composition and repository artifact checks. The verifier runs each topic's tests and demo from that project's directory, using its standalone package. To explore one project by itself, install from its folder, for example:

Push-Location projects\hybrid_search
python -m pip install -e ".[test]"
rag-hybrid-search
python -m pytest
Pop-Location

Scope and evidence

These are educational engineering projects, not claims that one retrieval strategy is universally best. The hashing embedder is not semantic; the vector store is a small SQLite reference, not a production vector service; HyDE and reranking accept injected functions rather than calling hosted models; GraphRAG uses supplied triples rather than extracting entities; faithfulness uses lexical overlap rather than entailment. Each guide states what its tests establish and what requires a real provider, corpus, security design or evaluation set.

Every project includes an editable Mermaid diagram in architecture/overview.mmd. CI runs the project test suites and demo commands on Windows, macOS and Linux.

For cross-project architecture decisions and links to primary framework references, see Architecture and Evaluation Notes. The validation guide describes the limits of these local tests. Run python scripts\reference_pipeline.py to see a deterministic composition of chunking, fixture embeddings, SQLite search, metadata filtering, hybrid fusion, reranking and context compression.

Local corpus workflow

The editable examples in data/ use JSON Lines: one source document or benchmark query per line. Install the root package, then use its CLI:

python -m pip install -e ".[test]"
rag-workbench --config configs/local.toml index
rag-workbench --config configs/local.toml search --query "hybrid vector search" --filters-file data/sample_filter.json
rag-workbench --config configs/local.toml evaluate

The index and evaluation report are written under ignored build/. The command supports a file-backed SQLite index across invocations, exact configured metadata filters, and per-query/aggregate precision, recall, hit rate, reciprocal rank and NDCG. The fixture encoder remains non-semantic; swap in a real adapter and rebuild the index before interpreting quality results.

About

Retrieval-augmented generation engineering labs

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages