tencent cloud

Tencent Cloud Agent Development Platform

Knowledge Graph GraphRAG

PDF
Focus Mode
Font Size
Last updated: 2026-04-10 14:41:23

What is GraphRAG?

GraphRAG is a Retrieval-Augmented Generation (RAG) solution that deeply integrates knowledge graphs with large language models (LLMs). It supports automatic extraction of entities, relationships, and attributes from unstructured documents to construct a structured knowledge Graph capable of reasoning and evolution. During question answering, it combines Graph-based relational reasoning with semantic search to provide more precise multi-hop reasoning answers for complex queries. Unlike traditional RAG approaches, GraphRAG organizes knowledge around entities, attributes, and relationships. This enables models to not only "locate relevant content" but also comprehend intrinsic connections between knowledge points. Consequently, it achieves deep understanding of complex knowledge in specific business scenarios, cross-document relational reasoning, and visual knowledge management and question answering.

Applicable Scenarios

GraphRAG is suitable for knowledge-intensive business scenarios requiring complex correlation analysis, multi-hop reasoning, and explainable question answering, including but not limited to:
Enterprise Knowledge Base Q&A
Suited for enterprise scenarios with large-scale documents and fragmented knowledge. By automatically constructing enterprise knowledge graphs, it enables cross-document, multi-entity relational reasoning and question answering, enhancing search and resolution efficiency for complex queries.
Insurance Product Advisory
Suited for advisory scenarios with complex insurance clauses and diverse matching relationships between products and demographics. By constructing an association graph for products-clauses-demographics-diseases, it supports multi-condition combined queries to provide clear, explainable policy recommendations.
Medical Knowledge Q&A
Suited for complex medical knowledge query scenarios. By constructing relationships between diseases, medications, and symptoms, it supports relational reasoning for complex queries such as drug interactions and treatment options.
Financial Risk Control Analysis
Suited for financial business scenarios with complex corporate relationships that require risk analysis. By constructing a graph of corporate, personnel, and transaction relationships, it supports multi-hop relationship queries, enabling rapid identification of potential associated risks.

Core Concepts Explained

GraphSchema

GraphSchema defines the core knowledge structure that needs to be identified and extracted for building a knowledge graph, comprising the following three types of knowledge elements:
Entity (Entity): Independently existent objects that serve as fundamental nodes in a knowledge graph, such as: persons, locations, items, organizations, and products.
Attribute (Attribute): Describe the characteristic information of entities, such as: a person's age, gender, etc. Attributes serve as supplementary descriptions of entities and do not directly form relationships with other attributes.
Relation (Relation): Used to describe relationships between entities, or between entities and their attributes, such as "belongs to", "is used for", "occurs in", etc.

Triple (Triple)

A triple is the most fundamental unit of expression in a knowledge graph, with the basic form: Entity A, Relation, Entity B/Attribute. Triples can be divided into two categories:
Relation Triple (Relation Triple): Used to represent the semantic relationship between two entities, with the basic form: entity, relation, entity, for example: Taiping Ai Shouhu 2021 Medical Insurance, used for, the insured.
Attribute Triple (Attribute Triple): Used to describe the attribute information of an entity, with the default relation being has_attribute. The basic form is: entity, has_attribute, attribute, for example: the insured, has_attribute, aged 20 to 40 years old.

Graph (Graph)

A Graph (Graph) is a visual representation of a set of triples, composed of nodes (Node) and edges (Edge). Nodes represent entities or attributes, while edges represent relationships between nodes, collectively forming a queryable and inferable knowledge network.

Directions

Knowledge Graph Construction

Go to the Knowledge Management page, click Import, and upload the required documents.



After the document status shows Import Completed, click Knowledge Graph to go to the Knowledge Graph page.



When first entering, the page is empty, and the top status bar shows Pending Generation. Click the button in the upper right corner of the page Generate Knowledge Graph to enter the setup process.



During the knowledge graph setup stage, first select the knowledge scope, which supports the following three scopes:
All Knowledge: All documents in the knowledge base undergo graph construction.
By specific knowledge: Select specific documents for graph construction.
By Tag: Select documents under specific tags.



During the Graph Schema setup stage, you can configure the graph structure in the following three ways:
Method 1: Use preset templates
Click Template, and the platform provides preset templates for multiple industries, allowing users to select according to their needs.



Click Add Extension, and the selected Schema template content will be automatically populated in the Graph Schema table.



Click Generate Knowledge Graph, and the system will pop up a confirmation window. After the user confirms, it will enter the build phase of the knowledge graph.



Method 2: Custom settings
Manually define entity, relationship, and attribute types:
Enter the entity types to be identified in Entity Type.
Define the relationship types between entities in Relationship Type.
Set the attribute dimensions of entities in Attribute Type.
Method 3: AI One-Click Extension
Based on the filled Graph Schema, click One-Click Extension, and the large model will combine the filled content with knowledge base document information to automatically reason and perform content extension.



Clicking Apply will update the existing Graph Schema content in the input box.



After the knowledge graph is set up, you can choose to click Save Settings Only to temporarily save the configuration items of the knowledge graph, or click Generate Knowledge Graph. After confirming the operation, you will enter the knowledge graph construction phase. The top status bar of the page will display Generating. The knowledge graph construction process may take a long time, and closing the page at this point will not affect the generation of the knowledge graph.


View Knowledge Graph

After the knowledge graph is built, you can view the overall statistics in the Graph Details section of the left sidebar. By clicking on entities, attributes, or relationships, you can quickly filter the knowledge graph.
Basic Info: Displays knowledge scope, document count, slice count, and Graph Schema configuration, and supports viewing and editing knowledge scope and Graph Schema.



Entity Types: Displays the total number of entities and their type distribution. Clicking on a specific entity type will highlight the corresponding entity nodes.



Attribute Type: Displays the total count and type distribution of attributes. Clicking on a specific attribute type will highlight entity nodes of the corresponding type.



Relationship Type: Displays the total count and type distribution of relationships. Clicking on a specific relationship type will highlight the corresponding relationship edges and the nodes at both ends.



In the knowledge graph canvas, the following operations are supported:
Click the search icon and enter entities, attributes, or relationships to search and locate.
Supports switching between grid view and list view.
Supports saving the current knowledge graph content as an image.
Grid View
List View


In graph view, entities, attributes, and relationships are distinguished by different colors. It supports operations such as zooming, panning, and node search, and allows exporting the current view as an image.
In list view, triple data is displayed in the form of a table, and keyword search is supported.
Clicking on a node or relationship edge in the knowledge graph will highlight the selected object and its associated content, and supports viewing detailed information in the right sidebar.
Entity Node Details
Attribute Node Details
Relationship Edge Details



Basic Info: Displays the entity name and entity type.
Attribute Types: Includes the attribute types and attribute contents.
Reference Source: Document names and slice content of knowledge sources.
Basic Info: Displays attribute names and attribute types.
Entity Types: Includes the entity type and entity name.
Reference Source: Document names and slice content of knowledge sources.
Basic Info: Relationship name and information of the connected nodes.
Reference Source: Document names and slice content of knowledge sources.

Knowledge Graph update

The system automatically detects changes in knowledge base and knowledge graph settings and prompts users to update.
Knowledge Base Update
When new documents are added to the knowledge base, the knowledge graph entry point on the Knowledge Management page displays a red dot reminder.



On the Knowledge Graph page, the top status bar displays a prompt: Knowledge Base has updates; please update the Knowledge Graph.

Click Update Knowledge Graph. After the user confirms the operation, the knowledge graph is updated, and the top operation status bar shows "Updating".



Demonstration of the Knowledge Graph effect after the update.



Knowledge Graph Configuration Update
In the basic information of the Graph Details, you can click Edit to modify the knowledge scope and Graph Schema.



After modification, you can directly click Update Graph to update the knowledge graph after confirmation, or choose to click Save Settings Only, in which case the system will save the knowledge graph settings without updating.



The top status bar now displays Pending Update.

Note:
When the knowledge scope changes:
When expanding the knowledge scope of the Knowledge Graph, the system will perform an incremental build based on the newly added documents, incurring corresponding Token consumption.
When documents are removed from the knowledge scope, the corresponding graph content (triple data) will be deleted and cannot be recovered.
If the graph is generated based on document tags, when a user modifies a document's tag so that it no longer falls within the current graph construction scope, this operation is equivalent to deleting the document, and its corresponding triples will be removed synchronously.
When performing document parsing intervention operations:
When documents are re-parsed or undergo segmentation intervention, the system will then delete the original corresponding triple data.
After clicking "Regenerate", the system will reconstruct the graph content corresponding to the document based on the latest parsing and segmentation results.
When Graph Schema changes:
Modifying the Graph Schema will affect the triple extraction logic.
The system will overwrite the existing graph results and perform a full rebuild. This process may incur significant Token consumption, so please proceed with caution.

Knowledge Base Retrieval and Q&A

Using the Standard mode application "Insurance Business Assistant" as an example to demonstrate Knowledge Graph retrieval Q&A.
After uploading the required documents and generating the Knowledge Graph on the Knowledge Management page, return to the application settings page. In the knowledge base search settings, turn on the Knowledge Graph Retrival toggle.



After performing Q&A, the reference sources in the application's response will display Knowledge Graph entries, allowing users to click and view the corresponding related content.

Note:
Enabling Knowledge Graph search allows the system to perform semantic retrieval using entities and relationship structures within the Knowledge Graph, but this may increase application response time.
Currently, only standard mode supports Knowledge Graph retrieval Q&A. Support for Knowledge Graph retrieval in workflow and Multi-Agent mode applications will be added in the future.

FAQs

What is the difference between GraphRAG and traditional RAG?

Traditional RAG: Documents are chunked and stored as vectors, with relevant segments retrieved through semantic similarity search. This approach is suited for simple factual question answering.
GraphRAG: Building upon traditional RAG, this approach incorporates a knowledge graph construction phase that extracts structured triples from documents, enabling more complex multi-hop reasoning Q&A.

How long does graph construction take?

Knowledge Graph construction time is determined by:
The number of documents and the total word count.
Schema complexity.
The model selected.
Generally, the initial construction may take a considerable amount of time, while subsequent incremental updates will be significantly faster.

How to optimize the effectiveness of Knowledge Graph construction

1. Curated Schema: Based on business scenarios, select appropriate pre-configured templates, or customize key entity and relationship types.
2. Control knowledge scope: Prioritize building core documents.
3. AI Extension: Utilize the AI one-click extension feature to automatically supplement missing entity and relationship types.
4. Iterative Optimization: Review the construction results and adjust the Schema configuration based on actual performance.

Whether it supports joint search across multiple knowledge base graphs

The current version performs graph construction and search based on a single knowledge base. If an application is associated with multiple knowledge bases, only those with completed graph construction support graph search.
Note:
Since knowledge graph construction consumes a significant amount of tokens, ensure that before use:
The documents have been uploaded and parsed for the knowledge base.
Select the appropriate knowledge scope based on business scenarios and configure a suitable Graph Schema.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback