---
title: "RAG and retrieval"
type: "topic"
url: "https://aifordevs.org/topics/rag"
markdown: "https://aifordevs.org/topics/rag.md"
publisher: "AI for Devs"
license: "https://aifordevs.org/reuse"
attribution: "Credit AI for Devs and link to https://aifordevs.org/topics/rag"
---

# RAG and retrieval

Giving a model the right documents at the right time. Chunking, embeddings, hybrid search, and how to tell whether retrieval is helping.

## Articles

- [RAG vs fine tuning: which failures each one can fix](https://aifordevs.org/articles/rag-vs-fine-tuning.md): RAG vs fine tuning compared by failure mode: what each changes, who still sells fine tuning, dated costs worked in code, and when to combine them. (2026-11-08)
- [What is a vector database? HNSW, IVF, and when to skip one](https://aifordevs.org/articles/what-is-a-vector-database.md): What is a vector database, how HNSW and IVF search work, recall measured on generated vectors, and when pgvector or no database is the right choice. (2026-11-08)
- [Context engineering: budget and order the context window](https://aifordevs.org/articles/context-engineering.md): Context engineering is choosing what a model reads on each call. Size each section, order it for prompt caching, trim inputs, and test every layout change. (2026-11-08)

## Glossary terms

- [Chunking](https://aifordevs.org/glossary/chunking.md): Chunking is splitting documents into smaller passages before you embed and index them for retrieval. Chunk size sets how much text a single retrieved passage can bring into the prompt.
- [Embedding](https://aifordevs.org/glossary/embedding.md): An embedding is a fixed-length vector of numbers that represents a piece of text, an image, or code, produced by an embedding model. Items with similar meaning end up close together, which is what vector search relies on.
- [HNSW](https://aifordevs.org/glossary/hnsw.md): HNSW (Hierarchical Navigable Small World) is a graph index for approximate nearest neighbor search that stacks proximity graphs, with fewer points in each higher layer. Queries start at the top layer and descend, which gives logarithmic scaling with dataset size.
- [Hybrid search](https://aifordevs.org/glossary/hybrid-search.md): Hybrid search combines keyword search, usually BM25, with vector search and merges the two ranked lists into one result. Keyword matching catches exact identifiers that embeddings miss, and vectors catch paraphrases that keywords miss.
- [RAG](https://aifordevs.org/glossary/rag.md): RAG (retrieval-augmented generation) is a technique that fetches relevant documents at request time and puts them in the prompt so the model answers from them. The term comes from Lewis et al. (2020).
- [Reranking](https://aifordevs.org/glossary/reranking.md): Reranking is a second retrieval pass that rescores a shortlist of candidates with a slower, more accurate model and keeps the best few. The first pass can favor recall because the reranker sets the final order.
- [Vector database](https://aifordevs.org/glossary/vector-database.md): A vector database is a database that indexes embeddings and returns the nearest neighbors to a query vector, usually with approximate search such as HNSW. It is a common retrieval layer in RAG systems.

## Platforms

- [pgvector](https://aifordevs.org/platforms/pgvector.md): Postgres extension for vector similarity search, so embeddings live next to your relational data.
- [Qdrant](https://aifordevs.org/platforms/qdrant.md): Vector database written in Rust, with payload filtering and a managed cloud option.
- [Weaviate](https://aifordevs.org/platforms/weaviate.md): Vector database with built-in hybrid search and modules for generating embeddings.
- [Chroma](https://aifordevs.org/platforms/chroma.md): Embedding database that runs in-process for prototypes and as a server or cloud service in production.
- [Milvus](https://aifordevs.org/platforms/milvus.md): Distributed vector database built for billions of vectors, with GPU-accelerated indexes.
- [Pinecone](https://aifordevs.org/platforms/pinecone.md): Managed serverless vector database with namespaces, metadata filtering, and hybrid search.
