RagReader Architecture & Performance Benchmark: Composable RAG Pipeline Deep Dive

Live web application screenshot and interface of RagReader - Composable RAG Benchmark & Research Workspace

RagReader Architecture & Performance Benchmark: Composable RAG Pipeline Deep Dive

Key Takeaways

  • Composable Pipeline: 13 advanced RAG modules (HyDE, RAG Fusion, RAPTOR, CRAG, Adaptive RAG, etc.) execute in a defined topological order, enabling reproducible pipeline composition.
  • Multi-LLM Benchmark Matrix: Compares Dense, Sparse, and Hybrid retrieval across any OpenRouter model (defaults: GPT-4o mini, Claude Haiku 4.5, Gemini 3 Flash) with configurable Top-K and live traces.
  • Production-Grade Topology: Django ASGI + Channels for real-time streaming, Celery + Redis for async ingestion/analysis, PostgreSQL for persistence, and Ollama cross-encoder reranking.

  • Rigorous Evaluation: Combines TREC-style RRF candidate pooling for ground truth with Precision@K/Recall@K/F1@K retrieval metrics and Ragas (Faithfulness, Relevance, Factual Correctness) for answer quality.
  • Cited, Streamed Answers: WebSocket/SSE streaming delivers answers with numbered citations resolving to document, page, character range, and passage text.
Live Project Access: https://rag.nevatal.id

Live web application screenshot and interface of RagReader - Composable RAG Benchmark & Research Workspace
Live web application interface of RagReader – Composable RAG Benchmark & Research Workspace (https://rag.nevatal.id)

The Engineering Challenge: Why RagReader Was Architected

Choosing a Retrieval-Augmented Generation (RAG) architecture by intuition leads to hallucinated answers, unpredictable latency, and inflated provider costs. While the industry standardized on basic Dense vs. Sparse vs. Hybrid retrieval comparisons, RagReader addresses a critical gap: quality depends equally on query transformation, routing, evidence refinement, and context construction.

Teams previously stitched together Jupyter notebooks or relied on closed SaaS benchmarks to evaluate advanced techniques like HyDE, RAPTOR, or CRAG. RagReader solves this by providing a self-hosted, composable RAG research workspace where engineers can assemble 13 distinct modules into ordered pipelines, run them against their own corpus, and measure results with industry-standard retrieval metrics and Ragas evaluation—all within a persistent, cited workspace.

Core Architecture & Technical Stack Deep-Dive

System Topology: Django ASGI, Celery, and Real-Time Streaming

The system follows a decoupled, service-oriented topology designed for long-running async workloads and real-time UX:

  • Frontend: React 18 + Vite + Tailwind CSS. Consumes REST, Server-Sent Events (SSE), and WebSockets via Django Channels.
  • API Gateway & Web Layer: Django ASGI (Daphne) with Django REST Framework. Exposes the Workspace API (documents, conversations, citations, auth) and the Deep-Analysis API. Django Channels powers /ws/analysis// for live STAGE_PROGRESS events during pipeline execution.
  • Async Workers: Celery + Redis (broker/result backend). Handles document ingestion (parsing, chunking, embedding) and Deep-Analysis batch jobs (retrieval, generation, evaluation) off the request path.
  • Data Layer: PostgreSQL (primary persistence for documents, chunks, conversations, jobs, ground truth, metrics). Pickled Index Files (FAISS/HNSW vectors + BM25 sparse indexes) stored on shared volume for low-latency retrieval.
  • Inference Layer: OpenRouter (primary LLM/Embedding gateway—any model ID runnable; defaults: GPT-4o mini, Claude Haiku 4.5, Gemini 3 Flash). Ollama (local cross-encoder reranker for Hybrid refinement).

Retrieval & Indexing Architecture

RagReader maintains dual-index strategy for Hybrid retrieval:

  • Dense Vector Index: Embeddings via OpenRouter (configurable model) stored in pickled FAISS/HNSW structures for ANN search.
  • Sparse Lexical Index: BM25 (Okapi BM25) indexes built per document/workspace for keyword matching.
  • Hybrid Fusion: Reciprocal Rank Fusion (RRF) merges Dense and Sparse candidate lists. This is the default “RRF Hybrid” module and the foundation for the Deep-Analysis matrix comparison.
  • Cross-Encoder Reranking: Optional Ollama-hosted cross-encoder re-scores top-N fused candidates for precision boost before generation.

The 13-Module Pipeline: Topological Execution Order

Modules are not merely a bag of tricks; they execute in a strict Directed Acyclic Graph (DAG) order, passing enriched context/state forward. The pipeline stages:

  1. Adaptive RAG: Classifies query complexity/route (simple lookup vs. multi-hop vs. summarization) to parameterize downstream modules.
  2. Query Transformation Layer: Rewrite-Retrieve-Read, Step Back Prompting, HyDE (Hypothetical Document Embeddings), RAG Fusion (multi-query generation + RRF), MemoRAG (memory-augmented rewrite).
  3. Retrieval & Fusion: RRF Hybrid (Dense+Sparse fusion), Self Route (decides retrieval strategy per sub-query).
  4. Long-Context & Hierarchical: LongRAG (long-chunk retrieval), RAPTOR (Recursive Abstractive Processing for Tree-Organized Retrieval—hierarchical clustering/summaries).
  5. Refinement & Verification: CRAG (Corrective RAG—web/search fallback on low confidence), FLARE (Forward-Looking Active Retrieval—iterative generate-retrieve), Contextual Learning (few-shot/context injection).
  6. Generation: Final LLM call with assembled context, streaming citations via WebSocket.

Every module is off by default; the Deep-Analysis UI allows toggling any subset per run, enabling ablation studies.

Key Features Breakdown & Practical Benefits

Persistent Research Workspace

  • Multi-Format Ingestion: PDF, DOCX, TXT, Markdown, Web URLs, Pasted text. Async Celery tasks with resumable embedding checkpoints (survives worker restarts).
  • Cross-Document Conversations: Chat sessions span multiple documents; context window management handled server-side.
  • Cited Streaming: Answers stream token-by-token with [1], [2] citations mapping to {doc_id, page, char_start, char_end, passage_text}.

Deep-Analysis Matrix: The Benchmarking Engine

  • Dimensions: Retrieval Method (Dense / Sparse / Hybrid) × LLM (Any OpenRouter ID) × Top-K × Temperature × Judge Model.
  • Live Traces: Per-stage module execution logs (latency, token counts, routing decisions, fallback triggers) streamed via WebSocket for debugging.
  • Replayable Results: Every analysis run persists configuration, traces, and metrics for historical comparison.

Automated Ground Truth & Evaluation Suite

  • TREC-Style RRF Pooling: Automatically constructs candidate pools from top-k results across multiple retrieval configurations, merges via RRF, presents top-N for human relevance labeling (or auto-label via LLM judge).
  • Retrieval Metrics: Precision@K, Recall@K, F1@K computed against ground truth chunks.
  • Answer Quality (Ragas): Faithfulness (hallucination check), Response Relevance, Factual Correctness (via Instructor-structured LLM judge).

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *