Retrieval method based on collaborative document tree reconstruction

By using sliding window block processing and GMM clustering to generate a multidimensional system document tree, positive and negative sample scores are determined, and the model is enhanced to perform global and pruned retrieval. This solves the problems of semantic confusion and low accuracy in professional domain document retrieval, and achieves logically coherent and semantically consistent retrieval results.

CN120994759AActive Publication Date: 2025-11-21HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD

Patent Information

Application Number
CN202511517322.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-22
Publication Date
2025-11-21
Estimated Expiration
2045-10-22

AI Technical Summary

Technical Problem

When using a general large model to retrieve documents in highly specialized technical fields, the semantic structure is chaotic and the accuracy is low, leading to the omission of key information.

Method used

Sample documents are processed in blocks using a sliding window, and structured summaries are generated using GMM clustering and LLM. A multidimensional system document tree is constructed to determine positive and negative sample scores, and the Embedding and Reranker models are enhanced to perform global and pruned retrieval.

Benefits of technology

It enables logical coherence and semantic consistency in the retrieval of documents in professional fields, avoids missing key information, and improves the accuracy and comprehensiveness of search results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994759A_ABST
    Figure CN120994759A_ABST
Patent Text Reader

Abstract

The invention provides a retrieval method based on collaborative document tree reconstruction, which comprises the following steps: taking vector representation of each document block as a first-layer node of a multi-dimensional system document tree, executing GMM clustering on the nodes, and taking a structured abstract of a clustering center obtained by combining LLM as a next-layer node of the document tree; according to the vector representation of each document block and the hierarchical relationship and / or path distance among other nodes in the tree, based on a quinary training sample, enhancing an Embedding model and rearranging a Reranker model; representing a first cosine similarity between nodes except a root node in the tree based on a to-be-retrieved vector of the query text to obtain a global candidate text set; pruning and traversing nodes of the document tree layer by layer, and obtaining the similarity between the traversed nodes and the to-be-retrieved vector to obtain a fine candidate text set; and rearranging a union set of the global candidate text set and the fine candidate text set by adopting the enhanced Reranker model to obtain a retrieval result.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, and particularly relates to a retrieval method based on collaborative document tree reconstruction. BACKGROUND

[0002] In the process of document processing, if fixed length or paragraph is used for splitting and then indexing, the hierarchical structure of the document will be broken, resulting in incoherent semantics, repeated paragraphs, redundant information, and increased processing burden of large models. If a standardized template is used for content recognition, the core content may be dispersed in multiple parts of the entire document, which may result in incomplete aggregation of the core content, and thus reduce the accuracy of content extraction. Therefore, the retrieval results of general large models for documents in technical fields with strong professional characteristics (for example, medical, chemical, etc.) are often semantically disordered and cannot meet the accuracy requirements of industry insiders. SUMMARY

[0003] Embodiments of the present application provide a retrieval method based on collaborative document tree reconstruction, which solves the technical problem of disordered semantic structure and low accuracy of retrieval results of general large models for documents in technical fields with strong professional characteristics.

[0004] In a first aspect, the present application provides a retrieval method based on collaborative document tree reconstruction, which comprises: obtaining a plurality of sample documents belonging to the same field as the query text to be retrieved, and performing block processing on the plurality of sample documents through a sliding window to obtain a plurality of document blocks; generating a vector representation of each document block using a vector representation Embedding model, taking the vector representation of each document block as a first layer node of a multi-dimensional system document tree, performing Gaussian Mixture Model GMM clustering on the node, and using a large language model LLM to obtain a structured summary of each clustering cluster as a dynamic clustering center in the GMM clustering process, taking the structured summary after the GMM clustering iteration ends as a next layer node of the multi-dimensional system document tree, until the clustering converges to obtain a complete multi-dimensional system document tree; determining the positive sample, positive sample score, negative sample, and negative sample score corresponding to each document block according to the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the multi-dimensional system document tree, to obtain five-element training samples; enhancing the Embedding model and Reranker model based on the five-element training samples; converting the query text into a to-be-retrieved vector representation based on the enhanced Embedding model; obtaining a global candidate text set based on a first cosine similarity between the to-be-retrieved vector representation and nodes in the multi-dimensional system document tree except the root node; starting from the root node, pruning and traversing nodes of the multi-dimensional system document tree layer by layer, obtaining an Embedding similarity between the to-be-retrieved vector and the traversed nodes based on an Embedding model, and obtaining a fine candidate text set; adopting the enhanced Reranker model to reorder a union set of the global candidate text set and the fine candidate text set, and obtaining a retrieval result.

[0005] Optionally, GMM clustering is performed on the nodes, and a structured summary of each cluster is obtained as a dynamic clustering center in the GMM clustering process by using the LLM, and the structured summary after the clustering iteration is ended is taken as a node of a next layer of the multi-dimensional system document tree, until the entire multi-dimensional system document tree is obtained by clustering convergence, including: In the process of generating the node of the new layer of the multi-dimensional system document tree by GMM clustering, dynamic clustering is iteratively performed by an EM algorithm, wherein every specified number of iterations, a structured summary of a current cluster of a node of a previous layer is generated by using the LLM, and a clustering center of a next generation cluster corresponding to the current cluster is updated by using the structured summary; In a case where the current cluster meets the new layer convergence condition, the structured summary of the current cluster is taken as the node of the new layer; The number of clusters is reduced layer by layer until the root node.

[0006] Optionally, for each cluster, a structured summary is generated by using the LLM to obtain posterior probability TOPk nodes therein, and is taken as a node of a new layer corresponding to the current cluster.

[0007] Optionally, GMM clustering is iteratively performed on the nodes, including: In the process of generating the node of the second layer and above: The nodes of the previous layer are preliminarily clustered by using a Kmeans++ algorithm to determine preliminary clustering centers; The posterior probability of each node of the previous layer relative to the preliminary clustering centers is calculated; Based on the posterior probability, the mixing weight, the clustering center and the covariance matrix of the GMM clustering are updated, and a new cluster is generated according to the updated clustering center. The posterior probability of each node of the previous layer relative to the updated clustering center is calculated, and the step of updating the mixing weight, the clustering center and the covariance matrix of the GMM clustering based on the posterior probability, and generating a new cluster according to the updated clustering center is returned.

[0008] Optionally, based on the posterior probability, updating the mixing weight, cluster center and covariance matrix of the GMM cluster, and generating a new cluster according to the updated cluster center, comprising: updating the mixing weight, cluster center and covariance matrix of the GMM cluster based on the posterior probability, determining the number of iterations of the current GMM cluster, and when the number of iterations reaches a specified number of times, for each cluster: obtaining a structured summary of the top k nodes in each cluster by LLM, and using the structured summary Embedding embedding vector to combine the cluster center for mean correction to obtain the new cluster center of the next generation cluster of the cluster; performing the next generation GMM clustering according to the new cluster center.

[0009] Optionally, according to the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the multi-dimensional system document tree, the positive and negative samples corresponding to the document block are determined, comprising: For each first layer node, the nodes in the multi-dimensional system document tree that satisfy at least one of the following relationships are taken as the positive samples of the document block corresponding to the first layer node: The child nodes and / or grandchild nodes of the first layer node; Different hierarchical nodes with a shortest tree path distance of no more than 3 and a hierarchical relationship of no more than 2 from the first layer node; The same layer sibling nodes of the first layer node belonging to the same subtree; For each first layer node, the nodes in the multi-dimensional system document tree that satisfy at least one of the following relationships are taken as the negative samples of the document block corresponding to the first layer node: Nodes with a shortest tree path distance greater than 5 from the first layer node; Same layer nodes belonging to different subtrees with the first layer node; Nodes with an Embedding similarity higher than 0.8 but irrelevant to the first layer node in terms of semantics determined by the LLM.

[0010] Optionally, the positive samples, positive sample scores, negative samples and negative sample scores corresponding to each document block are determined, comprising: The positive sample score between each document block and the corresponding positive sample is determined according to the first structure score, semantic score and abstract consistency score between them, wherein the first structure score is determined according to the topological proximity between the node corresponding to the document block and the node corresponding to the positive sample; determine a negative sample score between the document block and the corresponding positive sample according to a second structure score, a semantic score and an abstract consistency score between the document block and the corresponding negative sample, wherein the second structure score is determined according to topological proximity between the node corresponding to the document block and the node corresponding to the negative sample.

[0011] Optionally, the corresponding positive sample, the positive sample score, the negative sample and the negative sample score of each document block are determined according to the vector representation of the document block and the hierarchical relationship and / or path distance between other nodes in the multi-dimensional system document tree, comprising: Based on each document block, the topological proximity between the node corresponding to the document block and the node corresponding to the corresponding positive sample or negative sample is obtained, and the topological proximity is Based on the following formula:

[0012] Wherein, N i denotes the node corresponding to the document block, N j denotes the node corresponding to the positive sample or negative sample, h max denotes the maximum hop count, l i denotes the level to which the node corresponding to the document block belongs, l j denotes the level to which the node corresponding to the positive sample or negative sample belongs; For each document block, the corresponding semantic score is obtained based on the following formula:

[0013] Wherein, e i denotes the vector representation of the document block, e j denotes the vector representation of the positive sample or negative sample, d i denotes the content of the document block, d j denotes the content of the positive sample or negative sample, and normalize denotes the BM25 score normalization function of all documents; For each document block, if the corresponding positive sample or negative sample of the document block belongs to the refinement of the document block based on LLM, the corresponding abstract consistency result is given a high value, if the corresponding positive sample or negative sample of the document block belongs to the reverse refinement of the document block based on LLM, the corresponding abstract consistency result is given a medium value, and if the corresponding positive sample or negative sample of the document block does not have the relationship of refinement and reverse refinement, the corresponding abstract consistency result is assigned a value of zero; The corresponding positive sample score or negative sample score ​obtained by weighted summation of the topological proximity, semantic score and abstract consistency results: .

[0014] Optionally, based on the first cosine similarity between the to-be-retrieved vector representation and the nodes in the multi-dimensional system document tree except the root node, a global candidate text set is obtained, including: Starting from the root node, the Embedding similarity between each node in the current layer and the to-be-retrieved vector is calculated, and if the Embedding similarity is higher than a preset global threshold, the node is recorded in the global candidate text set; Starting from the root node, the nodes of the multi-dimensional system document tree are pruned and traversed layer by layer, the Embedding similarity between the traversed nodes and the to-be-retrieved vector is obtained based on the Embedding model, and a global and fine candidate text set is obtained, including: Starting from the root node, the Embedding similarity between each node in the current layer and the to-be-retrieved vector is calculated, and if the Embedding similarity is lower than a preset pruning threshold, the node corresponding to the subtree is skipped, wherein the preset pruning threshold is less than the preset global threshold; If the Embedding similarity is higher than or equal to the preset pruning threshold, recursively enter the next level in the subtree of the node, traverse each node in the next level, calculate the second cosine similarity between the node and the to-be-retrieved vector, and record the second cosine similarity TOPk nodes in the next level in the fine candidate text set.

[0015] In another aspect, an electronic device is provided, including: a processor; a memory, the memory storing computer readable instructions, the computer readable instructions being executed by the processor to implement the above method.

[0016] The technical scheme provided by the embodiments of the present application has at least the following beneficial effects: The embodiment of the application obtains the multi-dimensional system document tree which can optimize the Embedding model and the Reranker model by first performing sliding block processing on the sample documents of the associated knowledge base, combining GMM algorithm iterative clustering, and using the document block summary obtained by the posterior probability and LLM to optimize the clustering center, so as to obtain more interpretable positive and negative samples based on the hierarchical relationship and path distance of the multi-dimensional system document tree, and then realize the explicit representation mining of the knowledge system of the knowledge base based on the document tree structure, so that the Embedding model and the Reranker model learn the domain knowledge in the associated knowledge base. In this way, the optimization mode of the tree derivative sample backfeeding model is used, so that the model can obtain more accurate and comprehensive answers combined with domain knowledge, logical coherence and semantic consistency based on global retrieval and pruning retrieval of the multi-dimensional system document tree when subsequently retrieving query text, form a closed loop iteration of the perception of the tree structure on the knowledge system and the semantic understanding of the model, and thus avoid missing the associated information in the professional field in the retrieval process. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0018] Figure 1 is a first flowchart of a retrieval method based on collaborative document tree reconstruction provided by the embodiment of the present application; Figure 2 is a second flowchart of a retrieval method based on collaborative document tree reconstruction provided by the embodiment of the present application; Figure 3 is a system block diagram of a retrieval device based on collaborative document tree reconstruction provided by the embodiment of the present application; Figure 4 is a system block diagram of an electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION

[0019] The present application will be described in detail below in combination with the specific implementation manners shown in the drawings, but these implementation manners do not limit the present application, and the changes in structure, method or function made by those skilled in the art based on these implementation manners are all included in the protection scope of the present application.

[0020] General pre-training models such as BERT (Bidirectional Encoder Representations from Transformers), ColBERT (Contextualized Late Interaction over BERT, an improved ranking model based on BERT) often fail to incorporate professional semantic features in the professional field when retrieving documents in the professional field. For example, in medical literature, the "drug side effects" and "clinical trial conclusions" of some drugs need professional medical support to obtain the implicit association between the two. If a general pre-training model is used to retrieve drug side effects based on literal similarity, the "clinical trial conclusion" part will be missed, resulting in missed key information.

[0021] To solve the above problems, the embodiment of the application provides a retrieval method based on collaborative document tree reconstruction, comprising: S101: Obtain a plurality of sample documents belonging to the same field as the query text to be retrieved, and perform block processing on the plurality of sample documents through a sliding window to obtain a plurality of document blocks; S102: Generate a vector representation of each document block using a vector representation Embedding model, and use the vector representation of each document block as the first layer node of a multi-dimensional system document tree. Perform GMM (Gaussian Mixture Model) clustering on the node, and use LLM (Large Language Model) to obtain a structured summary of each clustering cluster as a dynamic clustering center during GMM clustering. The structured summary after GMM clustering iteration is used as the next layer node of the multi-dimensional system document tree, until the entire multi-dimensional system document tree is obtained by clustering convergence; S103: According to the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the multi-dimensional system document tree, determine the positive sample, positive sample score, negative sample and negative sample score corresponding to the document block, and obtain five training samples; S104: Enhance the Embedding model and Reranker model based on the five training samples; S105: Convert the query text into a to-be-retrieved vector representation based on the enhanced Embedding model; S106: Obtain a global candidate text set based on the first cosine similarity between the to-be-retrieved vector representation and the nodes in the multi-dimensional system document tree except the root node; S107: Starting from the root node, pruning layer by layer to traverse the nodes of the multi-dimensional system document tree, obtaining the Embedding similarity between the traversed nodes and the Embedding of the to-be-retrieved vector based on the Embedding model, and obtaining a fine candidate text set; S108: Using the enhanced Reranker model to reorder the union of the global candidate text set and the fine candidate text set, and obtaining the retrieval result.

[0022] In the above step S101, a plurality of document chunks can constitute a retrieval text pool. Since the plurality of documents belonging to the same field as the query document are used to construct a unified retrieval text pool for the query document in a professional field, the subsequent model can learn the knowledge of the professional field. In the processing process of the sliding window, a sliding window can be used for each document, and the document is processed by block according to the basic semantic unit with complete context, and the length of the divided document block can adapt to the input length limit of the vector representation Embedding model.

[0023] The LLM in the above step S102 can be a deep neural network architecture with a super large number of parameters and constructed by an attention mechanism, which can realize cross-modal semantic understanding and generation. The LLM has context perception ability formed by training a large amount of language and text materials. After generating the dynamic clustering center of each clustering cluster by GMM clustering combined with LLM, the structured summary is taken as the next layer node of the multi-dimensional system document tree after the clustering iteration of each layer is completed, until the clustering converges to the root node, and the whole multi-dimensional system document tree is obtained.

[0024] The Embedding (vector representation model) in the above step S102 can map the unstructured original data to a continuous numerical space, so as to convert the original data into a dense vector carrying semantic association information of the original data. The Embedding model can establish a nonlinear mapping relationship from symbol to geometric space through an embedding matrix, and the vector dimension range can be adaptively adjusted according to the application scenario. The vector representation of each document block is taken as the first layer node of the multi-dimensional system document tree, GMM clustering is performed on the node to obtain a plurality of clusters, LLM is used to obtain a structured summary of each cluster, and the structured summary is taken as the next layer node of the multi-dimensional system document tree. In this way, each layer node is clustered, and a multi-dimensional system document tree is obtained, which provides a document basis for subsequent retrieval.

[0025] In step S103, for each document block, the positive sample, the positive sample score, the negative sample, and the negative sample score corresponding to the document block are determined according to the vector representation of the document block and the hierarchical relationship and / or path distance between other nodes in the multidimensional system document tree, based on the topological structure of the multidimensional system document tree, to obtain the five-element training sample corresponding to the document block. The five-element training sample corresponding to each document block is obtained by constructing the five-element training sample corresponding to the document block using the obtained each positive sample, the positive sample score corresponding to each positive sample, each negative sample, and the negative sample score corresponding to each negative sample.

[0026] In step S104, the Embedding model and the Reranker model are open source models, which belong to general field models. The retrieval effect of the text library with a professional field may not be accurate, and therefore the Embedding model and the Reranker model need to be fine-tuned. The sample set of the five-element training sample is fine-tuned through the positive sample score and the negative sample score, so as to fine-tune the Embedding model and the Reranker model based on the fine-tuned five-element training sample, so that they are more suitable for the retrieval scene of the professional field.

[0027] In steps S105 and S106, the enhanced Embedding model is used to perform text vector representation on the query text to obtain the corresponding to-be-retrieved vector representation. The first cosine similarity between the to-be-retrieved vector representation and each node in the multidimensional system document tree except the root node is calculated, and the document block with the highest TOP-K first cosine similarity is selected as the corresponding global candidate text set according to the obtained each first cosine similarity.

[0028] In steps S107 and S108, the nodes of the multidimensional system document tree are pruned and traversed layer by layer from the root node of the multidimensional system document tree. For each traversed node, the Embedding similarity between the traversed node and the to-be-retrieved vector is obtained based on the Embedding model, and the corresponding fine candidate text set is determined according to the obtained each Embedding similarity. The enhanced Reranker model is used to rearrange the union set of the global candidate text set and the fine candidate text set, calculate the relevance score between the query text and each candidate text in the union set, sort the candidate texts in descending order of the relevance score, and select the candidate texts with high ranking as the retrieval result of the query text.

[0029] The embodiment of the application obtains a multi-dimensional system document tree that can optimize the Embedding model and the Reranker model by performing sliding block processing on sample documents of the associated knowledge base, combining GMM algorithm iterative clustering, and using the document block summary obtained by the LLM to optimize the clustering center, so that more interpretable positive and negative samples are obtained based on the hierarchical relationship and path distance of the multi-dimensional system document tree, and then the knowledge system explicit representation mining of the knowledge base is realized based on the document tree structure, so that the Embedding model and the Reranker model learn the domain knowledge in the associated knowledge base. In this way, the optimization mode of the tree derivative sample back to the model is used, so that the model can obtain more accurate and comprehensive answers combined with domain knowledge, logical coherence and semantic consistency based on global retrieval and pruning retrieval of the multi-dimensional system document tree when subsequently retrieving query text, forming a closed loop iteration of the perception of the tree structure to the knowledge system and the semantic understanding of the model, thereby avoiding missing the associated information in the professional field in the retrieval process.

[0030] In an embodiment of the application, the GMM clustering is performed on the nodes, and the LLM is used to obtain a structured summary of each cluster, and the structured summary is used as a node of a next layer of the multi-dimensional system document tree, to obtain a multi-dimensional system document tree including the first layer of nodes and multi-layer structured summaries, including: in the process of generating a node of a new layer of the multi-dimensional system document tree by GMM clustering, performing dynamic clustering by the EM algorithm iteratively, wherein every specified number of iterations, the LLM is used to generate a structured summary of a current cluster of a node of a previous layer, and the structured summary is used to update a clustering center of a next generation cluster corresponding to the current cluster; in the case that the current cluster meets the convergence condition of the new layer, the structured summary of the current cluster is used as the node of the new layer; and the number of clusters is reduced layer by layer until the root node.

[0031] For example, for each cluster, the structured summary is generated by using the LLM to obtain the posterior probability TOPk nodes in the cluster, as a node of a new layer corresponding to the current cluster.

[0032] In the embodiment, the dynamic clustering algorithm combining the GMM model and the LLM model combines the semantic summary generated by the LLM with the cluster generated by the GMM, and constructs a multi-dimensional system document tree with a semantic hierarchical structure based on the results of the clustering. By iteratively optimizing the clustering parameters and using the ability of the LLM to generate a text summary, the interpretability and semantic consistency of the clustering are significantly improved.

[0033] In an embodiment of the application, the GMM clustering is iteratively performed on the nodes, including: in the process of generating nodes of the second layer and above: determine a preliminary clustering center of each upper layer node through a Kmeans++ algorithm; calculate a posterior probability of each upper layer node relative to the preliminary clustering center; update the mixing weight, clustering center and covariance matrix of the GMM cluster based on the posterior probability, and generate a new cluster according to the updated clustering center; calculate a posterior probability of each upper layer node relative to the updated clustering center, and return to the step of updating the mixing weight, clustering center and covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster according to the updated clustering center.

[0034] In an embodiment of the present application, updating the mixing weight, clustering center and covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster according to the updated clustering center comprises: updating the mixing weight, clustering center and covariance matrix of the GMM cluster based on the posterior probability; judging the number of iterations of the current GMM cluster, and when the number of iterations reaches a specified number of times, for each cluster: obtaining a structured summary of the top k nodes in each cluster with a posterior probability through an LLM, and adopting an Embedding embedding vector of the structured summary to combine the clustering center for mean correction to obtain a new clustering center of the next generation of clusters of the cluster; performing the next generation of GMM clustering according to the new clustering center.

[0035] In this embodiment, the semantic summary generated by the LLM is combined with the GMM clustering, the clustering center is adaptively and dynamically corrected through the embedding vector of the structured summary and the mixing weight of the distance from the clustering center, and the high-confidence samples are screened by using the probability sampling strategy, so that the hierarchical semantic reorganization of the document set is realized, and a multi-dimensional system document tree including a topic layer (i.e. a center node layer of the structured summary), a leaf node layer (a node layer of each document block) and a topological structure of associated edges can be constructed.

[0036] In a specific embodiment of the present application, the first layer node of the multi-dimensional system document tree can be any one of the document blocks in the above-mentioned retrieval text pool. Assuming that there are n document blocks in the retrieval text pool, the retrieval text pool can be represented in the following form:

[0037] wherein, the first to n-th nodes are represented.

[0038] For each document block, a vector representation of the document block is generated through an Embedding model, that is,

[0039] In the embodiments of the present application, the generation process of the second layer and the nodes above the second layer obtained by dynamically clustering the vector representation of the document blocks can be implemented in the following manner: Step one: input the initialization parameters of GMM and LLM.

[0040] The initialization parameters can include, but are not limited to, the number of initial clusters of GMM: , n represents the number of document blocks, and the instruction template for constructing the LLM model .

[0041] Exemplarily, the instruction template is: please use [domain keywords] to refine the core semantics and content summary of this part of the document block. The number of sampled document blocks is m, the specified number of iterations of LLM is , the maximum number of iterations of GMM is T. The embedding model is represented as , and the LLM generation function is represented as .

[0042] Step two, in the process of generating the nodes of the new layer of the multi-dimensional system document tree by clustering through GMM, the following dynamic clustering is performed by updating the cluster center iteration through the EM algorithm combined with LLM: Step a, initialization of GMM parameters, the initial cluster centers of the vector representation of each document block are determined using the K-means++ algorithm, the initial value of the mean corresponding to each initial cluster center is calculated, the initial value of the covariance matrix of each initial cluster center is a unit matrix, and the initial value of the weight of each initial cluster center is , k represents the number of cluster centers; Step b, the parameters of GMM are updated for multiple iterations through the EM algorithm iteration, each iteration includes E step and M step: E step: under the current parameters of GMM, the posterior probability of the cluster center of the document block is calculated, which represents the probability value of the document block belonging to the cluster center , and the formula of the posterior probability is: ; wherein, represents the probability density function of the Gaussian distribution, represents the vector representation corresponding to the document block , and k represents the number of cluster centers.

[0043] M step: updating the mean according to the posterior probability obtained in the E step , covariance matrix , weight ; ; ; ; The E step and the M step are repeatedly performed until the number of iterations reaches , for each cluster center , according to the posterior probability obtained in the th iteration , the weight of the cluster center is updated according to the posterior probability , nodes are sampled from the cluster where the cluster center is located, and the LLM is guided by the instruction template Prompt to generate a structured summary corresponding to the content of the nodes ; the vector representation of the structured summary is updated to , and the mean of the cluster center is updated to , resulting in a revised mean , which is represented as: ; ; ;

[0044] where represents the weight of the vector representation of the structured summary , and represents a small constant to prevent division by zero. In the

[0045] th iteration, the revised mean is used as the new cluster center of the GMM, and the E step and the M step are repeatedly performed with the mean , covariance matrix , and weight until the parameters converge or the maximum number of iterations T is reached, and the structured summary corresponding to each cluster center obtained at the current time is used as the node of the current layer. where the condition for parameter convergence is that the log-likelihood in the iteration process is less than a small constant

[0046] :

[0047] ​​wherein the log-likelihood is calculated as:

[0048] wherein, denotes the specified number of iterations of LLM in the process of iteration of clustering centers, and means that in the iteration of clustering centers Compared with step iteration, the log-likelihood does not change significantly, denotes the number of clustering centers, n denotes the number of document numbers, and N denotes the total number of documents.

[0049] Step three, when k is equal to 1, stop iteration, and obtain the structured summary corresponding to the 1 clustering center as the root node.

[0050] In an embodiment of the present application, the positive sample and the negative sample corresponding to each document block are determined according to the vector representation of the document block and the hierarchical relationship and / or path distance between other nodes in the multi-dimensional system document tree, comprising: For each first layer node, the nodes in the multi-dimensional system document tree satisfying at least one of the following relationships are taken as the positive sample of the document block corresponding to the first layer node: The child node and / or the grandchild node of the first layer node; The different hierarchical nodes with the shortest tree path distance not greater than 3 and the hierarchical relationship not greater than 2 from the first layer node; The same layer sibling nodes belonging to the same sub-tree as the first layer node.

[0051] The node attributes of each node in the multi-dimensional system document tree include original text , summary , embedding vector , hierarchical depth , parent / node relationship, wherein the original text The document block corresponding to the leaf node of the multi-dimensional system document tree.

[0052] The multi-dimensional system document tree is traversed by a breadth-first traversal algorithm, and a graph representation corresponding to the multi-dimensional system document tree is constructed , wherein the nodes of the multi-dimensional system document tree are represented by , the edge weights between the node relationships of the multi-dimensional system document tree, which are represented by the hop distance between nodes, for example, the edge weight of the parent-child relationship between nodes is 1, and the edge weight of the sibling relationship between nodes is 0.5. The Floyd-Warshall algorithm is used to calculate the shortest tree path distance between any two nodes.

[0053] Each first layer node is determined The positive samples of the corresponding document blocks are generated by the following three rules: (1) Direct association rule: the document blocks corresponding to the child nodes and grandchild nodes of the first layer node (2) Cross-layer association rule: the document blocks corresponding to the non-same-layer nodes with a shortest tree path distance of no more than 3 from the first layer node (3) Same-level extension rule: the document blocks corresponding to the same-layer sibling nodes belonging to the same sub-tree of the first layer node

[0054] By way of example, the same-layer sibling nodes can be nodes determined by the LLM to have similar semantics to the content of the first layer node

[0055] In an embodiment of the present application, for each first layer node, the nodes in the multi-dimensional system document tree satisfying at least one of the following relationships are taken as the negative samples of the document blocks corresponding to the first layer node: nodes with a shortest tree path distance greater than 5 from the first layer node; same-layer nodes belonging to different sub-trees of the first layer node; nodes with an Embedding similarity higher than 0.8 to the first layer node but determined by the LLM to be irrelevant in semantics to the first layer node.

[0056] To determine the negative samples of the document blocks corresponding to each first layer node the following three rules are used to generate the corresponding negative samples: long-distance random sampling rule: the document blocks corresponding to nodes with a shortest tree path distance greater than 5 from the first layer node same-layer heterogeneous rule: the document blocks corresponding to same-layer nodes belonging to different sub-trees of the first layer node semantic opposition rule: the document blocks corresponding to nodes with an Embedding similarity higher than 0.8 to the first layer node but determined by the LLM to be irrelevant in semantics to the first layer node The semantic opposition negative samples can be designed specifically for cross-domain confusion scenarios (such as similar but different medical terms and legal terms), and can enhance the discriminative ability of the model in the vertical field.

[0057] In this embodiment, by using the generation mechanism of dynamic positive and negative samples, the hierarchical perception sampling of the multi-dimensional system document tree is used to capture cross-level dependencies, generate positive and negative samples of document blocks, and combine the adversarial negative samples to enhance the robustness of the model.

[0058] In an embodiment of the present application, as Figure 2 ​​​​​​As shown, determining the positive sample corresponding to each document block, the positive sample score, the negative sample and the negative sample score, comprising: S201, determining the positive sample score between each document block and the corresponding positive sample according to the first structure score, the semantic score and the abstract consistency score between the document block and the corresponding positive sample, wherein the first structure score is determined according to the topological proximity between the node corresponding to the document block and the node corresponding to the positive sample; S202, determining the negative sample score between each document block and the corresponding negative sample according to the second structure score, the semantic score and the abstract consistency score between the document block and the corresponding positive sample, wherein the second structure score is determined according to the topological proximity between the node corresponding to the document block and the node corresponding to the negative sample.

[0059] In this embodiment, the structure score, the semantic score and the abstract consistency score between the document block and the positive and negative samples are calculated, and the generation and evaluation of the positive and negative samples are realized from the scoring angles of the three dimensions of topological structure, semantic matching and abstract logic, which significantly strengthens the representation ability of the model to complex semantic relationships.

[0060] Exemplarily, the process of obtaining the positive sample score or the negative sample score of each document block and the corresponding positive sample or negative sample can be but not limited to realized by the following way: (1) Based on each document block, the topological proximity between the node corresponding to the document block and the node corresponding to the corresponding positive sample or negative sample is obtained, and the topological proximity is obtained based on the following formula:

[0061] Wherein, Ni represents the node corresponding to the document block, Nj represents the node corresponding to the positive sample or the negative sample, h max representing the maximum number of preset jump nodes (this value represents the maximum number of jumps of the shortest tree path between the node corresponding to the document block and the positive sample node), representing the larger level of the level to which the document block belongs and the level corresponding to the positive sample or the negative sample, representing the shortest tree path distance between the node corresponding to the document block and the positive sample or negative sample node, l i representing the level to which the node corresponding to the document block belongs, l j representing the level to which the node corresponding to the positive sample or the negative sample belongs. The first structure score is represented by the topological proximity between nodes. When the nodes are in the same level and the path is short, the value of the topological proximity tends to 1.

[0062] (2) For each document block, the corresponding semantic score is obtained based on the following formula to determine the cosine similarity matching result of the normalized BM25 word frequency of the document block and the corresponding positive sample or negative sample;

[0063] wherein, , e i characterizes the vector representation of the document block, e j characterizes the vector representation of the positive or negative sample, d j characterizes the content of the positive or negative sample, normalize represents the BM25 score normalization function of all documents. Combining the embedding cosine similarity with the BM25 word frequency matching can overcome the limitations of single model for long-tail vocabulary or semantic ambiguity.

[0064] (3) For each document block, if the corresponding positive or negative sample of the document block belongs to the refinement of the document block based on the LLM, the corresponding abstract consistency result is assigned a high value, if the corresponding positive or negative sample of the document block belongs to the inverse refinement of the document block based on the LLM, the corresponding abstract consistency result is assigned a medium value, if the corresponding positive or negative sample of the document block does not have the relationship of refinement and inverse refinement, the corresponding abstract consistency result is assigned zero.

[0065] Exemplarily, the formula of the abstract consistency result is: ; wherein, represents the content of the document block, represents the content of the corresponding positive or negative sample.

[0066] (4) The corresponding positive sample score or negative sample score is obtained by the following formula: .

[0067] characterizes the positive sample score or negative sample score.

[0068] When Nj represents a positive sample, characterizes the positive sample score; when Nj represents a negative sample, characterizes the negative sample score.

[0069] For each document block , according to the corresponding positive sample set , the corresponding positive sample score , the negative sample set and the corresponding negative sample score , the corresponding five-element training sample is obtained. For each document block The positive and negative samples of the positive sample and the negative sample are generated according to the score calculation mode, so that the Embedding model and the Reranker model can be fine-tuned.

[0070] The Embedding model fine-tuning needs to select a pre-trained Embedding encoder (such as BERT, Jina embedding, etc.). For example, the contrast learning method can be used: Obtain each document block The corresponding positive sample set , the negative sample set , and the corresponding three tuple training set For the pre-trained Emebdding model, the InfoNCE loss function is constructed. The pre-trained Emebdding model is fine-tuned and trained based on the three tuple training set and the InfoNCE loss function , wherein the InfoNCE loss function is expressed as:

[0071] , wherein the positive sample set , the positive example of one positive sample is , the negative sample set , and the negative example of one negative sample is , represents the cosine similarity after encoding embedding and the cosine similarity after encoding embedding, represents the cosine similarity after encoding embedding and the cosine similarity after encoding embedding, is a temperature coefficient, which can be set to 0.05-0.1.

[0072] The Reranker model fine-tuning needs to select the Cross-Encoder architecture corresponding to the Embedding model, such as CrossEncoders, Jina reranker, etc. For each document block , according to the corresponding positive sample set , the corresponding positive sample score , the negative sample set , and the corresponding negative sample score , the corresponding five tuple training sample is obtained. The Pairwise Ranking loss function and the five tuple training sample are used to fine-tune the Reranker model. The Pairwise Ranking loss function is expressed as:

[0073] wherein, is a sigmoid activation function. The E embedding model and the reranker model can be fine-tuned by the above two steps.

[0074] The query text is converted into a to-be-retrieved vector representation according to the enhanced Embedding model, and based on a first cosine similarity between the to-be-retrieved vector representation and nodes in the multi-dimensional system document tree except the root node, a Top-k nodes with the highest first cosine similarity are selected to obtain a global candidate text set. The query text is preliminarily retrieved.

[0075] In an embodiment of the present application, the global candidate text set is obtained based on the first cosine similarity between the to-be-retrieved vector representation and the nodes in the multi-dimensional system document tree except the root node, and includes: starting from the root node, calculating an Embedding similarity between each node in the current layer and the to-be-retrieved vector, and if the Embedding similarity is higher than a preset global threshold, the node is recorded in the global candidate text set.

[0076] In an embodiment of the present application, starting from the root node, the nodes of the multi-dimensional system document tree are pruned and traversed layer by layer, and an Embedding similarity between the traversed node and the to-be-retrieved vector is obtained based on the Embedding model to obtain a fine candidate text set, and includes: starting from the root node, calculating an Embedding similarity between each node in the current layer and the to-be-retrieved vector, and if the Embedding similarity is lower than a preset pruning threshold, the node corresponding to the sub-tree is skipped, wherein the preset pruning threshold is less than the preset global threshold; if the Embedding similarity is higher than or equal to the preset pruning threshold, recursively entering a next layer in the sub-tree of the node, traversing each node in the next layer, calculating a second cosine similarity between the node and the to-be-retrieved vector, and recording the Top-k nodes in the next layer in the fine candidate text set .

[0077] For example, the preset pruning threshold is set to 0.2.

[0078] In this embodiment, coarse selection is performed by full node traversal retrieval on the multi-dimensional system document tree to obtain a global candidate text set, fine selection is performed by combining the recursive abstraction retrieval of the LLM with the dynamic pruning optimization of the tree structure to obtain a fine candidate text set, and the coarse selection and fine selection are retrieved asynchronously and concurrently to significantly improve the retrieval efficiency and accuracy.

[0079] The enhanced Reranker model is used to retrieve the union set of the global candidate text set and the fine candidate text set The union set is input into the enhanced Reranker model, the relevance scores between the query text and the contents of each node in the union set are calculated , the contents of each node are rearranged based on the ranking of the relevance scores , and the rearranged results are output as the retrieval results corresponding to the query text. As shown in , the present application provides a retrieval device based on collaborative document tree reconstruction, comprising:

[0080] The block module 301 is used to obtain a plurality of sample documents belonging to the same field as the query text to be retrieved, and perform block processing on the plurality of sample documents through a sliding window to obtain a plurality of document blocks. Figure 3 The clustering module 302 is used to generate a vector representation of each document block using a vector representation Embedding model, and use the vector representation of each document block as the first layer node of a multi-dimensional system document tree to perform Gaussian Mixture Model (GMM) clustering on the node, and use a Large Language Model (LLM) to obtain a structured abstract of each cluster as a dynamic clustering center during the GMM clustering process. The structured abstract after the GMM clustering iteration is ended is used as the next layer node of the multi-dimensional system document tree, until the complete multi-dimensional system document tree is obtained by clustering convergence. The sample acquisition module 303 is used to determine the positive sample, positive sample score, negative sample, and negative sample score corresponding to each document block according to the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the multi-dimensional system document tree, and obtain five training samples. The model enhancement module 304 is used to enhance the Embedding model and the rearrangement Reranker model based on the five training samples. ​​​The global candidate text module 305 is configured to convert the query text into a to-be-retrieved vector representation based on the enhanced Embedding model, and obtain a global candidate text set based on a first cosine similarity between the to-be-retrieved vector representation and nodes in the multi-dimensional system document tree except the root node. The fine candidate text module 306 is configured to prune and traverse the nodes of the multi-dimensional system document tree layer by layer from the root node, and obtain a fine candidate text set based on an Embedding similarity between the to-be-retrieved vector and the traversed nodes. The retrieval module 307 is configured to reorder the union of the global candidate text set and the fine candidate text set by using an enhanced Reranker model, and obtain a retrieval result.

[0081] Optionally, the clustering module 302 is specifically configured to: In the process of generating the nodes of a new layer of the multi-dimensional system document tree by GMM clustering, the dynamic clustering is iteratively performed by an EM algorithm, wherein every specified number of iterations, a structured summary of a current cluster of the nodes of a previous layer is generated by using an LLM, and a cluster center of a next generation cluster corresponding to the current cluster is updated based on the structured summary; In a case where the current cluster meets the new layer convergence condition, the structured summary of the current cluster is taken as the nodes of the new layer; The number of clusters is reduced layer by layer until the root node.

[0082] Optionally, for each cluster, a structured summary of TOPk nodes in the cluster with a posterior probability obtained by the LLM is generated as a node of a new layer corresponding to the current cluster.

[0083] Optionally, the clustering module 302 is specifically configured to: In the process of generating the nodes of the second layer and the layers above the second layer: The nodes of a previous layer are preliminarily clustered by using a Kmeans++ algorithm to determine preliminary cluster centers; The posterior probability of each node of the previous layer relative to the preliminary cluster centers is calculated; Based on the posterior probability, the mixture weight, the cluster center and the covariance matrix of the GMM clustering are updated, and new clusters are generated based on the updated cluster center; The posterior probability of each node of the previous layer relative to the updated cluster center is calculated, and the step of updating the mixture weight, the cluster center and the covariance matrix of the GMM clustering based on the posterior probability, and generating new clusters based on the updated cluster center is returned.

[0084] Optionally, the clustering module 302 is specifically configured to: updating, based on the posterior probability, a mixture weight, a cluster center, and a covariance matrix of the GMM cluster, determining a number of iterations of the current GMM cluster, and when the number of iterations reaches a specified number of times, for each cluster: obtaining a structured summary of the top-k nodes in each cluster according to the LLM, and performing mean correction on the structured summary Embedding embedding vector combined with the cluster center to obtain a new cluster center of the next generation of clusters of the cluster; performing the next generation of GMM clustering according to the new cluster center.

[0085] Optionally, the sample obtaining module 303 is specifically configured to: for each first layer node, taking a node in the multi-dimensional system document tree satisfying at least one of the following relationships as a positive sample of the document block corresponding to the first layer node: a child node and / or a grandchild node of the first layer node; a different level node having a shortest tree path distance of no more than 3 and a level relationship of no more than 2 from the first layer node; a same level sibling node of the first layer node belonging to the same subtree; for each first layer node, taking a node in the multi-dimensional system document tree satisfying at least one of the following relationships as a negative sample of the document block corresponding to the first layer node: a node having a shortest tree path distance greater than 5 from the first layer node; a same level node belonging to a different subtree from the first layer node; a node having an Embedding similarity higher than 0.8 but being irrelevant in semantics to the first layer node according to the LLM.

[0086] Optionally, the sample obtaining module 303 is specifically configured to: determining a positive sample score between each document block and the corresponding positive sample according to a first structure score, a semantic score, and an abstract consistency score between the document block and the corresponding positive sample, wherein the first structure score is determined according to topological proximity between the node corresponding to the document block and the node corresponding to the positive sample; determining a negative sample score between each document block and the corresponding negative sample according to a second structure score, a semantic score, and an abstract consistency score between the document block and the corresponding negative sample, wherein the second structure score is determined according to topological proximity between the node corresponding to the document block and the node corresponding to the negative sample.

[0087] Optionally, the sample obtaining module 303 is specifically configured to: Based on each document block, the topological proximity between the document block and the node corresponding to the corresponding positive sample or negative sample is obtained, and the topological proximity is Based on the following formula: Wherein, N i represents the node corresponding to the document block, N j represents the node corresponding to the positive sample or negative sample, h max represents the maximum hop number, which can be set as a fixed constant of 3, l i represents the level to which the node corresponding to the document block belongs, l j represents the level to which the node corresponding to the positive sample or negative sample belongs; For each document block, the cosine similarity matching result of the normalized BM25 word frequency between the document block and the corresponding positive sample or negative sample is obtained based on the following formula to determine the corresponding semantic score

[0088] Wherein, e i represents the vector representation of the document block, e j represents the vector representation of the positive sample or negative sample, d i represents the content of the document block, d j represents the content of the positive sample or negative sample, and normalize represents the BM25 score normalization function of all documents; For each document block, if the corresponding positive sample or negative sample of the document block belongs to the refinement of the document block based on the LLM, the corresponding abstract consistency result is given a high value, if the corresponding positive sample or negative sample of the document block belongs to the reverse refinement of the document block based on the LLM, the abstract consistency result is given a medium value, and if the corresponding positive sample or negative sample of the document block does not exist refinement and reverse refinement relationship, the abstract consistency result is given a value of zero. The corresponding positive sample score or negative sample score The topological proximity, semantic score and abstract consistency result are weighted and summed to obtain: .

[0089] Optionally, the global candidate text module 305 is specifically configured to: Starting from the root node, the Embedding similarity between each node in the current layer and the to-be-retrieved vector is calculated layer by layer, and if the Embedding similarity is higher than a preset global threshold, the node is recorded in the global candidate text set; The fine candidate text module 306 is specifically configured to:​​​​ From the root node, the Embedding similarity of each node in the current layer and the to-be-retrieved vector is calculated layer by layer, and if the Embedding similarity is lower than a preset pruning threshold, the node corresponding to the sub-tree is skipped, wherein the preset pruning threshold is lower than the preset global threshold. If the Embedding similarity is higher than or equal to the preset pruning threshold, the next level in the sub-tree of the node is recursively entered, each node in the next level is traversed, the second cosine similarity of the node and the to-be-retrieved vector is calculated, and the second cosine similarity TOPk nodes in the next level are recorded in the fine candidate text set.

[0090] The application provides an electronic device, characterized by comprising a processor and a memory, wherein the memory stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the method.

[0091] Referring to Figure 4 In the implementation process, the electronic device can include a processor 401, a communication interface 402, a memory 403, and can be connected to each other in communication by other connection manners except a communication bus 404.

[0092] The memory 403 can be used to store a computer program, and the computer program can include instructions and data to implement the steps of any one of the above retrieval methods based on a collaborative document tree reconstruction. In the embodiment of the application, the memory 403 can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), flash memory, optical storage, and registers, etc. The memory 403 can include a hard disk and / or an internal memory.

[0093] The processor 401 can be a general processor, which can be a processor that performs specific steps and / or operations by reading and executing a computer program (e.g., a computer program) stored in a memory (e.g., the memory 403), and can use data stored in the memory (e.g., the memory 403) in the process of executing the steps and / or operations. The general processor can be, for example but not limited to, a central processing unit (CPU). In addition, the processor 401 can also be a special-purpose processor, which can be a processor specially designed to perform specific steps and / or operations. The special-purpose processor can be, for example but not limited to, ASIC, FPGA, etc. In addition, the processor 401 can also be a combination of multiple processors, such as a multi-core processor.

[0094] The communication interface 402 can include an input / output (I / O) interface, a physical interface, and a logical interface for realizing the interconnection of devices inside the network device, and an interface for realizing the interconnection of the network device and other devices (e.g., network devices). The communication network can be an Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 402 can be a module, a circuit, a transceiver, or any device capable of realizing communication.

[0095] In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 401 or the instructions in the form of software. The method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in the processor for execution. The software module can be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 403, and the processor 401 reads the information in the memory 403 and combines the hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.

[0096] It should be understood that the term "and / or" herein merely describes the association relationship of the associated objects, and can represent three relationships, for example, A and / or B can represent three cases of A alone, A and B together, and B alone, where A and B can be singular or plural. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after it, but can also represent an "and / or" relationship. The specific meaning can be understood in combination with the context before and after it.

[0097] In the present application, "at least one" means one or more, and "multiple" means two or more. "At least one of the following" or the like means any combination of the items, including a single item or any combination of multiple items. For example, at least one of a, b, or c can mean a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.

[0098] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0099] The communication interface is used for communication between the above electronic device and other devices. The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0100] It is to be noted that, in the present document, the terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between such entities or operations. Also, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the statement "comprising a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0101] Each of the embodiments in the present specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the description of the method embodiments.

[0102] The above merely describes the preferred embodiments of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application. Based on the same inventive concept, the embodiments of the present application also provide an electronic device, comprising: at least one memory and at least one processor, the at least one memory stores executable code, and the at least one processor is used to execute the executable code in the at least one memory to implement the training method of the image restoration model and / or the method of image restoration.

Claims

1. A retrieval method based on collaborative document tree reconstruction, characterized in that, The method includes: Obtain multiple sample documents belonging to the same domain as the query text to be retrieved, and divide the multiple sample documents into blocks using a sliding window to obtain multiple document blocks; A vector representation embedding model is used to generate a vector representation of each document block. The vector representation of each document block is used as the first-level node of the multidimensional system document tree. Gaussian mixture model (GMM) clustering is performed on the nodes. During the GMM clustering process, large language model (LLM) is used to obtain a structured summary of each cluster as a dynamic cluster center. The structured summary after the GMM clustering iteration is used as the next-level node of the multidimensional system document tree until the clustering converges to obtain a complete multidimensional system document tree. Based on the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the multidimensional system document tree, the positive sample, positive sample score, negative sample and negative sample score corresponding to the document block are determined to obtain the five-element training sample; The Embedding model and the Reranker model are enhanced based on the five-element training samples; The query text is transformed into a vector representation to be retrieved based on the enhanced Embedding model; Based on the first cosine similarity between the vector representation to be retrieved and the nodes in the multidimensional system document tree other than the root node, a global candidate text set is obtained; Starting from the root node, the nodes of the multidimensional system document tree are pruned and traversed layer by layer. Based on the Embedding model, the similarity between the traversed nodes and the Embedding of the vector to be retrieved is obtained to obtain a refined candidate text set. The enhanced Reranker model is used to rearrange the union of the global candidate text set and the refined candidate text set to obtain the retrieval results.

2. The method as described in claim 1, characterized in that, GMM clustering is performed on the nodes, and LLM is used during the GMM clustering process to obtain a structured summary of each cluster as a dynamic cluster center. The structured summary after the clustering iteration is completed is used as the next-level node of the multidimensional system document tree, until the clustering converges to obtain the entire multidimensional system document tree, including: In the process of generating nodes of the new layer of the multidimensional system document tree through GMM clustering, dynamic clustering is performed iteratively through the EM algorithm. Every specified number of iterations, LLM is used to generate a structured summary of the current cluster of the previous layer node, and the cluster center of the next generation cluster corresponding to the current cluster is updated with the structured summary. If the current cluster satisfies the convergence condition of the new layer, the structured summary of the current cluster is used as a node of the new layer; The number of clusters is reduced layer by layer until the root node is reached.

3. The method as described in claim 2, characterized in that, Using the structured summary of the current cluster as a node of the new layer includes: For each cluster, the TOPk nodes with posterior probabilities obtained through LLM are used to generate a structured summary, which is then used as the nodes of the new layer corresponding to the current cluster.

4. The method as described in claim 1, characterized in that, Iteratively perform GMM clustering on the nodes, including: During the generation of nodes at the second level and above: The Kmeans++ algorithm is used to perform preliminary clustering on the nodes of the previous layer to determine the preliminary cluster centers; Calculate the posterior probability of each node in the previous layer relative to the initial cluster center; Based on the posterior probability, the mixture weights, cluster centers, and covariance matrix of the GMM cluster are updated, and a new cluster is generated based on the updated cluster centers. The steps include calculating the posterior probability of each node in the previous layer relative to the updated cluster center, returning the mixture weights, cluster centers, and covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster based on the updated cluster centers.

5. The method as described in claim 4, characterized in that, Based on the posterior probability, the mixture weights, cluster centers, and covariance matrix of the GMM cluster are updated. Based on the updated cluster centers, new clusters are generated, including: Based on the posterior probability, update the mixture weights, cluster centers, and covariance matrix of the GMM cluster. Determine the current iteration count of the GMM clustering. When the iteration count reaches a specified number, for each cluster: The structured summary of the top k nodes with posterior probabilities in each cluster is obtained by LLM. The embedding vector of the structured summary is combined with the cluster center to perform mean correction, and the new cluster center of the next generation of the cluster is obtained. Based on the new cluster centers, perform next-generation GMM clustering.

6. The method as described in claim 1, characterized in that, Based on the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the multidimensional system document tree, determine the positive and negative samples corresponding to the document block, including: For each first-level node, nodes in the multidimensional system document tree that satisfy at least one of the following relationships are taken as positive samples of the document blocks corresponding to that first-level node: The child nodes and / or grandchild nodes of the first-level node; Nodes at different levels whose shortest tree path distance to the first-level node is no greater than 3 and whose hierarchical relationship is no greater than 2; The first-level node belongs to a sibling node at the same level in the same subtree; For each first-level node, a node in the multidimensional system document tree that satisfies at least one of the following relationships is taken as a negative sample of the document block corresponding to that first-level node: Nodes whose shortest tree path distance to the first-level node is greater than 5; Nodes at the same level as the first-level node that belong to a different subtree; A node whose embedding similarity to the first-layer node is higher than 0.8, but whose LLM determination is semantically unrelated to the first-layer node.

7. The method as described in claim 1, characterized in that, Determine the positive samples, positive sample scores, negative samples, and negative sample scores for each document block, including: The positive sample score between each document block and its corresponding positive sample is determined based on the first structural score, semantic score, and abstract consistency score between each document block and its corresponding positive sample, wherein the first structural score is determined according to the topological proximity between the node corresponding to the document block and the node corresponding to the positive sample. The negative sample score between a document block and its corresponding positive sample is determined based on the second structural score, semantic score, and abstract consistency score between each document block and its corresponding negative sample. The second structural score is determined according to the topological proximity between the node corresponding to the document block and the node corresponding to the negative sample.

8. The method as described in claim 1, wherein the positive sample, positive sample score, negative sample, and negative sample score corresponding to the document block are determined according to the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the multidimensional system document tree, comprising: For each document block, the topological proximity between that document block and the nodes corresponding to the corresponding positive or negative samples is obtained. Obtained based on the following formula: Where, N i N represents the node corresponding to this document block. j h represents the node corresponding to a positive or negative sample. max Represents the maximum number of hops, l i The level to which the node corresponding to this document block belongs, l j It represents the level to which the node corresponding to a positive or negative sample belongs; For each document block, the semantic score is determined by the cosine similarity matching result of the normalized BM25 term frequencies between the document block and the corresponding positive or negative sample, based on the following formula. ; Among them, e i The vector representation of this document block, e j The vector representation of a positive or negative sample, d i This indicates the content of the document block, d j It represents the content of positive or negative samples, and normalize represents the BM25 score normalization function for all documents; For each document block, if the positive or negative sample corresponding to that document block is determined based on LLM to belong to the refinement of that document block, then the corresponding abstract consistency result will be... If a high value is assigned, and based on LLM, the positive or negative sample corresponding to the document block is determined to be a reverse refinement of the document block, then the... Assign a moderate value; if there is no refinement / reverse refinement relationship between the positive or negative samples corresponding to the document block, then... Assign the value zero; The corresponding positive sample score or negative sample score The following is obtained by weighted summation of the topological proximity, semantic score, and abstract consistency results: 。 9. The method as described in claim 1, characterized in that, Based on the first cosine similarity between the vector representation to be retrieved and the nodes in the multidimensional system document tree (excluding the root node), a global candidate text set is obtained, including: Starting from the root node, calculate the embedding similarity between each node in the current layer and the vector to be retrieved. If the embedding similarity is higher than a preset global threshold, then the node is entered into the global candidate text set. Starting from the root node, the nodes of the multidimensional system document tree are pruned and traversed layer by layer. Based on the embedding model, the embedding similarity between the traversed nodes and the vector to be retrieved is obtained, resulting in a global and refined candidate text set, including: Starting from the root node, calculate the embedding similarity between each node in the current layer and the vector to be retrieved. If the embedding similarity is lower than a preset pruning threshold, skip the subtree corresponding to that node. The preset pruning threshold is less than the preset global threshold. If the embedding similarity is higher than or equal to the preset pruning threshold, then recursively enter the next level in the subtree of that node, traverse each node in the next level, calculate the second cosine similarity between that node and the vector to be retrieved, and record the top k nodes with the second cosine similarity in the next level into the refined candidate text set.

10. An electronic device, characterized in that, include: processor; A memory storing computer-readable instructions that, when executed by the processor, implement the method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Self-adaptive sensitive information intelligent identification method and device, equipment, storage medium and product

    CN119599130A

  • Document retrieval method based on multistage index and feature clustering

    CN120492611A

  • Apparatus and method for incremental physical data clustering

    US20110208737A1

Cited By

  • Text generation method based on large model, electronic equipment and storage medium

    CN122112212A

  • A large model-based text generation method, electronic equipment and storage medium

    CN122112212B

  • A hierarchical tree attention routing method, device and equipment for super-long context

    CN122364350A

  • A hierarchical tree attention routing method, device and equipment for super-long context

    CN122364350B