Knowledge rewriting methods for complex knowledge graph question answering tasks

By employing a knowledge rewriting method enhanced by thought chains, and utilizing supervised training and preference fine-tuning, the redundancy and semantic mismatch issues in complex knowledge graph question answering tasks are resolved, generating logically clear and accurate knowledge representations and improving the performance of the question answering model.

CN119025683BActive Publication Date: 2026-06-30SOUTHEAST UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SOUTHEAST UNIV
Filing Date
2024-08-26
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing knowledge rewriting methods suffer from redundant information, information loss, and semantic mismatch in complex knowledge graph question answering tasks, which affect the accuracy of question answering models and user experience.

Method used

We employ a thought chain to enhance knowledge representation, and through a training framework of supervised training and preference fine-tuning, we optimize the knowledge rewriter using GLM-4 and DPO algorithms to generate natural language text that conforms to the semantics and logic of the problem.

Benefits of technology

It significantly improves the performance of question-answering models in complex knowledge graph question-answering tasks, provides more accurate and logically clear answers, and enhances the practicality and adaptability of question-answering systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025683B_ABST
    Figure CN119025683B_ABST
Patent Text Reader

Abstract

This invention relates to a knowledge rewriting method for complex knowledge graph question-answering tasks, specifically as follows: Step 1, using GLM-4 as a data generator to construct a dataset for supervised training; Step 2, based on the constructed dataset, supervising training an open-source large model to enable it to initially master knowledge rewriting capabilities; Step 3, sampling multiple outputs of the same knowledge rewriting task from the supervised-trained large model as candidate knowledge representations; Step 4, using these candidate knowledge representations as context for the question-answering task to obtain the answers corresponding to the questions, constructing a preference dataset; Step 5, rewriting the preference knowledge representations using GLM-4 to improve the quality and diversity of the dataset; Step 6, using the preference dataset and the DPO algorithm to fine-tune the open-source large model to align it with the preferences of the question-answering model. This significantly improves the performance of the large model in handling complex knowledge graph question-answering tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and relates to a knowledge rewriting method for complex knowledge graph question answering tasks. Background Technology

[0002] Large Language Models (RAGs) have achieved remarkable results on multiple natural language processing tasks, marking a significant milestone in the field. While they excel in zero-shot scenarios, they still exhibit factual errors, or illusions, in fact-dense tasks, particularly question-answering. Recent retrieval augmentation works have attempted to leverage knowledge graphs as a knowledge source to enhance RAGs' capabilities in Knowledge Graph Question Answering (KGQA). Unlike typical question-answering tasks, a key challenge in RAG-based KGQA lies in transforming question-related subgraphs into natural language text understandable by RAGs as contextual information, while preserving as much structural information as possible—a process known as knowledge rewriting. Previous works typically involved simply concatenating the subject, predicate, and object of triples to form triple-form text. Furthermore, considering that RAGs are pre-trained on massive amounts of text corpora, they struggle to understand structured triple-form text. Other works have focused on KG-to-Text conversion of triples into natural language text or summarizing question-related knowledge from triples to generate question-related knowledge descriptions.

[0003] Although existing knowledge rewriting methods have proven effective, they suffer from the following problems: (1) The rewritten knowledge is redundant or lost, leading to usability challenges in the actual knowledge graph question answering applications. Existing knowledge rewriting methods convert question-related subgraphs into natural language text using simple linear concatenation or KG-to-Text methods, resulting in redundant information unrelated to the question's semantics. This redundant information may interfere with the question answering model, introduce irrelevant information, and affect the user experience. In addition, other works are based on questions and retrieval subgraphs. Figure 1 The process of generating a summary is flawed. This approach lacks fine-grained decomposition and analysis of the problem, making it prone to losing key information when dealing with complex problems that require a lot of contextual knowledge. This results in the rewritten knowledge representation lacking the key knowledge points needed to answer the question, making it difficult for the question answering model to provide satisfactory answers to users. (2) The generated knowledge representation does not match the semantics of the question. Existing work ignores the semantics of the question and lacks a logical organization that matches the reasoning path of the question. This not only affects the question answering model's ability to effectively utilize relevant contextual knowledge to provide users with accurate and concise answers, but also results in the model's generated answers lacking necessary logic and coherence, increasing users' confusion and incomprehension of the answers.

[0004] Based on this, we utilize the "thinking chain" approach to improve the performance of knowledge rewriting tasks and design a knowledge rewriting method for complex knowledge graph question answering tasks based on this strategy. The core of this knowledge rewriter lies in alternating reasoning and summarizing for a given question, using the thinking chain to enhance the comprehensiveness and logic of the knowledge representation. In the reasoning step, the knowledge rewriter decomposes the question, specifying the knowledge required for this step of reasoning. In the summarizing step, the knowledge rewriter summarizes the corresponding knowledge from the retrieved triples based on the reasoning content. In this way, the knowledge rewriting method for complex knowledge graph question answering tasks filters out information irrelevant to the question's semantics, reducing noise and increased reasoning costs caused by excessive contextual information. Simultaneously, it generates clear and logical natural language text that conforms to the semantic logic of the question. Furthermore, we propose an open-source large-scale model training framework that includes supervised training and preference fine-tuning to realize the knowledge rewriting method for complex knowledge graph question answering tasks. Supervised training mainly uses a high-performance closed-source large-scale model to generate reference knowledge representations to supervise the training of the open-source large-scale model, enabling it to initially master the ability to rewrite knowledge. Preference fine-tuning involves sampling candidate knowledge representations from a supervised-trained open-source large model and constructing a preference dataset. Finally, the DPO algorithm is used to further fine-tune the open-source large model. Through these two training stages, a knowledge rewriter capable of generating contextual knowledge that conforms to the preferences of the question-answering model can be obtained. Summary of the Invention

[0005] To address the shortcomings of existing technologies, the present invention aims to design a knowledge rewriting method for complex knowledge graph question answering tasks, thereby improving the knowledge representation of knowledge graph question answering tasks.

[0006] To achieve the above objectives, the present invention provides a knowledge rewriting method for complex knowledge graph question answering tasks, the method comprising the following steps:

[0007] Step 1: Construct a supervised training dataset based on GLM-4. For question q and answer entity a, first retrieve the subgraph G related to the question, then use GLM-4 to rewrite the knowledge in the subgraph G to generate a reference knowledge representation for subsequent supervised training. This process mainly includes the following three stages:

[0008] Subgraph retrieval: First, the two-hop subgraph corresponding to the head entity of question q is extracted as the preliminary retrieval result. Then, the semantic similarity between the triples in the subgraph and the question is calculated, and triples with a semantic similarity exceeding a pre-set threshold are selected as the subgraph retrieval result.

[0009] Knowledge Rewriting: The question q and subgraph G are concatenated using a prompt template and used as input x for the knowledge rewriting task. Then, x is input into GLM-4 to obtain the rewritten knowledge representation y. To improve the quality of the knowledge representation y and ensure it conforms to the expected format, three examples are provided to guide GLM-4 in generating higher-quality knowledge representations within the context learning paradigm.

[0010] Quality assessment: The knowledge representation y is used as the contextual knowledge for answering question q, and the question-answering model generates the answer r. If the answer r contains all the answer entities a, then question q is considered to be answered correctly, and the input-output pair (x, y) is included in the supervised training dataset. Otherwise, the knowledge representation is deemed to be of no benefit to the question-answering model, and this data is discarded. Finally, the supervised training dataset D is constructed. T ={(x1,y1),(x2,y2),…,(x T y T )}.

[0011] Step 2: Supervised training of the open-source large model based on the constructed training dataset.

[0012] In the training dataset D T In the context, for each pair of inputs and outputs (x... i y i ), open-source large model R θ Training is based on input x i Generate the corresponding output y i The objective function used in the exercise is defined as:

[0013]

[0014] Where θ represents the open-source large model R θ The parameter, p θ (y i |x i ) represents the condition given input x i Under the condition of open source large model R θ Generate output y i Through this stage of training, the open-source large model has initially mastered the ability to rewrite knowledge.

[0015] Step 3: Sample candidate knowledge representations from the supervised-trained open-source large model.

[0016] The question q and subgraph G are concatenated using a prompt template as input x, and then trained on the supervised open-source large model R. θ M candidate knowledge representations are sampled, y1, y2, ..., y M :

[0017] yi =R θ (x)i=1,2,...,M

[0018] Step 4: Based on the feedback from the question-answering model, perform preference labeling on the candidate knowledge representations. First, calculate the semantic similarity between each pair of M candidate knowledge representations, and select the two candidate knowledge representations y1 and y2 with the lowest semantic similarity. Then, use these two candidate knowledge representations as the context of the question-answering task to obtain the corresponding answers r1 and r2. Finally, evaluate the merits of answers r1 and r2 to perform preference labeling on y1 and y2. This process mainly includes the following three stages:

[0019] Semantic similarity calculation: For M candidate knowledge representations, calculate the semantic similarity between each pair of candidates and select the two candidate knowledge representations y1 and y2 with the largest semantic difference. The reason for this stage is that supervised training knowledge rewriters usually generate candidate knowledge representations with similar semantics, resulting in small differences between preferred and non-preferred knowledge representations in the constructed dataset, thus affecting the effect of preference fine-tuning.

[0020] Answer reasoning: Feedback from the question-answering model is used for preference labeling to avoid discrepancies between the two knowledge representations and the preferences of the question-answering model that might arise from direct evaluation. In this stage, the two knowledge representations y1 and y2 are used as contextual knowledge for the question-answering task, and the answers r1 and r2 from the question-answering model are obtained.

[0021] Preference labeling: GLM-4 is used to evaluate the quality of responses r1 and r2 from two dimensions: accuracy and relevance. Specifically, the question q, subgraph G, answer entity a, and responses r1 and r2 from the question-answering model are concatenated using prompt templates and input into GLM-4 to select the higher-quality responses. + The corresponding knowledge representation form is the preference knowledge representation form y + Low-quality answers - The corresponding knowledge representation form is the non-preference knowledge representation form y. - .

[0022] Step 5: Rewrite the knowledge representation of preferences using GLM-4 to improve the quality and diversity of the data.

[0023] Knowledge representation of preferences y +The dataset was rewritten using GLM-4 to improve its quality and diversity. Unlike knowledge rewriting tasks, GLM-4 provides not only the question q and subgraph G, but also the answer entity a. This allows GLM-4 to consider not only the question and related subgraphs, but also to organize relevant knowledge around the answer entity, effectively improving the accuracy of the rewritten knowledge representation and significantly reducing information redundancy. Based on this, GLM-4 will use the preferred knowledge representation y. + Rewritten as a higher quality knowledge representation y ++ . (x, y ++ y - As a pair of preference data, a preference dataset was constructed.

[0024] Step 6: Use preference data to fine-tune the open-source large model based on the DPO algorithm.

[0025] The open-source large model R is further fine-tuned using the Direct Preference Optimization (DPO) algorithm. θ To obtain a preference-aligned knowledge rewriter It aims to minimize the following objective function:

[0026]

[0027] Where σ represents the Sigmoid function, p θ (y i |x i R represents the supervised knowledge rewriter. θ Based on input x i Generate y i The probability, Represents a knowledge rewriter with fine-tuned preferences. Based on input x i Generate y i The probability. The knowledge rewriter obtained after DPO fine-tuning. The tendency is to generate knowledge representations k that are more favorable to question-answering models. ++ At the same time, it avoids generating knowledge representations k that are not beneficial to the question-answering model. -Given the varying preferences of different question-answering models for contextual knowledge, it is recommended to construct separate preference fine-tuning datasets for different question-answering models during preference fine-tuning. These datasets are used to fine-tune the large open-source model, aligning it with the preferences of the specific question-answering model. Through preference fine-tuning, the knowledge rewriter transforms the question-related subgraph into a comprehensive knowledge summary that is consistent with the question's logic. This knowledge summary is used as the context of the question, significantly improving the performance of large models in handling complex knowledge graph question-answering tasks.

[0028] Compared with the prior art, the advantages of the present invention are as follows:

[0029] 1. This solution proposes a knowledge rewriting method for complex knowledge graph question answering tasks, aiming to optimize the relevant knowledge representation of questions in these tasks. This method not only handles simple problems solved by a single fact but also addresses complex problems requiring multiple facts. This invention can effectively organize and rewrite the complex factual knowledge involved in real-world application scenarios, transforming it into a knowledge representation easily processed by downstream question answering models. Furthermore, this method can be widely applied to existing retrieval-enhanced knowledge graph question answering frameworks, rewriting retrieved question-related subgraphs into comprehensive knowledge summaries consistent with the question's semantics. This rewriting process significantly improves the question answering model's ability to solve various problems in real-world application scenarios, enhancing the practicality of the question answering system in real-world situations.

[0030] 2. This scheme designs a training framework comprising two stages: supervised training and preference fine-tuning. First, supervised training enables the open-source large model to initially grasp the ability to rewrite knowledge. Then, preference fine-tuning aligns the knowledge representation generated by the open-source large model with the preferences of the question-answering model. This training strategy demonstrates significant practical value. Compared to methods relying solely on supervised fine-tuning, preference fine-tuning enhances the adaptability of the open-source large model in real-world application scenarios and optimizes the knowledge representation generated by the model to better serve downstream question-answering systems. Furthermore, through meticulous preference adjustments, the question-answering system can provide more accurate answers that meet user needs and ensure that the generated content complies with human ethical standards. This not only improves the system's functionality but also strengthens its social responsibility. Attached Figure Description

[0031] Figure 1 This is a flowchart illustrating a solution for knowledge rewriting methods in complex knowledge graph question answering tasks. Figure 2 This provides an input / output example for a knowledge rewriting method for complex knowledge graph question answering tasks. Detailed Implementation

[0032] The present application will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention, and should not be construed as limiting the scope of protection of the present application.

[0033] Example 1: The knowledge rewriting method for complex knowledge graph question answering tasks proposed in this invention, such as... Figure 1 As shown, the process mainly consists of two parts: supervised training and preference fine-tuning. Supervised training aims to construct a supervised training corpus using a closed-source large model to supervise the training of an open-source large model, enabling it to initially grasp the ability to rewrite knowledge. Then, given the preference differences between the supervised-trained open-source large model and the question-answering model, candidate knowledge representations are sampled from the supervised-trained open-source large model to construct a preference dataset. Subsequently, the open-source large model is further fine-tuned using the DPO algorithm, ultimately achieving a knowledge rewriter that possesses both knowledge rewriting capabilities and preferences consistent with the question-answering model. This includes the following steps:

[0034] Step 1: Construct a supervised training dataset based on GLM-4. For question q and answer entity a, first retrieve the subgraph G related to the question, then use GLM-4 to rewrite the knowledge in the subgraph G to generate a reference knowledge representation for subsequent supervised training. This process mainly includes the following three stages:

[0035] Subgraph retrieval: First, the two-hop subgraph corresponding to the head entity of question q is extracted as the preliminary retrieval result. Then, the semantic similarity between the triples in the subgraph and the question is calculated, and triples with a semantic similarity exceeding a pre-set threshold are selected as the subgraph retrieval result.

[0036] Knowledge Rewriting: The question q and subgraph G are concatenated using a prompt template and used as input x for the knowledge rewriting task. Then, x is input into GLM-4 to obtain the rewritten knowledge representation y. To improve the quality of the knowledge representation y and ensure it conforms to the expected format, three examples are provided to guide GLM-4 in generating higher-quality knowledge representations within the context learning paradigm.

[0037] Quality assessment: The knowledge representation y is used as the contextual knowledge for answering question q, and the question-answering model generates the answer r. If the answer r contains all the answer entities a, then question q is considered to be answered correctly, and the input-output pair (x, y) is included in the supervised training dataset. Otherwise, the knowledge representation is deemed to be of no benefit to the question-answering model, and this data is discarded. Finally, the supervised training dataset D is constructed. T ={(x1,y1),(x2,y2),…,(x T y T )}.

[0038] Step 2: Supervised training of the open-source large model based on the constructed training dataset.

[0039] In the training dataset D T In the context, for each pair of inputs and outputs (x... i y i ), open-source large model R θ Training is based on input x i Generate the corresponding output y i The objective function used in the exercise is defined as:

[0040]

[0041] Where θ represents the open-source large model R θ The parameter, p θ (y i |x i ) represents the condition given input x i Under the condition of open source large model R θ Generate output y i Through this stage of training, the open-source large model has initially mastered the ability to rewrite knowledge.

[0042] Step 3: Sample candidate knowledge representations from the supervised-trained open-source large model.

[0043] The question q and subgraph G are concatenated using a prompt template as input x, and then trained on the supervised open-source large model R. θ M candidate knowledge representations are sampled, y1, y2, ..., y M :

[0044] y i =R θ (x)i=1,2,...,M

[0045] Step 4: Based on the feedback from the question-answering model, perform preference labeling on the candidate knowledge representations. First, calculate the semantic similarity between each pair of M candidate knowledge representations, and select the two candidate knowledge representations y1 and y2 with the lowest semantic similarity. Then, use these two candidate knowledge representations as the context of the question-answering task to obtain the corresponding answers r1 and r2. Finally, evaluate the merits of answers r1 and r2 to perform preference labeling on y1 and y2. This process mainly includes the following three stages:

[0046] Semantic similarity calculation: For M candidate knowledge representations, calculate the semantic similarity between each pair of candidates and select the two candidate knowledge representations y1 and y2 with the largest semantic difference. The reason for this stage is that supervised training knowledge rewriters usually generate candidate knowledge representations with similar semantics, resulting in small differences between preferred and non-preferred knowledge representations in the constructed dataset, thus affecting the effect of preference fine-tuning.

[0047] Answer reasoning: Feedback from the question-answering model is used for preference labeling to avoid discrepancies between the two knowledge representations and the preferences of the question-answering model that might arise from direct evaluation. In this stage, the two knowledge representations y1 and y2 are used as contextual knowledge for the question-answering task, and the answers r1 and r2 from the question-answering model are obtained.

[0048] Preference labeling: GLM-4 is used to evaluate the quality of responses r1 and r2 from two dimensions: accuracy and relevance. Specifically, the question q, subgraph G, answer entity a, and responses r1 and r2 from the question-answering model are concatenated using prompt templates and input into GLM-4 to select the higher-quality responses. + The corresponding knowledge representation form is the preference knowledge representation form y + Low-quality answers - The corresponding knowledge representation form is the non-preference knowledge representation form y. - .

[0049] Step 5: Rewrite the knowledge representation of preferences using GLM-4 to improve the quality and diversity of the data.

[0050] Knowledge representation of preferences y + The dataset was rewritten using GLM-4 to improve its quality and diversity. Unlike knowledge rewriting tasks, GLM-4 provides not only the question q and subgraph G, but also the answer entity a. This allows GLM-4 to consider not only the question and related subgraphs, but also to organize relevant knowledge around the answer entity, effectively improving the accuracy of the rewritten knowledge representation and significantly reducing information redundancy. Based on this, GLM-4 will use the preferred knowledge representation y. + Rewritten as a higher quality knowledge representation y ++ . (x, y ++ y - As a pair of preference data, a preference dataset was constructed.

[0051] Step 6: Use preference data to fine-tune the open-source large model based on the DPO algorithm.

[0052] The open-source large model R is further fine-tuned using the Direct Preference Optimization (DPO) algorithm. θ To obtain the preference-aligned knowledge rewriter R θ* It aims to minimize the following objective function:

[0053]

[0054] Where σ represents the Sigmoid function, p θ (y i |x i R represents the supervised knowledge rewriter. θ Based on input x i Generate y i The probability, Represents a knowledge rewriter with fine-tuned preferences. Based on input x i Generate y i The probability. The knowledge rewriter obtained after DPO fine-tuning. The tendency is to generate knowledge representations k that are more favorable to question-answering models. ++ At the same time, it avoids generating knowledge representations k that are not beneficial to the question-answering model. - Given the varying preferences of different question-answering models for contextual knowledge, it is recommended to construct separate preference fine-tuning datasets for different question-answering models when performing preference fine-tuning. This allows for the fine-tuning of large open-source models to align with the preferences of specific question-answering models. Through preference fine-tuning, the knowledge rewriter transforms the question-related subgraph into a comprehensive knowledge summary that is consistent with the question's logic. This knowledge summary is used as the context of the question, significantly improving the performance of large models in handling complex knowledge graph question-answering tasks.

[0055] Example 2: Healthcare is a key application area for knowledge graph question-answering systems in real life. This system utilizes fact triples related to the question in the knowledge graph to provide users with accurate and concise answers. This method has application potential in the healthcare field and can support large-scale language models to provide users with high-quality services.

[0056] Step 1: Use GLM-4 as the corpus generator to construct training corpus for the knowledge rewriting task based on medical knowledge graphs and question-answering datasets.

[0057] For a question q and its corresponding head entity e, the domain knowledge graph first retrieves the triples related to question q from the two-hop subgraphs surrounding head entity e, forming a subgraph G. Specifically, taking the question "What is the relationship between retinopathy and diabetes, and how can it be avoided through treatment?" as an example, the head entity of the question is first determined to be "diabetes," and then the two-hop subgraphs surrounding this entity are retrieved from the knowledge graph. During this process, triples semantically related to the question are selected to form subgraph G, including the following triples: (diabetes, common symptoms, hyperglycemia), (diabetes, common symptoms, frequent urination), (diabetes, potential complications, retinopathy), (diabetes, potential complications, kidney disease), (retinopathy, treatment methods, laser photocoagulation), (kidney disease, treatment methods, hemodialysis), (hyperglycemia, treatment methods, insulin injection), (frequent urination, treatment methods, behavioral therapy).

[0058] Then, the question q and the retrieved subgraph G are concatenated as input x. x is then used as input for the knowledge rewriting task, and GLM-4 is applied to rewrite the knowledge to obtain the corresponding knowledge summary y. For example, in the above example, the retrieved subgraph G can be rewritten as "Inference 1: I need to know the relationship between diabetes and retinopathy. Summary 1: Potential complications of diabetes include retinopathy. Inference 2: I need to know the treatment methods for retinopathy. Summary 2: Retinopathy can be treated with laser photocoagulation." (x, y) serves as the input and output pair for the knowledge rewriting task.

[0059] Step 2: Supervised training of the knowledge rewriter based on the constructed training corpus. After obtaining a certain amount of training data, supervised training is performed using an open-source large language model. For example, llama-3-chinese-8b-instruct-v3 is used as the base model for supervised fine-tuning to cultivate the model's initial adaptation and execution ability for knowledge rewriting tasks. Through this process, the model masters basic knowledge rewriting skills, laying the foundation for subsequent in-depth feature development and optimization.

[0060] Step 3: Construction of the preference fine-tuning dataset.

[0061] To ensure that the rewritten knowledge matches the preferences of the question-answering model in real-world application scenarios and facilitates the application of the question-answering model, this step constructs a preference fine-tuning dataset. For the knowledge rewriter trained in step 2, different outputs for the same input were sampled. For example, for the question "What is the relationship between retinopathy and diabetes, and how can it be avoided through treatment?" and its corresponding subgraph, the supervised-trained knowledge rewriter can generate multiple representations. For example, knowledge representation 1 ("Inference 1: I need to know the relationship between diabetes and retinopathy. Summary 1: Potential complications of diabetes include retinopathy. Inference 2: I need to know the treatment methods for retinopathy. Summary 2: Laser photocoagulation can treat retinopathy.") and knowledge representation 2 ("Inference 1: I need to know what the complications of diabetes are. Summary 1: Complications of diabetes include retinopathy and nephropathy. Inference 2: How can these complications be treated? Summary 2: Retinopathy can be treated with laser photocoagulation, and nephropathy can be treated with hemodialysis."). Then, the rewritten knowledge representations are used as the context for answering the question to obtain the answer. For example, for the two knowledge representation formats mentioned above, two answers can be obtained: Answer 1 ("There is a potential complication relationship between diabetes and retinopathy, which can be treated with laser photocoagulation.") and Answer 2 ("Potential complications of diabetes include retinopathy and nephropathy. Retinopathy can be treated with laser photocoagulation, and nephropathy can be treated with hemodialysis."). Comparing these two answers with the standard answer "There is a potential complication relationship between retinopathy and diabetes, which can be avoided with laser photocoagulation," knowledge representation format 1 corresponding to Answer 1 is considered the superior representation, while knowledge representation format 2 corresponding to Answer 2 is considered the inferior representation.

[0062] Step 4: Rewrite the superior knowledge representation using GLM-4 to improve the quality of the knowledge representation.

[0063] In the example above, GLM-4 is used to rewrite the superior knowledge representation to improve its quality. For example, the superior knowledge representation above can be rewritten as: "Inference 1: I need to know the relationship between diabetes and retinopathy. Summary 1: There is a potential complication relationship between diabetes and retinopathy. Inference 2: I need to know the treatment methods for retinopathy. Summary 2: Retinopathy can be treated with laser photocoagulation."

[0064] Step 5: Use the collected preference fine-tuning dataset to fine-tune the open-source large model based on the DPO algorithm to align with the preferences of the downstream question answering model.

[0065] Through the above steps, a knowledge rewriter with enhanced thought chain is obtained. Compared to traditional knowledge rewriting methods, which simply convert question-related triples into text, this invention can rewrite question-related triples into a comprehensive and semantically consistent knowledge summary. This rewriting significantly improves the performance of question-answering models. Particularly in the healthcare field, the proposed knowledge rewriting method effectively transforms question-related medical domain triples into question-related knowledge summaries, enabling question-answering models to provide users with more accurate and concise answers, thereby enhancing the practicality of question-answering systems in the healthcare field.

[0066] Example 3: In the e-commerce field, the application of knowledge graph question-answering systems is fundamentally changing the consumer shopping experience. By integrating and structuring product data, user reviews, supply chain information, and other knowledge sources, knowledge graphs enable consumers to quickly obtain accurate product information and recommendations through natural language queries. This method can be applied to the e-commerce field to provide consumers with information about products and enhance their shopping experience.

[0067] Step 1: Based on consumer demand and interaction data, construct a knowledge graph and question-answer dataset specifically for the e-commerce field. The e-commerce field encompasses a wide range of product categories and user reviews, enriching the knowledge graph's content. Customized knowledge graphs and question-answer datasets are constructed according to different application scenarios and specific user needs, aiming to improve consumer experience and satisfaction through precise information services.

[0068] Step 2: Based on the knowledge graph and question-answering dataset in the e-commerce field, construct a supervised training corpus for the knowledge rewriting task.

[0069] For a question q and its corresponding head entity e, firstly, a two-hop subgraph of the head entity e is retrieved from the domain knowledge graph, and then triples related to question q are selected to construct a subgraph G. For example, for the question "iPhon..." e Who are the founders of the 12 manufacturers? Retrieve the head entity "iPhon" from the knowledge graph. eThe first subgraph is a two-hop subgraph of "12". Then, triples semantically related to the question are selected to form a subgraph G, including: (iPhone 12, manufacturer, Apple), (iPhone 12, screen size, 6.1 inches), (iPhone 12, operating system, iOS 14), (Apple, founder, Steve Jobs), (Apple, founding date, April 1, 1976), (Apple, headquarters location, Cupertino, California). The question q and subgraph G are combined as input x, which is fed into a closed-source large language model (such as GLM-4) to obtain the rewritten knowledge representation y. For example, for the above question, the rewritten knowledge representation using the large language model is: "Inference 1: I need to know the manufacturer of iPhone 12. Summary 1: The manufacturer of iPhone 12 is Apple. Inference 2: I need to know who the founder of Apple is. Summary 2: The founder of Apple is Steve Jobs." (x, y) is used as training data for the knowledge rewriting task, specifically for knowledge rewriting tasks in the e-commerce field.

[0070] Step 3: Supervised Training of the Open-Source Large Language Model. The open-source large language model is trained under supervised conditions using a knowledge rewriting task dataset from the e-commerce domain. This training process aims to ensure that the model initially masters knowledge rewriting skills, laying the foundation for subsequent preference fine-tuning steps.

[0071] Step 4: Construction of the E-commerce Domain Preference Fine-tuning Dataset. Although supervised training has enabled the knowledge rewriter to initially master knowledge rewriting techniques, the generated knowledge representation is not yet fully aligned with the preferences of downstream question-answering models. In the e-commerce domain, while the rewritten knowledge structure conforms to a predetermined format, the actual application of the content may be limited by the processing capabilities of the question-answering model. Therefore, preference fine-tuning is used to bridge the preference gap between the knowledge rewriter and the question-answering model, ensuring that the generated knowledge representation can be fully adopted by the downstream question-answering model to provide consumers with more accurate answers. Specific operations include: First, for the same question and related subgraphs, sampling multiple knowledge representations from the open-source large language model completed by supervised fine-tuning. Then, for different knowledge representations, using them as context for the question-answering model to generate corresponding answers. Afterwards, comparing these answers with the standard answer, using the knowledge representation corresponding to the higher-quality answer as the preferred knowledge representation and the knowledge representation corresponding to the lower-quality answer as the non-preferred knowledge representation. Finally, a closed-source large language model (such as GLM-4) is used to rewrite the knowledge representation of preferences to improve its quality, ensure the maximization of fine-tuning effects and the rapid convergence of the fine-tuning process.

[0072] Step 5 involves further fine-tuning the open-source large language model using the DPO algorithm based on the constructed preference fine-tuning dataset. The purpose of this step is to align preferences between the knowledge rewriter and the question answering model to optimize the model's performance in real-world applications.

[0073] This invention has significant advantages over traditional knowledge graph question answering frameworks, especially in handling complex knowledge and user needs in the e-commerce field. First, the knowledge in the e-commerce field is complex and user needs are numerous. Traditional knowledge graph question answering frameworks often struggle to comprehensively organize the large amount of factual knowledge related to user queries, thus failing to provide satisfactory answers to consumers. The knowledge rewriting method designed in this invention is specifically designed for complex knowledge graph question answering challenges. It can organize a large amount of factual knowledge related to a question into a concise summary that conforms to the semantics of the question, significantly improving the service quality of the question answering system. (2) User queries sometimes involve common sense questions, while traditional knowledge graph question answering frameworks are usually limited to factual knowledge in the knowledge graph. For questions that are outside the scope of the knowledge graph, especially common sense questions, it is difficult to provide accurate answers. The knowledge rewriting method proposed in this invention is adapted to retrieval-enhanced knowledge graph question answering frameworks. For questions that lack corresponding factual knowledge in the knowledge graph, this framework can use knowledge from large language models to provide users with more accurate and concise answers. (3) Given the rapid pace of knowledge updates in the e-commerce field, the corresponding knowledge graph also needs to be updated in real time. The knowledge rewriting method of this invention has good generalization ability and can be directly applied to the updated knowledge graph without additional training. This feature demonstrates that this invention has strong practical value and broad application prospects.

[0074] The applicant of this invention has provided a detailed description of the embodiments of the invention in conjunction with the accompanying drawings. However, those skilled in the art should understand that the above embodiments are merely preferred embodiments of the invention. The detailed description is only intended to help readers better understand the spirit of the invention and is not intended to limit the scope of protection of the invention. On the contrary, any improvements or modifications made based on the inventive spirit of the invention should fall within the scope of protection of the invention.

Claims

1. A knowledge rewriting method for complex knowledge graph question answering tasks, characterized in that, The method includes the following steps: Step 1: Use GLM-4 as a data generator to construct a dataset for supervised training. Step 2: Based on the constructed dataset, conduct supervised training on the open-source large model to enable it to initially acquire the ability to rewrite knowledge. Step 3: Sample multiple outputs of the same knowledge rewriting task from the supervised-trained large model as candidate knowledge representations. Step 4: For candidate knowledge representations, use them as context for the question-answering task to obtain the answers to the questions. By evaluating the merits of answers corresponding to different knowledge representations, perform preference labeling on the candidate knowledge representations and construct a preference dataset. Step 5: Rewrite the knowledge representation of preferences using GLM-4 to improve the quality and diversity of the dataset. Step 6: Fine-tune the open-source large model using the preference dataset and the DPO algorithm to align it with the preferences of the question-answering model; Specifically, step 5 is as follows: High-quality knowledge representations tailored to preferences The dataset was rewritten using GLM-4 to improve its quality and diversity. When using GLM-4 for knowledge rewriting, it not only provides the problem... Hezi Diagram The answer entity is also provided. This allows GLM-4 to consider not only the problem and related subgraphs during the rewriting process, but also to organize relevant knowledge around the answer entity of the problem. This effectively improves the accuracy of the rewritten knowledge representation and significantly reduces information redundancy. Based on this, GLM-4 will use preferred knowledge representation... Rewritten into a higher quality knowledge representation ,Will As a pair of preference data, a preference dataset was constructed. ; Step 6 is as follows: The open-source large model was further fine-tuned using the Direct Preference Optimization (DPO) algorithm. To obtain a preference-aligned knowledge rewriter It aims to minimize the following objective function : in, Represents the Sigmoid function. Represents a knowledge rewriter trained under supervision. Based on input generate The probability, Represents a knowledge rewriter with fine-tuned preferences. Based on input generate The probability, after being fine-tuned by DPO, yields the knowledge rewriter. Tends to generate knowledge representations that are more favorable to question-answering models At the same time, it avoids generating knowledge representations that are not beneficial to the question-answering model. .

2. The knowledge rewriting method for complex knowledge graph question answering tasks according to claim 1, characterized in that, Step 1 is described in detail as follows: Regarding the problem... and answer entity First, retrieve the subgraphs related to the question. Then use GLM-4 pair graph Knowledge rewriting is performed to generate a reference knowledge representation for subsequent supervised training. This process mainly includes the following three stages: Subgraph retrieval: First, extract the question. The two-hop subgraph corresponding to the head entity is used as the initial search result. Then, the semantic similarity between the triples in the subgraph and the question is calculated. Triples with a semantic similarity to the question exceeding a pre-set threshold are selected as the subgraph search results. Knowledge rewriting: rewriting the problem Hezi Diagram A prompt template is used as the input for the knowledge rewriting task. Then, Input GLM-4 to obtain the rewritten knowledge representation. In order to improve the form of knowledge representation To ensure the quality of knowledge representations and to guarantee they conform to the expected format, three examples were provided to guide GLM-4 in generating higher-quality knowledge representations within the context learning paradigm. Quality assessment: Representing knowledge In response to the question Contextual knowledge, and generate answers through a question-answering model. If the answer It contains all the answer entities. Then the problem is considered The input and output pairs were answered correctly. If a knowledge representation is not included in the supervised training dataset, it is considered useless to the question-answering model and discarded. This process ultimately resulted in the construction of the supervised training dataset. .

3. The knowledge rewriting method for complex knowledge graph question answering tasks according to claim 1, characterized in that, Step 2 is described in detail below: In the training dataset In the middle, for each pair of inputs and outputs Open source large model Training based on input Generate the corresponding output The objective function used for training is defined as: in, Represents the open-source large model The parameters, Indicates that given input Under these conditions, open source large model Generate output Through this stage of training, the open-source large model has initially mastered the ability to rewrite knowledge.

4. The knowledge rewriting method for complex knowledge graph question answering tasks according to claim 1, characterized in that, Step 3 is as follows: The problem Hezi Diagram Use prompt templates as input From supervised training of open source large models Medium sampling Various candidate knowledge representation forms : 。 5. The knowledge rewriting method for complex knowledge graph question answering tasks according to claim 1, characterized in that, Step 4 is as follows: First, from... Among the candidate knowledge representations, the semantic similarity between each pair is calculated, and the two candidate knowledge representations with the lowest semantic similarity are selected. and Then, these two candidate knowledge representations are used as the context of the question-answering task to obtain the corresponding answers. and Finally, through evaluation of the answers and The advantages and disadvantages of and Preference labeling involves the following three stages: Semantic similarity calculation: For Given several candidate knowledge representations, calculate the semantic similarity between each pair of them, and select the two candidate knowledge representations with the largest semantic difference. and The reason for designing this stage is that supervised training of knowledge rewriters usually generates semantically similar candidate knowledge representations, resulting in small differences between preferred and non-preferred knowledge representations in the constructed dataset, thus affecting the effectiveness of preference fine-tuning. Answer reasoning: Feedback from a question-answering model is used for preference labeling to avoid discrepancies between the two knowledge representations and the preferences of the question-answering model that might arise from direct evaluation. In this stage, the two knowledge representations... and These are used as contextual knowledge for the question-answering task, and the answers from the question-answering model are obtained. and , Preference labeling: GLM-4 was used to evaluate responses based on both accuracy and relevance. and Conduct a quality assessment, specifically, identify the problems. subgraph Answer entity And the answers from the question-and-answer model and Use prompt templates to construct the responses, input them into GLM-4, select the higher-quality responses, and then submit the higher-quality responses. The corresponding knowledge representation form serves as the knowledge representation form of preferences. Low-quality answers The corresponding knowledge representation form is a non-biased knowledge representation form. .