Part IV: Discovery Through Knowledge
Chapter 37: Retrieval Augmented Discovery Systems

Retrieval Augmented Discovery Systems

"I have read 47 million papers. I have understood none of them. But I can tell you which paragraph answers your question, and that turns out to be enough."

A Vector Database With Impostor Syndrome

Overview

Large language models know a great deal, but they do not know what they do not know. When a researcher asks about a specific protein interaction, a recent clinical trial, or a niche experimental protocol, the model must either retrieve the relevant evidence or confabulate an answer that sounds authoritative but is wrong. Retrieval Augmented Generation (RAG) solves this by grounding every generated response in retrieved documents, turning the language model from an unreliable oracle into a well-sourced research assistant.

This chapter builds RAG systems designed specifically for scientific discovery. We begin with the architecture (Section 37.1): the retriever that finds relevant passages, the reranker that sharpens relevance, and the generator that synthesizes a cited answer. We cover embedding models, vector databases (Qdrant, pgvector), cross-encoder rerankers, and the tradeoffs between long-context windows and retrieval-based approaches. Section 37.2 tackles the hardest problem in scientific RAG: ensuring that generated answers are faithful to their sources. We formalize hallucination taxonomies, build citation verification pipelines, and measure faithfulness with automated metrics. Finally, Section 37.3 assembles these components into a complete multi-hop research copilot that decomposes complex questions, retrieves evidence across a paper corpus, and produces cited, verifiable answers with faithfulness scores.

Prerequisites

This chapter assumes familiarity with Chapter 3 (Knowledge Representation), which introduced embeddings and similarity, and Chapter 36 (Literature Mining), which covered document parsing and information extraction from scientific text. You should be comfortable with Python, basic linear algebra (dot products, cosine similarity), and have an understanding of how language models generate text. Familiarity with the Anthropic API from Chapter 10 is helpful but not required; we introduce every API call from scratch.

What You Will Learn

Sections

What's Next

RAG grounds language model answers in retrieved documents, but documents are flat: they contain facts without explicit relationships. Chapter 38: Knowledge Graph Discovery introduces structured knowledge representations where entities and relationships form a navigable graph. The retrieval techniques from this chapter combine powerfully with knowledge graphs: you can retrieve candidate entities via embedding search, then traverse graph edges to find multi-hop connections that no single document contains. The faithfulness metrics we developed here will reappear when we validate claims extracted from graph traversals.

Bibliography

Foundational Papers

Lewis, P., Perez, E., Piktus, A., et al. (2020). "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks." NeurIPS.

The paper that introduced RAG as a paradigm, combining a pre-trained retriever (DPR) with a seq2seq generator and training them jointly.

Lala, R., Skreta, M., Bran, A. M., et al. (2024). "PaperQA2: An Agent for Retrieval-Augmented Generative AI with Verifiable Citations." arXiv:2312.07559.

Demonstrates a RAG agent that achieves superhuman performance on scientific question answering by combining retrieval, citation verification, and iterative refinement.

Karpukhin, V., Oguz, B., Min, S., et al. (2020). "Dense Passage Retrieval for Open-Domain Question Answering." EMNLP.

Introduced Dense Passage Retrieval (DPR), showing that learned dense representations outperform BM25 for open-domain QA retrieval.

Nogueira, R. & Cho, K. (2019). "Passage Re-ranking with BERT." arXiv:1901.04085.

Established cross-encoder reranking as the standard second stage in neural retrieval pipelines, improving precision dramatically over bi-encoder retrieval alone.

Retrieval and Evaluation

Gao, Y., Xiong, Y., Dibia, V., et al. (2024). "Retrieval-Augmented Generation for Large Language Models: A Survey." arXiv:2312.10997.

A comprehensive survey covering naive RAG, advanced RAG, and modular RAG architectures, with a taxonomy of retrieval, augmentation, and generation strategies.

Es, S., James, J., Espinosa-Anke, L., & Schockaert, S. (2024). "RAGAs: Automated Evaluation of Retrieval Augmented Generation." EACL.

Introduces the RAGAS framework for evaluating RAG pipelines along four dimensions: faithfulness, answer relevancy, context precision, and context recall.

Tools & Libraries

Qdrant (2021). Qdrant: Vector Search Engine.

A high-performance vector database with filtering, payload indexing, and hybrid search. Supports both in-memory and on-disk modes for corpora of any size.

pgvector (2021). Open-source vector similarity search for PostgreSQL.

Adds vector similarity search to PostgreSQL, allowing teams to store embeddings alongside relational data without a separate vector database.

Reimers, N. & Gurevych, I. (2019). Sentence-Transformers: Sentence Embeddings using Siamese BERT-Networks.

The standard library for computing dense text embeddings, with pre-trained models optimized for semantic search and clustering.

Anthropic (2024). Claude API Documentation.

Reference for the Claude API used in our generator stage, including structured output, citations, and tool use for research copilots.

Future House (2024). PaperQA2: RAG agent for scientific literature.

Open-source implementation of the PaperQA2 system, providing a complete pipeline for question answering over scientific papers with citation verification.

Hallucination and Faithfulness

Huang, L., Yu, W., Ma, W., et al. (2023). "A Survey on Hallucination in Large Language Models." arXiv:2311.05232.

Comprehensive taxonomy of hallucination types in LLMs, covering intrinsic vs. extrinsic hallucinations and their detection methods.

Min, S., Krishna, K., Lyu, X., et al. (2023). "FActScore: Fine-grained Atomic Evaluation of Factual Precision in Long Form Text Generation." EMNLP.

Introduces atomic fact decomposition and per-fact verification as a fine-grained alternative to coarse factuality scores.