Large model prompt design method for social governance knowledge graph construction based on CoT chain thinking
By introducing a large-scale model prompt design method of CoT chain thinking in the construction of knowledge graph, the problems of inefficiency, insufficient flexibility and model illusion of traditional methods are solved, and efficient and flexible social governance data extraction and knowledge graph construction are achieved.
Patent Information
- Application Number
- CN202510398928.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-04-01
AI Technical Summary
Traditional knowledge graph construction methods are inefficient, lack of flexibility, strong domain knowledge dependence, and are prone to model hallucinations, making it difficult to adapt to complex and diverse social governance data.
A large-scale model prompt design method based on CoT chain thinking is adopted, and by decomposing complex tasks into logically coherent substeps, high-precision prompt templates are dynamically generated to realize the automated extraction and structure of entities, relationships and attributes in social governance data.
It significantly reduces the cost of manual intervention, improves the flexibility of templates and scene adaptability, effectively alleviates the problem of model hallucinations, and provides innovative solutions for the efficient construction of knowledge graphs.
Smart Images

Figure CN119918677A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and specifically relates to a large model prompt design method based on CoT chain thinking, which is used to automatically construct a knowledge graph quintuple knowledge containing entity categories from social governance data. Background Art
[0002] With the rapid development of artificial intelligence technology, knowledge graphs, as an important tool for structured knowledge representation, play a key role in social governance, policy analysis, and decision support. Traditional knowledge graph construction methods usually rely on manual annotation and rule design, especially in the triple extraction stage, which requires experts to pre-define entity types, relationship patterns, and templates to guide the training and reasoning of information extraction models. For example, in political and legal data, manually designed templates may include fixed fields such as case name, participants, time, and legal terms. However, this method has the following significant defects: (1) Inefficiency: Manually designing templates requires a lot of time and professional resources, especially when faced with large-scale, multi-source and heterogeneous social governance data, and it is difficult to quickly adapt to different scenarios and task requirements. For example, the entities and relationships of marriage and family disputes and labor disputes are significantly different, and templates need to be designed separately, resulting in a long development cycle and high costs.
[0003] (2) Lack of flexibility and adaptability: Static templates are difficult to cover the complex semantic relationships and dynamic changes in data. For example, emerging dispute types or implicit information in unstructured text may exceed the scope of preset templates, resulting in omissions or errors in information extraction.
[0004] (3) Strong reliance on domain knowledge: Traditional methods are highly dependent on the experience of domain experts. In cross-domain or segmented scenarios (such as neighborhood disputes in grassroots social governance), the generalization ability of templates is limited, making it difficult to achieve large-scale application.
[0005] (4) Model hallucination problem: Although the information extraction method based on pre-trained language models can partially alleviate human intervention, it is easy to produce "hallucination" output that is unrelated to the original text in the absence of high-quality template guidance, affecting the accuracy of triples.
[0006] In recent years, researchers have tried to optimize the knowledge graph construction process through automated template generation technology. For example, using rule engines or machine learning models to dynamically generate templates, but these methods still have problems such as unstable quality of generated templates and weak context adaptation capabilities. In addition, existing technologies pay less attention to how to guide large models to accurately understand complex requirements through task decomposition and chain-of-thought (CoT), resulting in insufficient guidance and controllability of templates.
[0007] In response to the above problems, the present invention proposes a large model prompt design method based on CoT chain thinking. By decomposing complex tasks into logically coherent sub-steps and combining the contextual understanding ability of the large model, high-precision prompt templates are dynamically generated to achieve the automatic extraction and structuring of entities, relationships and attributes in social governance data. Compared with traditional methods, the present invention significantly reduces the cost of manual intervention, improves the flexibility and scenario adaptability of the template, and effectively alleviates the model illusion problem, providing an innovative solution for the efficient construction of knowledge graphs. Summary of the invention
[0008] In order to improve the accuracy and efficiency of extracting information from social governance data through the automatic generation and optimization of big model prompt templates, the present invention proposes a big model prompt design method based on the construction of social governance knowledge graph based on CoT chain thinking, including the following steps: (1) Step 1: Data preprocessing First, collect a large amount of text data and metadata (such as source, release time, classification label, etc.) from the government public information center or other social governance-related platforms. Data cleaning, denoising, formatting and structuring are the key to this step. Data cleaning includes removing invalid and redundant data, correcting errors and repeated information in the text. Formatting ensures that all data conforms to unified standards and encoding methods, providing high-quality, standardized data sets for subsequent large model input.
[0009] (2) Step 2: Design of expected output In this step, the output format is designed to meet the different requirements of the data layer, event layer, and logic layer. The structure of the model output is determined by defining the "five-tuple" (entity-entity category-relationship-entity-entity category) format. This step includes clarifying the task requirements for the construction of the data layer, event layer, and logic layer, defining the entity categories and relationship types required for each layer, and designing corresponding output templates for each layer.
[0010] (3) Step 3: Prompt template generation Using CoT chain thinking, we first divide the knowledge graph construction task, and then design the first part of the prompt template: "Task description-Entity to be extracted-Relationship to be extracted-Designed expected output template"; secondly, in order to further enable the big model to understand the task, a restrictive text is used to promote the big model's processing to be more accurate; finally, high-quality example output is used to help the big model understand the reasoning process from text to five-tuples and reduce the risk of the model producing "hallucination" output. The prompt template is composed of the above three parts, and the specific details are dynamically adjusted according to the needs of each level of tasks to guide the big model on how to accurately extract key information.
[0011] (4) Step 4: Knowledge Graph Construction According to the generated prompt template, the big model automatically extracts key information from the social governance text and generates structured quintuples in this step. These quintuples are composed of entity, relationship, and entity category information, which conform to the knowledge graph standard. By automatically filling in this information, it ensures that useful structured data is extracted from the text data, and further builds a complete social governance knowledge graph.
[0012] (5) Step 5: Optimization and Feedback After generating the quintuple, the result optimization and feedback phase begins. According to the evaluation results, the prompt template is adjusted to further optimize the model's generation output. Through continuous feedback, optimization and adjustment of the prompt template, the large model can better adapt to the subsequent social governance data analysis needs and continuously improve the quality and accuracy of triple construction.
[0013] Compared with the prior art, the beneficial effects of the present invention are: by introducing CoT chain thinking, the present invention can help large models better understand and extract key information, effectively alleviate the illusion problem and the limitations of domain knowledge; a variety of five-tuple output templates are designed according to different social governance scenarios to ensure that the generated triples can meet various application requirements; through continuous result evaluation and feedback mechanism, the processing capabilities of prompt templates and large models are continuously optimized to ensure that the model output always maintains a high level of accuracy and quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0016] like Figure 1 As shown, the large model prompt design method for constructing a social governance knowledge graph based on CoT chain thinking proposed in the present invention can efficiently and intelligently extract key information from text data in the field of social governance and construct a more complete knowledge graph through the implementation of the following steps. The implementation method includes multiple steps such as data preprocessing, expected output design, prompt template generation, knowledge graph construction, optimization and feedback, and each step can be adjusted and optimized according to task requirements. The following is the implementation method of each step.
[0017] (1) Step 1: Data preprocessing, This step includes three main parts: data cleaning, formatting and structuring: a. Data cleaning: Data is collected from government public information platforms or other social governance-related databases. The data is first cleaned to remove invalid, redundant or incomplete records. For erroneous data, rule-based algorithms or manual annotations are used to correct them. All duplicate information is removed, and spelling errors and grammatical problems in the text are corrected.
[0018] b. Data formatting: Ensure that all data fields are in a unified format, such as date, time, location, person name, etc. Data fields are standardized before being input into the model to ensure that all text content, metadata, etc. meet the preset format requirements and provide consistent and standardized data input for the model.
[0019] c. Data structuring: By extracting key information from the text, the data is converted into a structured format, such as mapping the participants, time, location and other information in the case into structured data. Invalid or incomplete records are marked or removed to ensure that the final data set can meet the input requirements of subsequent models.
[0020] (2) Step 2: Design of expected output, This step designs the expected output format to meet the needs of different application scenarios. The implementation method is as follows: a. Entity and relationship definition: First, define the key information entities in the social governance scenario and the relationships between them. For the construction of the data layer, entities include people, time, place, case type, etc. Each entity also needs to be clearly labeled with its category, and the relationship is the connection between these entities. For example, "Wang A"-"Father"-"Li B". For the construction of the event layer, entities refer to specific events in the text data, and relationships are the relationships between events, such as: cause-effect relationships, sequential relationships, etc. For the construction of the matter layer, entities are events abstracted from specific events identified in the text, and relationships are the relationships between abstracted small events, such as: explanation relationships, cause-effect relationships, etc.
[0021] b. Output quintuple format design: According to the task requirements, multiple output templates are designed. For example, for marriage and family dispute cases, a five-tuple template of event data can be designed: "(Wang A, person, marriage relationship, Li B, person)". For the mediation process of the case, a five-tuple of mediation results can be designed: "(case, mediation result, Li B pays 1,000 yuan in alimony per month, mediation result)"; for the five-tuple at the event level, the output format is designed as (Wang A and Li B divorce, event, causal relationship, Li B pays 1,000 yuan in alimony per month, event); for the five-tuple at the principle level, the output format is designed as (divorce, event, causal relationship, lawsuit, event).
[0022] c. Output template: At this stage, the system applies the output templates to different social governance scenarios to ensure that the generated quintuples meet expectations. For each application scenario, a specific set of templates can be designed to ensure that different types of case data can be covered.
[0023] (3) Step 3: Prompt template generation This step is the core step of the whole method. CoT chain thinking is used to design and generate effective prompt templates. The implementation method is as follows: a. Task decomposition: clarify task requirements and reasoning steps The first step of CoT chain thinking is task decomposition, which helps the large model to reason step by step by splitting a complex task into multiple small subtasks, ensuring that each link can be processed with high quality.
[0024] First, clarify what tasks the model needs to complete. For example, when constructing a data layer knowledge graph for marriage and family dispute cases in social governance, the task requirement is: "Please generate a five-tuple containing event title, event category, occurrence time, source method, applicant, respondent, case introduction, mediation process and mediation result, and entity type annotation (entity 1, entity 1 type, relationship, entity 2, entity 2 type) based on the specific content." Clarifying task requirements helps provide guidance for subsequent steps and enables the model to understand the goal.
[0025] In CoT chain thinking, step-by-step reasoning is an important process. The completion of each subtask is the basis for the successful execution of subsequent tasks. For example, in the task of building a marriage and family dispute data layer, the first step is to identify the character entities in the text, such as "Wang Moumou" and "Li Moujia"; the second step is to identify the relationship between these characters, such as "marriage relationship"; the third step is to convert the identified entities and relationships into structured data. Through these small steps, the model can clearly understand the needs of each link and avoid confusion.
[0026] b. Reasoning Path: How to Go from Text to Five-tuple While guiding the model to complete the task step by step through the reasoning path, the large model needs to extract key information from the text through self-reasoning and convert it into structured knowledge graph elements.
[0027] The first step in the reasoning path is to identify entities from the text. For example, in a case of marriage and family disputes, the model needs to identify the main people involved from the case description, such as "Wang XX" and "Li XX", and these two entities need to be marked as "person" categories.
[0028] The next reasoning step is to identify the relationship between entities. In the task of marriage and family disputes, the model needs to identify the relationship between "Wang Moumou" and "Li Moujia" from the text and identify this relationship as a "marriage relationship." This step requires the model to understand the semantics of keywords such as "marriage" or "husband and wife" and judge the relationship between the two from the context.
[0029] Finally, the result of reasoning needs to be converted into structured information, usually in the form of five-tuples. For example, the relationship "marriage relationship" between the entities "Wang Moumou" and "Li Moujia" identified from the text can be converted into a five-tuple: "(Wang Moumou, person, marriage relationship, Li Moujia, person)". This structured information can facilitate subsequent data processing, storage and analysis.
[0030] c. Demonstration output: ensuring correct reasoning To ensure that the large model works along the correct reasoning path, we designed high-quality example outputs. The example outputs help guide the model to understand the transformation process from task requirements to quintuples, thereby reducing the risk of the model producing "hallucination" outputs when performing tasks.
[0031] The examples are designed based on real scenarios of task requirements, which demonstrate the reasoning process from text to structured output. For example, in the task of marriage and family dispute cases, an example can be: given a case description: "Wang A and Li A have been married for ten years, and now they have a dispute over property issues and the custody of Li B." The output quintuple is: "(Wang A, person, marriage partner, Li A, person)", or "(Wang A, person, mother, Li B, person)". These examples help the large model understand how to extract and correctly organize information based on different input texts.
[0032] High-quality examples can effectively reduce the amount of information generated by large models that is irrelevant to the actual task. Especially when dealing with complex tasks in the field of social governance, the model may generate irrelevant outputs due to the lack of clear guidance. By providing specific examples, the model can understand the goal of the task more clearly and avoid generating "hallucination" outputs, that is, results that are irrelevant to the actual task.
[0033] d. Feedback adjustment: Dynamically optimize task prompts The last step of CoT chain thinking is feedback adjustment, which is a process of improving the model's reasoning ability by continuously optimizing the prompt template and task decomposition. At this stage, the system will fine-tune the prompt template according to the output effect of the model so that the model can better adapt to new task requirements and data scenarios.
[0034] (4) Step 4: Knowledge Graph Construction a. Five-tuple extraction: Based on the generated prompt template, the system automatically extracts key information from social governance text data and maps it into a five-tuple structure. Each five-tuple contains entities, entity categories, relationships, and related attributes, which meets the requirements for building a knowledge graph.
[0035] b. Structured generation: Each quintuple represents specific information extracted from the text. The model will automatically fill in the relevant entity and relationship content to generate triples or quintuples in a structured form.
[0036] c. Identification of related information: During the quintuple construction process, the model will identify and analyze the relationships between entities, such as time relationships, person relationships, geographic location relationships, etc., to ensure that the extracted information can construct a complete knowledge graph.
[0037] (5) Step 5: Optimization and Feedback According to the evaluation results, adjust and optimize the output format of the quintuple and the generated prompt template. Through manual intervention and automatic optimization mechanism, ensure that the generated quintuple can meet the final needs and expectations. Through continuous evaluation and feedback, optimize the prompt template and improve the performance of the model. This continuous optimization process can ensure that the generated knowledge graph is always in the best state and meet the needs of social governance data analysis and decision support.
[0038] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0039] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
Claims
1. A large model prompt design method based on the social governance knowledge graph of CoT chain thinking, characterized by: The steps include: Data preprocessing: Obtain social governance data and perform data cleaning, formatting and structuring to remove invalid, redundant and erroneous data; Expected output design: Design the output format for social governance application scenarios, define the entity categories that need to be extracted for the data layer, event layer, and reasoning layer, and define the relationships between entities; Prompt template generation: Apply CoT chain thinking to divide the prompt design task into four steps: Task decomposition: decompose the task into entity recognition, relationship recognition, entity category labeling and format assembly steps, and generate different task descriptions according to the different expected outputs of the design; Reasoning path: complete the task step by step; Example output: provide high-quality example output to help the model make correct inferences and alleviate the "hallucination" problem; Feedback adjustment: adjust the prompt content according to the output of small sample data; Knowledge graph construction: Based on the prompt template, extract key information and generate quintuples, including entity, relationship and entity category information, to construct structured quintuples that meet the knowledge graph standards; Optimization and feedback: The feedback mechanism is used to refine and optimize the results. First, the generated knowledge graph is evaluated; then, the prompt template is adjusted based on the feedback information to ensure that the next step of reasoning can better adapt to the task requirements.
2. According to claim 1, the large model prompt design method for constructing a social governance knowledge graph based on CoT chain thinking is characterized in that: The data preprocessing utilizes a deep learning model to perform semantic analysis of text content.
3. According to claim 1, the large model prompt design method for constructing a social governance knowledge graph based on CoT chain thinking is characterized in that: The knowledge graph construction intelligently fills in relevant entities and relationships through a large model, and finally generates quintuple data.
4. According to claim 1, the large model prompt design method for constructing a social governance knowledge graph based on CoT chain thinking is characterized in that: The optimization and feedback optimizes the expected output and prompt design according to actual application feedback to ensure that the generated prompt template can adapt to the task requirements.
Citation Information
Patent Citations
Entity relationship extraction method and system in text, storage medium, and electronic device
CN109472033A
Domain knowledge graph automatic construction method based on large language model and prompt project
CN117035076A
Large model illusion relieving method and device, equipment and storage medium
CN118964583A
Social governance knowledge graph triple construction-oriented large model prompt template generation method
CN119323263A
Knowledge graph construction system and method based on cue words
CN119443253A