A search method based on collaborative document tree reconstruction

By employing a collaborative document tree reconstruction method, utilizing GMM clustering and LLM to generate structured summaries, constructing a multidimensional systematic document tree, and optimizing the Embedding and Reranker models, the problem of semantic structure confusion and accuracy in professional domain document retrieval is solved, achieving retrieval results with logical coherence and semantic consistency.

CN120994759BActive Publication Date: 2026-01-02HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

When using general large models to retrieve documents in highly specialized technical fields, existing technologies suffer from semantic confusion and low accuracy, especially in the medical and chemical fields, leading to the omission of key information.

Method used

A collaborative document tree reconstruction method is adopted, which processes sample documents in blocks through a sliding window, generates structured summaries using GMM clustering and large language model (LLM), constructs a multidimensional systematic document tree, determines positive and negative sample scores, and performs retrieval through enhanced embedding and reranker models. The nodes are pruned layer by layer to obtain a refined candidate text set, and finally the retrieval results are optimized.

Benefits of technology

It achieves logical coherence and semantic consistency in the retrieval of documents in professional fields, avoids missing key information, improves the accuracy and comprehensiveness of retrieval results, and forms a closed-loop iteration of explicit representation and semantic understanding of the knowledge system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994759B_ABST
    Figure CN120994759B_ABST
Patent Text Reader

Abstract

The application provides a retrieval method based on collaborative document tree reconstruction, taking the vector representation of each document block as the first layer node of a multi-dimensional system document tree, performing GMM clustering on the node, and combining the structured summary of the clustering center obtained by LLM as the next layer node of the document tree; based on the vector representation of each document block and the hierarchical relationship and / or path distance between other nodes in the tree, the Embedding model and the Reranker model are enhanced based on a five-element training sample; based on the first cosine similarity between the vector representation of the query text to be retrieved and the nodes in the tree except the root node, a global candidate text set is obtained; the nodes of the document tree are pruned and traversed layer by layer, the similarity between the traversed node and the vector to be retrieved is obtained, and a fine candidate text set is obtained; the union of the global candidate text set and the fine candidate text set is rearranged by using the enhanced Reranker model, and the retrieval result is obtained.
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:

[0005] 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;

[0006] 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 obtaining a structured summary of each clustering cluster as a dynamic clustering center using a large language model LLM 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 a complete multi-dimensional system document tree is obtained through clustering convergence;

[0007] 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, determining the positive sample, positive sample score, negative sample and negative sample score corresponding to the document block to obtain five-element training samples;

[0008] Enhancing the Embedding model and the Reranker model based on the five-element training samples;

[0009] transforming the query text into a to-be-retrieved vector representation based on the enhanced Embedding model;

[0010] 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;

[0011] pruning and traversing the nodes of the multi-dimensional system document tree layer by layer from the root node, and obtaining an Embedding similarity between a traversed node and the to-be-retrieved vector based on the Embedding model to obtain a fine candidate text set;

[0012] rearranging the union of the global candidate text set and the fine candidate text set by using an enhanced Reranker model to obtain a retrieval result.

[0013] 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:

[0014] 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 using the 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;

[0015] 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;

[0016] The number of clusters is reduced layer by layer until the root node.

[0017] Optionally, for each cluster, a structured summary is generated by using the LLM to obtain posterior probabilities of top k nodes in the cluster, and the structured summary is taken as a node of a new layer corresponding to the current cluster.

[0018] Optionally, GMM clustering is iteratively performed on the nodes, including:

[0019] In the process of generating the node of the second layer and the node of a layer above the second layer:

[0020] The nodes of the previous layer are preliminarily clustered by using the Kmeans++ algorithm to determine preliminary clustering centers;

[0021] The posterior probability of each node of the previous layer relative to the preliminary clustering center is calculated;

[0022] updating the mixture weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster according to the updated cluster center;

[0023] calculating the posterior probability of each previous layer node relative to the updated cluster center, and returning to the step of updating the mixture weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster according to the updated cluster center.

[0024] Optionally, the step of updating the mixture weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster according to the updated cluster center, comprises:

[0025] updating the mixture weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability,

[0026] 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:

[0027] obtaining a structured summary of the top-k nodes in each cluster according to the LLM, and obtaining a new cluster center of the next generation of clusters of the cluster by using the Embedding embedding vector of the structured summary and combining the cluster center for mean correction;

[0028] performing the next generation of GMM clustering according to the new cluster center.

[0029] Optionally, the positive samples and the negative samples corresponding to each 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 multi-dimensional system document tree, comprising:

[0030] 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 samples of the document block corresponding to the first layer node:

[0031] the child nodes and / or grandchild nodes of the first layer node;

[0032] 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;

[0033] the same layer sibling nodes of the first layer node belonging to the same sub-tree;

[0034] 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 block corresponding to the first layer node:

[0035] nodes with a shortest tree path distance greater than 5 from the first layer node;

[0036] a node at the same layer as the first layer node and belonging to a different sub-tree than the first layer node;

[0037] a node with an Embedding similarity higher than 0.8 to the first layer node but determined by the LLM to be semantically irrelevant to the first layer node.

[0038] Optionally, determining the positive sample, the positive sample score, the negative sample and the negative sample score corresponding to each document block comprises:

[0039] determining a positive sample score between the 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 the topological proximity between the node corresponding to the document block and the node corresponding to the positive sample;

[0040] determining 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 the topological proximity between the node corresponding to the document block and the node corresponding to the negative sample.

[0041] Optionally, determining the positive sample, the positive sample score, the negative sample and the negative sample score corresponding to each document block comprises:

[0042] based on each document block, obtaining the topological proximity between the node corresponding to the document block and the node corresponding to the corresponding positive sample or negative sample, wherein the topological proximity is obtained based on the following formula:

[0043]

[0044] 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;

[0045] for each document block, determining the corresponding semantic score based on the cosine similarity matching result of the normalized BM25 term frequency between the document block and the corresponding positive sample or negative sample according to the following formula ;

[0046]

[0047] wherein e i a vector representation characterizing the document block, e j a vector representation characterizing the positive or negative sample, d i representing the content of the document block, d j representing the content of the positive or negative sample, normalize represents a BM25 score normalization function for all documents;

[0048] for each document block, if the corresponding positive or negative sample of the document block is determined to belong 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 is determined to belong 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 a refinement-inverse refinement relationship, the corresponding abstract consistency result is assigned a value of zero;

[0049] the corresponding positive or negative sample score is obtained by weighted summation of the topological proximity, semantic score and abstract consistency result:

[0050] .

[0051] 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:

[0052] 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;

[0053] Starting from the root node, the nodes of the multi-dimensional system document tree are pruned and traversed layer by layer, and the Embedding similarity between the traversed nodes and the to-be-retrieved vector is obtained based on the Embedding model, to obtain a global and fine candidate text set, including:

[0054] 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 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;

[0055] 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 of 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.

[0056] In another aspect, an electronic device is provided, comprising:

[0057] a processor;

[0058] a memory having computer readable instructions stored thereon, the computer readable instructions, when executed by the processor, implement the method described above.

[0059] The technical solutions provided by the embodiments of the present application have at least the following beneficial effects:

[0060] In the retrieval of the document, the embodiments of the present application first perform sliding block processing on the sample documents of the associated knowledge base, combine GMM algorithm iterative clustering, and use the document block abstract obtained by the posterior probability and LLM to optimize the clustering center, so as to obtain a multi-dimensional system document tree that can optimize the Embedding model and the Reranker model, and 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 model is achieved by using tree derivative samples to feed back the model, 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 retrieving query text in the future, form a closed loop iteration of the perception of 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

[0061] 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.

[0062] Figure 1 is a first flowchart of a retrieval method based on collaborative document tree reconstruction provided by the embodiments of the present application;

[0063] Figure 2is a second flowchart of a retrieval method based on collaborative document tree reconstruction provided by an embodiment of the present application;

[0064] Figure 3 is a system block diagram of a retrieval device based on collaborative document tree reconstruction provided by an embodiment of the present application;

[0065] Figure 4 is a system block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0066] The present application will be described in detail below with reference to the specific embodiments shown in the accompanying drawings, but these embodiments do not limit the present application, and the structural, method, or functional changes made by those of ordinary skill in the art based on these embodiments are included in the protection scope of the present application.

[0067] The general pre-training model, such as BERT (Bidirectional Encoder Representations from Transformers), ColBERT (Contextualized Late Interaction over BERT), an improved ranking model based on the BERT model, often cannot integrate the professional semantic features of 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 only by literal similarity, the content of the “clinical trial conclusion” part will be missed, resulting in missed detection of key information.

[0068] To solve the above problems, an embodiment of the present application provides a retrieval method based on collaborative document tree reconstruction, comprising:

[0069] 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;

[0070] S102: generating a vector representation of each document chunk by using an Embedding model, taking the vector representation of each document chunk as a first layer node of a multi-dimensional system document tree, performing GMM (Gaussian Mixture Model) clustering on the node, and using an LLM (Large Language Model) to obtain a structured summary of each cluster as a dynamic cluster center in the GMM clustering process, taking the structured summary after the GMM clustering iteration as a next layer node of the multi-dimensional system document tree until the entire multi-dimensional system document tree is obtained by clustering convergence;

[0071] S103: determining the positive sample, positive sample score, negative sample and negative sample score corresponding to each document chunk according to the vector representation of each document chunk and the hierarchical relationship and / or path distance between other nodes in the multi-dimensional system document tree, to obtain five-element training samples;

[0072] S104: enhancing the Embedding model and Reranker model based on the five-element training samples;

[0073] S105: converting the query text into a to-be-retrieved vector representation based on the enhanced Embedding model;

[0074] S106: obtaining 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;

[0075] S107: starting from the root node, pruning and traversing the nodes of the multi-dimensional system document tree layer by layer, and obtaining the Embedding similarity between the traversed node and the to-be-retrieved vector based on the Embedding model, to obtain a fine candidate text set;

[0076] S108: rearranging the union of the global candidate text set and the fine candidate text set by using the enhanced Reranker model to obtain a retrieval result.

[0077] 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. The length of the divided document chunk can adapt to the input length limit of the vector representation Embedding model.

[0078] The LLM in the step S102 can be a deep neural network architecture with super large scale parameter quantity and constructed by attention mechanism, which can realize cross-modal semantic understanding and generation. The LLM forms context perception ability through massive language and character materials training. After generating the dynamic clustering center of each clustering cluster by the GMM clustering combined with the 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 ends, until the clustering converges to the root node, and the entire multi-dimensional system document tree is obtained.

[0079] The Embedding in the step S102 can map the unstructured original data to the continuous numerical space, so as to convert the original data into the dense vector carrying the 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, the GMM clustering is performed on the node to obtain a plurality of clusters, the structured summary of each cluster is obtained by using the LLM, and the structured summary is taken as the next layer node of the multi-dimensional system document tree, and the clustering is performed on each layer node in this way, so as to obtain the multi-dimensional system document tree, and provide a document basis for subsequent retrieval.

[0080] In the step S103, the topological structure of the multi-dimensional system document tree is used to determine the positive sample, the positive sample score, the negative sample and the negative sample score corresponding to each document block 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, so as to obtain the five-element training sample corresponding to the document block.

[0081] In the step S104, the Embedding model and the Reranker model are open source models, which belong to general field models, and the retrieval effect on the text library with professional field can be inaccurate, so the Embedding model and the Reranker model need to be fine-tuned. The five-element training sample is fine-tuned by 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.

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

[0083] In steps S107 and S108, the nodes of the multi-dimensional system document tree are pruned and traversed layer by layer from the root node of the multi-dimensional system document tree. For each traversed node, an Embedding similarity between the traversed node and the to-be-retrieved vector is obtained based on the Embedding model, and a corresponding fine candidate text set is determined according to the obtained Embedding similarities. The union of the global candidate text set and the fine candidate text set is reordered by using the enhanced Reranker model, a relevance score between the query text and each candidate text in the union is calculated, the candidate texts are sorted in descending order of the relevance scores, and candidate texts with high ranking are selected as the retrieval result of the query text.

[0084] In the retrieval of the document, the sliding block processing of the sample document of the associated knowledge base is performed first, the GMM algorithm is iteratively clustered, the document block summary obtained by the posterior probability and the LLM is used to optimize the clustering center, so that the multi-dimensional system document tree that can optimize the Embedding model and the Reranker model is obtained. The positive and negative samples with higher interpretability are obtained based on the hierarchical relationship and path distance of the multi-dimensional system document tree, and then the explicit representation mining of the knowledge system 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 model is used to feed back the tree-derived samples, so that the model can perform global retrieval and pruning retrieval on the multi-dimensional system document tree when performing retrieval on the query text in the future, and obtain more accurate and comprehensive answers combined with domain knowledge, logical coherence and semantic consistency. The closed-loop iteration of the perception of the tree structure on the knowledge system and the semantic understanding of the model is formed, so that the missing detection of the associated information in the professional field in the retrieval process is avoided.

[0085] In an embodiment of the present application, the GMM clustering is performed on the nodes, and the structured summary of each cluster is obtained by using the LLM, and the structured summary is used as the next layer of nodes of the multi-dimensional system document tree, and a multi-dimensional system document tree including the first layer of nodes and multi-layer structured summaries is obtained, including: in the process of generating the nodes of the new layer of the multi-dimensional system document tree by GMM clustering, the dynamic clustering is iteratively performed by using the EM algorithm, wherein, every specified number of iterations, the structured summary of the current cluster of the previous layer of nodes is generated by using the LLM, and the cluster center of the next generation cluster corresponding to the current cluster is updated by using the structured summary; 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.

[0086] For example, the structured summary of the TOPk nodes in each cluster is generated by using the LLM, and the structured summary is used as the node of the new layer corresponding to the current cluster.

[0087] In the embodiment, the dynamic clustering algorithm combining the GMM model and the LLM model is used to combine the semantic summary generated by the LLM and the cluster generated by the GMM, and the multi-dimensional system document tree with semantic hierarchy is constructed based on the result 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.

[0088] In an embodiment of the present application, the GMM clustering is iteratively performed on the nodes, including: in the process of generating the nodes of the second layer and above:

[0089] The initial cluster centers are determined by performing the initial clustering on the nodes of the previous layer by using the Kmeans++ algorithm;

[0090] The posterior probability of each node of the previous layer relative to the initial cluster centers is calculated;

[0091] Based on the posterior probability, the mixture weight, the cluster center and the covariance matrix of the GMM clustering are updated, and the new cluster is generated according to the updated cluster center.

[0092] 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 the new cluster according to the updated cluster center is returned.

[0093] In an embodiment of the present application, based on the posterior probability, the mixture weight, the cluster center and the covariance matrix of the GMM clustering are updated, and the new cluster is generated according to the updated cluster center, including:

[0094] updating the mixing weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability;

[0095] 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:

[0096] obtaining a structured summary of the top-k nodes in each cluster by the LLM, and obtaining a new cluster center of the next generation of clusters of the cluster by using the Embedding embedding vector of the structured summary and combining the cluster center for mean correction;

[0097] performing the next generation of GMM clustering according to the new cluster center.

[0098] In the embodiment, the semantic summary generated by the LLM is combined with the GMM cluster, the cluster center is adaptively and dynamically corrected by the embedding vector of the structured summary and the mixing weight of the distance from the cluster center, and the high-confidence samples are selected 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.

[0099] In one 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:

[0100]

[0101] wherein, representing the first to nth nodes.

[0102] For each document block, a vector representation of the document block is generated by the Embedding model, i.e.

[0103]

[0104] In the embodiment of the present application, the vector representation of the above-mentioned document block is dynamically clustered to obtain the generation process of the nodes of the second layer and above, which can be realized in the following way:

[0105] Step 1: input the initialization parameters of GMM and LLM.

[0106] 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 .

[0107] Exemplarily, the instruction template is represented as: 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 the LLM is , and the maximum number of iterations of the GMM is T. The embedding model is represented as , and the LLM generation function is represented as .

[0108] Step two, in the process of generating a new layer of nodes of the multi-dimensional system document tree by clustering through the GMM, the clustering centers are updated iteratively by the EM algorithm combined with the LLM, and the dynamic clustering is performed as follows:

[0109] Step a, initialization of GMM parameters, the initial clustering centers are determined using the K-means++ algorithm for the vector representation of each document block, the initial value of the mean corresponding to each initial clustering center is calculated, the initial value of the covariance matrix of each initial clustering center is the unit matrix, and the initial value of the weight of each initial clustering center is , where k represents the number of clustering centers;

[0110] Step b, the parameters of the GMM are updated iteratively for multiple rounds by the EM algorithm, and each iteration includes an E step and an M step:

[0111] E step: under the current parameters of the GMM, the posterior probability of the clustering center is calculated for the document block , which represents the probability value of the document block belonging to the clustering center , and the formula of the posterior probability is represented as:

[0112] ;

[0113] where represents the Gaussian distribution probability density function, represents the vector representation corresponding to the document block , and k represents the number of clustering centers.

[0114] M step: according to the posterior probability obtained in the E step, the mean , the covariance matrix , and the weight are updated;

[0115] ;

[0116] ;

[0117] ;

[0118] Repeat the E-step and M-step until the number of iterations reaches For each cluster center , according to the posterior probability obtained in the th iteration, sample nodes from the cluster where the cluster center is located, and guide the LLM to generate a structured summary of the content corresponding to the nodes by the instruction template Prompt ; modify the mean of the vector representation of the structured summary and the mean of the cluster center to obtain the modified mean , denoted as:

[0119] ;

[0120] ;

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

[0122] In the th iteration, use the modified mean as the new cluster center of the GMM, and repeat the E-step and M-step with the mean , covariance matrix , and weight until the parameters converge or the maximum number of iterations T is reached, and use the structured summary corresponding to each cluster center obtained in the current iteration as the node of the current layer.

[0123] where the condition for parameter convergence is that the log-likelihood in the iteration process is less than a small constant :

[0124]

[0125] where the calculation formula of the log-likelihood is:

[0126]

[0127] where ​​denotes the specified number of iterations of LLM in the iteration process of cluster center, means that in Compared with In the step iteration, the logarithmic likelihood does not change significantly, denotes the number of cluster centers, n denotes the number of document numbers, and N denotes the total number of documents.

[0128] Step three, when k is equal to 1, stop iteration, and take the structured summary corresponding to the 1 cluster center as the root node.

[0129] In an embodiment of the present application, the positive samples and negative samples corresponding to each 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:

[0130] For each first layer node, the nodes in the multidimensional 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:

[0131] The child nodes and / or grandchild nodes of the first layer node;

[0132] 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;

[0133] Same layer sibling nodes belonging to the same subtree as the first layer node.

[0134] The node attributes of each node in the multidimensional 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 multidimensional system document tree.

[0135] The multidimensional system document tree is traversed by a breadth-first traversal algorithm, and a graph representation corresponding to the multidimensional system document tree is constructed , denotes the node of the multidimensional system document tree, denotes the edge weight between the node relationships of each node of the multidimensional system document tree, which is 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.

[0136] The positive samples of the document block corresponding to each first layer node are determined by the following three rules to generate the corresponding positive samples:

[0137] (1) Directly associated rules: the document blocks corresponding to the child nodes and grandchild nodes of the first layer node;

[0138] (2) Cross-layer associated rules: 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;

[0139] (3) Same-layer extended rules: the document blocks corresponding to the same-layer sibling nodes belonging to the same sub-tree of the first layer node.

[0140] 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.

[0141] In one 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 negative samples of the document blocks corresponding to the first layer node:

[0142] nodes with a shortest tree path distance greater than 5 from the first layer node;

[0143] same-layer nodes belonging to different sub-trees of the first layer node;

[0144] 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.

[0145] Determining the negative samples of the document blocks corresponding to each first layer node is achieved by generating corresponding negative samples through the following three rules: a 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; a same-layer heterogeneous rule: the document blocks corresponding to same-layer nodes belonging to different sub-trees of the first layer node; and a semantic confrontation rule: 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 confrontation 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 vertical fields.

[0146] In this embodiment, through the dynamic generation mechanism of 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. ​​​​​​

[0147] One embodiment of the present application, as shown in Figure 2 The determination of the positive sample corresponding to each document block, the positive sample score, the negative sample and the negative sample score includes:

[0148] 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;

[0149] 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.

[0150] 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 for complex semantic relationships.

[0151] 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:

[0152] (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:

[0153]

[0154] 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 represents the preset maximum number of 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), represents the larger level of the level to which the document block belongs and the level corresponding to the positive sample or the negative sample, represents the shortest tree path distance between the node corresponding to the document block and the positive sample or negative sample node, 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 document block belongs, l 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 document block belongs, l

[0155] (2) For each document block, the normalized BM25 word frequency cosine similarity matching result 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:

[0156]

[0157] wherein, , e i represents the vector representation of the document block, e j represents the vector representation of the positive sample or negative sample, di 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. The combination of embedding cosine similarity and BM25 word frequency matching can overcome the limitations of single model on long-tail vocabulary or semantic ambiguity.

[0158] (3) 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 assigned a high value, if the corresponding positive sample or negative sample of the document block belongs to the inverse refinement of the document block based on LLM, the corresponding abstract consistency result is assigned a medium value, and if the corresponding positive sample or negative sample of the document block does not have a refinement and inverse refinement relationship, the corresponding abstract consistency result is assigned a value of zero.

[0159] Exemplarily, the formula of the abstract consistency result is:

[0160] ;

[0161] wherein, represents the content of the document block, represents the content of the corresponding positive sample or negative sample.

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

[0163] .

[0164] represents the positive sample score or negative sample score.

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

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

[0167] 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:

[0168] Obtain the corresponding positive sample set , the negative sample set , and construct the three-element training set corresponding to the training sample . For the pre-trained Emebdding model, construct the InfoNCE loss function . Fine-tune and train the pre-trained Emebdding model with the three-element training set and the InfoNCE loss function , wherein the InfoNCE loss function is expressed as:

[0169]

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

[0171] 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 , to obtain the corresponding five-element training sample . The Reranker model is fine-tuned using the Pairwise Ranking loss function and the five-element training sample. The Pairwise Ranking loss function is expressed as:

[0172]

[0173] wherein, is a sigmoid activation function. The Embedding model and the Reranker model can be fine-tuned by the above two steps.

[0174] The query text is converted into a to-be-retrieved vector representation according to the enhanced Embedding model, and 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, the Top-k nodes with the highest first cosine similarity are selected to obtain a global candidate text set , to realize preliminary retrieval of the query text.

[0175] In an embodiment of the present application, 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, the global candidate text set is obtained, including: starting from the root node, calculating the 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.

[0176] 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 the Embedding similarity between the traversed nodes and the to-be-retrieved vector is obtained based on the Embedding model to obtain a fine candidate text set, including:

[0177] 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 lower than a preset pruning threshold, the subtree corresponding to the node is skipped, wherein the preset pruning threshold is less than the preset global threshold;

[0178] 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 TOP-k nodes in the next level in the fine candidate text set .

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

[0180] In this embodiment, a coarse selection is performed by traversing all nodes of the multidimensional system document tree to obtain a global candidate text set. A fine selection is then performed by combining recursive abstract retrieval of LLM with dynamic pruning optimization of the tree structure to obtain a refined candidate text set. The asynchronous concurrent retrieval of coarse and fine selection significantly improves retrieval efficiency and accuracy.

[0181] The enhanced Reranker model is used to analyze the global candidate text set. and the refined candidate text set union , will be the union Input the enhanced Reranker model and calculate the query text and its union. The content of each node in Correlation score between Based on correlation score The sorting of the contents of each node Perform a rearrangement and output the rearranged result as the search result corresponding to the query text.

[0182] like Figure 3 As shown, this application provides a retrieval device based on collaborative document tree reconstruction, comprising:

[0183] The block segmentation module 301 is used to obtain multiple sample documents that belong to the same field as the query text to be retrieved, and to segment the multiple sample documents into blocks through a sliding window to obtain multiple document blocks.

[0184] Clustering module 302 is used to generate a vector representation of each document block using a vector representation embedding model. 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, a 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.

[0185] The sample acquisition module 303 is used to determine the positive sample, positive sample score, negative sample and negative sample score corresponding to the document block 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, so as to obtain the five-element training sample.

[0186] The model enhancement module 304 is configured to enhance the Embedding model and the Reranker model based on the five-element training sample.

[0187] 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.

[0188] 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 an Embedding similarity between the traversed nodes and the to-be-retrieved vector based on the Embedding model, to obtain a fine candidate text set.

[0189] The retrieval module 307 is configured to reorder the union set of the global candidate text set and the fine candidate text set by using the enhanced Reranker model, to obtain a retrieval result.

[0190] Optionally, the clustering module 302 is specifically configured to:

[0191] In the process of generating the nodes of a new layer of the multi-dimensional system document tree by GMM clustering, dynamic clustering is performed by an EM algorithm, and every specified number of iterations, a structured summary of a current cluster of the nodes of the previous layer is generated by using the LLM, and a cluster center of a next generation cluster corresponding to the current cluster is updated based on the structured summary.

[0192] In a case where the current cluster meets the convergence condition of the new layer, a structured summary of the current cluster is taken as the nodes of the new layer.

[0193] The number of clusters is reduced layer by layer until the root node.

[0194] Optionally, for each cluster, a structured summary of the top k nodes in the cluster obtained by the LLM is taken as the nodes of a new layer corresponding to the current cluster.

[0195] Optionally, the clustering module 302 is specifically configured to:

[0196] In the process of generating the nodes of the second layer and the layers above the second layer:

[0197] The nodes of the previous layer are initially clustered by using a Kmeans++ algorithm to determine initial cluster centers;

[0198] The posterior probability of each node of the previous layer relative to the initial cluster centers is calculated;

[0199] updating the mixture weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster according to the updated cluster center;

[0200] calculating the posterior probability of each previous layer node relative to the updated cluster center, and returning to the step of updating the mixture weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability, and generating a new cluster according to the updated cluster center.

[0201] Optionally, the clustering module 302 is specifically configured to:

[0202] updating the mixture weight, the cluster center and the covariance matrix of the GMM cluster based on the posterior probability,

[0203] 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:

[0204] obtaining a structured summary of the top k nodes in each cluster according to the LLM, and obtaining a new cluster center of the next generation of clusters of the cluster by using the Embedding embedding vector of the structured summary to correct the mean value of the cluster center;

[0205] performing the next generation of GMM clustering according to the new cluster center.

[0206] Optionally, the sample acquisition module 303 is specifically configured to:

[0207] 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:

[0208] a child node and / or a grandchild node of the first layer node;

[0209] a different level node having a shortest tree path distance of not more than 3 and a hierarchical relationship of not more than 2 from the first layer node;

[0210] a same level sibling node belonging to a same subtree of the first layer node;

[0211] 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:

[0212] a node having a shortest tree path distance greater than 5 from the first layer node;

[0213] a same level node belonging to a different subtree of the first layer node;

[0214] a node with a similarity higher than 0.8 to the Embedding of the first layer node but determined by the LLM to be semantically irrelevant to the first layer node.

[0215] Optionally, the sample obtaining module 303 is specifically configured to:

[0216] determine 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;

[0217] determine 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.

[0218] Optionally, the sample obtaining module 303 is specifically configured to:

[0219] based on each document block, obtain topological proximity between the node corresponding to the document block and the node corresponding to the corresponding positive sample or negative sample, wherein the topological proximity is determined according to the following formula: based on the following formula:

[0220] ;

[0221] 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 number, which can be set as a fixed constant of 3, 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;

[0222] for each document block, determine a corresponding semantic score based on the cosine similarity matching result of the normalized BM25 term frequency between the document block and the corresponding positive sample or negative sample according to the following formula: ;

[0223]

[0224] 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 jnormalize represents a BM25 score normalization function of all documents;

[0225] if the LLM determines that the positive sample or the negative sample corresponding to each document block belongs to the refinement of the document block, the corresponding abstract consistency result is assigned a high value, if the LLM determines that the positive sample or the negative sample corresponding to the document block belongs to the inverse refinement of the document block, the corresponding abstract consistency result is assigned a medium value, if the positive sample or the negative sample corresponding to the document block does not have a refinement-inverse refinement relationship, the corresponding abstract consistency result is assigned a value of zero;

[0226] the corresponding positive sample score or negative sample score is obtained by weighted summation of the topological proximity, semantic score and abstract consistency result:

[0227] .

[0228] Optionally, the global candidate text module 305 is specifically configured to:

[0229] 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;

[0230] The fine candidate text module 306 is specifically configured to:

[0231] 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 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;

[0232] 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.

[0233] 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 above method.

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

[0235] The memory 403 can be used to store a computer program, which can include instructions and data, to implement the steps of any of the above retrieval methods based on collaborative document tree reconstruction. In the embodiments of the present 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.

[0236] The processor 401 can be a general-purpose processor, which can be a processor that reads and executes a computer program (such as a computer program) stored in a memory (such as the memory 403) to perform specific steps and / or operations, and can use data stored in the memory (such as the memory 403) in the process of executing the steps and / or operations. The general-purpose 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 and FPGA, etc. In addition, the processor 401 can also be a combination of multiple processors, such as a multi-core processor.

[0237] The communication interface 402 can include input / output (I / O) interfaces, physical interfaces, and logical interfaces for realizing the interconnection of devices within the network device, as well as interfaces for realizing the interconnection of the network device with other devices (such as network devices). The communication network can be Ethernet, radio access network (RAN), 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.

[0238] 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 instruction in the form of software. The method disclosed in combination with the embodiments of the present application can be directly embodied as hardware processor execution completion, or executed by a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the art, such as random access memory flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, 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.

[0239] It should be understood that the term "and / or" herein merely describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the 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 that the associated objects before and after are an "or" relationship, but can also represent an "and / or" relationship, which can be understood in combination with the context.

[0240] In the present application, "at least one" means one or more, and "a plurality of" means two or more. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or 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.

[0241] 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.

[0242] The communication interface is configured to communicate with 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 remotely from the aforementioned processor. The aforementioned processor can be a general purpose processor, including a central processing unit (CPU), a network processor (NP), etc. The aforementioned processor 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, discrete gate or transistor logic, discrete hardware components.

[0243] It should be noted that the relational terms herein such as first and second and the like are used solely to distinguish one from another entity or action, without necessarily requiring or implying any actual relationship or order between such entities or actions. Moreover, 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 further limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0244] Each of the embodiments in the specification is described in a relevant manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment 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 method embodiments.

[0245] The above merely describes preferred embodiments of the present application, but 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 further provide an electronic device, comprising: at least one memory and at least one processor, the at least one memory storing executable code, and the at least one processor being configured 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 search method based on a collaborative document tree reconstruction, characterized in that, The method 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 cluster as a dynamic cluster center in the GMM clustering process, taking the structured summary after the GMM clustering iteration is completed as a node of the next layer of the multi-dimensional system document tree, and iterating until the cluster 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 the 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 the first cosine similarity between the to-be-retrieved vector representation and the nodes other than the root node in the multi-dimensional system document tree; starting from the root node, pruning and traversing the nodes of the multi-dimensional system document tree layer by layer, obtaining the Embedding similarity between the traversed nodes and the to-be-retrieved vector based on the Embedding model, and obtaining a fine candidate text set; using the enhanced Reranker model to reorder the union of the global candidate text set and the fine candidate text set to obtain a retrieval result.

2. The method of claim 1, wherein, performing GMM clustering on the node, and using LLM to obtain a structured summary of each cluster as a dynamic cluster center in the GMM clustering process, taking the structured summary after the clustering iteration is completed as a node of the next layer of the multi-dimensional system document tree, and iterating until the cluster converges to obtain the entire multi-dimensional system document tree, including: in the process of generating the nodes of the new layer of the multi-dimensional system document tree through GMM clustering, performing dynamic clustering through EM algorithm iteration, wherein every specified number of iterations, using LLM to generate a structured summary of the current cluster of the previous layer node, and updating the cluster center of the next generation cluster corresponding to the current cluster with the structured summary; in the case where the current cluster meets the new layer convergence condition, taking the structured summary of the current cluster as the node of the new layer; reducing the number of clusters layer by layer until the root node.

3. The method of claim 2, wherein, taking the structured summary of the current cluster as the node of the new layer, including: generating a structured summary for the TOPk nodes in each cluster cluster through LLM to obtain the posterior probability, as the node of the new layer corresponding to the current cluster.

4. The method of claim 1, wherein, iteratively performing GMM clustering on the node, including: in the process of generating nodes of the second layer and above: performing preliminary clustering on the nodes of the previous layer through the Kmeans++ algorithm to determine the preliminary cluster centers; calculating a posterior probability of each upper layer node relative to the preliminary clustering center; updating the mixture 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; calculating a posterior probability of each upper layer node relative to the updated clustering center, and returning to the step of updating the mixture 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.

5. The method of claim 4, wherein, updating the mixture 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 mixture 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 the highest posterior probability in the LLM, and obtaining a new clustering center of the next generation of clusters of the cluster by using the Embedding embedding vector of the structured summary and combining the clustering center for mean correction; performing the next generation of GMM clustering according to the new clustering center.

6. The method of claim 1, wherein, determining the positive samples and negative samples 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, comprising: for each first layer node, taking the nodes in the multi-dimensional system document tree that satisfy at least one of the following relationships 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; same layer sibling nodes belonging to the same subtree as the first layer node; for each first layer node, taking the nodes in the multi-dimensional system document tree that satisfy at least one of the following relationships as the negative samples of the document block corresponding to the first layer node: nodes with a shortest tree path distance of more than 5 from the first layer node; same layer nodes belonging to different subtrees as the first layer node; nodes with an Embedding similarity higher than 0.8 but irrelevant in semantics to the first layer node as determined by the LLM.

7. The method of claim 1, wherein, determining the positive samples, positive sample scores, negative samples and negative sample scores corresponding to each document block, comprising: determining the positive sample score between each document block and the corresponding positive sample 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; determining the negative sample score between each document block and the corresponding positive sample according to the second structure score, semantic score and abstract consistency score between them, 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.

8. The method of claim 1, wherein the positive sample, the positive sample score, the negative sample, and the negative sample score corresponding to each 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 multi-dimensional system document tree, comprising: obtaining 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, comprising: starting from the root node, calculating the 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; starting from the root node, pruning the nodes of the multi-dimensional system document tree layer by layer, obtaining the Embedding similarity between the traversed nodes and the to-be-retrieved vector based on the Embedding model, and obtaining a global and fine candidate text set, comprising: starting from the root node, calculating the 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 subtree is skipped, wherein the preset pruning threshold is smaller than the preset global threshold; if the Embedding similarity is higher than or equal to the preset pruning threshold, recursively entering the next level in the subtree of the node, traversing each node in the next level, calculating the second cosine similarity between the node and the to-be-retrieved vector, and recording the TOPk nodes in the next level in the fine candidate text set. Based on each document block, obtain the topological proximity between the document block and the nodes corresponding to the corresponding positive sample or negative sample, the topological proximity is obtained based on the following formula: where N i denotes a node corresponding to the document block, j denotes a node corresponding to the positive or negative sample, max denotes a maximum hop count, l i denotes a level to which the node corresponding to the document block belongs, j denotes a level to which the node corresponding to the positive or negative sample belongs. For each document block, a normalized BM25 term frequency cosine similarity match result between the document block and the corresponding positive or negative sample is obtained based on the following formula to determine a corresponding semantic score ; where e i a vector representation characterizing the document block, e j a vector representation characterizing a positive or negative sample, d i representing the content of the document block, d j representing the content of the positive or negative sample, normalize a BM25 score normalization function over all documents; For each document block, if it is determined based on the LLM that the positive sample or the negative sample corresponding to the document block belongs to the refinement of the document block, the corresponding abstract consistency result is assigned a high value a high value is assigned, if it is determined based on the LLM that the positive sample or the negative sample corresponding to the document block belongs to the inverse refinement of the document block, the corresponding abstract consistency result is assigned a medium value a medium value is assigned, if the positive sample or the negative sample corresponding to the document block does not have a relationship of refinement and inverse refinement, the corresponding abstract consistency result is assigned a value of zero zero is assigned; the corresponding positive or negative sample score obtained by a weighted sum of the topological proximity, semantic score and abstract consistency results: 。 9. The method of claim 1, wherein, comprising: a processor; a memory, wherein computer readable instructions are stored on the memory, and the computer readable instructions are executed by the processor to implement the method of any one of claims 1 to 9. ​ ​ ​ ​ 10. An electronic device, comprising: ​ ​ ​

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