Knowledge graph
Definition
A structured representation of entities and the relationships between them, sometimes used alongside vector search to improve retrieval.
In more detail
Graph-based RAG approaches extract entities and relations from documents so questions that span many documents, or ask about connections, can be answered. Building and maintaining the graph adds significant work.
A knowledge graph stores facts as nodes and edges: "Acme Ltd" (company) -> "supplies" -> "Widget X" (product). A question such as "which suppliers of Widget X also had late deliveries last quarter?" needs several hops across documents, which plain vector search handles poorly because no single chunk holds the answer.
Most teams should start with ordinary retrieval and add a graph only when evals show multi-hop questions failing. The graph has to be kept in sync with its sources, and entity extraction by a model makes mistakes that then look like facts.
Related terms
GraphRAG
Retrieval-augmented generation that uses a knowledge graph of entities and relationships to connect related facts across many documents.
Hybrid search
Combining keyword search, such as BM25, with vector search and merging the results into one ranking, often with reciprocal rank fusion.
Retrieval-augmented generation (RAG)
Retrieving relevant documents and adding them to the prompt before the model generates an answer from them.
Vector database
A database designed to store embeddings and quickly find the nearest neighbours to a query vector, often with metadata filtering.
Read more about Knowledge graph
- Retrieval-augmented generation
Fetching relevant documents and adding them to a prompt to ground answers.
- RAG fundamentals: retrieval before generation
What RAG is and how retrieval-augmented generation works, when it beats long context or fine-tuning, and a minimal working pipeline in about 80 lines of Python.
- RAG vs long context vs fine-tuning: how to choose
What each approach changes, what it costs, where it fails, and a practical order to try them in before you commit to one.