A semantic graph-based multi-source knowledge conflict detection and repair method and system
By using a lightweight language model based on semantic graphs and a set of repair operators, the transparency problem of real-time conflict detection and repair in multi-source knowledge fusion systems is solved, achieving efficient and interpretable multi-source knowledge conflict detection and repair, and improving the real-time performance and reliability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-04-14
AI Technical Summary
Existing multi-source knowledge fusion systems lack real-time conflict detection capabilities, cannot automatically identify contradictory information in documents from different sources, and the repair process lacks transparency and explainability, affecting the system's credibility and maintainability.
A semantic graph-based approach is adopted, which trains a lightweight language model through knowledge distillation for real-time conflict detection, generates structured conflict reports, and dynamically repairs multi-source contextual data using a predefined set of repair operators. Combined with offline conflict graph optimization and incremental update mechanisms, automated conflict detection and repair are achieved.
It achieves improved inference speed while ensuring detection accuracy, meets the real-time requirements of online services, provides detailed decision logs and repair process records, significantly improves the system's credibility and auditability, reduces computational complexity, and supports in-depth analysis of large-scale knowledge bases.
Smart Images

Figure CN121118873B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, specifically to a method and system for detecting and repairing multi-source knowledge conflicts based on semantic graphs. Background Technology
[0002] With the rapid development of large-scale language models and retrieval-enhanced generation technologies, knowledge-based question-answering systems have been widely applied in various professional fields. Traditional RAG systems generate accurate and reliable answers by matching user queries with relevant documents in the knowledge base, providing contextual support to the language model. Existing technologies mainly focus on improving retrieval efficiency, optimizing embedding models, and enhancing generation quality. However, existing RAG systems lack effective conflict detection mechanisms when integrating multi-source knowledge. When documents from different sources contradict each other in terms of factual descriptions, numerical data, or timeliness, the system cannot automatically identify these conflicts, resulting in generated content containing contradictory information. Traditional knowledge consistency processing methods mostly employ offline batch processing, which cannot meet the needs of real-time question-answering scenarios. Existing solutions rely on manual review, resulting in slow response times and high costs; or they use simple rule filtering, leading to low accuracy and limited coverage. There is a lack of lightweight solutions capable of detecting and repairing conflicts in real time during the generation process. Existing automatic repair methods lack transparent decision-making processes and detailed modification records, making it difficult for users to understand the basis for repairs and to verify and audit the repair results, severely impacting the system's credibility and maintainability. Summary of the Invention
[0003] The purpose of this invention is to provide a method and system for detecting and repairing multi-source knowledge conflicts based on semantic graphs, so as to solve the problems mentioned in the background art, such as insufficient multi-source knowledge conflict detection capabilities, inability to detect conflicts in real time, and lack of interpretability in the repair process.
[0004] To achieve the above objectives, the present invention adopts the following technical solution:
[0005] According to one aspect of the present invention, a method for detecting and repairing multi-source knowledge conflicts based on semantic graphs is provided, the method comprising:
[0006] The received user query, multi-source contextual information, and predefined prompt word templates are combined and input into the conflict detection model to generate a structured conflict report. The conflict report includes at least the conflict type and the documents involved in the conflict.
[0007] The conflict report is parsed, and a corresponding repair operator is matched from a predefined set of repair operators according to the conflict type. The matched repair operator is then executed to dynamically repair the multi-source context data, resulting in repaired context data and a decision log.
[0008] A final response to the user's query is generated based on the repaired context information.
[0009] Based on the aforementioned scheme, the method further includes an offline knowledge base optimization step:
[0010] Periodically perform sentence-level analysis on all documents in the knowledge base, and use natural language inference models to detect sentence conflicts within documents and sentence conflicts across documents;
[0011] An offline conflict graph is constructed based on the detected conflict relationships. In the offline conflict graph, nodes represent conflict sentences, edges represent conflict relationships, and weights are based on conflict frequency.
[0012] The repair priority is determined based on the weights of the edges in the offline conflict graph, and a list of objects to be repaired is generated.
[0013] Based on the aforementioned scheme, the construction of the offline conflict graph includes storing sentences identified as conflicting during the detection of sentence conflicts within the document into a conflict sentence cache pool; when detecting cross-document sentence conflicts, only the sentences in the conflict sentence cache pool are used to calculate pairwise conflict relationships.
[0014] Based on the aforementioned scheme, the conflict detection model is a lightweight language model obtained through knowledge distillation.
[0015] Based on the aforementioned scheme, the knowledge distillation method includes:
[0016] Conflict sample data is generated through entity substitution, time manipulation, and counterfactual statements.
[0017] The conflict sample data is input into a large teacher language model to obtain the output conflict report data and the Logits vector data of the intermediate layer;
[0018] Using the output of the large-scale teacher language model as the supervision signal, the student model is trained using a joint loss function that integrates KL divergence loss and cross-entropy loss to obtain the conflict detection model.
[0019] Based on the aforementioned scheme, the set of repair operators includes a time-series sorting operator, an authoritative source selection operator, a key value repair operator, and a conflict retention operator;
[0020] The matching of the repair operator includes establishing a mapping relationship between conflict types and repair operators, querying the mapping relationship based on the conflict type field in the conflict report, and determining the corresponding repair operator.
[0021] Based on the aforementioned scheme, the repair operator for performing the matching includes:
[0022] When the time-series sorting operator is matched, the time metadata of each document in the multi-source context data is extracted, and the document with the latest time is retained after sorting by timestamp.
[0023] When the authoritative source selection operator is matched, a preset authority rating dictionary is queried, and the document corresponding to the source with the highest authority rating is selected and retained;
[0024] When the key value repair operator is matched, the key values that conflict in the multi-source context data are located and replaced with a specific mask marker.
[0025] When the conflict preservation operator is matched, an explicit conflict marker is inserted before the conflict content and the original data is preserved.
[0026] Based on the aforementioned scheme, the conflict report is in JSON format and includes at least the conflict identifier, the index of the documents involved in the conflict, the conflict type identifier, the confidence score, and the evidence text fragment field.
[0027] Based on the aforementioned scheme, the method further includes: storing the conflict report, the decision log, and user feedback data in a historical case library; periodically performing incremental fine-tuning on the conflict detection model based on the historical case library, and optimizing the repair operator matching strategy.
[0028] According to another aspect of the present invention, a multi-source knowledge conflict detection and repair system based on semantic graphs is provided. The system includes: a conflict detection module, a repair execution engine, an offline graph construction engine, an answer generation module, and a log management module.
[0029] The conflict detection module is used to receive multi-source contextual information queried and retrieved by the user, and to generate a structured conflict report using the conflict detection model.
[0030] The repair execution engine is used to parse the conflict report, match and execute the repair operator, and output the repaired context information and decision log;
[0031] The offline graph construction engine is used to periodically perform full analysis of the knowledge base and use a natural language reasoning model to detect conflicts in order to construct an offline conflict graph.
[0032] The answer generation module is used to generate a final response based on the repaired context information;
[0033] The log management module is used to record and store operation logs for the entire conflict resolution process.
[0034] As can be seen from the above technical solutions, compared with the prior art, the present invention has at least the following advantages and positive effects: By adopting a lightweight detection model based on knowledge distillation, while ensuring the detection accuracy, the inference speed is improved to meet the real-time requirements of online services; Through the dynamic operator combination framework, the optimal repair strategy can be automatically selected for different types of conflicts, greatly improving the processing efficiency. Structured conflict reports and detailed decision logs completely record the whole process from conflict discovery to repair; Users can clearly understand the decision-making basis and modified content of the system, significantly enhancing the credibility and auditability of the system. Through optimized designs such as conflict sentence cache pools and hierarchical detection architectures, the computational complexity of global conflict analysis is reduced from O(N²) to O(M²) (M << N), making in-depth analysis of large-scale knowledge bases possible. Support for incremental updates and parallel processing significantly improves the system throughput.
[0035] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings. In the drawings:
[0037] Figure 1 is a schematic diagram of a multi-source knowledge conflict detection and repair method based on a semantic graph according to the present invention;
[0038] Figure 2 is a flowchart of online conflict detection and repair according to the present invention;
[0039] Figure 3 is a flowchart of offline conflict graph construction according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0040] In order to more clearly illustrate the purpose, technical solutions and advantages of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. The exemplary embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; on the contrary, these embodiments are provided to make the present invention more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0041] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of the invention.
[0042] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0043] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0044] The present invention will now be described in detail with reference to specific embodiments:
[0045] Example 1, such as Figure 1 , 2 As shown in the figure, this embodiment provides a method for multi-source knowledge conflict detection and repair based on semantic graphs. The specific steps of the method are as follows:
[0046] S1: Combine the received user query, multi-source contextual information and predefined prompt word templates, and input them into the conflict detection model to generate a structured conflict report. The conflict report includes at least the conflict type and the documents involved in the conflict.
[0047] The input data includes contextual information queried and retrieved by the user. This input data is combined with predefined conflict detection prompt word templates to form model input data, which is then fed into a lightweight language model trained by knowledge distillation, i.e., the conflict detection model. The conflict detection model performs real-time analysis on the multi-source contextual information to detect whether there are semantic inconsistencies, time-lag conflicts, or key data conflicts. Based on the standardized output format defined in the prompt word templates, it outputs a machine-readable structured conflict report, which includes at least a conflict identifier, an index of documents involved in the conflict, a conflict type identifier, a confidence score, and evidence text fragment fields.
[0048] Specifically, the retrieved contextual information is a collection of the most relevant references or document fragments retrieved in real time from a vast knowledge base by the RAG system in response to the user's current query. Since this information may originate from multiple different sources, information conflicts exist within the contextual information. The predefined prompt word engineering is a series of pre-designed and constructed text instructions and format templates used to guide and constrain the large language model in performing conflict detection tasks. Conflicts are defined in the conflict detection prompt words as: semantic inconsistency conflicts, time-lapse conflicts, and critical data conflicts. For example, a semantic inconsistency conflict is defined as contradictory descriptions of the same event; a time-lapse conflict is defined as an outdated policy or regulation version; and a critical data conflict is defined as a conflict regarding key numerical values and entity attributes, thus clarifying the conflict criteria.
[0049] Furthermore, the system detects conflicts between multiple knowledge sources online. Upon receiving a user-submitted query, the RAG system retrieves multi-source context information and directly calls a lightweight language model trained through knowledge distillation to output a structured conflict report. For the lightweight language model trained through knowledge distillation, a smaller distillation model (such as Qwen3-0.6B) is used to "compress" the conflict detection capabilities of a large teacher model (such as DeepSeek-V3) into a lighter model, thereby achieving real-time, low-cost online conflict detection while maintaining high accuracy.
[0050] Specifically, a large-scale teacher language model is used to generate training data (soft labels / Logits) to teach a lightweight language model (conflict detection model). During the offline training phase of the lightweight language model, the knowledge from the large model is compressed into the smaller model, and then directly invoked for real-time conflict detection during the online application phase. First, a conflict sample library is constructed. Automated rule and prompt word engineering are used to generate high-quality conflict sample pairs, including: using NER technology to identify named entities (such as names, locations, and organizations) in the text and replacing them with similar entities (e.g., replacing "Beijing" with "Shanghai") to create semantic inconsistency conflicts; identifying and systematically modifying dates in the original text (e.g., changing "2023" to "2021") to create time lag conflicts; and using LLM to generate statements that are completely opposite to the original text (e.g., changing "increased profits" to "decreased profits") to create counterfactual statements and create key data or factual conflicts.
[0051] Further, training data is generated, and the constructed conflict samples are input into a large teacher language model for conflict detection, obtaining its output soft labels, i.e., the raw output and Logits; the raw output is a structured conflict report; Logits represent the output vector of the model's final layer before Softmax activation, containing the model's "raw prediction scores" for all possible tokens, which contain richer knowledge than a single hard label, such as the model's confidence in different options and the similarity between different categories. Further, distillation training is performed, using the output of the large teacher language model as the supervision signal, and training the student model using a joint loss function fusing KL divergence loss and cross-entropy loss to obtain the conflict detection model; the loss function is:
[0052] ;
[0053] KL divergence loss measures the predicted probability distribution of the student model. The predicted probability distribution of the teacher model The differences between them; Cross-entropy loss measures the difference between the student model's predictions and the true label y, ensuring the student model doesn't deviate from the basic facts; α is a hyperparameter used to adjust the importance of the two loss terms. In this embodiment, the teacher model is DeepSeek-v3, and the student model is Qwen3-0.6B. The KL divergence loss is defined as:
[0054] ;
[0055] in Let be the predicted probability of the i-th token in the sentence from the teacher model. Let be the predicted probability of the i-th token in the sentence of the student model.
[0056] Furthermore, an online conflict detection model is applied. First, the user query, the context retrieved by the RAG system, and the predefined conflict detection prompts are concatenated into a complete text sequence according to a predetermined format. The system loads the pre-deployed conflict detection model, inputs the concatenated complete text sequence into the conflict detection model, performs conflict identification, conflict classification and location, determines whether there is a conflict between the documents, and if a conflict exists, determines its type (semantic / timeliness / numerical), and identifies the specific document and textual evidence where the conflict point is located. The model generates a standardized JSON string, i.e., a structured conflict report, according to the prompt instructions.
[0057] Furthermore, the structured conflict report, for example, includes a unique identifier (conflict_id), a list of documents involved (docs), a conflict type label (conflict_type), a confidence score (confidence), and an evidence span (evidence_span). The unique identifier is used for log tracking, case management, and subsequent closed-loop feedback. The list of documents involved indicates which documents are in conflict (e.g., ["doc_1", "doc_4"]), accurately locating the source of the problem. The conflict type label indicates whether the conflict is semantic inconsistency, time lag, or key data conflict, thus determining the type of operator to invoke. The confidence score provides the language model's confidence in the judgment, providing a basis for decision-making regarding whether to automatically repair or transfer to manual review. The evidence span directly applies specific sentences from the original text to provide evidence for the repair operation.
[0058] S2: Parse the conflict report, match the corresponding repair operator from the predefined repair operator set according to the conflict type, and execute the matched repair operator to dynamically repair the multi-source context data, obtain the repaired context data and generate a decision log.
[0059] In this embodiment, a standard JSON parsing library is used to extract key fields, such as `conflict_type`: a key instruction that determines which repair operator to execute subsequently; `docs`: clearly identifies the target document to be operated on; `evidence_span`: precisely locates the specific text position that needs to be modified; and `confidence`: can be used as a decision threshold. Further, repair operators are automatically matched based on the conflict type, establishing a mapping relationship between conflict types and repair operators. The mapping relationship is queried based on the conflict type field in the conflict report to determine the corresponding repair operator. If the conflict type is not defined in the mapping, the default repair operator is used. Furthermore, repair operators are executed to dynamically repair the context data. Corresponding repair operators are designed for each conflict type; each operator is an independent function or class that implements specific repair logic. In this embodiment, the repair operators include: a time-series sorting operator, an authoritative source selection operator, a key value repair operator, and a conflict retention operator. A structured conflict report is input, and by looking up a dictionary, the conflict_type is mapped to a specific repair function. This function is then executed, outputting the repaired context data that can be used to generate the final answer, as well as a structured, interpretable decision log for recording, auditing, and optimization.
[0060] For operator matching: if the conflict type is time lag, the time-series sorting operator is selected; if the conflict type is authority conflict, the authority source selection operator is selected; if the conflict type is critical value error, the critical value repair operator is selected; if the conflict type is unknown or unclassifiable, the conflict retention operator is selected. When the time-series sorting operator is matched, the time metadata of each document in the multi-source context data is extracted, sorted by timestamp, and the document with the latest time is retained; when the authority source selection operator is matched, the preset authority rating dictionary is queried, and the document corresponding to the source with the highest authority rating is selected and retained; when the critical value repair operator is matched, the critical values in the multi-source context data that are in conflict are located and replaced with specific mask markers; when the conflict retention operator is matched, an explicit conflict marker is inserted before the conflict content and the original data is retained.
[0061] Specifically, the time-series sorting operator parses the "date" metadata in each piece of data (or extracts the date from the content), sorts all data by date from newest to oldest, and retains only the most recent data, discarding other older data (based on the assumption that "the latest information is the most accurate"). The authoritative source selection operator relies on a predefined "authority rating dictionary" to assign credibility scores to common data sources; it checks the sources of all conflicting data, selecting the data from the source with the highest authority score for retention, and discarding those with lower scores. The key value repair operator locates the specific conflicting numbers in the data content; it replaces the numbers with the [MASK] tag commonly used in natural language processing to prevent the propagation of misinformation. The conflict retention operator does not delete or modify complex conflicts that cannot be handled automatically; it inserts an explicit tag [CONF] before the conflicting content.
[0062] Furthermore, a decision log is generated. During the remediation process, a detailed, structured log file is simultaneously generated, recording information including decision details, modification details, and context information. Decision information includes the conflict ID, conflict type, operator selection, and decision basis. Modification details include the original data before remediation and the content after remediation. Context information includes user queries and timestamps. The decision log meets the requirements for transparency, auditability, and debuggability. If the final answer is incorrect, this log can be used to accurately pinpoint which remediation step went wrong.
[0063] Finally, a repaired context is generated for this answer generation, and the conflict log is recorded to provide a data foundation for subsequent offline steps.
[0064] S3: Generate a final response to the user query based on the repaired context information.
[0065] In this embodiment, the final response is the final, consumable natural language answer directly returned to the user by the RAG system, which is a direct answer to the user's question. The repaired context information, the original user query, and the prompt word template used for answer generation are combined and input into the answer generation model. This model can be a general-purpose large-scale language model (such as GPT-4) or a model fine-tuned for a specific domain; it can be the same as the conflict detection model or a different model. The model's task is to read and understand the repaired context and generate a direct, accurate, and fluent answer accordingly. The natural language text output by the model is the final response; the system presents this final response to the user, completing the closed loop of this query service.
[0066] In one implementation, such as Figure 3 As shown, this method also includes an offline knowledge base optimization step, which includes: periodically performing sentence-level analysis on all documents in the knowledge base, using a natural language inference model to detect sentence conflicts within documents and sentence conflicts across documents; constructing an offline conflict graph based on the detected conflict relationships, where nodes represent conflicting sentences, edges represent conflict relationships and weights are based on conflict frequency; determining repair priorities based on edge weights, and generating a list of documents to be repaired.
[0067] Specifically, sentence-level analysis is performed on the knowledge base documents. A Natural Language Inference (NLI) model is used to detect sentence conflicts within and across documents, constructing a conflict graph. Conflicting sentences are used as nodes, and conflict relationships as edges. The edges are weighted and prioritized according to their conflict probabilities to generate a list of conflicts to be processed. Input document set D ={ D 1 , D 2 ,..., D n},in D i Indicates the first i One document; output conflict sentence library G =( V , E '),in V It is a set of conflicting sentence nodes. E ′ is the set of edges sorted by priority.
[0068] First, perform conflict detection within the knowledge base documents, and then digitize each document. i Segmented into a list of sentences D i =[s1, s2,..., s j The document in the knowledge base is segmented into sentences to obtain a set of sentences for all documents; sentences within a single document are paired to generate a set of sentence pairs within the document (s).u ,s v A pre-trained Natural Language Inference (NLI) model is used to calculate the conflict probability of sentence pairs and output a conflict score matrix. A confidence threshold is set; sentences exceeding this threshold are considered conflicting, and all conflicting sentence pairs are stored in a conflict sentence cache pool. The conflict sentence cache pool is essentially a set of unique sentence identifiers, associated with their original content and source document information. The cache pool is pre-populated through in-document conflict detection and employs a multi-level indexed data structure. This structure includes primary storage of sentence content, a document inverted index, a conflict frequency index, and a time access index to achieve efficient access and priority management. The document inverted index establishes a mapping between document identifiers and the set of conflicting sentences, supporting fast retrieval and updates at the document level. The conflict frequency index maintains an ordered mapping from conflict counts to the sentence set, prioritizing high-frequency conflicting sentences. The time access index implements a cache eviction policy based on the most recently used time, ensuring the freshness of the cache pool data.
[0069] The core function of the conflict sentence cache pool is to limit the computational scope of subsequent cross-document conflict detection from the total set of sentences in the entire database, S_total, to the cache pool set of sentences, S_cache, where |S_cache| << |S_total|. The cache pool uses a set data structure to ensure sentence uniqueness and avoid duplicate storage. The conflict sentence cache pool introduces a smart filtering layer that first performs lightweight intra-document detection, only placing sentences identified as conflicting into the cache pool. This reduces the global computational complexity from O(N²) to O(n*m²+M²), where N is the total number of sentences, n is the number of documents, m is the average number of sentences per document, and M is the cache pool size (the total number of conflicting sentences, M < 0). <N)。
[0070] Furthermore, all sentences in the conflict sentence cache pool are paired across documents, and a parallel conflict relationship determination is performed again using a Natural Language Inference (NLI) model, outputting cross-document conflict relationship data to construct a conflict graph; wherein, the cross-document conflict graph is represented as ( V,E Using all conflicting sentences as graph nodes, the conflict relationships between sentences as edges, and the frequency of conflict relationships as edge weights, it can be represented as: For a set of nodes, This represents the k-th sentence in the i-th document. Let be the set of edges that have conflicting relationships, where each edge represents a combination relationship formed by any two sentences.
[0071] Edge weights are dynamically calculated based on conflict frequency and confidence level; the edges in the conflict graph are sorted in descending order according to their weights to generate a list of conflicts to be repaired; the conflicts connected by the edges with the highest weights are listed as the highest priority; high-frequency conflict nodes are pushed to the manual review interface in descending order of edge weights.
[0072] Specifically, the edge weights are calculated through a nonlinear combination of conflict frequency and confidence level, with the formula: W = α × F(f) + β × C(c) + γ × I(f,c); F(f) is the weight component based on conflict frequency f, C(c) is the weight component based on confidence level c, and I(f,c) is the interaction component between frequency and confidence level; α, β, and γ are weighting coefficients that satisfy α + β + γ = 1.
[0073] Wherein, the frequency component F(f) = log(1+f) × D(t) × S(f); f is the collision frequency, that is, the number of times the collision is detected; log(1+f) smooths the collision frequency to avoid excessive weighting of high-frequency collisions, and ensures that this term is 0 when f=0; D(t) is the time decay factor, where t represents the time interval since the most recent detection of the collision. D(t) is usually calculated using exponential decay, for example, D(t) = exp(-λ*t), where λ is the decay rate; S(f) is the frequency saturation factor, used to avoid excessive weighting due to infinite frequency growth; for example, S(f) = 1 - exp(-f / K), where K is a saturation constant, such as 10; when the frequency is very high, S(f) approaches 1, but the overall frequency component will be suppressed.
[0074] The confidence component C(c) = μ^1.5 × (1 - σ / μ) × (1 + 0.2 × R_high); c is a list of confidence scores, i.e., the confidence score given by the model each time the conflict is detected; μ is the average of the confidence scores; σ is the standard deviation of the confidence scores; (1 - σ / μ) represents the stability of the confidence; if the standard deviation σ is large, the stability decreases; R_high is the proportion of high confidence, i.e., the proportion of confidence scores above a certain threshold (e.g., 0.9), and this factor is used to reward conflicts that have a high confidence in multiple detections.
[0075] Interaction component: I(f,c) = Synergy(f,c) × (1 + 0.3 × (1 - H(c))); Synergy(f,c) is the synergy factor used to capture the synergistic effect between frequency and confidence; for example, it can be defined as: when f ≥ 3 and μ ≥ 0.85, Synergy(f,c) = 1.5; when f ≥ 5 and μ ≥ 0.75, Synergy(f,c) = 1.2; otherwise, Synergy(f,c) = 1.2. f,c)=1.0; This means that when a conflict simultaneously satisfies high frequency and high confidence, a synergistic gain will be generated; H(c) is the information entropy of the confidence distribution, which is used to measure the uncertainty of the confidence distribution; the higher the entropy value, the more dispersed the confidence distribution, that is, sometimes the confidence is high and sometimes the confidence is low; the lower the entropy value, the more concentrated the confidence distribution; (1-H(c)) represents the degree of concentration of the confidence distribution; if the confidence distribution is concentrated, then H(c) is small, the factor is large, and thus a reward is given.
[0076] Furthermore, by pairwise combining all sentences in the conflict sentence cache pool across documents, an intelligent sampling strategy can be employed to generate a set of cross-document sentence pairs. This intelligent sampling strategy includes positive sampling based on semantic similarity, negative sampling based on topic differences, and hard sample mining based on semantic similarity. For positive semantic similarity sampling, the cosine similarity of semantic embeddings between sentences in the cache pool is calculated, and sentence pairs with similarity higher than a first threshold and from different source documents are selected. For negative topic difference sampling, based on the sentence topic distribution vector, sentence pairs with topic similarity lower than a second threshold and from different source documents are selected as negative samples. For hard sample mining, sentence pairs with semantic similarity in the middle range and from different source documents are identified as potential conflicting hard samples. The proportions of the three sampling methods are dynamically adjusted according to the knowledge base features, and the total number of samples is limited by computational resource constraints.
[0077] Preferably, a batch processing parallel architecture is used for cross-document parallel conflict relationship determination, dividing the cross-document sentence pair set into multiple processing batches, each batch containing a preset number of sentence pairs; a multi-threaded or distributed computing framework is used to execute the forward inference process of the natural language inference model in parallel; computing resources are dynamically allocated according to sentence length and model complexity; and a monitoring mechanism for the inference process is provided to collect conflict confidence scores and computing performance indicators in real time.
[0078] When performing cross-document conflict detection, the algorithm only reads sentences from the conflict sentence cache pool and combines them pairwise; the computational complexity is reduced from O(N²) to O(M²), where M is the size of the cache pool, making global conflict analysis of large-scale knowledge bases computationally feasible. When the knowledge base is updated, an incremental update strategy can be adopted, performing internal conflict detection only on newly added or modified documents and incrementally adding newly discovered conflict sentences to the cache pool to update the cache pool, without the need for a full database rebuild; a time period (such as weekly) can be set to automatically clear and rebuild the entire cache pool to ensure synchronization with the latest state of the knowledge base.
[0079] Finally, a conflict map and a list of items to be repaired are generated to guide manual or automated scripts in directly modifying the source data of the knowledge base.
[0080] Optionally, a human-computer collaborative repair interface is also provided, offering a conflict graph and a list of pending conflicts to a visual interactive interface to assist human reviewers in conflict resolution. Correction suggestions (such as LLM-based rewrite recommendations) and version modification rollbacks are provided based on the cross-document conflict graph. Abstract conflict data (nodes, edges) are transformed into an intuitive graphical interface, using layout algorithms such as force-directed graphs, enabling human reviewers to quickly grasp the overall conflict situation. For node design, circles represent individual sentences, and different colors or icons distinguish document sources (e.g., red for document A, blue for document B). For node size, the diameter is positively correlated with the number of conflicts; a larger diameter indicates a more serious problem and prioritizes its handling. For edges (connecting lines), solid red lines represent conflict relationships; thicker lines indicate higher conflict frequency and greater confidence. Furthermore, the manual correction interface offers interactive features: clicking on a node displays the complete content of the sentence, its associated document, and other metadata; hovering over an edge quickly displays detailed conflict information, most importantly the confidence score given by the NLI model (e.g., "Contradiction: 0.95"); selecting multiple nodes allows human reviewers to select multiple related conflicting nodes at once (e.g., the same outdated policy being cited and conflicting by multiple new policies) for batch operations, such as batch accepting LLM rewriting suggestions or batch marking them as "resolved," greatly improving efficiency. Further, it provides correction suggestions and version control. Based on LLM rewriting recommendations, when a human selects one or a group of conflicting nodes, the system can invoke the LLM and automatically generate one or more correction suggestions based on the context and user intent (e.g., rewriting contradictory sentences into consistent expressions); version modification rollback is supported, all modifications made through the interface do not immediately overwrite the knowledge base source file, but instead generate a new version; the system records the complete modification history; if a problem is found after a modification, reviewers can easily view historical versions and roll back.
[0081] It should be noted that online dynamic repair and the construction of offline conflict graphs can be parallel and independent, with online dynamic repair taking priority and serving as the main path, while the construction of offline conflict graphs serves as a subsequent optimization and fundamental governance path. Online dynamic repair is triggered by specific user queries, while the construction of offline conflict graphs is triggered by scheduled tasks or manual actions by administrators, without affecting real-time services. The construction of offline conflict graphs involves a full scan and analysis of all documents in the entire knowledge base, identifying and repairing all potential contradictions within the knowledge base at their root, thereby improving the overall quality of the knowledge base.
[0082] In one implementation, input data, process data, and result data generated during the remediation process are fed back to a historical case database to optimize the conflict detection model and remediation strategy, and to update the knowledge base. Specifically, the complete data chain generated during online conflict detection and remediation is collected and recorded, including input data, process data, and result data. Input data includes the context of user queries and retrievals; process data includes conflict reports, applied remediation operators, decision logic, and comparisons of content before and after modification; result data includes the final generated response, user satisfaction scores (explicit scores or implicit behaviors), and manual review markers. The collected data is standardized and anonymized, and stored in the historical conflict case database in a unified format. Furthermore, the conflict detection model and remediation operator matching strategy are iteratively optimized.
[0083] To optimize the conflict detection model, a historical case database is used as a high-quality labeled training set. The conflict detection model (e.g., the distilled Qwen3-0.6B) is periodically incrementally fine-tuned to improve its accuracy. Fine-tuning the conflict detection model involves extracting cases from the historical conflict case database and using the context and conflict reports within those cases as training samples for supervised fine-tuning. Dynamically adjusting the matching rules and parameters of the repair operator includes updating the authority scoring dictionary of the authority source optimization operator, or modifying the mapping relationship between conflict types and repair operators.
[0084] To optimize the repair operator matching strategy, large-scale backtesting is conducted based on a historical case database, and intelligent adjustments are made: the authoritative scoring dictionary is automatically updated, operator matching rules are optimized, and new strategies may be discovered, driving the development of new repair operators. The optimization of the repair operator matching strategy includes establishing a repair strategy effectiveness evaluation matrix, statistically analyzing the success rate and user satisfaction indicators of each repair operator under different conflict types; when the success rate of a specific operator combination in a certain conflict type falls below a preset threshold, a repair strategy adjustment mechanism is automatically triggered; the adjustment mechanism includes: modifying the conflict type-repair operator matching rules, for example, if it is found that operator A is consistently ineffective for a certain type of conflict, then operator B is triggered instead; or adjusting the weight score of a specific data source in the authoritative scoring dictionary, for example, if it is found that a certain data source has been successfully used multiple times, then its weight is increased.
[0085] Furthermore, by integrating the analysis results of the offline conflict graph and feedback from online cases, a knowledge base optimization work order is generated. This precisely locates the specific source documents and content paragraphs in the knowledge base that cause conflicts. After manual review, the source documents in the knowledge base are corrected to reduce conflicts at their source. By calculating the semantic similarity between conflict statement vectors and knowledge base document segments, a mapping relationship between online conflicts and offline knowledge sources is established. High-frequency conflict patterns are correlated with online repair cases to locate the source documents and specific content that need to be modified. A knowledge base optimization work order containing source document location, modification suggestions, and impact assessment is automatically generated and pushed to the manual review interface. Based on the review results, the source documents in the knowledge base are updated in a versioned manner, and a complete modification history is recorded.
[0086] Preferably, the case data generated during the online conflict detection and remediation process continuously enriches the historical case library; the historical case library provides training data for continuous optimization of the conflict detection model and remediation strategy; the optimized detection model and remediation strategy improve the accuracy of online processing and reduce the generation of new conflicts; the root-cause update of the knowledge base eliminates conflicts from the data source, forming a quality optimization cycle.
[0087] Example 2 presents an exemplary multi-source knowledge conflict detection and repair system based on semantic graphs, including a conflict detection module, a repair execution engine, an offline graph construction engine, an answer generation module, and a log management module.
[0088] The conflict detection module receives multi-source contextual information queried and retrieved by the user, and generates a structured conflict report using the conflict detection model. It combines the input data with predefined conflict detection prompt word templates to form model input data, which is then input into a lightweight language model trained by knowledge distillation, i.e., the conflict detection model. The conflict detection model performs real-time analysis on the multi-source contextual information to detect whether there are semantic inconsistencies, time lags, or key data conflicts. Based on the standardized output format defined in the prompt word templates, it outputs a machine-readable structured conflict report.
[0089] The repair execution engine parses conflict reports, matches and executes repair operators, and outputs repaired contextual information and decision logs. It automatically matches repair operators based on conflict types, establishing a mapping between conflict types and repair operators. It queries the mapping relationship based on the conflict type field in the conflict report to determine the corresponding repair operator. If the conflict type is not defined in the mapping, a default repair operator is used. In this embodiment, the repair operators include: a time-series sorting operator, an authority source selection operator, a key value repair operator, and a conflict retention operator. When the time-series sorting operator is matched, it extracts the time metadata of each document in the multi-source contextual information, sorts them by timestamp, and retains the document with the latest time. When the authority source selection operator is matched, it queries a preset authority rating dictionary, selects and retains the document corresponding to the source with the highest authority rating. When the key value repair operator is matched, it locates the key values in the multi-source contextual information where conflicts occur and replaces them with specific mask markers. When the conflict retention operator is matched, it inserts an explicit conflict marker before the conflict content and retains the original information.
[0090] An offline conflict graph construction engine is used to periodically perform full analysis of the knowledge base, using a natural language inference model to detect sentence conflicts within documents and sentence conflicts across documents; an offline conflict graph is constructed based on the detected conflict relationships; in the offline conflict graph, nodes represent conflicting sentences, edges represent conflict relationships, and weights are based on conflict frequency; repair priorities are determined according to edge weights, and a list of items to be repaired is generated.
[0091] The answer generation module is used to generate the final response based on the repaired context information; the log management module is used to record and store the operation logs of the entire conflict resolution process.
[0092] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims. It should be understood that the invention is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for multi-source knowledge conflict detection and repair based on semantic graphs, characterized in that, The method includes: The received user query, multi-source contextual information, and predefined prompt word templates are combined and input into the conflict detection model to generate a structured conflict report. The conflict report is in a machine-readable data format and includes at least the conflict type and the documents involved in the conflict. Based on the structured conflict report, the conflict type is parsed, and the predefined mapping relationship between conflict type and repair operator is queried according to the conflict type. The corresponding repair operator is matched from the repair operator set, and the matched repair operator is executed to dynamically repair the multi-source context data, thereby obtaining the repaired context data and generating a decision log. A final response to the user's query is generated based on the repaired context information; The method also includes an offline knowledge base optimization step: Sentence-level analysis is periodically performed on all documents in the knowledge base, and natural language inference models are used to detect sentence conflicts within documents and sentence conflicts across documents. An offline conflict graph is constructed based on the detected conflict relationships, where nodes represent conflicting sentences and edges represent conflict relationships. Repair priorities are determined according to the weights of the edges in the offline conflict graph, and a list of documents to be repaired is generated. The weight of the edge is calculated through a nonlinear combination of conflict frequency and confidence level, with the formula: W = α × F(f) + β × C(c) + γ × I(f,c); F(f) is the weight component based on conflict frequency f, C(c) is the weight component based on confidence level c, and I(f,c) is the interaction component between frequency and confidence level; α, β, and γ are weighting coefficients, satisfying α + β + γ = 1; the frequency component F(f) = log(1 + f) × D(t) × S(f), where D(t) is the time decay factor, t is the time interval from the most recent detected conflict relationship corresponding to the edge, and S(f) is the frequency saturation factor; where D(t) = exp(-λ*t), λ is the decay rate; and S(f) = 1 - exp(-f / K), K is the saturation constant. The interaction component I(f,c) = Synergy(f,c) × (1 + 0.3 × (1 - H(c))); where Synergy(f,c) is the synergy effect factor, used to capture the synergistic effect between frequency and confidence; H(c) is the information entropy of the confidence distribution, used to measure the uncertainty of the confidence distribution; the higher the entropy value, the more dispersed the confidence distribution. The construction of the offline conflict graph includes storing sentences identified as conflicting during the detection of intra-document sentence conflicts into a conflict sentence cache pool; when detecting cross-document sentence conflicts, only the sentences in the conflict sentence cache pool are used to calculate pairwise conflict relationships.
2. The method for multi-source knowledge conflict detection and repair based on semantic graphs according to claim 1, characterized in that, The conflict detection model is a lightweight language model obtained through knowledge distillation.
3. The method for multi-source knowledge conflict detection and repair based on semantic graphs according to claim 2, characterized in that, The knowledge distillation method includes: Conflict sample data is generated through entity substitution, time manipulation, and counterfactual statements. The conflict sample data is input into a large teacher language model to obtain the output conflict report data and the Logits vector data of the intermediate layer; Using the output of the large-scale teacher language model as the supervision signal, the student model is trained using a joint loss function that integrates KL divergence loss and cross-entropy loss to obtain the conflict detection model.
4. The method for multi-source knowledge conflict detection and repair based on semantic graphs according to claim 1, characterized in that, The set of repair operators includes time-series sorting operators, authoritative source selection operators, key value repair operators, and conflict retention operators; The matching of the repair operator includes establishing a mapping relationship between conflict types and repair operators, querying the mapping relationship based on the conflict type field in the conflict report, and determining the corresponding repair operator.
5. The method for multi-source knowledge conflict detection and repair based on semantic graphs according to claim 4, characterized in that, The repair operator that performs the matching includes: When the time-series sorting operator is matched, the time metadata of each document in the multi-source context data is extracted, and the document with the latest time is retained after sorting by timestamp. When the authoritative source selection operator is matched, a preset authority rating dictionary is queried, and the document corresponding to the source with the highest authority rating is selected and retained; When the key value repair operator is matched, the key values that conflict in the multi-source context data are located and replaced with a specific mask marker. When the conflict preservation operator is matched, an explicit conflict marker is inserted before the conflict content and the original data is preserved.
6. The method for multi-source knowledge conflict detection and repair based on semantic graphs according to claim 1, characterized in that, The conflict report is in JSON format and includes at least a conflict identifier, an index of the documents involved in the conflict, a conflict type identifier, a confidence score, and a fragment of evidence text.
7. The method for multi-source knowledge conflict detection and repair based on semantic graphs according to claim 1, characterized in that, The method further includes: storing the conflict report, the decision log, and user feedback data in a historical case library; periodically performing incremental fine-tuning on the conflict detection model based on the historical case library; and optimizing the repair operator matching strategy.
8. A multi-source knowledge conflict detection and repair system based on semantic graphs, used to implement the method as described in any one of claims 1-7, characterized in that, This includes a conflict detection module, a repair execution engine, an offline graph construction engine, an answer generation module, and a log management module; The conflict detection module is used to receive multi-source contextual information queried and retrieved by the user, and to generate a structured conflict report using the conflict detection model. The repair execution engine is used to parse the conflict report, match and execute the repair operator, and output the repaired context information and decision log; The offline graph construction engine is used to periodically perform full analysis of the knowledge base and use a natural language reasoning model to detect conflicts in order to construct an offline conflict graph. The answer generation module is used to generate a final response based on the repaired context information; The log management module is used to record and store operation logs for the entire conflict resolution process.
Citation Information
Patent Citations
Self-adaptive question-answering system and method based on knowledge distillation and multi-modal dynamic fusion
CN120354944A
Multi-source heterogeneous knowledge fusion question and answer solving system
CN120952147A