Knowledge base-oriented conflict content detection method, device, electronic device and medium
By clustering the semantic feature vectors of document paragraphs in the knowledge base and conflict detection of large language models, the problems of low efficiency and poor accuracy of conflict content detection in the intelligent question-and-answer system are solved, and more efficient and accurate detection effects are achieved.
Patent Information
- Application Number
- CN202411253296.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-09-06
AI Technical Summary
When the existing intelligent question-and-answer system detects conflicting content in the knowledge base, it is inefficient and prone to missed or missed detection problems, which affects the accuracy of the answer.
By clustering the semantic eigenvectors of document paragraphs in the knowledge base, a vector cluster is formed, and the document paragraph collection is determined based on the semantic similarity, conflict detection is used for large language models, and conflict detection results are output.
It improves the efficiency and accuracy of conflict content detection, reduces the cost and error rate of manual detection, and ensures the accuracy of answers of the intelligent question and answer system.
Smart Images

Figure CN118760760B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a knowledge base-oriented conflict content detection method, device, electronic device and medium. Background Art
[0002] With the development of artificial intelligence technology, intelligent question-answering systems based on large models have been widely used. To achieve intelligent question-answering, intelligent question-answering systems usually maintain a knowledge base, which stores multiple documents, and each document is divided into multiple document paragraphs. When the user's query statement is obtained, the intelligent question-answering system obtains the document paragraphs related to the query statement from the knowledge base, and inputs the query statement and its related document paragraphs into the large language model, so that the large language model generates the answer corresponding to the query statement. However, due to different sources and different storage times, there may be conflicting content in the knowledge base, such as different indicators or definition content of the same object. If the document paragraphs related to the query statement but conflicting are provided to the large language model, it will affect the accuracy of the answer generated by the large language model. In order to improve the accuracy of the intelligent question-answering system, it is necessary to detect the conflicting content in the knowledge base.
[0003] Currently, manual methods are used to detect conflicting content in knowledge bases. However, when facing a large number of documents and document paragraphs in a knowledge base, the detection efficiency of manual methods is low, and even missed detections and wrong detections may occur. Summary of the invention
[0004] The embodiment of the present application provides a knowledge base-oriented conflict content detection method, device, electronic device and medium, which can detect conflict content in the knowledge base based on prompt engineering and calling a large language model without manual methods, thereby improving the detection efficiency and the accuracy of the detection results. The technical solution is as follows:
[0005] In a first aspect, a knowledge base-oriented conflict content detection method is provided, the method comprising:
[0006] Clustering the semantic feature vectors corresponding to each document paragraph of the plurality of source documents included in the target knowledge base to obtain a plurality of vector clusters, each vector cluster including at least one semantic feature vector;
[0007] For any vector cluster, based on each semantic feature vector included in the vector cluster and the target knowledge base, at least one document paragraph set corresponding to the vector cluster is determined, each document paragraph set includes a document paragraph corresponding to a first semantic feature vector, and a document paragraph corresponding to a second semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a preset threshold, the first semantic feature vector being any semantic feature vector in the vector cluster;
[0008] The document paragraphs and prompt templates included in each document paragraph set are input into the large language model, so that the large language model performs conflict detection on each document paragraph in the input document paragraph set, and outputs the conflict detection result when there is a conflict in the input document paragraph set.
[0009] In a second aspect, a knowledge base-oriented conflict content detection device is provided, the device comprising:
[0010] A clustering module, used for clustering the semantic feature vectors corresponding to each document paragraph of a plurality of source documents included in the target knowledge base to obtain a plurality of vector clusters, each vector cluster including at least one semantic feature vector;
[0011] A determination module, configured to determine, for any vector cluster, at least one document paragraph set corresponding to the vector cluster based on each semantic feature vector included in the vector cluster and the target knowledge base, wherein each document paragraph set includes a document paragraph corresponding to a first semantic feature vector and a document paragraph corresponding to a second semantic feature vector having a semantic similarity with the first semantic feature vector greater than a preset threshold, wherein the first semantic feature vector is any semantic feature vector in the vector cluster;
[0012] The input module is used to input each document paragraph and prompt template included in each document paragraph set into the large language model, so that the large language model performs conflict detection on each document paragraph in the input document paragraph set, and outputs the conflict detection result when there is a conflict in the input document paragraph set.
[0013] In a third aspect, an electronic device is provided, comprising a processor and a memory; the memory stores at least one program code; the at least one program code is used to be called and executed by the processor to implement the knowledge base-oriented conflict content detection method described in the first aspect.
[0014] In a fourth aspect, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, and when the at least one computer program is executed by a processor, the knowledge base-oriented conflict content detection method described in the first aspect can be implemented.
[0015] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the knowledge base-oriented conflict content detection method described in the first aspect can be implemented.
[0016] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0017] Each document paragraph of the source document in the target knowledge base provided by the embodiment of the present application corresponds to a semantic feature vector, and the semantic feature vector can characterize the semantic information of each document paragraph at the semantic level. Usually, the conflicting contents in the knowledge base are generally document paragraphs with the same object but different indicators, and documents with exactly the same content. The semantic feature vectors of these conflicting contents are relatively similar. Therefore, by performing conflict detection on document paragraphs with higher semantic similarity, the conflicting contents in the knowledge base can be detected. When obtaining document paragraphs with higher semantic similarity, a clustering method is first used to cluster document paragraphs with similar semantic feature vectors in the knowledge base into a vector cluster, and then the semantic similarity between each semantic feature vector in the vector cluster is calculated, and the document paragraphs corresponding to the more similar semantic feature vectors are selected from the vector cluster to form a document paragraph set, and then with the help of a prompting project, by calling a large language model, each document paragraph included in each document paragraph set is subjected to conflict detection, and when it is identified that the input document paragraph set has a conflict, the conflict detection result is output. The method provided by the embodiment of the present application does not need to be detected manually, which improves the detection efficiency, and combines the clustering method to reduce the computing power consumption. Moreover, compared with manual detection of a large number of document paragraphs, machine detection is less likely to result in missed detections, false detections, etc., and the detection results are more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 is a schematic diagram of a RAG link provided in an embodiment of the present application;
[0020] Figure 2 It is an architecture diagram of an intelligent question-answering system provided in an embodiment of the present application;
[0021] Figure 3 It is a flow chart of a knowledge base-oriented conflict content detection method provided in an embodiment of the present application;
[0022] Figure 4 is a flowchart of determining at least one document paragraph set in a vector cluster provided by an embodiment of the present application;
[0023] Figure 5 is a flow chart of another knowledge base-oriented conflict content detection method provided in an embodiment of the present application;
[0024] Figure 6It is a schematic diagram of the structure of a knowledge base-oriented conflict content detection device provided in an embodiment of the present application;
[0025] Figure 7 A structural block diagram of an electronic device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0026] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0027] It can be understood that the terms "each", "multiple", and "any" used in the embodiments of the present application include two or more, each refers to each of the corresponding multiple, and any refers to any one of the corresponding multiple. For example, the multiple words include 10 words, and each word refers to each of the 10 words, and any word refers to any one of the 10 words.
[0028] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0029] Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain better results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0030] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0031] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role. The solution provided in the embodiment of the present application involves natural language processing, machine learning / deep learning and other technologies of artificial intelligence, and is mainly used in intelligent question-answering systems using the RAG (Retrieval-Augmented Generation) framework. Among them, RAG refers to retrieving relevant information from an external knowledge base before using a large language model to answer questions, and prompting the large model based on the retrieved relevant information for answering questions. RAG improves the accuracy of the reasoning results of the large language model by combining information retrieval with the large language model.
[0032] Figure 1 The intelligent question answering process of the intelligent question answering system using the RAG framework is shown in FIG. Figure 1 The intelligent question-answering system obtains documents in a certain field (such as electricity, medicine, etc.) in advance, identifies and parses the obtained documents, and then divides them into multiple document paragraphs, and then stores each document paragraph in the knowledge base. After obtaining the question entered by the user, the knowledge base database is searched for document paragraphs related to the question entered by the user, and then the question, related document paragraphs and prompt templates are provided to the large language model, so that the large language model can understand and answer the question entered by the user based on these document fragments, and return the answer to the user.
[0033] Figure 2 The architecture diagram of the intelligent question answering system used in the embodiment of the present application is shown in FIG. Figure 2 , the intelligent question-answering system includes: a terminal 201 and a server 202.
[0034] Among them, the terminal 201 can be a smart phone, a laptop computer, a tablet computer, etc., and the embodiment of the present application does not specifically limit the product type of the terminal 201. The terminal 201 can be installed with an intelligent question and answer application, based on which a conversation between a person and a machine can be completed. Among them, the intelligent question and answer application can be an application specifically used for human-computer conversation, or it can be other applications with intelligent question and answer functions, such as social applications, browser applications, search engines, etc. with intelligent question and answer functions, and the embodiment of the present application does not specifically limit this.
[0035] Server 202 is the background server of the intelligent question and answer application. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. The embodiment of the present application does not make specific limitations on this. In order to realize intelligent question and answer, the server 202 maintains a knowledge base, which can store document identification information of source documents in a certain field (such as document name, field standard name, etc.), and can also store each document paragraph segmented by the source document and its corresponding semantic feature vector, etc. The server 202 can call multiple models such as embedded models and large language models. These models can be deployed directly on the server 202 or on other servers. The server 202 can call these models by interacting with other servers.
[0036] The intelligent question-answering process based on the terminal 201 and the server 202 can be as follows: the user can input a question (query statement) on the terminal 201, and send a query request carrying the question through the terminal 201. After receiving the query request, the server 202 obtains the user's question, calls the embedding model, and vectorizes the user's question to obtain the semantic feature vector corresponding to the question. Then, based on the semantic feature vector corresponding to the question and the semantic feature vectors corresponding to each document paragraph in the knowledge base, by calculating the similarity between the semantic feature vector corresponding to the question and the semantic feature vectors corresponding to each document paragraph, the document paragraph related to the question is obtained from the knowledge base, and then the user's question and the document paragraph related to the question are provided to the large language model, so that the large language model summarizes the answer to the question from the relevant document paragraphs, and then sends the answer to the terminal 201, which is provided to the user by the terminal 201.
[0037] For the intelligent question-answering system using the RAG framework, the accuracy of the document content in the knowledge base directly affects the question-answering results. At present, source documents obtained from different sources or at different times are added to the knowledge base, and these source documents obtained from different sources or at different times may have some conflicting content. For example, for two source documents describing the electricity consumption in a certain area in the first quarter of 2023, one source document describes the electricity consumption in a certain area in the first quarter of 2023 as 10,000 watts, and the other source document describes the electricity consumption in a certain area in the first quarter of 2023 as 13,000 watts. The descriptions of the electricity consumption in a certain area in the first quarter of 2023 in the two source documents are different. If the user wants to query the electricity consumption in the region in the first quarter of 2023, the content in the two source documents that is related to the user's question but conflicting will be provided to the large language model. The answer summarized by the large language model based on the conflicting content will not be accurate, and may even be unable to summarize the answer, thereby reducing the user experience. In order to improve the accuracy of the question-answering results, it is necessary to detect the conflicting content in the knowledge base. At present, manual methods are mainly used for detection. However, the manual detection method has high detection costs, low detection efficiency, and inaccurate detection results, and there may be missed detections and false detections.
[0038] In order to solve the problems of high detection cost, low detection efficiency and inaccurate detection results when detecting conflicting content in the knowledge base of the intelligent question-answering system using the RAG framework. When detecting conflicts in documents, the relevant technology also provides several solutions. Solution 1 is to directly compare the vector similarity between the semantics of paragraphs, and determine the paragraph pairs with similarity exceeding a certain threshold as conflicting content. The adoption of this solution will mistakenly determine a large number of non-conflicting contents as conflicting contents. For example, in the same document, many paragraphs are similar in themselves, but the content is connected, not conflicting content, etc. Solution 2 is to directly compare the two paragraphs based on the large language model to determine whether the two paragraphs have content conflicts. However, due to the large number of document paragraphs, the number of paragraph pairs combined is huge, and each comparison requires calling the large language model, which will bring huge computing resource overhead and is not feasible. In addition, most of the paragraphs are irrelevant content, which is an invalid comparison and wastes a lot of computing resources.
[0039] The embodiment of the present application provides a conflict content detection method for a knowledge base, which is based on clustering document paragraphs in the knowledge base and then detecting them with the help of a large language model. Specifically, when the knowledge base is constructed, the embodiment of the present application first divides the source document into multiple document paragraphs, then performs semantic vectorization processing on each document paragraph to obtain the semantic feature vector corresponding to each document paragraph, and then uses a simple clustering method to cluster the more similar semantic feature vectors into a vector cluster, and then divides the closer semantic feature vectors in the vector cluster into a document paragraph set, thereby excluding the detection of irrelevant content and reducing the computational complexity. Finally, based on each document paragraph set, prompt information is generated with the help of a prompt project, and then a large language model is called to detect the conflicting content in each document paragraph set, and the detection result of each document paragraph set is obtained. The entire detection process does not require manual participation, and it is not for the full amount of paragraphs to perform conflict detection, but clusters the document paragraphs with potential conflicts in a set, and detects them with the help of the powerful information analysis ability of the large language model, which reduces the detection cost and improves the detection efficiency and the accuracy of the detection results.
[0040] For the detailed detection process of the application embodiment, the following will be combined with Figure 3 Provide explanation.
[0041] The present application embodiment provides a knowledge base-oriented conflict content detection method. Figure 2 The server in the smart question-answering system shown in the figure executes the embodiment of the present application as an example, see Figure 3 , the method flow provided in the embodiment of the present application includes:
[0042] 301. Build the target knowledge base.
[0043] The knowledge base is the basis of intelligent question answering and is the source of knowledge for the answers generated by the intelligent question answering system for user questions. The target knowledge base is the knowledge base constructed in the embodiment of the present application and needs to perform conflict content detection. The construction process of the target knowledge base includes the following steps:
[0044] 3011. Obtain multiple source documents.
[0045] Among them, the source document is the unprocessed initial document. There are many sources of source documents. They can be crawled from the search network through crawlers, or obtained from professional websites such as journals and newspapers. Each source document has document identification information, which includes document name, field standard name, etc. The source document in the knowledge base can be targeted at a certain field or multiple fields. When the source document in the knowledge base is targeted at a certain field, each source document can have the same field label. When the source document in the knowledge base is targeted at multiple fields, each source document can have different field labels. Generally speaking, there can be multiple field standards in the same field. For example, documents in the power field have a common power field label, but the power generation types in the power field include thermal power generation, wind power generation, nuclear power generation, etc. Each power generation type has at least one field standard, and each field standard has different versions. Therefore, documents in the power field have different field standard names.
[0046] Furthermore, after obtaining any source document, the embedding model can be called to vectorize the document identification information of the source document to obtain the semantic feature vector corresponding to the document identification information of the source document. When the document identification information is the document name, the semantic feature vector corresponding to the document name of the source document can be obtained by calling the embedding model to vectorize the document name of the source document, and the semantic feature vector is used to represent the document name at the semantic level; when the document identification information is the domain standard name, the semantic feature vector corresponding to the domain standard name of the source document can be obtained by calling the embedding model to vectorize the document name of the source document, and the semantic feature vector is used to represent the domain standard name at the semantic level. Among them, the embedding model is an embedding model, which is a model that represents high-dimensional data (such as text, pictures, videos, etc.) as points (i.e., vectors) in a continuous numerical space. The embedding model can not only reduce the dimensionality of high-dimensional data and improve computational efficiency, but also the converted low-dimensional vector captures the semantic information of high-dimensional data, which is more meaningful than high-dimensional data. The embedding model is the core of RAG technology and the key to the application of large language models.
[0047] 3012. Segment each source document to obtain multiple document paragraphs of each source document.
[0048] When any source document is obtained, the source document is identified to determine the positions of multiple document paragraphs in the source document, and then the source document is segmented based on the position of each document paragraph to obtain multiple document paragraphs of the source document.
[0049] 3013. Call the embedding model to perform vectorization processing on each document paragraph of each source document to obtain a semantic feature vector corresponding to each document paragraph of each source document.
[0050] After each source document is divided into multiple document paragraphs, the embedding model can be called to perform vectorization processing on each document paragraph of each source document to obtain the semantic feature vector corresponding to each document paragraph of each source document.
[0051] 3014. Construct a target knowledge base based on document paragraphs of multiple source documents and their corresponding semantic feature vectors.
[0052] By storing the document identification information of each source document and its corresponding semantic feature vector, and the document paragraph of each source document and its corresponding semantic feature vector, a target knowledge base can be constructed.
[0053] The source documents in the target knowledge of the embodiment of the present application may have conflicting contents in the constructed target knowledge base due to factors such as different sources and different storage times. For example, the indicator description or definition content of the same object in two document paragraphs is different. In the intelligent question-answering system using the RAG framework, the large language model needs to summarize the document paragraphs related to the query statement to obtain the answer corresponding to the query statement. However, if there is conflicting content in the knowledge base, the large language model summarizes the conflicting content, and the summarized answer will not be accurate. In order to improve the accuracy of the question and answer results of the intelligent question and answer system, after the target knowledge base is constructed, the target knowledge base can be detected for conflicting contents through the following steps. In addition, the number of source documents in the target knowledge base is not fixed. As time goes by, the number of source documents in the target knowledge base continues to increase. In order to avoid the decrease in the accuracy of the questions and answers of the intelligent question and answer system, the target knowledge base can be detected for conflicting contents at preset intervals.
[0054] 302. Cluster the semantic feature vectors corresponding to each document paragraph in the target knowledge base to obtain multiple vector clusters.
[0055] Considering that the computational complexity of clustering calculation is much smaller than that of calculating the semantic similarity of semantic feature vectors, in order to reduce computing power consumption and improve the speed of intelligent question answering, the embodiment of the present application can first cluster the semantic feature vectors corresponding to each document paragraph in the target knowledge base to obtain multiple vector clusters. Each vector cluster includes at least one semantic feature vector, and the semantic distance of the semantic feature vectors in the same vector cluster is relatively close, and the semantic distance of the semantic feature vectors in different vector clusters is relatively far.
[0056] Specifically, when the semantic feature vectors corresponding to each document paragraph in the target knowledge base are clustered to obtain multiple vector clusters, a preset clustering algorithm can be used to cluster the semantic feature vectors corresponding to each document paragraph in the target knowledge base to obtain multiple vector clusters. The preset clustering algorithm can be a k-means clustering algorithm, a dbscan clustering algorithm, a hierarchical clustering algorithm, etc.
[0057] 303. For any vector cluster, based on the semantic feature vectors and the knowledge base included in the vector cluster, determine at least one document paragraph set corresponding to the vector cluster.
[0058] Each document paragraph set includes a document paragraph corresponding to a first semantic feature vector and a document paragraph corresponding to a second semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a preset threshold, and the first semantic feature vector is any semantic feature vector in the vector cluster. Specifically, based on the semantic feature vectors and the knowledge base included in the vector cluster, determining at least one document paragraph set corresponding to the vector cluster includes the following steps:
[0059] 3031. Select any semantic feature vector from the vector cluster as a first semantic feature vector, and calculate the semantic similarity between the first semantic feature vector and other semantic feature vectors in the vector cluster.
[0060] For any vector cluster, any semantic feature vector can be selected from the vector cluster as the first semantic feature vector, and the first semantic feature vector can be used as a new cluster center, and then the semantic similarity between the first semantic feature vector and other semantic feature vectors in the vector cluster except the first semantic feature vector is calculated. When calculating the semantic similarity between the first semantic feature vector and other semantic feature vectors in the vector cluster except the first semantic feature vector, cosine similarity, edit distance, Hamming distance, etc. can be calculated.
[0061] 3032. Obtain a second semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a preset threshold.
[0062] The preset threshold value can be set by a technician. After calculating the semantic similarity between the first semantic feature vector and other semantic feature vectors in the vector cluster except the first semantic feature vector, the obtained semantic similarity is compared with the preset threshold value, and a semantic feature vector whose semantic similarity with the first semantic feature vector is greater than the preset threshold value is obtained as the second semantic feature vector.
[0063] 3033. Obtain, from the knowledge base, a document paragraph corresponding to the first semantic feature vector and a document paragraph corresponding to the second semantic feature vector.
[0064] 3034. Group the document paragraph corresponding to the first semantic feature vector and the document paragraph corresponding to the second semantic feature vector into a candidate document paragraph set.
[0065] 3035. After each semantic feature vector in the vector cluster is selected as the first semantic feature vector, at least one candidate document paragraph set is obtained.
[0066] By traversing each semantic feature vector in the vector cluster, when each semantic feature vector is selected as the first semantic feature vector, a candidate document paragraph set can be obtained (of course, there are also cases where some first semantic feature vectors do not have a corresponding candidate document paragraph set). After each semantic feature vector in the vector cluster is selected as the first semantic feature vector, at least one candidate document paragraph set can be obtained.
[0067] Optionally, to avoid missing a semantic feature vector in a vector cluster, the embodiment of the present application may number each semantic feature vector in the vector cluster, and then select each semantic feature vector in sequence as the first semantic feature vector according to the numbering order.
[0068] 3036. Perform deduplication processing on at least one candidate document paragraph set to obtain at least one document paragraph set corresponding to the vector cluster.
[0069] After the embodiment of the present application selects the first semantic feature vector, the semantic similarity between the first semantic feature vector and other semantic feature vectors in the vector cluster is calculated. Thus, the same candidate document paragraph set may exist in at least one of the obtained candidate document paragraph sets, that is, a set including the same document paragraphs. In order to reduce the amount of calculation, it is necessary to deduplicate the repeated candidate document paragraph sets.
[0070] Specifically, when the server performs deduplication processing on at least one candidate document paragraph set and obtains at least one document paragraph set corresponding to the vector cluster, it can detect whether the document paragraphs included in any two candidate document paragraph sets are the same. If the document paragraphs included in any two candidate document paragraph sets are the same, one of the candidate document paragraph sets is deleted to obtain at least one document paragraph set corresponding to the vector cluster.
[0071] Optionally, after the clustering calculation results in multiple vector clusters, the embodiment of the present application calculates semantic similarity within the vector cluster in order to reduce the amount of calculation. If the number of semantic feature vectors included in the vector cluster obtained after clustering is relatively small, there is no need to calculate semantic similarity within the vector cluster, and abnormal content detection can be performed directly on the vector cluster; if the number of semantic feature vectors included in the vector cluster obtained after clustering is relatively large, it is necessary to calculate semantic similarity within the vector cluster. After obtaining multiple vector clusters, whether to calculate semantic similarity within a certain vector cluster can be determined by first obtaining the number of semantic feature vectors included in the vector cluster. If the number of semantic feature vectors included in the vector cluster is greater than a preset number, then based on the semantic feature vectors included in the vector cluster and the knowledge base, at least one document paragraph set corresponding to the vector cluster is determined; if the number of semantic feature vectors included in the vector cluster is less than the preset number, step 304 is directly executed.
[0072] It should be noted that the above describes the clustering process within any vector cluster. For the clustering process within other vector clusters, reference may be made to the above step 303 , which will not be described in detail here.
[0073] Figure 4 The specific implementation process of this step is shown in Figure 4 , for vector cluster K among the multiple vector clusters obtained by clustering, the vector cluster includes multiple semantic feature vectors, which are abbreviated as vector 1, vector 2, ..., vector M in the figure. For vector i (i<M) in the vector cluster, the semantic similarity between vector i and the remaining vectors in the vector cluster is calculated. If the semantic similarity is greater than the preset threshold, vector 1, vector 3, and vector i whose semantic similarity with vector i is greater than the preset threshold are combined into a document paragraph set. Next, the semantic similarity between vector i+1 and the remaining vectors in the vector cluster is calculated, and the above processing of vector i is repeated until vector M is processed. After calculating each vector in vector cluster K, multiple document paragraph sets are obtained, and then deduplication processing is performed on the multiple document paragraph sets. If the vectors included in the two document paragraph sets are exactly the same, one of the document paragraph sets is deleted and the other document paragraph set is retained. After the deduplication processing is completed, all document paragraph sets are output, and this step process ends.
[0074] 304. Input each document paragraph and the prompt template included in each document paragraph set into the large language model, so that the large language model performs conflict detection on each document paragraph in the input document paragraph set, and outputs the conflict detection result when there is a conflict in the input document paragraph set.
[0075] In a possible implementation, after obtaining multiple document paragraph sets, for any document paragraph set, each document paragraph and prompt template included in the document paragraph set can be input into a large language model, so that the large language model performs conflict detection on each document paragraph in the document paragraph set, and outputs a conflict detection result when a conflict exists in the document paragraph set. The conflict detection result includes whether there is a conflict. When a conflict exists, the cause of the conflict and the number of the document paragraph in conflict will be output, so that the document paragraph in conflict can be processed according to the cause of the conflict. Specifically, the following steps may be included:
[0076] The first step is to fill each document paragraph included in the document paragraph set into a specified position of the prompt template to obtain first prompt information.
[0077] The first prompt information includes a designated position, which is used to fill in each document paragraph included in the document paragraph set to instruct the large language model to perform conflict judgment on each document paragraph at the designated position, and output the conflict detection result when the document paragraph set meets any conflict judgment condition. The conflict judgment condition is the basis for judging whether there is a conflict in the document paragraph, including at least one of "conflict in the description of data indicators of the same object" and "conflict in the definition content of the same object". Taking the power field as an example, the first prompt information obtained can be:
[0078] "You are a power dispatch document expert. You have the following chunks (paragraphs). Please determine which chunks have conflicts. Conflicts include but are not limited to:
[0079] (1) Conflicting descriptions of data indicators for the same object
[0080] (2) Conflicting definitions of the same object
[0081] If a chunk with conflicting content is detected, please output the fragment number of the conflicting chunk and the reason:
[0082] [chunk 1]: The situation facing the peak summer period During the summer, photovoltaic power generation provides strong support for the midday peak, and the overall power supply and demand is balanced; there are short-term power supply gaps of 4 million kilowatts and 7 million kilowatts during the evening peak periods of normal summer and hot summer respectively.
[0083] [chunk 2]: Based on the comprehensive load forecast results, unit commissioning and external power supply, it is estimated that the midday peak supply capacity will be 125 million kilowatts during the summer of 2024, and the power supply and demand will be balanced. The evening peak supply capacity is 105 million kilowatts, with a periodic gap of about 3 million kilowatts in the long summer and about 7 million kilowatts in the hot summer.
[0084] Let’s get started now!”
[0085] In the second step, the first prompt information is input into the large language model. The large language model performs conflict judgment on each document paragraph at the specified position according to at least one conflict judgment condition corresponding to the prompt template, and outputs the conflict detection result when the document paragraph set meets any conflict judgment condition.
[0086] Taking the first prompt information obtained in the first step as an example, the first prompt information is input into the large language model. The large language model judges "[chunk fragment 1]: The situation of meeting the peak summer period is that the midday peak photovoltaic power generation has strong support during the summer period, and the overall balance of power supply and demand; there are 4 million and 7 million kilowatts of short-term power supply gaps in the evening peak periods of long summer and hot summer respectively." and "[chunk fragment 2]: Comprehensive load forecast results, unit commissioning and As for the situation of external power supply, it is estimated that the midday peak supply capacity will be 125 million kilowatts during the summer of 2024, and the power supply and demand will be balanced. The evening peak supply capacity is 105 million kilowatts, and there is a periodic gap of about 3 million kilowatts in the long summer, and about 7 million kilowatts in the hot summer. "Whether there is a conflict, it is found that the two paragraphs have different descriptions of the power supply gap indicators during the long summer evening peak period. The output conflict detection result is: there is a conflict, and the conflict reason is the conflict in the description of the data indicators of the same object. The conflict fragment numbers are [chunk fragment 1] and [chunk fragment 2].
[0087] In another possible implementation, the prompt template includes multiple prompt sub-templates, each prompt sub-template corresponds to a conflict judgment condition, and each conflict judgment condition is used to detect a type of conflict. For example, the conflict judgment condition corresponding to the first sub-prompt template may be "conflict in the description of data indicators of the same object"; the conflict judgment condition corresponding to the second sub-prompt template may be "conflict in the definition content of the same object." After obtaining multiple document paragraph sets, for any document paragraph set, the document paragraphs and prompt templates included in the document paragraph set are input into the large language model, so that the large language model performs conflict detection on each document paragraph in the document paragraph set, and outputs the conflict detection result when there is a conflict in the document paragraph set. Specifically, the following steps may be included:
[0088] In the first step, each document paragraph included in the document paragraph set is filled into a designated position of each prompt sub-template to obtain a plurality of second prompt information.
[0089] In the second step, each second prompt information is input into the large language model so that the large language model performs conflict judgment on each document paragraph at the specified position according to the conflict judgment condition corresponding to each prompt sub-template, and outputs the conflict detection result when the document paragraph set meets the corresponding conflict judgment condition.
[0090] The embodiment of the present application sets multiple prompt sub-templates, and then based on the multiple prompt sub-templates, respectively performs different types of conflict detection on a document paragraph set by calling a large language model, thereby improving the detection efficiency and the accuracy of the detection results.
[0091] In an embodiment of the present application, the conflict situation may include a conflict in the data indicator description or definition content of the same object in at least two document paragraphs, and may also include that the contents of each document paragraph included in at least two documents are identical. For different conflict situations, the conflict resolution methods are different.
[0092] In one possible implementation, when the conflict detection result of any document paragraph set is that there is a conflict in the data indicator description or definition content of the same object in at least two document paragraphs, the at least two conflicting document paragraphs can be deleted to ensure the accuracy of the target knowledge base content.
[0093] In another possible implementation, when the conflict detection result of multiple document paragraph sets is that the contents of the document paragraphs included in at least two documents are the same, at least one of the two documents is retained and the remaining documents are deleted to reduce the computational complexity of searching and judging duplicate documents and shorten the search time.
[0094] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0095] The embodiment of the present application reuses the document parsing and semantic vectorization functions in the RAG framework, clusters the various document paragraphs included in the knowledge base by using a clustering method, divides the various document paragraphs into multiple vector clusters, and recalls more similar document paragraphs in each vector cluster through a similarity calculation method, and then performs conflict content detection. In this way, based on the clustering-similarity recall method, a highly similar set of document paragraphs can be screened out from a large number of document paragraphs, thereby shielding a large number of invalid calculations, greatly reducing computing resources, and improving detection efficiency. In addition, using prompt engineering to judge conflicts in internal document paragraphs can effectively utilize the semantic understanding ability of the large language model, avoid erroneous judgments based only on similarity calculations, and improve the accuracy of the detection results.
[0096] Figure 5 The whole process of conflict content detection for knowledge base is shown in Figure 5, obtain N source documents, identify and parse each source document, obtain the document names of N source documents, namely document name 1, document name 2, document name 3, ..., document name N, segment each source document to obtain multiple document paragraphs, among which source document 1 is segmented into document paragraph 1, document paragraph 2, ..., document paragraph M, source document 2 is segmented into document paragraph 1, document paragraph 2, ..., document paragraph K, source document 3 is segmented into document paragraph 1, document paragraph 2, ..., document paragraph P, ..., source document 1 is segmented into document paragraph 1, document paragraph 2, ..., document paragraph N, call the embedding model, vectorize each document paragraph in each source document, and the semantic feature vector corresponding to each document paragraph in each source document is , where the semantic feature vectors corresponding to document paragraph 1, document paragraph 2, …, and document paragraph M in source document 1 are semantic feature vector 1, semantic feature vector 2, …, and semantic feature vector M respectively; the semantic feature vectors corresponding to document paragraph 1, document paragraph 2, …, and document paragraph K in source document 2 are semantic feature vector 1, semantic feature vector 2, …, and semantic feature vector K respectively; the semantic feature vectors corresponding to document paragraph 1, document paragraph 2, …, and document paragraph K in source document 3 are semantic feature vector 1, semantic feature vector 2, …, and semantic feature vector P respectively; the semantic feature vectors corresponding to document paragraph 1, document paragraph 2, …, and document paragraph N in source document N are semantic feature vector 1, semantic feature vector 2, …, and semantic feature vector N respectively. Next, cluster the semantic feature vectors of each document included in the N source documents to obtain K vector clusters, where vector cluster 1 includes semantic feature vector 1, semantic feature vector 5, and semantic feature vector P; vector cluster 2 includes semantic feature vector 2, semantic feature vector 3, semantic feature vector J, and semantic feature vector Q, ...; vector cluster 3 includes semantic feature vector 6 and semantic feature vector 7. Next, clustering is performed within each vector cluster. Taking any vector cluster as an example, any semantic feature vector can be selected from the vector cluster as the first semantic feature vector, and then the semantic similarity between the first semantic feature vector and other semantic feature vectors is calculated, and the semantic feature vector whose semantic similarity with the semantic feature vector is greater than a preset threshold is used as the second semantic feature vector, and then the document paragraph corresponding to the first semantic feature vector and the document paragraph corresponding to the second semantic feature vector are combined into a document paragraph set. Through this clustering method, multiple document paragraph sets can be obtained, namely document paragraph set 1, document paragraph set 2, ..., document paragraph set N. The document paragraph set 1 includes the document paragraphs corresponding to the semantic feature vector 1, the document paragraphs corresponding to the semantic feature vector 3, and the document paragraphs corresponding to the semantic feature vector J. The document paragraph set 2 includes the document paragraphs corresponding to the semantic feature vector Q and the document paragraphs corresponding to the semantic feature vector M.Then, based on the prompt engineering, by calling the large language model, conflict content detection is performed on each document paragraph set to obtain multiple conflict sets, namely conflict set 1, conflict set 2, ..., conflict set K. Among them, conflict set 1 includes document paragraphs corresponding to semantic feature vector 2 and document paragraphs corresponding to semantic feature vector 3, and conflict set 2 includes document paragraphs corresponding to semantic feature vector Q and document paragraphs corresponding to semantic feature vector M. Of course, when outputting the conflict set, the conflict reasons of the document paragraphs in each conflict set can also be output.
[0097] Please refer to Figure 6 , which shows a schematic diagram of the structure of a knowledge base-oriented conflict content detection device provided in an embodiment of the present application. The device can be implemented by software, hardware, or a combination of both, and becomes the whole or part of an electronic device. The device includes:
[0098] A clustering module 601 is used to cluster the semantic feature vectors corresponding to each document paragraph of a plurality of source documents included in the target knowledge base to obtain a plurality of vector clusters, each vector cluster including at least one semantic feature vector;
[0099] A determination module 602 is used to determine, for any vector cluster, at least one document paragraph set corresponding to the vector cluster based on each semantic feature vector included in the vector cluster and the target knowledge base, each document paragraph set includes a document paragraph corresponding to a first semantic feature vector and a document paragraph corresponding to a second semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a preset threshold, and the first semantic feature vector is any semantic feature vector in the vector cluster;
[0100] The input module 603 is used to input each document paragraph and prompt template included in each document paragraph set into the large language model, so that the large language model performs conflict detection on each document paragraph in the input document paragraph set, and outputs the conflict detection result when there is a conflict in the input document paragraph set.
[0101] In another embodiment of the present application, the device further comprises:
[0102] A construction module is used to obtain multiple source documents; segment each source document to obtain multiple document paragraphs of each source document; call the embedding model to vectorize each document paragraph of each source document to obtain a semantic feature vector corresponding to each document paragraph of each source document; and construct a target knowledge base based on the document paragraphs of multiple source documents and their corresponding semantic feature vectors.
[0103] In another embodiment of the present application, the clustering module 601 is used to cluster the semantic feature vectors corresponding to each document paragraph in the target knowledge base using a preset clustering algorithm to obtain multiple vector clusters.
[0104] In another embodiment of the present application, a determination module 602 is used to select any semantic feature vector from the vector cluster as the first semantic feature vector, calculate the semantic similarity between the first semantic feature vector and other semantic feature vectors in the vector cluster; obtain a second semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a preset threshold; obtain, from the knowledge base, a document paragraph corresponding to the first semantic feature vector and a document paragraph corresponding to the second semantic feature vector; form a candidate document paragraph set by combining the document paragraph corresponding to the first semantic feature vector and the document paragraph corresponding to the second semantic feature vector; after each semantic feature vector in the vector cluster is selected as the first semantic feature vector, obtain at least one candidate document paragraph set; deduplicate the at least one candidate document paragraph set to obtain at least one document paragraph set corresponding to the vector cluster.
[0105] In another embodiment of the present application, the determination module 602 is used to detect whether the document paragraphs included in any two candidate document paragraph sets are the same; if the document paragraphs included in any two candidate document paragraph sets are the same, one of the candidate document paragraph sets is deleted to obtain at least one document paragraph set corresponding to the vector cluster.
[0106] In another embodiment of the present application, the device further comprises:
[0107] An acquisition module, used for acquiring the number of semantic feature vectors included in the vector cluster;
[0108] The determination module is used to execute the step of determining at least one document paragraph set corresponding to the vector cluster based on the semantic feature vectors included in the vector cluster and the knowledge base if the number of semantic feature vectors included in the vector cluster is greater than a preset number.
[0109] In another embodiment of the present application, the input module 603 is used to fill each document paragraph included in the document paragraph set into a specified position of the prompt template for any document paragraph set to obtain first prompt information; input the first prompt information into the large language model so that the large language model performs conflict judgment on each document paragraph at the specified position according to at least one conflict judgment condition corresponding to the prompt template, and output a conflict detection result when the document paragraph set meets any conflict judgment condition.
[0110] In another embodiment of the present application, the prompt template includes multiple prompt sub-templates, each prompt sub-template corresponds to a conflict judgment condition, and the input module 603 is used to fill each document paragraph included in the document paragraph set into the specified position of each prompt sub-template for any document paragraph set, to obtain multiple second prompt information; each second prompt information is input into the large language model, so that the large language model performs conflict judgment on each document paragraph at the specified position according to the conflict judgment condition corresponding to each prompt sub-template, and outputs the conflict detection result when the document paragraph set meets the corresponding conflict judgment condition.
[0111] In another embodiment of the present application, the device further comprises:
[0112] A deletion module, used for deleting at least two document paragraphs with conflicts when the conflict detection result of any document paragraph set is that the data indicator description or definition content of the same object in at least two document paragraphs conflicts;
[0113] The deletion module is used to retain any one of the at least two documents and delete the remaining documents when the conflict detection result of the plurality of document paragraph sets is that the contents of the document paragraphs included in at least two documents are the same.
[0114] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0115] Figure 7 The structure block diagram of an electronic device 700 provided by an exemplary embodiment of the present application is shown. Generally, the electronic device 700 includes: a processor 701 and a memory 702 .
[0116] The processor 701 can be implemented in at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 701 may also include a main processor and a coprocessor, wherein the main processor is a processor for processing data in an awake state; and the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 701 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 701 may also include an artificial intelligence processor, which is used to process computing operations related to machine learning.
[0117] The memory 702 may include one or more computer-readable storage media, which may be non-temporary computer-readable storage media, for example, the non-temporary computer-readable storage media may be CD-ROM (Compact Disc Read-Only Memory), ROM, RAM (Random Access Memory), magnetic tape, floppy disk and optical data storage device, etc. The computer-readable storage medium stores at least one computer program, which can implement the above-mentioned knowledge base-oriented conflict content detection method when executed.
[0118] Of course, the above electronic device may also include other components, such as input / output interface, communication component, etc. The input / output interface provides an interface between the processor and the peripheral interface module, and the above peripheral interface module may be an output device, an input device, etc. The communication component is configured to facilitate wired or wireless communication between the electronic device and other devices.
[0119] Those skilled in the art will understand that Figure 7 The structure shown in the figure does not constitute a limitation on the electronic device 700, and may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0120] An embodiment of the present application provides a computer-readable storage medium, in which at least one computer program is stored. When the at least one computer program is executed by a processor, the above-mentioned knowledge base-oriented conflict content detection method can be implemented.
[0121] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above-mentioned knowledge base-oriented conflict content detection method can be implemented.
[0122] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A knowledge base-oriented conflict content detection method, characterized in that: The method comprises: Clustering the semantic feature vectors corresponding to each document paragraph of the plurality of source documents included in the target knowledge base to obtain a plurality of vector clusters, each vector cluster including at least one semantic feature vector; For any vector cluster, based on each semantic feature vector included in the vector cluster and the target knowledge base, at least one document paragraph set corresponding to the vector cluster is determined, each document paragraph set includes a document paragraph corresponding to a first semantic feature vector, and a document paragraph corresponding to a second semantic feature vector whose semantic similarity with the first semantic feature vector is greater than a preset threshold, the first semantic feature vector being any semantic feature vector in the vector cluster; The document paragraphs and prompt templates included in each document paragraph set are input into the large language model, so that the large language model performs conflict detection on each document paragraph in the input document paragraph set, and outputs the conflict detection result when there is a conflict in the input document paragraph set.
2. The method according to claim 1, characterized in that Before clustering the semantic feature vectors corresponding to the respective document paragraphs of the plurality of source documents included in the target knowledge base, the method further includes: Get multiple source documents; Segment each source document to obtain multiple document paragraphs of each source document; Call the embedding model to vectorize each document paragraph of each source document to obtain the semantic feature vector corresponding to each document paragraph of each source document; The target knowledge base is constructed based on document paragraphs of a plurality of source documents and their corresponding semantic feature vectors.
3. The method according to claim 1, characterized in that The semantic feature vectors corresponding to each document paragraph in the target knowledge base are clustered to obtain multiple vector clusters, including: A preset clustering algorithm is used to cluster the semantic feature vectors corresponding to each document paragraph in the target knowledge base to obtain multiple vector clusters.
4. The method according to claim 1, characterized in that The step of determining at least one document paragraph set corresponding to the vector cluster based on the semantic feature vectors included in the vector cluster and the target knowledge base includes: Select any semantic feature vector from the vector cluster as a first semantic feature vector, and calculate the semantic similarity between the first semantic feature vector and other semantic feature vectors in the vector cluster; Acquire a second semantic feature vector whose semantic similarity with the first semantic feature vector is greater than the preset threshold; Acquire, from the target knowledge base, a document paragraph corresponding to the first semantic feature vector and a document paragraph corresponding to the second semantic feature vector; The document paragraph corresponding to the first semantic feature vector and the document paragraph corresponding to the second semantic feature vector are combined into a candidate document paragraph set; After each semantic feature vector in the vector cluster is selected as a first semantic feature vector, obtaining at least one candidate document paragraph set; Deduplication processing is performed on the at least one candidate document paragraph set to obtain at least one document paragraph set corresponding to the vector cluster.
5. The method according to claim 4, characterized in that The performing deduplication processing on the at least one candidate document paragraph set to obtain at least one document paragraph set corresponding to the vector cluster includes: Detect whether the document paragraphs included in any two candidate document paragraph sets are the same; If any two candidate document paragraph sets include the same document paragraphs, one of the candidate document paragraph sets is deleted to obtain at least one document paragraph set corresponding to the vector cluster.
6. The method according to claim 1, characterized in that Before determining at least one document paragraph set corresponding to the vector cluster based on the semantic feature vectors included in the vector cluster and the target knowledge base, the method further includes: Obtaining the number of semantic feature vectors included in the vector cluster; If the number of semantic feature vectors included in the vector cluster is greater than a preset number, a step of determining at least one document paragraph set corresponding to the vector cluster based on each semantic feature vector included in the vector cluster and the target knowledge base is performed.
7. The method according to claim 1, characterized in that The step of inputting each document paragraph and the prompt template included in each document paragraph set into the large language model so that the large language model performs conflict detection on each document paragraph in the input document paragraph set and outputs a conflict detection result when a conflict exists in the input document paragraph set, including: For any document paragraph set, each document paragraph included in the document paragraph set is filled into a specified position of the prompt template to obtain first prompt information; The first prompt information is input into the large language model so that the large language model performs conflict judgment on each document paragraph at a specified position according to at least one conflict judgment condition corresponding to the prompt template, and outputs a conflict detection result when the document paragraph set meets any conflict judgment condition.
8. The method according to claim 1, characterized in that The prompt template includes a plurality of prompt sub-templates, each prompt sub-template corresponds to a conflict judgment condition, and each document paragraph included in each document paragraph set and the prompt template are input into the large language model so that the large language model performs conflict detection on each document paragraph in the input document paragraph set, and outputs a conflict detection result when a conflict exists in the input document paragraph set, including: For any document paragraph set, each document paragraph included in the document paragraph set is filled into a designated position of each prompt sub-template to obtain a plurality of second prompt information; Each second prompt information is input into the large language model, so that the large language model performs conflict judgment on each document paragraph at the specified position according to the conflict judgment condition corresponding to each prompt sub-template, and outputs the conflict detection result when the document paragraph set meets the corresponding conflict judgment condition.
9. The method according to any one of claims 1 to 8, characterized in that: After inputting each document paragraph and the prompt template included in each document paragraph set into the large language model so that the large language model performs conflict detection on each document paragraph in the input document paragraph set and outputs the conflict detection result when there is a conflict in the input document paragraph set, the method further includes: When the conflict detection result of any document paragraph set is that the data indicator description or definition content of the same object in at least two document paragraphs conflicts, the at least two document paragraphs with the conflict are deleted; When the conflict detection result of the plurality of document paragraph sets is that the contents of the document paragraphs included in at least two documents are the same, any one of the at least two documents is retained, and the remaining documents are deleted.
10. A knowledge base-oriented conflict content detection device, characterized in that: The device comprises: A clustering module, used for clustering the semantic feature vectors corresponding to each document paragraph of a plurality of source documents included in the target knowledge base to obtain a plurality of vector clusters, each vector cluster including at least one semantic feature vector; A determination module, configured to determine, for any vector cluster, at least one document paragraph set corresponding to the vector cluster based on each semantic feature vector included in the vector cluster and the target knowledge base, wherein each document paragraph set includes a document paragraph corresponding to a first semantic feature vector and a document paragraph corresponding to a second semantic feature vector having a semantic similarity with the first semantic feature vector greater than a preset threshold, wherein the first semantic feature vector is any semantic feature vector in the vector cluster; The input module is used to input each document paragraph and prompt template included in each document paragraph set into the large language model, so that the large language model performs conflict detection on each document paragraph in the input document paragraph set, and outputs the conflict detection result when there is a conflict in the input document paragraph set.
11. An electronic device, characterized in that: It comprises a processor and a memory; the memory stores at least one program code; the at least one program code is used to be called and executed by the processor to implement the knowledge base-oriented conflict content detection method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and when the at least one computer program is executed by a processor, the knowledge base-oriented conflict content detection method according to any one of claims 1 to 9 can be implemented.
13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the knowledge base-oriented conflict content detection method according to any one of claims 1 to 9 can be implemented.
Citation Information
Patent Citations
Natural language question answering method and device based on large language model, medium and equipment
CN117473053A
Medical big language model training and reasoning method and device, equipment and medium
CN117577350A