Releases: UBC-MDS/amazon_books_chat_rag_llm_system
Releases · UBC-MDS/amazon_books_chat_rag_llm_system
v0.3.0
v0.3.0: Final Submission
Final submission for DSCI 575. Scales the pipeline from the Milestone 2 state, adds an LLM comparison, and completes documentation and cloud-deployment planning.
Highlights
- Scale (Option 3): pipeline now samples 120,000 reviews and builds a 110,167-document corpus after preprocessing. BM25 and FAISS indexes rebuilt against the larger corpus.
- LLM experiment: LLaMA 3.3 70B vs LLaMA 3.1 8B on 5 queries with identical retrieval context and the same
BALANCEDprompt. LLaMA 3.3 70B selected as the default based on completeness, grounding, and filtering of off-topic retrievals. - App: Streamlit app (
app/app.py) supports BM25, Semantic, Hybrid, and RAG modes over the full corpus, with a Groq model fallback chain for resilience. - Cloud deployment plan: S3 for storage, Elastic Beanstalk for compute, Groq managed API for inference, EventBridge + AWS Batch for nightly re-indexing. Architecture diagram and justification in
results/final_discussion.md.
Docs and code quality
- README updated for the scaled pipeline, new active-retriever note, demo, and runtime/disk footprint.
- All public functions and classes in
src/have docstrings. - No hardcoded paths, no API keys in source.
environment.ymltrimmed of unused packages.
Where to look
results/final_discussion.md: full write-up: scaling, LLM comparison, cloud plan.notebooks/08_llm_comparison.ipynb: side-by-side LLM outputs.app/app.py: Streamlit app.
v0.2.0
This release adds a full Retrieval-Augmented Generation (RAG) pipeline over the Amazon Books dataset.
New features
- RAG pipeline (src/rag_pipeline.py): chains hybrid retrieval, context building, prompt formatting, and LLM generation into a single invoke() call
- Hybrid retriever (src/hybrid.py): combines BM25 and semantic search using round-robin interleaving, returning results with their source (BM25, Semantic, or BM25 + Semantic)
- LLM integration: Groq API with LLaMA 3.2 90B and automatic model fallback; SimpleLLM placeholder for demo mode
- Prompt templates (src/prompts.py): Balanced and Strict variants, selectable in the app
- Document chunker (src/chunking.py): 500-char chunks with 50-char overlap for long reviews
- Updated Streamlit app: four tabs (BM25, Semantic, Hybrid, RAG); RAG tab shows generated answer above source documents
Notebooks
- notebooks/06_hybrid_retrieval.ipynb: hybrid retrieval with auto-generation of src/hybrid.py
- notebooks/07_rag_pipeline.ipynb: full RAG pipeline with evaluation on 10 queries
Evaluation
- Qualitative evaluation of 5 queries (Easy / Medium / Complex) documented in results/milestone2_discussion.md.
v0.1.0
Milestone 1: Dual-Method Retrieval System
What's Included
- BM25 Keyword Search: Fast, exact-match retrieval with consistent tokenization
- Semantic Search: Embedding-based retrieval using all-MiniLM-L6-v2 + FAISS (IndexFlatL2)
- Hybrid Search: Combined BM25 + Semantic with adjustable weights
- Web App: Streamlit interface with query input, method selection, results display
- Evaluation: 10 diverse queries (4 Easy, 3 Medium, 3 Complex) with detailed comparisons
- Complete Documentation: Comprehensive README, data processing pipeline, preprocessing steps
Key Features
- Consistent text preprocessing (lowercase, remove punctuation, normalize whitespace)
- Top-5 results with titles, review previews, ratings, scores
- 2800 word README with full reproducibility instructions
- Professional evaluation with strengths/weaknesses analysis
- BM25 query speed under 10ms, Semantic search around 100ms
Files
- src/bm25.py - BM25Retriever class
- src/semantic.py - SemanticRetriever class
- src/utils.py - Preprocessing and tokenization
- notebooks/01_exploration.ipynb - Data exploration
- notebooks/02-05 - Data processing and indexing
- app/app.py - Streamlit application
- results/milestone1_discussion.md - Evaluation with 10 queries and 5 detailed comparisons