A retrieval enhancement generation method and system based on multi-view clustering
Through multi-view clustering technology, we build graphs and vector databases, perform multi-view preprocessing and clustering, solve the problem of retrieval efficiency and precision balance in RAG technology, and achieve efficient document retrieval and improved output quality of large language models.
Patent Information
- Application Number
- CN202410853239.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-28
AI Technical Summary
Traditional RAG technology is difficult to balance between retrieval efficiency and accuracy, resulting in insufficient retrieval accuracy and affecting the output quality of large language models.
Using a retrieval enhancement generation method based on multi-view clustering, by constructing a map database, a vector database and an ES database, multi-view preprocessing and clustering are performed, a multi-view feature database is generated, and data points in the same cluster are selected for multi-channel recall , and fuse the rearranged results based on soft clustering scores to improve retrieval accuracy.
On the premise of ensuring retrieval efficiency, the retrieval accuracy is significantly improved, and the output accuracy and user experience of large language models are improved.
Smart Images

Figure CN118394946B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a retrieval enhancement generation method and system based on multi-view clustering. Background Art
[0002] Limitations of large language models: Traditional large language models (such as BERT, GPT-3, etc.) are usually pre-trained on large-scale datasets to master general knowledge of language. However, these models may generate "hallucinations" that are inconsistent with the facts and have limited ability to respond to new information.
[0003] RAG (Retrieval-Augmented Generation) technology is an advanced method that combines information retrieval and generation, aiming to improve the performance of large language models (LLMs). The core idea of RAG is to obtain relevant information through the retrieval stage and use it to assist the generation stage to produce more accurate and richer text output. Traditional RAG schemes have certain limitations in terms of scattered paragraphs, system throughput, and large candidate sets. Researchers are exploring how to more efficiently integrate the retrieval and generation processes, as well as how to improve the interaction between retrievers and generators. The retrieval part is an extremely important part of RAG technology, which determines the upper limit of the entire RAG system. Only accurate and efficient retrieval methods can guarantee high-quality output. However, general RAG retrieval methods are difficult to balance the relationship between retrieval efficiency and retrieval accuracy. Summary of the invention
[0004] Based on this, it is necessary to provide a retrieval enhancement generation method and system based on multi-view clustering, which can further improve the retrieval accuracy while ensuring the retrieval efficiency, in order to address the above technical problems.
[0005] A retrieval enhancement generation method based on multi-view clustering, the method comprising:
[0006] Constructing a graph database, a vector database and an ES database; the graph database includes graph structures corresponding to multiple knowledge graphs; the vector database includes vector codes corresponding to multiple text information; the ES database includes multiple text information;
[0007] Perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point to obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database to obtain multiple clusters and a soft clustering score for each data point;
[0008] Select the data points that belong to the same cluster as the user input and put them into the candidate pool, perform multi-way recall on the original data corresponding to each data point in the candidate pool, and obtain the recall result;
[0009] The recall results are fused and rearranged according to the soft clustering scores to obtain the rearranged results. The rearranged results and user input are loaded into the prompt words and then input into the large language model to output the corresponding answers.
[0010] In one of the embodiments, it also includes: if the number of data points in the candidate pool is less than a first threshold, performing multi-way recall in the multi-view feature database according to the multi-view features input by the user to obtain a recall result; if the number of data points in the candidate pool is greater than or equal to the first threshold, selecting 4N data points with top soft clustering scores in the candidate pool, and performing multi-way recall on the original data corresponding to the 4N data points to obtain a recall result.
[0011] In one of the embodiments, it also includes: performing staggered zipper-style sparse search and dense search in the graph database and vector database respectively according to the graph structure and vector encoding of each data point, deduplicating and integrating the search results to obtain corresponding comprehensive search results; performing keyword search in the ES database according to the text information of each data point to obtain keyword search results; and obtaining 2N recall results based on the comprehensive search results and the keyword search results.
[0012] In one of the embodiments, the method further includes: using the BGE-RERANKER ranking model to re-rank the recall results to obtain a re-ranking score for each data point; and performing soft voting according to the re-ranking score and the soft clustering score to obtain a re-ranking result.
[0013] In one of the embodiments, it also includes: performing multi-view orthogonal reconstruction on the multi-view features input by the user and the multi-view features of each data point in the multi-view feature database to obtain corresponding reconstructed features; performing hard clustering and soft clustering on each reconstructed feature to obtain multiple cluster clusters and a soft clustering score for each data point.
[0014] In one of the embodiments, it also includes: obtaining a knowledge graph, representing the knowledge graph as a graph structure and putting it into a graph database; obtaining text information, representing the text information as a vector code and putting it into a vector database, and putting the text information into an ES database.
[0015] In one of the embodiments, it also includes: using a bag-of-words model to process text information to obtain text keyword features, using a text encoding embedding model to process vector encoding to obtain contextual semantic embedding features, and using an entity extraction model to process the knowledge graph to obtain text triple link features.
[0016] A retrieval enhancement generation system based on multi-view clustering, the system comprising a database module, a multi-view clustering module, a retrieval enhancement module and a generation model module;
[0017] The database module includes a graph database, a vector database and an ES database; the graph database includes graph structures corresponding to multiple knowledge graphs; the vector database includes vector codes corresponding to multiple text information; the ES database includes multiple text information;
[0018] The multi-view clustering module is used to perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point to obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database, and obtain multiple clusters and a soft clustering score for each data point;
[0019] The retrieval enhancement module is used to select data points belonging to the same cluster as the user input and put them into the candidate pool, and perform multi-channel recall on the original data corresponding to each data point in the candidate pool to obtain the recall result;
[0020] The generation model module is used to fuse and rearrange the recall results according to the soft clustering scores to obtain the rearrangement results, load the rearrangement results and user input into the prompt words, input them into the large language model, and output the corresponding answers.
[0021] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0022] Constructing a graph database, a vector database and an ES database; the graph database includes graph structures corresponding to multiple knowledge graphs; the vector database includes vector codes corresponding to multiple text information; the ES database includes multiple text information;
[0023] Perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point to obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database to obtain multiple clusters and a soft clustering score for each data point;
[0024] Select the data points that belong to the same cluster as the user input and put them into the candidate pool, perform multi-way recall on the original data corresponding to each data point in the candidate pool, and obtain the recall result;
[0025] The recall results are fused and rearranged according to the soft clustering scores to obtain the rearranged results. The rearranged results and user input are loaded into the prompt words and then input into the large language model to output the corresponding answers.
[0026] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0027] Constructing a graph database, a vector database and an ES database; the graph database includes graph structures corresponding to multiple knowledge graphs; the vector database includes vector codes corresponding to multiple text information; the ES database includes multiple text information;
[0028] Perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point to obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database to obtain multiple clusters and a soft clustering score for each data point;
[0029] Select the data points that belong to the same cluster as the user input and put them into the candidate pool, perform multi-way recall on the original data corresponding to each data point in the candidate pool, and obtain the recall result;
[0030] The recall results are fused and rearranged according to the soft clustering scores to obtain the rearranged results. The rearranged results and user input are loaded into the prompt words and then input into the large language model to output the corresponding answers.
[0031] The above-mentioned retrieval enhancement generation method and system based on multi-view clustering performs multi-view preprocessing on the data in the graph database, vector database and ES database, clusters the view features of the same data point, obtains a multi-view feature database, performs multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database, obtains multiple clusters and a soft clustering score for each data point; selects data points belonging to the same cluster as the user input and puts them into the candidate pool, performs multi-way recall on the original data corresponding to each data point in the candidate pool to obtain a recall result, fuses and rearranges the recall result according to the soft clustering score to obtain a rearrangement result, loads the rearrangement result and the user input into the prompt word and then inputs into the large language model, and outputs the corresponding answer. The embodiment of the present invention can further improve the retrieval accuracy and realize efficient document retrieval under the premise of ensuring the retrieval efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1is a flow chart of a retrieval enhancement generation method based on multi-view clustering in one embodiment;
[0033] Figure 2 Schematic diagram of the execution flow of a multi-view clustering module and a retrieval enhancement module in one embodiment;
[0034] Figure 3 A structural block diagram of a retrieval enhancement module in one embodiment;
[0035] Figure 4 is a structural block diagram of a retrieval enhancement generation system based on multi-view clustering in one embodiment;
[0036] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0038] In one embodiment, Figure 1 As shown, a retrieval enhancement generation method based on multi-view clustering is provided, comprising the following steps:
[0039] Step 102, constructing a graph database, a vector database and an ES database.
[0040] The graph database includes graph structures corresponding to multiple knowledge graphs, the vector database includes vector codes corresponding to multiple text information, and the ES database includes multiple text information. External graphs, texts and other information are obtained through the basic database, and encoded into the corresponding database. For the graph database, a knowledge graph containing a directory structure of index entities and attribute documents can be created by building a graph structure ontology and importing structured information into the knowledge graph database, which is used for retrieval indexing of graph structure information. For the vector database, the text can be encoded into a vector through the vector encoding model and imported into the vector database. The ES database can directly import the original text for subsequent keyword retrieval.
[0041] The method of the present invention is applied to document knowledge retrieval. The knowledge graph and text information can be derived from the original document. The method of the present invention can realize knowledge retrieval of book documents, academic papers, patent documents, legal documents and corporate documents.
[0042] Step 104, perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point to obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database, and obtain multiple clustering clusters and a soft clustering score for each data point.
[0043] Multi-view preprocessing refers to processing the data in the graph database, vector database, and ES database into corresponding view features. Views from different data sources provide information on different aspects of objects or data points. Corresponding to document knowledge retrieval, data points refer to entities in documents. The view features of the same data point are clustered to obtain multi-view features of each data point. Multi-view features refer to feature sets that describe the same object or data point in different views. Based on the multi-view features of each data point, a multi-view feature database is obtained. By obtaining multi-view features of each entity in the original document, it is helpful to improve the retrieval accuracy and the accuracy of the answer of the large model, and improve the user experience.
[0044] Multi-view clustering refers to clustering analysis of multiple multi-view features. Each multi-view feature contains a set of different features. By clustering on different multi-view features, a more comprehensive and accurate data classification can be obtained. In the document retrieval of the present invention, one view contains text keyword features, another view contains text semantic embedding features, and the third view contains text triple graph link features.
[0045] Step 106 , select data points that belong to the same cluster as the user input and put them into a candidate pool, perform multi-channel recall on the original data corresponding to each data point in the candidate pool, and obtain a recall result.
[0046] Multi-path recall refers to improving the recall rate of the retrieval system through multiple independent recall paths. Through multi-path recall, the coverage of the retrieval can be increased, thereby improving the recall rate. Each recall path can use different features or models for retrieval, and finally the results of all paths are merged together. The present invention uses dense retrieval and sparse retrieval to recall data from the atlas database and vector database, and uses keyword retrieval to recall data from the ES database.
[0047] Step 108, the recall results are fused and rearranged according to the soft clustering scores to obtain rearranged results, the rearranged results and the user input are loaded into the prompt words and then input into the large language model, and the corresponding answers are output.
[0048] The present invention adopts multi-view clustering to introduce multi-dimensional information, divides the basic candidate set, adopts soft clustering and hard clustering in parallel to realize hybrid hierarchical retrieval, refines the candidate pool, and combines multi-way recall technology to obtain the final rearrangement result. It further improves the retrieval accuracy while ensuring the retrieval efficiency, thereby improving the output accuracy of the large model.
[0049] In the above-mentioned retrieval enhancement generation method based on multi-view clustering, multi-view preprocessing is performed on the data in the graph database, vector database and ES database, and the view features of the same data point are clustered to obtain a multi-view feature database. Multi-view clustering is performed on the multi-view features input by the user and the data in the multi-view feature database to obtain multiple cluster clusters and soft clustering scores for each data point; data points belonging to the same cluster cluster as the user input are selected and put into the candidate pool, and the original data corresponding to each data point in the candidate pool is multi-way recalled to obtain the recall result, and the recall result is fused and rearranged according to the soft clustering score to obtain the rearrangement result, and the rearrangement result and the user input are loaded into the prompt word and then input into the large language model to output the corresponding answer. The embodiment of the present invention can further improve the retrieval accuracy and realize efficient document retrieval under the premise of ensuring the retrieval efficiency.
[0050] In one embodiment, the steps of constructing a graph database, a vector database and an ES database include: obtaining a knowledge graph, representing the knowledge graph as a graph structure and putting it into the graph database; obtaining text information, representing the text information as a vector code and putting it into the vector database, and putting the text information into the ES database.
[0051] In one embodiment, the multi-view preprocessing step includes: using a bag-of-words model to process text information to obtain text keyword features, using a text encoding embedding model to process vector encoding to obtain contextual semantic embedding features, and using an entity extraction model to process a knowledge graph to obtain text triple link features.
[0052] In this embodiment, through the principle of complementarity, multi-view features are constructed based on multi-source features, and the information of different views is integrated through the clustering mechanism to jointly learn a shared clustering structure or through feature fusion of multiple views. The data of the graph structure is encoded in a graph learning-based manner, and the text features are represented by sparse coding and dense coding embedding to construct multiple views.
[0053] In one embodiment, multi-view clustering is performed on the multi-view features input by the user and the data in the multi-view feature database to obtain multiple clusters and a soft clustering score for each data point, including: multi-view orthogonal reconstruction is performed on the multi-view features input by the user and the multi-view features of each data point in the multi-view feature database to obtain corresponding reconstructed features; hard clustering and soft clustering are performed on each reconstructed feature to obtain multiple clusters and a soft clustering score for each data point.
[0054] In this embodiment, if Figure 2 The execution flow diagram of the multi-view clustering module and the retrieval enhancement module shown in the figure uses a multi-view clustering algorithm to implement hard clustering and soft clustering in parallel for the fused multi-view features, and calculates through a joint multi-view clustering model to obtain the results of soft clustering and hard clustering. In hard clustering, each data point is accurately assigned to a cluster. The purpose is to divide the data points into K clusters so that the sum of the square distances of each data point to the center point of its designated cluster is minimized. Soft clustering allows data points to belong to multiple clusters with different degrees of membership. In this method, each data point has a membership value, which indicates the degree to which the data point belongs to the cluster. In this method, hard clustering can be used for initial recall, and soft clustering can be used for secondary recall and sorting. It can be understood that in this method, the multi-view clustering algorithm is not restricted, and it only needs to be converted into a data format that matches the algorithm and can be replaced by a variety of clustering methods. The clustering method used in the embodiment of the present invention is as follows:
[0055] Multi-view orthogonalization is used to reconstruct multi-view features, weaken the linear relationship between features, disperse the distance of features, and improve the clustering effect. Hard clustering and soft clustering are then implemented based on the KMeans clustering algorithm.
[0056] The optimization objective function is as follows:
[0057] ;
[0058] in, Indicates The data matrix of each view. represents a hard partition matrix where each row represents the classification label of a data point. Indicates The basis matrix of each view. Indicates The cluster center matrix of views, is a The identity matrix of Represents a hard partition matrix No. row, indicating the Which category does the data point belong to? Indicates the measurement The degree of fit between the data of each view and its corresponding centroid and basis matrix, represents the weight of each view, where is the number of views. The purpose of this objective function is to minimize the matrix decomposition error of multi-view data while taking into account the contribution of each view.
[0059] In one embodiment, data points belonging to the same cluster as the user input are selected and put into a candidate pool, and multi-way recall is performed on the original data corresponding to each data point in the candidate pool to obtain a recall result, including: if the number of data points in the candidate pool is less than a first threshold, multi-way recall is performed in a multi-view feature database according to the multi-view features input by the user to obtain a recall result; if the number of data points in the candidate pool is greater than or equal to the first threshold, 4N data points with top soft clustering scores in the candidate pool are selected, and multi-way recall is performed on the original data corresponding to the 4N data points to obtain a recall result.
[0060] In this embodiment, the clusters whose categories in the hard clustering results are the same as the categories corresponding to the user input are selected and put into the candidate pool. If the number of candidate pools is less than 4N, the cluster recall method is not used. If the number of candidate pools is greater than 4N, 4N samples are recalled according to the soft clustering score. Considering the balance between the accuracy and speed of the retrieval, N can be 5 to 15. In this implementation case, N=10.
[0061] In one embodiment, the multi-way recall step includes: performing interlaced zipper-style sparse search and dense search in the graph database and the vector database respectively according to the graph structure and vector encoding of each data point, deduplicating and integrating the search results to obtain corresponding comprehensive search results; performing keyword search in the ES database according to the text information of each data point to obtain keyword search results; and obtaining 2N recall results based on the comprehensive search results and the keyword search results.
[0062] In this embodiment, if Figure 3 The structural block diagram of the retrieval enhancement module shown selects the index of the recalled sample in the candidate pool, encodes the samples in the atlas database and the vector database, performs sparse retrieval and dense retrieval, and implements keyword recall for the ES database to realize the multi-way recall method.
[0063] In sparse retrieval, the BM25 algorithm is used to measure the relevance of alternative answers to queries and ensure consistency in the algorithms or models used in sentence vectorization embedding and text segmentation processing. The BM25 calculation formula is:
[0064] ;
[0065] Scoring function Measures the database being queried Input text with user query In this function, Represents a specific term in the query statement. Indicates the frequency of the word appearing in the queried database S. is the inverse document frequency of the term, which reflects the prevalence of the term in the entire document collection. Is the database being queried The number of words, Represents the average number of words in all indexed documents. and is the adjustment parameter, represents the effect of word frequency, is the impact of document length score, specifically, they are set to 1 and 0.75 respectively.
[0066] In dense retrieval, the relevance of each potential answer to the query content is evaluated by the cosine similarity algorithm, which is suitable for determining the closeness of meaning between different texts. Specifically, the BGE-RANKER vector encoding model is used, and the cosine similarity calculation formula is:
[0067] ;
[0068] in, and Represents text and text The semantic feature vector of . and They refer to the first A quantity.
[0069] For graph structure data and text embedded data, sparse retrieval and dense retrieval are used at the same time. The output is sorted by relevance, using an interlaced zipper method, with dense retrieval first and sparse retrieval later. The results are deduplicated and integrated, and N-1 results are retrieved respectively. The final comprehensive retrieval result is 2N-2 results. For keyword retrieval, the ES database is used to retrieve the two most relevant text segments. Finally, 2N results are formed.
[0070] In one embodiment, the recall results are fused and rearranged according to the soft clustering scores to obtain the rearranged results, including: using the BGE-RERANKER ranking model to rearrange the recall results to obtain the rearrangement score of each data point; and performing soft voting according to the rearrangement score and the soft clustering score to obtain the rearrangement result.
[0071] In this embodiment, the re-ranking model and the multi-view soft clustering scores are fused and re-ranked to obtain the final re-ranking result, which is then input into the large language model for response synthesis. This approach can take into account the interactive features between documents and queries, thereby more carefully evaluating the relevance between them. The re-ranking model adopts the BGE-RERANKER ranking model, and the final result is based on the re-ranking score and the soft clustering score for soft voting to make the final decision. The Top2N documents and user questions of the final ranking result are input into the large language model for integrated response, and the final reply is output to the user question-answering module to interact with the user.
[0072] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0073] In one embodiment, Figure 4 As shown, a retrieval enhancement generation system based on multi-view clustering is provided, the system includes a database module, a multi-view clustering module, a retrieval enhancement module and a generation model module;
[0074] The database module includes a graph database, a vector database and an ES database; the graph database includes graph structures corresponding to multiple knowledge graphs; the vector database includes vector codes corresponding to multiple text information; the ES database includes multiple text information;
[0075] The multi-view clustering module is used to perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point, obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database, and obtain multiple clusters and soft clustering scores for each data point;
[0076] The retrieval enhancement module is used to select data points that belong to the same cluster as the user input and put them into the candidate pool, and perform multi-way recall on the original data corresponding to each data point in the candidate pool to obtain the recall result;
[0077] The generation model module is used to fuse and rearrange the recall results according to the soft clustering scores to obtain the rearranged results, load the rearranged results and user input into the prompt words, input them into the large language model, and output the corresponding answers.
[0078] For the specific definition of the retrieval enhancement generation system based on multi-view clustering, please refer to the definition of the retrieval enhancement generation method based on multi-view clustering above, which will not be repeated here. Each module in the above-mentioned retrieval enhancement generation system based on multi-view clustering can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0079] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a retrieval enhancement generation method based on multi-view clustering is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0080] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0081] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in the above embodiment when executing the computer program.
[0082] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0083] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0084] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0085] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims
1. A retrieval enhancement generation method based on multi-view clustering, characterized in that: The method comprises: Constructing a graph database, a vector database and an ES database; the graph database includes graph structures corresponding to multiple knowledge graphs; the vector database includes vector codes corresponding to multiple text information; the ES database includes multiple text information; Perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point to obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database to obtain multiple clusters and a soft clustering score for each data point; Select the data points that belong to the same cluster as the user input and put them into the candidate pool, perform multi-way recall on the original data corresponding to each data point in the candidate pool, and obtain the recall result; The recall results are fused and rearranged according to the soft clustering scores to obtain the rearranged results. The rearranged results and user input are loaded into the prompt words and then input into the large language model to output the corresponding answers.
2. The method according to claim 1, characterized in that: Select the data points that belong to the same cluster as the user input and put them into the candidate pool. Perform multi-way recall on the original data corresponding to each data point in the candidate pool. The recall results include: If the number of data points in the candidate pool is less than a first threshold, performing multi-way recall in the multi-view feature database according to the multi-view features input by the user to obtain a recall result; If the number of data points in the candidate pool is greater than or equal to the first threshold, 4N data points with the highest soft clustering scores in the candidate pool are selected, and multi-way recall is performed on the original data corresponding to the 4N data points to obtain a recall result, where N is a positive integer.
3. The method according to claim 2, characterized in that The steps of the multi-way recall include: According to the graph structure and vector encoding of each data point, interlaced zipper-style sparse search and dense search are performed in the graph database and the vector database respectively, and the search results are deduplicated and integrated to obtain the corresponding comprehensive search results; Perform keyword search in the ES database according to the text information of each data point to obtain keyword search results; 2N recall results are obtained according to the comprehensive search results and the keyword search results.
4. The method according to claim 1, characterized in that: The recall results are fused and rearranged according to the soft clustering scores to obtain the rearranged results including: The BGE-RERANKER ranking model is used to re-rank the recall results and obtain the re-ranking score of each data point; Soft voting is performed based on the rearrangement score and the soft clustering score to obtain the rearrangement result.
5. The method according to claim 1, characterized in that The multi-view clustering is performed on the multi-view features input by the user and the data in the multi-view feature database to obtain multiple clusters and a soft clustering score for each data point, including: Respectively reconstruct the multi-view features input by the user and the multi-view features of each data point in the multi-view feature database by multi-view orthogonalization to obtain corresponding reconstructed features; Hard clustering and soft clustering are performed on each reconstructed feature to obtain multiple clusters and a soft clustering score for each data point.
6. The method according to claim 1, characterized in that The steps to build the graph database, vector database, and ES database include: Obtain the knowledge graph, represent the knowledge graph as a graph structure and put it into the graph database; Obtain text information, represent the text information as vector code and put it into the vector database, and then put the text information into the ES database.
7. The method according to claim 1, characterized in that The steps of multi-view preprocessing include: The bag-of-words model is used to process text information to obtain text keyword features, the text encoding embedding model is used to process vector encoding to obtain contextual semantic embedding features, and the entity extraction model is used to process the knowledge graph to obtain text triple link features.
8. A retrieval enhancement generation system based on multi-view clustering, characterized in that: The system includes a database module, a multi-view clustering module, a retrieval enhancement module and a generation model module; The database module includes a graph database, a vector database and an ES database; the graph database includes graph structures corresponding to multiple knowledge graphs; the vector database includes vector codes corresponding to multiple text information; the ES database includes multiple text information; The multi-view clustering module is used to perform multi-view preprocessing on the data in the graph database, vector database and ES database, cluster the view features of the same data point to obtain a multi-view feature database, perform multi-view clustering on the multi-view features input by the user and the data in the multi-view feature database, and obtain multiple clusters and a soft clustering score for each data point; The retrieval enhancement module is used to select data points belonging to the same cluster as the user input and put them into the candidate pool, and perform multi-channel recall on the original data corresponding to each data point in the candidate pool to obtain the recall result; The generation model module is used to fuse and rearrange the recall results according to the soft clustering scores to obtain the rearrangement results, load the rearrangement results and user input into the prompt words, input them into the large language model, and output the corresponding answers.
9. The system according to claim 8, characterized in that Select the data points that belong to the same cluster as the user input and put them into the candidate pool. Perform multi-way recall on the original data corresponding to each data point in the candidate pool. The recall results include: If the number of data points in the candidate pool is less than a first threshold, performing multi-way recall in the multi-view feature database according to the multi-view features input by the user to obtain a recall result; If the number of data points in the candidate pool is greater than or equal to the first threshold, 4N data points with the highest soft clustering scores in the candidate pool are selected, and multi-way recall is performed on the original data corresponding to the 4N data points to obtain a recall result, where N is a positive integer.
10. The system according to claim 9, characterized in that The steps of the multi-way recall include: According to the graph structure and vector encoding of each data point, interlaced zipper-style sparse search and dense search are performed in the graph database and the vector database respectively, and the search results are deduplicated and integrated to obtain the corresponding comprehensive search results; Perform keyword search in the ES database according to the text information of each data point to obtain keyword search results; 2N recall results are obtained according to the comprehensive search results and the keyword search results.
