Multi-document retrieval method and system based on semantic half tree and hierarchical reasoning
By constructing a binary navigation tree based on a semantic Huffman tree and a hierarchical reasoning method, the problems of retrieval accuracy, scalability and decision interpretability in large-scale multi-document retrieval are solved, and efficient and interpretable document localization is achieved.
Patent Information
- Application Number
- CN202611182813.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-11-20
AI Technical Summary
Existing technologies struggle to simultaneously achieve retrieval accuracy, scalability, and traceability of the retrieval decision-making process in large-scale, multi-document scenarios, resulting in a difficulty in balancing retrieval efficiency, accuracy, and interpretability.
A multi-document retrieval method based on semantic Huffman trees and hierarchical reasoning is adopted. By generating document summaries and semantic embedding vectors, density clustering is performed to construct a binary semantic navigation tree. Then, a large language model is used to select sub-branches layer by layer to locate the target document, providing a traceable retrieval decision chain.
It achieves high-precision and low-cost document localization in large-scale multi-document scenarios, reduces the candidate document range and contextual burden of large language models, and forms an interpretable retrieval decision process, which is suitable for multi-document retrieval of thousands and tens of thousands of documents.
Smart Images

Figure CN123138441A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence and information retrieval technology, and in particular to a multi-document retrieval method and system based on semantic Huffman tree and hierarchical reasoning. Background Technology
[0002] Retrieval Enhancement Generative Algorithm (RAG) is a mainstream application solution for large language models in vertical fields. It is divided into two main stages: retrieval location and inference generation. It achieves accurate knowledge output by "first recalling relevant documents and then generating answers based on the documents".
[0003] Inference-based RAG technologies, exemplified by PageIndex, achieve high generation accuracy in single-document scenarios and possess high-precision reasoning capabilities, making them suitable for business scenarios such as intelligent question answering and document parsing. Enterprise-level knowledge bases typically consist of hundreds, thousands, or even tens of thousands of documents, such as aerospace design plans, contingency plans, and corporate financial reports, resulting in a massive document volume and broad topic coverage. Because PageIndex's high accuracy relies on correct document input, before using PageIndex capabilities in enterprise business scenarios, it is necessary to first retrieve and locate the accurate target document from a large-scale document pool before performing deep reasoning to generate the data.
[0004] High-precision document retrieval technology for large-scale document collections is a prerequisite for the application of reasoning-based RAG technology in enterprise-level scenarios. Existing retrieval technologies can be divided into cascaded retrieval schemes based on vector similarity and direct selection schemes based on full-scale reasoning of large models, according to their core decision-making mechanisms.
[0005] Based on vector similarity, the recall capability is based on vector semantic matching. Depending on the different technical components superimposed in the subsequent fine ranking stage, it can be divided into pure vector retrieval scheme, vector retrieval-cross encoder re-ranking scheme, and vector retrieval-cross encoder-large model final selection retrieval scheme. Overall, it shows the characteristics of progressively improving accuracy and simultaneous increase in cost.
[0006] The core process of the pure vector retrieval (VoC) scheme is as follows: Document content and user queries are encoded into high-dimensional semantic vectors using an embedding model. The top-ranked document is then retrieved directly from the entire candidate document set using metrics such as cosine similarity. This scheme has a simple architecture, low computational consumption, and fast retrieval speed, supporting ultra-large-scale document databases of hundreds of thousands or even millions of documents. However, this scheme relies solely on surface-level semantic similarity for matching, has weak ability to capture fine-grained constraints in the query, and has limited document localization accuracy. Furthermore, the similarity calculation process is a black box, unable to output decision-making criteria, and the retrieval results lack interpretability.
[0007] The Vector Retrieval-Cross-Encoder Reordering (VCR) scheme introduces a cross-encoder as a secondary fine-grained ranking step on top of the pure vector retrieval scheme. This scheme first performs coarse vector recall of all documents using an embedding model, obtaining a Top-N candidate document set. Then, the cross-encoder performs pairwise semantic interaction calculations between the candidate documents and the user query, outputting a refined ranking result, with the top-ranked document being the final target document. This scheme improves ranking accuracy through deep semantic interaction of the cross-encoder, exhibits better matching ability for fine-grained queries than pure vector retrieval, and has good retrieval efficiency. Its drawbacks include increased computational costs and retrieval time, and the fact that the reordering logic of the cross-encoder remains a black box, making the decision-making process difficult to trace.
[0008] The Vector Retrieval-Cross-Encoder-Large Model Final Selection (VCLR) scheme employs a three-stage cascaded architecture of "coarse recall-fine ranking-final decision." This scheme first uses an embedding model to perform coarse recall of all document vectors to obtain Top-N candidates. Then, a cross-encoder re-ranks the candidate set to obtain a Top-K subset. Finally, the finely ranked small number of candidates are input into a large language model, which performs the final document selection and output. While this scheme can improve document location accuracy, it suffers from high technical complexity, deployment costs, and maintenance costs. The decision-making process becomes more difficult to trace due to the multiple layers involved, and the introduction of a large language model for final selection further increases token consumption and computational costs.
[0009] The common problem with the aforementioned vector similarity-based schemes is that the entire retrieval decision-making process is typically a black box. Vector similarity matching, cross-encoder reordering, and the final selection by the large language model operate independently, and the outputs of each stage lack traceable semantic reasoning, making it difficult to clearly explain why a particular document was selected and why other documents were excluded. In scenarios with stringent requirements for transparency, such as financial compliance audits, military intelligence analysis, and aerospace fault diagnosis, the criteria for each selection step and the reasons for choosing or rejecting each candidate document must be clear and auditable.
[0010] The LoR (LoW) approach, based on large-scale model full-scale reasoning, leverages the deep contextual understanding capabilities of large language models. It inputs the summaries or descriptions of all candidate documents into the large language model at once. The large language model, relying on its deep semantic understanding and reasoning capabilities, directly analyzes, compares, and selects the target document from the full pool of candidates. This approach can capture fine-grained constraints in user queries, such as specific fiscal years, specific report types, and specific event dates, and can simultaneously output the reasoning process and selection criteria.
[0011] However, the solution based on full inference using a large model requires inputting the summary information of all candidate documents into the large language model for processing in each query. As the document size increases, the token consumption per query rises significantly, retrieval latency increases, and computational costs are high. When the input content exceeds the upper limit of the context window of the large language model, the solution cannot be used directly. In addition, when there are many candidate documents, it is easy to cause the "Lost-in-the-Middle" problem of the large language model, and the localization accuracy may decrease as the candidate size increases.
[0012]
[0013] Table 1 Comparison of Technical Solutions
[0014] However, existing retrieval solutions struggle to simultaneously balance document retrieval accuracy, document scalability, and traceability of the retrieval decision-making process, resulting in difficulties in achieving a balance between retrieval efficiency, accuracy, and interpretability in large-scale, multi-document scenarios. Summary of the Invention
[0015] To address the problems existing in the prior art, this application aims to provide a multi-document retrieval method and system based on semantic Huffman trees and hierarchical reasoning. This method generates document summaries and semantic embedding vectors, performs density clustering on the documents, constructs semantic clusters into binary semantic navigation trees, and generates differentiated summaries at the internal nodes of the tree to distinguish between two sub-branches. Upon receiving a query, based on the semantic similarity between the query and the sub-nodes and the differentiated summaries, a large language model selects sub-branches layer by layer. Once the target semantic cluster is reached, the target document within the cluster is determined. This addresses the challenge of simultaneously achieving retrieval accuracy, scalability, and decision interpretability in large-scale multi-document retrieval.
[0016] To achieve the above-mentioned objectives, this application provides a multi-document retrieval method based on semantic Huffman trees and hierarchical reasoning, comprising the following steps:
[0017] Step S1: Generate document summaries and corresponding semantic embedding vectors based on documents in the knowledge base;
[0018] Step S2: Cluster the document based on the semantic embedding vector to obtain multiple semantic clusters;
[0019] Step S3: Construct a binary semantic navigation tree using the number of documents contained in each semantic cluster as the node weight and semantic distance as the merging criterion, and generate a differentiated summary representing the difference between its two sub-branches for each internal node;
[0020] Step S4: Receive the query and generate the query embedding vector;
[0021] Step S5: Starting from the root node of the binary semantic navigation tree, navigate from top to bottom. At the current internal node, based on the semantic similarity between the query embedding vector and the two child nodes and the differential summary, generate navigation prompt information and call the large language model to select the next navigation node from the two child nodes.
[0022] Step S6: Take the selected next navigation node as the new current node and repeat the navigation process until the current node is a leaf node;
[0023] Step S7: Provide the summary and meta-information of each document in the target semantic cluster corresponding to the leaf node to the large language model to determine the target document.
[0024] According to one technical solution of the present invention, step S1, generating a document summary based on documents in a knowledge base, includes:
[0025] Divide the document into multiple text blocks according to the document directory structure;
[0026] When a text block exceeds a preset length, it is split according to paragraph boundaries, and when a single paragraph exceeds the preset length, it is split according to sentence boundaries.
[0027] Text block summaries for each text block are generated using a large language model.
[0028] The document summary is generated by integrating text blocks belonging to the same document in their original order.
[0029] The preset length is determined based on the word segmenter of the target embedding model, so that the actual input length of each text block does not exceed the context length of the target embedding model.
[0030] According to a technical solution of the present invention, in step S2, clustering the document based on the semantic embedding vector includes:
[0031] The distance between documents is determined based on the cosine similarity of the semantic embedding vectors of any two documents;
[0032] HDBSCAN density clustering is performed using the inter-document distance as input to obtain the multiple semantic clusters;
[0033] The minimum cluster size for HDBSCAN density clustering is 3, the minimum number of samples is 2, the cluster selection threshold is 0.15, and noisy documents are assigned to noisy clusters.
[0034] According to one technical solution of the present invention, in step S3, constructing a binary semantic navigation tree includes:
[0035] Each semantic cluster is initialized as a leaf node, and the weight of the leaf node is the number of documents in the corresponding semantic cluster.
[0036] Select the first active node with the lowest weight from among all active nodes;
[0037] From the other active nodes besides the first active node, determine the candidate nodes whose weight ratio with the first active node is not greater than the current balance threshold, and select the second active node with the smallest semantic distance from the first active node from the candidate nodes;
[0038] Merge the first active node and the second active node to generate a new internal node, and update the active node set;
[0039] Repeat the above operation until only the root node remains in the set of active nodes.
[0040] According to one technical solution of the present invention, in step S3, the differentiated summary includes at least:
[0041] The document type and entity scope contained in the corresponding internal node, the metadata and topic of the left sub-branch, the metadata and topic of the right sub-branch, branch selection suggestions for metadata, and branch selection suggestions for topic.
[0042] According to one technical solution of the present invention, in step S5, the navigation prompt information includes:
[0043] The current internal node contains two child nodes, each containing the number of documents, the main meta-information categories, unique meta-information features, the semantic similarity between the query embedding vector and the two child nodes, the comparison conclusion of the semantic similarity, the differentiated summary, and branch selection suggestions.
[0044] According to one technical solution of the present invention, in step S7, the summary and meta-information of each document within the target semantic cluster corresponding to the leaf node are provided to the large language model, including:
[0045] Organize each document's document identifier, associated entity, time period, document type, and document summary into a structured document description;
[0046] The large language model is invoked to determine the target document based on the query and the structured document description;
[0047] The output is a JSON-formatted result containing the reasoning process and the target document identifier.
[0048] According to one aspect of the present invention, a multi-document retrieval system based on semantic Huffman trees and hierarchical reasoning is proposed, comprising:
[0049] The semantic embedding vector production module is used to generate document summaries and corresponding semantic embedding vectors based on documents in the knowledge base.
[0050] The clustering module is used to cluster the document based on the semantic embedding vector to obtain multiple semantic clusters;
[0051] The differential summary generation module is used to construct a binary semantic navigation tree by using the number of documents contained in each semantic cluster as the node weight and semantic distance as the merging criterion, and to generate differential summaries for each internal node that represent the differences between its two sub-branches.
[0052] The query embedding vector generation module is used to receive queries and generate query embedding vectors.
[0053] The navigation prompt information generation module is used to navigate from top to bottom starting from the root node of the binary semantic navigation tree. At the current internal node, it generates navigation prompt information based on the semantic similarity between the query embedding vector and the two child nodes and the differential summary, and calls the large language model to select the next navigation node from the two child nodes.
[0054] The navigation prompt information generation module is also used to take the selected next navigation node as the new current node and repeat the navigation process until the current node is a leaf node.
[0055] The sending module is used to provide the summary and meta-information of each document in the target semantic cluster corresponding to the leaf node to the large language model in order to determine the target document.
[0056] Compared with existing technologies, the multi-document retrieval method and system based on semantic Huffman trees and hierarchical reasoning provided in this application have the following significant technical advantages:
[0057] By using the number of documents contained in a semantic cluster as the node weight and semantic distance as the basis for node merging, both node weight balance and semantic coherence can be considered during the node merging process. By generating differentiated summaries within internal nodes that include document type, entity scope, left and right sub-branch metadata, topic, and branch selection suggestions, semantic basis can be provided for layer-by-layer branch selection. By organizing the document identifier, entity to which the document belongs, time period, document type, and document summary within the target semantic cluster into a structured document description, accurate document selection can be achieved within a relatively small candidate range.
[0058] Using the above method, direct selection across the entire document scope can be transformed into layer-by-layer navigation along a binary semantic navigation tree. At each layer, the semantic similarity between the query and its two child nodes, differentiated summaries, and branch selection suggestions are retained, thus forming a traceable retrieval decision chain. By first locating the target semantic cluster and then selecting documents within that cluster, the range of candidate documents processed in a single large language model call can be reduced, the contextual burden decreased, and the difficulty in locating documents caused by an excessive number of candidates across the entire document pool reduced. Under the condition that preset balance constraints effectively limit the differences in node weights, the tree depth can be kept low, making it suitable for multi-document retrieval scenarios involving thousands or tens of thousands of documents. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are only some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0060] Figure 1 This is a diagram illustrating the overall architecture of a multi-document retrieval system based on semantic Huffman trees and hierarchical reasoning.
[0061] Figure 2 Here is a flowchart of the greedy merging algorithm for two objectives;
[0062] Figure 3 This is a schematic diagram of semantic embedding and HDBSCAN density clustering module;
[0063] Figure 4 Here is a flowchart of hierarchical navigation and intra-cluster retrieval;
[0064] Figure 5 This is a diagram comparing the multi-document search path and the single-document chapter tree navigation path, where the technical path on the right is marked as SHT-HR-MDR;
[0065] Figure 6 This is a schematic diagram of the multi-document retrieval method based on semantic Huffman tree and hierarchical reasoning proposed in this application. Detailed Implementation
[0066] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0067] It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of this application can be combined with each other. The following embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the patent application. It should be pointed out that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of this application, and these all fall within the protection scope of this application.
[0068] Implementation Method 1: Multi-Document Retrieval Method
[0069] like Figure 1 and Figure 6 As shown, this application provides a multi-document retrieval method based on semantic Huffman trees and hierarchical reasoning, the method comprising:
[0070] Step S1: Generate document summaries and corresponding semantic embedding vectors based on documents in the knowledge base;
[0071] Step S2: Cluster the document based on the semantic embedding vector to obtain multiple semantic clusters;
[0072] Step S3: Construct a binary semantic navigation tree using the number of documents contained in each semantic cluster as the node weight and semantic distance as the merging criterion, and generate a differentiated summary representing the difference between its two sub-branches for each internal node;
[0073] Step S4: Receive the query and generate the query embedding vector;
[0074] Step S5: Starting from the root node of the binary semantic navigation tree, navigate from top to bottom. At the current internal node, based on the semantic similarity between the query embedding vector and the two child nodes and the differential summary, generate navigation prompt information and call the large language model to select the next navigation node from the two child nodes.
[0075] Step S6: Take the selected next navigation node as the new current node and repeat the navigation process until the current node is a leaf node;
[0076] Step S7: Provide the summary and meta-information of each document in the target semantic cluster corresponding to the leaf node to the large language model to determine the target document.
[0077] By using the number of documents contained in a semantic cluster as the node weight and semantic distance as the basis for node merging, both node weight balance and semantic coherence can be considered during the node merging process. By generating differentiated summaries within internal nodes that include document type, entity scope, left and right sub-branch metadata, topic, and branch selection suggestions, semantic basis can be provided for layer-by-layer branch selection. By organizing the document identifier, entity to which the document belongs, time period, document type, and document summary within the target semantic cluster into a structured document description, accurate document selection can be achieved within a relatively small candidate range.
[0078] Using the above method, direct selection across the entire document scope can be transformed into layer-by-layer navigation along a binary semantic navigation tree. At each layer, the semantic similarity between the query and its two child nodes, differentiated summaries, and branch selection suggestions are retained, thus forming a traceable retrieval decision chain. By first locating the target semantic cluster and then selecting documents within that cluster, the range of candidate documents processed in a single large language model call can be reduced, the contextual burden decreased, and the difficulty in locating documents caused by an excessive number of candidates across the entire document pool reduced. Under the condition that preset balance constraints effectively limit the differences in node weights, the tree depth can be kept low, making it suitable for multi-document retrieval scenarios involving thousands or tens of thousands of documents.
[0079] This application transforms the retrieval of all documents into a layer-by-layer binary decision-making process on a binary semantic navigation tree. Each layer provides semantic similarity, differential summaries, and branch suggestions, making each navigation step interpretable. Compared to schemes that rely solely on vector matching or full-document inference, this method achieves a new balance between accuracy, efficiency, and interpretability.
[0080] Implementation Method 2: Document Summary Generation
[0081] For the knowledge base One document { , , …, The system generates an enhanced summary for each document. First, each document is segmented into multiple semantically coherent text chunks according to the Table of Contents structure. For text chunks exceeding a preset length, recursively splitting them according to paragraph boundaries; if a single paragraph still exceeds the preset length, it is further split according to sentence boundaries.
[0082] The preset length is determined based on the tokenizer of the target embedding model, ensuring that the actual input length of each text block does not exceed the context length of the target embedding model. Typically, each chunk is controlled within 8000 tokens (approximately counted by segmenting words by spaces). For chunks exceeding 8000 tokens, the system recursively splits them according to paragraph boundaries; if a single paragraph still exceeds the limit, it further splits them according to sentence boundaries, ensuring that all chunks do not exceed the 8000 token limit.
[0083] The large language model is invoked to generate a 3-5 sentence summary for each text block. This summary includes key financial data, time-related metadata, and a concise summary of the text block. All text block summaries for the same document are then concatenated in their original order and integrated again using the large language model to form a 5-8 sentence enhanced document summary. This enhanced summary covers metadata, important events, key business segments, and emphasizes unique information that distinguishes the document from others. The enhanced document summary is denoted as... .
[0084] Compared to the original document, the enhanced summary removes noise such as tables, headers, footers, and legal notices, while retaining key semantic information. The enhanced summary forms the foundation for subsequent semantic embedding, density clustering, tree node summarization generation, and precise intra-cluster retrieval.
[0085] While removing structural noise, the enhanced summary retains key financial data, time metadata, event descriptions, and business segment information, making it usable for semantic matching and providing sufficient discriminative information for subsequent differentiated summary generation and intra-cluster document selection.
[0086] Implementation Method 3: Semantic Embedding and Density Clustering
[0087] like Figure 3 As shown, this application provides a schematic diagram of the semantic embedding and HDBSCAN density clustering module. A semantic embedding vector is generated for each document: ;
[0088] in, For the vector representation function of the embedded model, For document Enhanced summary.
[0089] Based on semantic embedding vectors, the HDBSCAN algorithm is used to perform density clustering of documents. First, the distance matrix between documents is calculated: = 1 - cos( , );
[0090] Using the distance matrix as input, perform HDBSCAN density clustering with the following parameters set: minimum cluster size (min_cluster_size) = 3, minimum number of samples (min_samples) = 2, and cluster selection threshold (cluster_selection_epsilon) = 0.15. Output cluster labels, dividing N documents into C semantic clusters. , , …, The noisy documents are grouped into the noise cluster.
[0091] The semantic distribution of multi-document collections is typically non-uniform. Some topic categories have a large number of documents, forming high-density document clusters with strong semantic connections; other categories have a limited document size, resulting in a relatively sparse semantic distribution, with no fixed pattern in cluster shape and size. Traditional partitioning clustering algorithms like K-Means require pre-setting the number of clusters and assume a spherically uniform distribution, which doesn't match the uneven density and irregular cluster shapes of documents. HDBSCAN, however, eliminates the need for manual pre-setting of cluster numbers, can identify semantic clusters of different shapes and densities, and can handle discrete, noisy documents.
[0092] Implementation Method 4: Construction of a Binary Semantic Navigation Tree
[0093] like Figure 2 As shown, this application provides a flowchart of a bi-objective greedy merging algorithm. Classical Huffman coding is a prefix code construction method in information theory. For a given frequency distribution... The average code length can be expressed as: ;
[0094] in, For symbols The encoding length. The Huffman algorithm uses a method of merging two symbols with lower frequency first.
[0095] In multi-document retrieval scenarios, each semantic cluster is treated as a symbol, the number of documents within a cluster is considered as frequency, and the encoding length corresponds to the navigation depth. Semantic clusters with a larger number of documents can have shorter navigation paths because higher-frequency queries are more likely to hit larger semantic clusters. When merging nodes, semantic clusters with smaller semantic distances are merged first under node weight constraints, ensuring semantic coherence among the merged internal nodes and facilitating the understanding of branch meanings by large language models.
[0096] Classical Huffman coding relies primarily on frequency for merging, while binary semantic navigation trees introduce semantic distance constraints under node weight constraints. Node weight constraints limit the skewness of the merged tree structure, while semantic distance constraints ensure semantic coherence among merged nodes. Using only node weight constraints may lead to the merging of semantically unrelated clusters, making it difficult for internal node summaries to form effective differentiated descriptions; using only semantic distance constraints may lead to frequent merging of small and large clusters, increasing the depth of the tree.
[0097] During the construction process, each semantic cluster is initialized as a leaf node. Leaf node weight .size represents the number of documents within the corresponding semantic cluster; the embedding vector of the leaf node. .emb represents the embedding vectors of all documents within a semantic cluster. Weighted average; meta-information of leaf nodes The `.meta` tag is a collection of meta-information for semantic clusters, including entities, topics, and document types; the leaf nodes contain summaries. .summary is a cluster summary generated by the large language model, and the cluster summary consists of 3 to 4 sentences.
[0098] Initialize the active node set ActiveNodes={ , , …, } and construct an initial C×C semantic distance matrix. For any active node and The distance is:
[0099] (1)
[0100] A preset balancing threshold θ is established, initially set to 2.0, and gradually increased to 3.0, 5.0, and ∞ when no candidate node meets the criteria. In each merge loop, the first active node with the lowest weight is selected from the set of active nodes, ActiveNodes. From the other active nodes that are different from the first active node, determine the candidate nodes whose weight ratio with the first active node is not greater than the current balance threshold. List:
[0101] (2)
[0102] When the candidate node set is not empty, select the second active node n with the smallest semantic distance to the first active node from the candidate node set. best :
[0103] (3)
[0104] Merge the first and second active nodes to generate a new internal node. The weight of the new internal node is:
[0105] (4)
[0106] The embedding vector of the new internal node is:
[0107] (5)
[0108] The metadata of the new internal node is .meta vs. The union of .meta. The summary of the new internal nodes is generated by the large language model based on the summaries of the first active node, the second active node, and unique meta-information.
[0109] For other active nodes The distance matrix is expanded using the average link method:
[0110] (6)
[0111] Subsequently, the first active node is removed from the set of active nodes. Second active node and add new internal nodes. Repeat the above process until only the root node remains in the set of active nodes.
[0112] The aforementioned merging algorithm is known as the "bi-objective greedy merging algorithm." Its input consists of C semantic clusters and the corresponding enhanced embedding vectors for each cluster, and its output is the root node of a binary semantic navigation tree. This algorithm considers both node weight balance (frequency constraint) and semantic coherence (distance constraint) in each merging step, which is fundamentally different from the classic Huffman coding method that relies solely on frequency.
[0113] Input: C semantic clusters and the augmented embedding vectors corresponding to each semantic cluster;
[0114] Output: The root node of the binary semantic navigation tree;
[0115] Initialize each semantic cluster as a leaf node;
[0116] Initialize the set of active nodes; construct the initial semantic distance matrix;
[0117] When the number of nodes in the active node set is greater than 1: select the first active node with the smallest weight;
[0118] Set the balance thresholds sequentially as 2.0, 3.0, 5.0, and ∞;
[0119] Candidate nodes are determined from other active nodes that are different from the first active node;
[0120] Select the second most active node with the smallest semantic distance from the candidate nodes;
[0121] Merge the first and second active nodes;
[0122] Update node weights, embedding vectors, metadata, summaries, and distance matrices; update the set of active nodes;
[0123] Output the root node.
[0124] Implementation Method 5: Generation of Internal Node Differentiation Summary
[0125] The summaries of the internal nodes are generated by the large language model, emphasizing the differentiated features between the two sub-branches:
[0126]
[0127] in, For the left subtree summary, For the right subtree summary, the large language model generates a differential description of 3 to 4 sentences. The differential summary includes at least: the document type and entity range contained in the corresponding internal node; the meta-information and topic of the left sub-branch; the meta-information and topic of the right sub-branch; branch selection suggestions based on the meta-information; and branch selection suggestions based on the topic.
[0128] The design of this differentiated summary is based on the concept of information gain in information theory: in a binary navigation tree, the summary of each internal node should maximize the discriminative power between the two branches, that is, maximize the information gain obtained by the large language model when choosing branches. If the summary descriptions of the two branches are highly similar, it is difficult to form an effective basis for branch selection, which is equivalent to the information gain of that node being zero. The differentiated summary ensures that each internal node provides positive information gain by explicitly listing the unique features of the left and right sub-branches (such as different entities, time periods, document types, topics, etc.).
[0129] By clearly defining the differences in entities, time, document type, and topic between the left and right sub-branches in the summary, the branch recognition ability of large language models in hierarchical navigation can be improved, so that the decision at each level has a clear semantic basis.
[0130] Implementation Method Six: Hierarchical Navigation and Precise Intra-Cluster Search
[0131] like Figure 4 As shown, this application provides a flowchart of hierarchical navigation and intra-cluster retrieval. In step S4, given a user query... Then, calculate the query embedding vector:
[0132]
[0133] In step S5, the system navigates from top to bottom starting from the root node of the binary semantic navigation tree. The root node serves as the initial current node. At the current internal node, the semantic similarity between the query embedding vector and the left and right child nodes of that current internal node is calculated:
[0134] ; ;
[0135] Navigation prompts are generated based on the current internal nodes. The navigation prompts include:
[0136] The number of documents, main metadata categories, and unique metadata features contained in the two child nodes of the current internal node, respectively;
[0137] Query the semantic similarity between the embedded vector and two child nodes;
[0138] Conclusions from the comparison of semantic similarity;
[0139] Differential summaries of internal nodes;
[0140] And suggestions on branch selection.
[0141] For example, for queries involving a specific entity, time period, or document type, suggestions for selecting corresponding sub-branches can be provided in the differentiated summary; suggestions for selecting corresponding sub-branches can also be provided for queries involving a specific topic.
[0142] After reading the navigation prompts, the large language model combines the query semantics, the semantic similarity between the two sub-branches, the differences in meta-information, the topic differences, and branch selection suggestions to select the next navigation node from the two child nodes of the current internal node. In step S6, the selected next navigation node is taken as the new current node. If the new current node is an internal node, the navigation process in step S5 is repeated; if the new current node is a leaf node, the top-down navigation ends. Leaf nodes correspond to the target semantic cluster.
[0143] In step S7, the summaries and meta-information of each document within the target semantic cluster corresponding to the leaf node are provided to the large language model. Specifically, the document identifier, entity to which it belongs, time period, document type, and document summary of each document within the cluster are organized into a structured document description. The structured document description can adopt the format of "document identifier, entity to which it belongs, time period, document type, document summary". The query and structured document description are provided to the large language model (the large language model is called to determine the target document based on the query and structured document description). The large language model comprehensively analyzes the matching degree between the query and the document meta-information and document summary content to determine the target document, represented as:
[0144]
[0145] The description format for each document is: Document Name\nSummary.
[0146] The target document identification results are output in JSON format, which includes the reasoning process and target document identifiers. The large language model does not require pre-defined explicit priority rules; instead, it performs a comprehensive analysis based on query semantics, the entity to which the document belongs, the time period, document type, and document summary content.
[0147] Through the above retrieval process, the hierarchical navigation stage processes only the information of the two sub-branches of the current node at a time, while the intra-cluster precise retrieval stage processes only the document information within the target semantic cluster. Each navigation level retains semantic similarity, differentiated summaries, and branch selection suggestions, forming a decision-making basis from the root node to the leaf node. By jointly controlling the node merging process through node weight constraints and semantic distance constraints, excessive tree structure skewness caused by merging solely based on semantic distance can be avoided, as well as semantic incoherence in branches caused by merging solely based on weight.
[0148] Under the condition that the preset balance constraints can effectively limit the differences in node weights, the tree depth can be kept low, the navigation path is short, the complexity is low, and thus the time is shorter. Let the total number of documents be... The number of clusters is The tree height is O(log n). Each navigation iteration only requires the LLM to process information from two branches, therefore the complexity of hierarchical navigation is O(log n). For example, if N=361, C is approximately 40, and log(C) is approximately 6, then the positioning can be completed in 6 steps, without needing to perform N (350) steps.
[0149] This method first locates the target semantic cluster in a large document set, and then selects the target document within that cluster. Compared to inputting all candidate documents into a large language model at once, it reduces the candidate range in a single inference. Compared to determining documents solely based on vector similarity, it adds semantic decision-making basis through branch-based differential summarization and large language model inference. Excluding the first active node during node merging ensures that each merge is completed by two different nodes, preventing the binary semantic navigation tree from failing to construct correctly when a node merges with itself. By outputting the navigation inference process at each level and the final target document identifier, the traceability of the retrieval decision-making process is improved.
[0150] Implementation Method Seven: Document Segmentation and Text Block Length Control
[0151] In some embodiments of the present invention, the document summary generation process includes: dividing the document into multiple text blocks according to the document directory structure; splitting the text blocks according to paragraph boundaries when the text blocks exceed a preset length; splitting the text blocks according to sentence boundaries when a single paragraph exceeds a preset length; generating text block summaries for each text block using a large language model; and integrating the text block summaries belonging to the same document in the original order to generate a document summary.
[0152] For each PDF document, the full text content is first extracted. Then, according to the PDF's Table of Contents structure, the document is segmented into semantically coherent text blocks by item or section. Text blocks exceeding a preset length are split at paragraph boundaries; small text blocks with fewer than 100 tokens can be merged into adjacent blocks. The actual token count for each text block is calculated using the tokenizer of the target embedding model and controlled to not exceed the context length of the target embedding model. Typically, the number of tokens per chunk is controlled between 100 and 8000.
[0153] Before a tokenizer is introduced at the emb stage, word segmentation by spaces can be used as an approximate estimate of the number of tokens. For example, 361 PDF documents can be segmented into 6154 chunk files, each of which can be named in the format "filename_{serial number}.txt" for easy tracking and management.
[0154] By using table of contents, paragraph, and sentence boundaries as segmentation boundaries, the relative semantic coherence of each text block can be maintained. By integrating text block summaries in their original order, the content order and informational connections between chapters within the same document can be preserved.
[0155] This text block length control method determines the number of tokens based on the actual tokenizer used by the target embedding model, rather than approximating it based on the number of words separated by spaces. Therefore, it ensures that the actual input length of the text block matches the contextual constraints of the embedding model. Splitting according to paragraph and sentence boundaries reduces semantic content truncation; merging excessively short text blocks into adjacent blocks reduces the number of fragmented text blocks. Generating text block summaries and integrating them in their original order reduces noise in the original document while preserving key metadata, event information, and business information.
[0156] Implementation Method 8: Construction of a Binary Semantic Navigation Tree
[0157] In some embodiments of the present invention, the process of constructing a binary semantic navigation tree includes: initializing each semantic cluster as a leaf node, with the weight of the leaf node being the number of documents in the corresponding semantic cluster; selecting the first active node with the smallest weight among the active nodes; determining candidate nodes from other active nodes whose weight ratio with the first active node is not greater than the current balance threshold; selecting the second active node with the smallest semantic distance from the first active node among the candidate nodes; merging the first active node and the second active node to generate a new internal node and updating the active node set; repeating the above operations until only the root node is retained in the active node set.
[0158] The embedding vector of a leaf node can be obtained by weighted averaging of the embedding vectors of documents within the corresponding semantic cluster. The metadata of a leaf node can include entities, topics, and document types. The embedding vector of an internal node is calculated by weighting the embedding vectors of the two nodes to be merged according to their node weights. The metadata of an internal node is obtained by merging the metadata sets of the two nodes to be merged.
[0159] The balancing threshold can start at 2.0, and is progressively increased to 3.0, 5.0, and ∞ when no candidate node exists at the current balancing threshold. Among the candidate node set, the node with the smallest semantic distance is selected as the second most active node. The average linking method is used to update the semantic distance between the new internal node and other active nodes.
[0160] The first active node must be excluded from the candidate node set. If the first active node is not excluded, its weight ratio with itself is 1, and its semantic distance with itself is usually 0. It may be selected as the second active node, thus making it impossible to merge two different nodes.
[0161] By starting the merging process with active nodes that have lower weights and selecting nodes with smaller semantic distances from candidate nodes that meet the balance threshold, the two sub-branches of an internal node can be kept relatively well-matched in terms of node size and semantic content. Gradually relaxing the balance threshold avoids situations where there are no nodes to merge while prioritizing stricter balance conditions. Excluding the first active node itself ensures that each merging operation produces a new internal node consisting of two different child nodes.
[0162] Implementation Method Nine: Navigation Prompts and Cluster Document Determination
[0163] In some embodiments of the present invention, in step S5, navigation prompt information is generated for the current internal node. The hierarchical navigation and intra-cluster document determination process includes: at the current internal node of the binary semantic navigation tree, generating navigation prompt information including the number of documents contained in the two child nodes of the current internal node, the main meta-information categories, unique meta-information features, the semantic similarity between the query embedding vector and the two child nodes, the comparison conclusion of the semantic similarity, the differential summary, and the branch selection suggestion; calling the large language model to select the next navigation node from the two child nodes based on the navigation prompt information; in step S6, the selected next navigation node is taken as the new current node and the navigation process is repeated until the current node is a leaf node; in step S7, the documents in the target semantic cluster corresponding to the leaf node are organized into structured document descriptions, the large language model is called to determine the target document based on the query and the structured document description, and outputs a JSON format result containing the reasoning process and the target document identifier.
[0164] The overall information of the parent node in the differentiated summary can include the document types and entity ranges contained within the parent node. The information of the left child branch can include the entities, time period, document type, main metadata category, unique metadata features, and topic of the left child branch; the information of the right child branch can include the entities, time period, document type, main metadata category, unique metadata features, and topic of the right child branch. Branch selection suggestions can include selection suggestions for metadata-related questions and selection suggestions for topic-related questions.
[0165] In-cluster document descriptions can take the following forms: document identifier, belonging entity, time period, document type, and document summary. The large language model outputs JSON-formatted results, including the reasoning process and the target document identifier, based on the matching relationship between the query and each structured document description. The document summary may include key financial data, time metadata, important events, key business segments, and unique information to distinguish the document from others.
[0166] By providing the number of documents, meta-information categories, unique meta-information features, semantic similarity, and differential summaries for each of the two sub-branches at each internal node, the large language model can select branches based on multiple dimensions, rather than relying solely on a single vector similarity. By processing only structured document descriptions within the target semantic cluster after reaching the leaf node, precise document selection can be limited to a smaller candidate range. The JSON format results simultaneously preserve the inference process and target document identifiers, facilitating verification of each navigation layer and the final document selection process.
[0167] Implementation Method 10: Dataset, Model Setup, and Experimental Results
[0168] The following is a detailed explanation of this application using a specific example. 361 long documents in the financial domain from the FinanceBench open-source dataset were selected as the test corpus, containing 150 financial query questions. The number of documents N is 361; the number of branches M of the binary semantic navigation tree is 2; the embedding model uses text-emb-v3 with an embedding dimension of 1024 and a maximum input length of 8192 tokens; the Reranker model uses qwen3-rerank; the large language model uses qwen3-next-80b-a3b-instruct; the HDBSCAN parameters are set to min_cluster_size=3, cluster_selection_epsilon=0.15, and min_samples=2; the initial value of the balancing threshold θ is 2.0, and it is relaxed in the order of 2.0, 3.0, 5.0, and ∞.
[0169] Enhanced summaries were generated from 361 documents using a large language model, with an average summary length of approximately 500 characters. Semantic embeddings of the document summaries were calculated, generating a 361×1024-dimensional embedding matrix. HDBSCAN density clustering was performed, generating 41 semantic clusters, including one noisy cluster, with documents within each cluster primarily consisting of documents of the same entity and type. A binary semantic navigation tree was constructed based on semantic Huffman coding: initially 41 leaf nodes were established, and a 41×41 distance matrix was constructed. A greedy merging algorithm with two objectives was used for 40 steps to generate 40 internal nodes. The tree depth was 8 levels, with leaf depth ranging from 4 to 8 levels and an average of 5.6 levels. The ratio of the size of the left and right subtrees of internal nodes was a maximum of 3.0 and an average of 1.5. Differentiated summaries based on the large language model were generated for all internal nodes, emphasizing the semantic differences between the left and right subtrees.
[0170]
[0171] Table 2. Binary Semantic Navigation Tree Indicators
[0172] After the user enters their query, the system calculates the query embedding and performs hierarchical reasoning starting from the root node. In each step of reasoning, the large language model reads the differential summaries and semantic similarity of the two sub-branches of the current node and selects a sub-branch. After approximately six navigation steps, the system reaches the semantic cluster corresponding to the leaf node. Within the cluster, all document summaries, summary content, and meta-information are provided to the large language model for comprehensive analysis and precise selection. The large language model returns a JSON-formatted result, including the reasoning process and the identifier of the selected document.
[0173]
[0174] Table 3 Comparison of accuracy, time consumption, and token consumption of various methods
[0175] VoR offers the fastest retrieval speed at 0.23 seconds per query, but its accuracy is only 40.67%. VCR, by introducing the Reranker model, achieves an accuracy of 52.67%. VCLR further incorporates a large language model for fine-tuning, achieving an accuracy of 80.00% with a token cost of 542 per query, making it the most cost-effective option. However, its retrieval decision-making process is a black box, lacking interpretability. LoR achieves an accuracy of 84.00%, but a single query takes 9.52 seconds and consumes a staggering 54,586 tokens, approximately 7.5 times that of this invention, resulting in extremely high efficiency and cost.
[0176] Using the binary semantic navigation tree and hierarchical reasoning retrieval method proposed in this application, the accuracy rate is 82.00%, which is 41.33 percentage points higher than VoR's 40.67%. Compared with LoR, the accuracy rate differs by only 2 percentage points, but the token consumption is only 1 / 7.5 of LoR (7279 vs 54586), and the retrieval time is only about 1 / 1.8 of LoR (5.30s vs 9.52s), meaning the speed is improved by about 1.8 times. This indicates that this method significantly reduces computational resource consumption while maintaining accuracy close to that of full inference, and each navigation step has a clear semantic basis, possessing complete interpretability.
[0177]
[0178] Table 4. Accuracy Indicators by Stage
[0179] Based on Table 4, the first stage, semantic Huffman tree navigation to the target cluster, achieved an accuracy of 90.00% (135 / 150). This means that the LLM correctly located the target cluster from 41 semantic clusters through approximately 6 steps of hierarchical binary reasoning. The second stage, intra-cluster reasoning, involves comprehensive analysis and precise selection of document summaries within the cluster, assuming correct navigation, achieving an accuracy of 91.11% (123 / 135). Since the errors in the two stages are independent, the final accuracy is the concatenated product of the two stage accuracy rates: 90.00% × 91.11% ≈ 82.00%. The stage-specific metrics show that both stages have high reliability: navigation stage errors account for approximately 10.00%, and intra-cluster selection errors account for approximately 8.89%. The high accuracy (90.00%) in the navigation stage fully validates that the semantic Huffman tree structure provides effective semantic support for LLM navigation decisions in large-scale document sets.
[0180]
[0181] Table 5 Token Consumption Comparison
[0182] LoR requires inputting the summary descriptions of all 361 documents into a large language model for full inference at once. The document list input tokens total 54,321, and the total token consumption for a single query is 54,586. When using a hierarchical navigation strategy, the input for a single-step complete navigation prompt is approximately 670 tokens, with the two subtree summary parts requiring approximately 200 to 400 tokens.
[0183]
[0184] Table 6 Ablation Experiment
[0185] As shown in Table 6, after removing the balance constraint, the tree depth increased from 8 to 13 layers, the navigation accuracy decreased from 90.00% to 83.33%, the overall accuracy decreased from 82.00% to 74.00%, and the token consumption increased from 7279 to 9385. This result indicates that the balance constraint is used to limit the skewness of the tree structure; when the balance constraint is missing, large language models require more navigation steps, and the possibility of branch selection errors increases.
[0186] Implementation Method 11: Multi-Document Retrieval System
[0187] This application also provides a multi-document retrieval system based on semantic Huffman trees and hierarchical reasoning, including:
[0188] The semantic embedding vector production module is used to generate document summaries and corresponding semantic embedding vectors based on documents in the knowledge base.
[0189] The clustering module is used to cluster the document based on the semantic embedding vector to obtain multiple semantic clusters;
[0190] The differential summary generation module is used to construct a binary semantic navigation tree by using the number of documents contained in each semantic cluster as the node weight and semantic distance as the merging criterion, and to generate differential summaries for each internal node that represent the differences between its two sub-branches.
[0191] The query embedding vector generation module is used to receive queries and generate query embedding vectors.
[0192] The navigation prompt information generation module is used to navigate from top to bottom starting from the root node of the binary semantic navigation tree. At the current internal node, it generates navigation prompt information based on the semantic similarity between the query embedding vector and the two child nodes and the differential summary, and calls the large language model to select the next navigation node from the two child nodes.
[0193] The navigation prompt information generation module is also used to take the selected next navigation node as the new current node and repeat the navigation process until the current node is a leaf node.
[0194] The sending module is used to provide the summary and meta-information of each document in the target semantic cluster corresponding to the leaf node to the large language model in order to determine the target document.
[0195] When constructing a binary semantic navigation tree, for the first active node with the smallest weight, the second active node that satisfies the balance constraint and has the smallest semantic distance is selected from other active nodes that are different from the first active node and then merged.
[0196] It also includes a storage device that can be used to store full-text documents, text blocks, text block summaries, document summaries, semantic embedding vectors, semantic cluster labels, node weights, node embedding vectors, node metadata, differential summaries, query embedding vectors, navigation tips, branch selection results, and JSON format search results.
[0197] This system stores document summaries, semantic clusters, node metadata, and differential summaries in memory, and each module calls the large language model layer by layer according to the tree structure, forming a processing chain from document preprocessing, semantic clustering, node merging, tree navigation to intra-cluster document selection. Because the second active node is selected from other active nodes different from the first active node, the node itself is avoided from being merged, thus ensuring the normal progress of the tree construction process.
[0198] like Figure 5 As shown, this application also provides a comparative diagram of multi-document retrieval paths and single-document chapter tree navigation paths, where the technical path on the right is labeled SHT-HR-MDR. Multi-document retrieval paths and PageIndex's single-document internal navigation paths address different levels of problems, and their essential differences are as follows:
[0199] (1) The PageIndex tree is a mapping of the internal structure of the document, and the tree nodes correspond to the document chapters, so no clustering is required; the binary semantic navigation tree of the present invention is a mapping of the semantic relationship between documents, and the tree nodes correspond to semantic clusters, so density clustering is required as a prerequisite step.
[0200] (2) PageIndex navigation is top-down chapter positioning, and each branch is the inherent structure of the document; the navigation of this invention is top-down cluster positioning, and each branch needs to be constructed through semantic Huffman coding and tree balance constraint optimization to ensure branch distinguishability.
[0201] (3) PageIndex does not involve tree balance optimization because the document structure is fixed; the present invention must solve the contradiction between balance and distinguishability, which is a unique technical challenge of multi-document navigation.
[0202] Therefore, this invention is not a simple scaling extension of PageIndex, but rather a different technical solution for different technical problems. The multi-document macro-navigation problem solved by this invention is one that PageIndex does not address and cannot be directly extended to solve.
[0203] Multi-document retrieval paths and PageIndex's single-document internal navigation paths address different levels of problems. PageIndex is used to locate relevant paragraphs within a document's chapter tree; its tree index describes the document's internal structural hierarchy, such as chapters, sections, and paragraphs, with navigation granularity at the paragraph level. Multi-document retrieval paths are used to locate a target document across multiple documents; their navigation tree describes the semantic clustering hierarchy between documents, with navigation granularity at the document level.
[0204] Single-document chapter trees typically map the internal structure of a document, with tree nodes corresponding to document chapters, and do not require density clustering. Binary semantic navigation trees, on the other hand, map semantic relationships between documents, with tree nodes corresponding to semantic clusters, and require density clustering as a preprocessing step. The branches of a single-document chapter tree are usually determined by the document's inherent structure; the branches of a binary semantic navigation tree are constructed through semantic cluster merging, balance constraints, and semantic distance constraints, ensuring branch distinguishability. The structure of a single-document chapter tree is usually fixed, while a binary semantic navigation tree needs to handle the relationship between node weight balance and branch semantic distinguishability.
[0205] As the document size expands from hundreds to thousands, the number of navigation steps can be increased; even when the document size expands to tens of thousands, the candidate range processed in each large language model call can still be narrowed down through layer-by-layer binary navigation. The single-step complete navigation prompts include information on the two sub-branches of the current node, similarity information, and a differential summary. The intra-cluster selection stage processes the document descriptions within the semantic clusters corresponding to the leaf nodes. This two-stage processing avoids inputting the entire document description into the large language model all at once.
[0206] According to one aspect of this application, an electronic device is provided, comprising: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory; when the electronic device is running, the processor executes the one or more computer programs stored in the memory to cause the electronic device to perform a multi-document retrieval method based on semantic Huffman tree and hierarchical reasoning as described in any of the above technical solutions.
[0207] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0208] The memory can be an internal storage unit of the terminal device, such as a hard drive or RAM. Alternatively, it can be an external storage device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory can include both internal and external storage units. The memory is used to store the computer program and other programs and data required by the terminal device. It can also be used to temporarily store data that has been output or will be output.
[0209] According to one aspect of this application, a computer-readable storage medium is provided for storing computer instructions, which, when executed by a processor, implement a multi-document retrieval method based on semantic Huffman trees and hierarchical reasoning as described in any of the above technical solutions.
[0210] For example, computer-readable storage media can be read-only memory (ROM), random access memory (RAM), read-only optical disc (CD-ROM), magnetic tape, floppy disk, and optical data storage devices, etc. They can be implemented using program code executable by a computing device, thus allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Therefore, this application is not limited to any particular hardware and software combination.
[0211] This application presents a multi-document retrieval method and system based on semantic Huffman trees and hierarchical reasoning, which has the following advantages:
[0212] (1) The SHT-HR-MDR proposed in this application breaks through the "impossible triangle" of retrieval technology: compared with the pure vector retrieval scheme (VoR, 52.67%), the accuracy of the method of this invention reaches 82.00%, an improvement of 29.33 percentage points, and the effect is significantly improved. Compared with the large model full inference scheme (LoR, 84.00%), this invention achieves a significant improvement in retrieval efficiency with an accuracy difference of only 2 percentage points: LoR retrieval time is 9.52 seconds / query, while SHT-HR-MDR is 5.30 seconds / query, a speed improvement of 1.8 times; LoRToken consumption is 54586 / query, while SHT-HR-MDR is only 7279 / query, saving 7.5 times. At the same time, SHT-HR-MDR is the only scheme that provides a complete and traceable retrieval decision chain while maintaining high accuracy, achieving a breakthrough balance in the three dimensions of accuracy, efficiency and interpretability.
[0213] (2) The total token consumption of SHT-HR-MDR is only 13.3% of that of LoR (7279 vs 54586), achieving a relative accuracy of 97.6% (82.00% / 84.00%) with a token consumption of only 13.3%, demonstrating the significant advantage of the hierarchical navigation strategy in reducing the context burden of LLM. SHT-HR-MDR decomposes the retrieval process into O(log C) (C is the number of clusters) small-scale LLM calls, each call only needs to process the digests of the two subtrees of the current node (about 200-400 tokens), avoiding the context window overflow and "Lost-in-the-Middle" problem caused by the full inference mode of LoR.
[0214] (3) High accuracy of semantic Huffman tree navigation: The cluster localization accuracy of LLM hierarchical navigation reaches 90.00%, proving that the combined use of semantic Huffman coding and balance constraints effectively alleviates the contradiction between balance and distinguishability. Only about 6 LLM calls are needed in the navigation stage to locate the target cluster from 41 semantic clusters. Each navigation decision is based on branch differential summary and semantic similarity score.
[0215] (4) The tree structure is balanced and distinguishable: the classic Huffman algorithm ensures that the tree depth is O(log C), the binary tree constructed by 41 clusters has a depth of 8 layers, and the average size ratio of the left and right subtrees of the internal nodes is only 1.4; the differential summary of the internal nodes of the tree ensures that LLM obtains the maximum amount of information when selecting branches at each level.
[0216] (5) Scalability: The navigation depth is logarithmically related to the number of documents. When the document size expands from hundreds to thousands, the number of navigation steps only increases by 2-3 steps; when it expands to tens of thousands, it increases by 3-5 steps. Since the token consumption for each navigation is fixed (about 200-400 tokens), the total system overhead increases logarithmically with the document size, which has good scalability.
[0217] This application can support efficient retrieval of multiple documents on a scale of thousands or tens of thousands, avoid context window overflow, eliminate cross-document routing conflicts, significantly reduce token consumption, and improve the efficiency and accuracy of inference retrieval.
[0218] The above description is merely one embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A multi-document retrieval method based on semantic Huffman trees and hierarchical reasoning, characterized in that, Includes the following steps: Step S1: Generate document summaries and corresponding semantic embedding vectors based on documents in the knowledge base; Step S2: Cluster the document based on the semantic embedding vector to obtain multiple semantic clusters; Step S3: Construct a binary semantic navigation tree using the number of documents contained in each semantic cluster as the node weight and semantic distance as the merging criterion, and generate a differentiated summary representing the difference between its two sub-branches for each internal node; Step S4: Receive the query and generate the query embedding vector; Step S5: Starting from the root node of the binary semantic navigation tree, navigate from top to bottom. At the current internal node, based on the semantic similarity between the query embedding vector and the two child nodes and the differential summary, generate navigation prompt information and call the large language model to select the next navigation node from the two child nodes. Step S6: Take the selected next navigation node as the new current node and repeat the navigation process until the current node is a leaf node; Step S7: Provide the summary and meta-information of each document in the target semantic cluster corresponding to the leaf node to the large language model to determine the target document.
2. The method according to claim 1, characterized in that, In step S1, document summaries are generated based on the documents in the knowledge base, including: Divide the document into multiple text blocks according to the document directory structure; When a text block exceeds a preset length, it is split according to paragraph boundaries, and when a single paragraph exceeds the preset length, it is split according to sentence boundaries. Text block summaries for each text block are generated using a large language model. The document summary is generated by integrating text blocks belonging to the same document in their original order. The preset length is determined based on the word segmenter of the target embedding model, so that the actual input length of each text block does not exceed the context length of the target embedding model.
3. The method according to claim 1, characterized in that, In step S2, the documents are clustered based on the semantic embedding vectors, including: The distance between documents is determined based on the cosine similarity of the semantic embedding vectors of any two documents; HDBSCAN density clustering is performed using the inter-document distance as input to obtain the multiple semantic clusters; The minimum cluster size for HDBSCAN density clustering is 3, the minimum number of samples is 2, the cluster selection threshold is 0.15, and noisy documents are assigned to noisy clusters.
4. The method according to claim 1, characterized in that, In step S3, a binary semantic navigation tree is constructed, including: Each semantic cluster is initialized as a leaf node, and the weight of the leaf node is the number of documents in the corresponding semantic cluster. Select the first active node with the lowest weight from among all active nodes; From the other active nodes besides the first active node, determine the candidate nodes whose weight ratio with the first active node is not greater than the current balance threshold, and select the second active node with the smallest semantic distance from the first active node from the candidate nodes; Merge the first active node and the second active node to generate a new internal node, and update the active node set; Repeat the above operation until only the root node remains in the set of active nodes.
5. The method according to claim 1, characterized in that, In step S3, the differential summary includes at least: The document type and entity scope contained in the corresponding internal node, the metadata and topic of the left sub-branch, the metadata and topic of the right sub-branch, branch selection suggestions for metadata, and branch selection suggestions for topic.
6. The method according to claim 1, characterized in that, In step S5, the navigation prompt information includes: The current internal node contains two child nodes, each containing the number of documents, the main meta-information categories, unique meta-information features, the semantic similarity between the query embedding vector and the two child nodes, the comparison conclusion of the semantic similarity, the differentiated summary, and branch selection suggestions.
7. The method according to claim 1, characterized in that, In step S7, the summaries and meta-information of each document within the target semantic cluster corresponding to the leaf node are provided to the large language model, including: Organize each document's document identifier, associated entity, time period, document type, and document summary into a structured document description; The large language model is invoked to determine the target document based on the query and the structured document description; The output is a JSON-formatted result containing the reasoning process and the target document identifier.
8. A multi-document retrieval system based on semantic Huffman trees and hierarchical reasoning, characterized in that, include: The semantic embedding vector production module is used to generate document summaries and corresponding semantic embedding vectors based on documents in the knowledge base. The clustering module is used to cluster the document based on the semantic embedding vector to obtain multiple semantic clusters; The differential summary generation module is used to construct a binary semantic navigation tree by using the number of documents contained in each semantic cluster as the node weight and semantic distance as the merging criterion, and to generate differential summaries for each internal node that represent the differences between its two sub-branches. The query embedding vector generation module is used to receive queries and generate query embedding vectors. The navigation prompt information generation module is used to navigate from top to bottom starting from the root node of the binary semantic navigation tree. At the current internal node, it generates navigation prompt information based on the semantic similarity between the query embedding vector and the two child nodes and the differential summary, and calls the large language model to select the next navigation node from the two child nodes. The navigation prompt information generation module is also used to take the selected next navigation node as the new current node and repeat the navigation process until the current node is a leaf node. The sending module is used to provide the summary and meta-information of each document in the target semantic cluster corresponding to the leaf node to the large language model in order to determine the target document.
