← All books

Book cover of RAG ENGINEERING by Faramarz Kowsari

RAG ENGINEERING

From First Principles to Production

Faramarz Kowsari · English · Artificial Intelligence & AI Engineering · 2026

Free Google Books Preview

Read a free sample of this book on Google Books before you buy.

About this book

RAG ENGINEERING: From First Principles to Production is a graduate-level engineering reference for building retrieval-augmented generation systems that can justify their answers with inspectable evidence. Rather than treating RAG as a prompt plus a vector database, the book begins with the source contract of the application: what information is authoritative, which user may access it, how freshness and supersession are represented, when the system should abstain, and what evidence must be preserved so a response can later be audited. The opening parts establish information-retrieval fundamentals, lexical baselines, corpus provenance, document parsing, chunking, hierarchy, embeddings, indexes and metadata before advancing to dense retrieval and approximate nearest-neighbor search.

The search architecture section develops a progression from sparse and dense retrieval to hybrid search, fusion, reranking and query adaptation, while keeping ranking quality separate from generation quality. Context assembly, grounded answer construction, citation support, abstention, multi-turn and temporal questions, multi-hop retrieval, structured outputs and tool-facing RAG are treated as distinct engineering problems with their own failure modes. The book repeatedly rejects the idea that retrieval automatically eliminates hallucination: an outdated, unauthorized or merely topical passage can be retrieved perfectly and still produce an operationally wrong answer.

Evaluation is treated as a first-class scientific discipline. Dedicated chapters cover benchmark design, dataset validity, retrieval metrics, grounded-answer and citation evaluation, ablation studies, significance, replication, continuous evaluation and quality monitoring. Advanced sections extend the architecture to hierarchical and long-document retrieval, GraphRAG, knowledge-graph retrieval, adaptive and corrective retrieval, agentic RAG, multimodal systems and domain-specific implementations. Throughout, the emphasis is on falsifiable comparisons, independently defined relevance judgments, held-out evaluation, reproducible artifacts and error analysis that can identify whether a failure belongs to parsing, retrieval, ranking, context packing, generation or citation.

The production sequence addresses security boundaries, permissions, privacy, indirect prompt injection, retrieval poisoning, cross-tenant leakage, latency, cost, capacity, deployment, versioning, RAGOps, rollback and reliability engineering. The capstone then asks the reader to design, benchmark and defend a complete RAG system with a rights-cleared corpus, versioned indexing code, lexical baseline, justified alternatives, qrels, retrieval and grounded-answer evaluation, safety tests, service interface, and cost/latency profile. Additional evidence-led laboratories, operational dossiers, vendor-documentation studies, failure-injection exercises and release gates reinforce the book's central standard: a production RAG claim should be traceable from immutable source evidence through retrieval and generation to an auditable answer, and it should be precise enough that another engineer can attempt to reproduce or falsify it.

What you will learn

Key topics

Who this book is for

For software architects, applied AI engineers, machine-learning engineers, retrieval engineers, master's students, researchers and technical teams who already know Python and basic statistics and want a rigorous bridge from RAG fundamentals to evaluation, security, deployment, observability and production operations.

Browse Books by Topic

Explore the library by subject and find related books faster.