LLMOps · Module 03
Experiment Comparison: Naive, Graph, Hybrid
Compare RAG architectures the way an experiment should be run: one dataset, fixed metrics, controlled setups, then a recommendation based on quality, cost and latency.
Học xong bạn làm được
- Design a fair experiment across RAG architectures
- Build an evaluation dataset
- Run naive, advanced, graph and hybrid setups under the same conditions
- Analyse quality, cost and latency and recommend one
Bài học
- Experimental design
The module compares RAG architectures in a controlled experiment. Four research questions frame it - GraphRAG against Naive RAG on multi-hop queries, the best hybrid, when to use each architecture, and the quality-cost-latency trade-off - and four systems are compared - Naive RAG, Advanced RAG, GraphRAG and a Hybrid of graph and advanced retrieval.
- Architectures: Naive and Advanced RAG
Naive RAG chunks, embeds and stores documents, embeds the query, searches and generates - simple, fast and cheap, but blind to relationships and multi-hop questions. Advanced RAG adds semantic chunking, HNSW, hybrid vector plus BM25 search, HyDE, cross-encoder reranking and MMR - better and more precise retrieval at the price of complexity, latency and cost.
- Architectures: GraphRAG and the Hybrid system
GraphRAG extracts entities and relations into a knowledge graph, detects the entities in a query and traverses the graph - explicit relationships and multi-hop reasoning, but a hard schema, extraction quality and graph maintenance. The Hybrid system indexes in vector and graph form, routes each query and fuses the results - the best quality and flexibility, at the highest complexity, cost and maintenance.
- Evaluation dataset and metrics
The experiment uses a synthetic dataset of 100 computer-science papers and 200 questions - 40% factual, 30% relational, 20% multi-hop, 10% analytical - with expert-annotated answers and source references, split 20 for tuning and 180 held out. It measures retrieval (context precision and recall, latency, API calls), generation (faithfulness, answer relevance and correctness, time to first token), cost and user-centric metrics.
- Experimental setup and running the experiments
An ExperimentRunner holds the four systems behind one interface and evaluates each on the same dataset. The evaluation runs every question through a system, collects question, answer, contexts and ground truth, scores them with RAGAS and adds latency and cost. Running the experiment means setting up the systems, preparing the dataset, evaluating, saving traces and testing whether differences are real.
- Results and recommendations
Hybrid gave the best quality at the highest price, Naive the best cost-efficiency on simple tasks, Graph the best multi-hop recall, and Advanced the balanced, pragmatic choice. By query type, graphs shine on relational and multi-hop questions and everything struggles with analytical ones. Advanced RAG is the default for production; GraphRAG only for strongly relational needs.
- Assignment: RAG Architecture Experiment Comparison
RAG Architecture Experiment Comparison