Skip to content

About

CMU Advanced NLP Assignment 2: End-to-end NLP System Building

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

anlp-rag-implementation

CMU Advanced NLP Assignment 2: End-to-end NLP System Building

RAG System for Pittsburgh & CMU QA

This repository contains a Retrieval-Augmented Generation (RAG) system to answer questions about Pittsburgh and Carnegie Mellon University.

Project Structure

  • data/ - raw and processed data (HTML, PDFs, chunked JSONL, test set)
  • src/ - source code
    • crawler/ - scrapers and chunkers
    • retriever/ - BM25, dense, hybrid retrieval
    • reader/ - QA models and RAG pipeline
    • utils/ - helper functions
  • notebooks/ - optional exploratory notebooks
  • tests/ - unit tests
  • requirements.txt / environment.yml - dependencies

Setup

# Using pip
pip install -r requirements.txt

# Using conda
conda env create -n rag_env python=3.10
conda activate rag_env

Download Ollama

curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
ollama pull qwen2.5:32b
ollama pull llama3.2:3b

Install faiss

# CPU-only version
$ conda install -c pytorch faiss-cpu=1.12.0

# GPU(+CPU) version
$ conda install -c pytorch -c nvidia faiss-gpu=1.12.0

# GPU(+CPU) version with NVIDIA cuVS
$ conda install -c pytorch -c nvidia -c rapidsai -c conda-forge libnvjitlink faiss-gpu-cuvs=1.12.0

# GPU(+CPU) version using AMD ROCm not yet available

Chunk files

cd src/retriever/chunk.py
python chunk.py all_html5.json    # The chunk will be stored in the retriever folder

Start RAG

python rag.py
🔧 Building Dense index ...
🔁 Computing embeddings ...
⚡ FAISS index built with 61930 vectors (dim=768)
Dense meta + FAISS saved to src/retriever/indexes

About

CMU Advanced NLP Assignment 2: End-to-end NLP System Building

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages