Production RAG Pipeline
/Case StudyA production-grade Retrieval-Augmented Generation system that answers natural language questions about AI research papers with fully cited, grounded responses. Built to demonstrate the enterprise RAG pattern used in real-world document intelligence systems.
- Category
- RAG & Search
- Type
- ArXiv Research Assistant
- Core stack
- Python · FastAPI · Qdrant
- Status
- Live at production-rag-pipeline.vercel.app
A production-grade Retrieval-Augmented Generation system that answers natural language questions about AI research papers with fully cited, grounded responses.
/Architecture
- 50 ArXiv PDFs downloaded via the arxiv Python client, parsed with PyMuPDF, chunked into 646 overlapping 512-word segments with citation metadata per chunk (title, authors, published date, arXiv URL).
- BM25 keyword search (rank-bm25) and dense vector similarity (BAAI/bge-small-en-v1.5, 384-dim embeddings) run in parallel. Results fused with Reciprocal Rank Fusion (RRF).
- Qdrant Cloud (AWS us-east-1), cosine similarity, 646 vectors persisted and queryable over HTTP.
- cross-encoder/ms-marco-MiniLM-L-6-v2 re-scores top 20 hybrid candidates, returns top 5 chunks.
- GPT-4o with citation-enforcement prompt. Every claim references a numbered source; ungrounded answers are refused.
- RAGAs (Faithfulness, Context Recall) on a golden Q&A dataset. GitHub Actions CI gates every PR — regressions block merges.
/Stack
- Python · FastAPI · uvicorn
- rank-bm25 · sentence-transformers · Qdrant Cloud
- Hugging Face Transformers · cross-encoder/ms-marco-MiniLM-L-6-v2
- OpenAI GPT-4o
- RAGAs · pytest · GitHub Actions
- React · Vite · Tailwind CSS
- Railway (backend) · Vercel (frontend) · Qdrant Cloud
/Key engineering decisions
04 pointsHybrid over vector-only
Semantic search misses exact technical terms; BM25 catches model names and paper-specific terminology. RRF fuses both without score normalization.
Two-stage retrieval
Fast approximate search for recall, accurate cross-encoder for precision.
Citation enforcement over best-effort
Every claim tied to a retrieved chunk — auditable answers for enterprise deployment.
CI-gated evaluation
Automated RAGAs on every PR so retrieval tuning never silently degrades quality.