What are knowledge graphs and how do they enhance RAG systems?
Knowledge graphs represent information as entities and relationships in a graph structure, complementing vector-based RAG with structured relational data. In a RAG system, knowledge graphs enable multi-hop reasoning by traversing relationships between entities, precise entity-based retrieval that vector search alone might miss, contextual enrichment by providing related entities and their properties alongside retrieved text, and disambiguation by using entity relationships to resolve queries about entities with similar names. Implementation involves extracting entities and relationships from documents during indexing, storing them in a graph database like Neo4j, and querying the graph alongside the vector store at retrieval time. GraphRAG from Microsoft uses LLMs to automatically build knowledge graphs from text and generates community summaries for global query answering. The combination of vector search for semantic matching and graph traversal for relational reasoning produces more comprehensive and accurate RAG responses.