No history yet

Graphrag 基本概念

What is GraphRAG?

GraphRAG is a framework that enhances how large language models (LLMs) answer questions. It combines two powerful technologies: Knowledge Graphs (KGs) and Retrieval-Augmented Generation (RAG).

Think of a standard LLM as a very knowledgeable person who relies only on what they've learned up to a certain point. RAG gives that person a library card, allowing them to look up current information from a collection of documents before answering. This is a big improvement.

GraphRAG takes it a step further. It doesn't just give the LLM a library; it gives it a librarian who understands how every piece of information connects. This "librarian" is the knowledge graph, which maps out relationships between facts. By using this structured knowledge, GraphRAG helps the LLM find more precise information and understand the context behind it, leading to smarter and more accurate answers.

Graph-based RAG enhances structural reasoning by introducing explicit relational organization that enables information propagation across semantically connected text units.

The Components of GraphRAG

GraphRAG is built from a few key parts working together. Understanding each one helps clarify how the system functions.

Knowledge Graph

noun

A network of real-world entities (like people, places, and events) and the relationships between them. It represents information in a structured, machine-readable format.

The knowledge graph is the system's structured brain. Instead of just storing text, it stores facts as a web of connections. For example, it doesn't just know about "Paris" and "France"; it knows the relationship is "capital of."

Next is the Retrieval-Augmented Generation (RAG) system. This is the mechanism that fetches information. When you ask a question, the RAG component searches through its data sources—including the knowledge graph—to find relevant facts.

Finally, the Large Language Model (LLM) puts everything together. It takes your original question and the context provided by the RAG system and generates a clear, human-like answer. The LLM's strength is language, and the KG's strength is structured facts. GraphRAG combines them.

Its Role in Finding Information

In standard information retrieval, a system might find several documents that mention your keywords. It's then up to you or the LLM to piece together the answer from these scattered sources. This can be inefficient and sometimes misleading if the context is missing.

GraphRAG improves this process by retrieving structured information. Instead of just pulling text chunks, it can traverse the knowledge graph to find direct relationships between concepts. This means the information it provides to the LLM is not just relevant but also organized and contextually rich. It finds the needle in the haystack and also explains how that needle connects to everything around it.

By understanding relationships, GraphRAG can answer complex, multi-part questions that would stump systems relying on simple keyword retrieval.

For knowledge-based question answering, this is a game-changer. Consider the question, "What movies starring Tom Hanks were directed by Steven Spielberg?"

A standard RAG system would retrieve documents about Tom Hanks and documents about Steven Spielberg. The LLM would then have to sift through this information to find the overlap.

GraphRAG can directly query the knowledge graph for the intersection of two facts: (Tom Hanks, acted in, ?) and (Steven Spielberg, directed, ?). It retrieves a clean, precise list of movies, allowing the LLM to generate a perfect answer instantly. This ability to reason over structured data makes it incredibly powerful for answering questions that require connecting multiple dots.