Tree document retrieval method, device and equipment and storage medium

By constructing a combination of task trees and document trees, and utilizing a large language model to plan retrieval paths in a tree structure, the problems of incomplete answers and insufficient contextual support in traditional systems are solved, achieving more accurate and comprehensive document retrieval.

CN121166842BActive Publication Date: 2026-04-14BEIJING SILICON HEART TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-14
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Traditional retrieval-enhanced generation systems and deep search systems cannot fully utilize the capabilities of large language models when processing tree-structured documents, resulting in incomplete answers or a lack of sufficient contextual support, which affects the solution quality.

Method used

A tree-structured document retrieval method is adopted. By constructing a task tree and a document tree, a large language model is used to plan the retrieval path in the tree structure, conduct multi-step thinking and gradual in-depth exploration, and generate more accurate and comprehensive answers.

Benefits of technology

It improves retrieval efficiency and accuracy, ensures comprehensive coverage of key information, avoids information loss caused by excessively long historical records, and significantly enhances the performance of large language models in handling complex problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166842B_ABST
    Figure CN121166842B_ABST
Patent Text Reader

Abstract

The application discloses a tree document retrieval method, device, equipment and storage medium. The method comprises the following steps: obtaining a pre-stored document tree, the leaf nodes of the document tree correspond to document content, and the non-leaf nodes correspond to directory information; initializing a task tree representing a retrieval path, the initial state of the task tree comprises a root node, and the four-tuple information of the root node comprises an original question, a document tree root node path, document tree root node content and an empty history record list; inputting the information on the current task tree into a large language model, the large language model plans a retrieval path based on the task tree, and outputs text information returned by the root node of the task tree; and obtaining a retrieval result based on the text information returned by the root node of the task tree. The application proposes a document retrieval method based on a task tree and a document tree, uses the reasoning and multi-step thinking ability of the large language model, so that the model can further explore and reason according to the existing node information, and generate more accurate and comprehensive answers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data retrieval technology, and more specifically, to a tree-structured document retrieval method, apparatus, device, and storage medium. Background Technology

[0002] In AI-assisted software development, much critical information (such as niche or confidential operational manuals, user documents, and technical specifications) is unknown during AI model training. These documents are typically organized in a tree structure, facilitating human reading and management. However, traditional retrieval-enhanced generative systems and deep search systems have significant limitations in processing this type of information.

[0003] Traditional retrieval-enhanced generation systems obtain relevant information through a one-time similarity search and directly input this information along with the question into a large language model to generate an answer. This approach fails to fully utilize the capabilities of the large language model; the model can only answer based on the limited information retrieved so far, unable to think and explore further based on existing information like a human. Furthermore, it cannot retrieve all content at once, resulting in incomplete answers.

[0004] Deep search systems address the multi-hop problem by repeatedly using similarity retrieval, determining the next retrieval request based on the previous retrieval result. However, in single-agent or multi-agent task assignments, each agent needs to linearly maintain its entire historical record for use by the large language model. As the number of retrieval steps increases, the historical record of a single agent becomes increasingly long, potentially leading to reduced performance. When each agent is first assigned a task, it may not have all the relevant information about the task's current state. This results in agents lacking sufficient contextual support when solving the problem, thus affecting the final solution. Summary of the Invention

[0005] This application provides a tree-structured document retrieval method, apparatus, device, and storage medium to at least address the technical problem of low document retrieval accuracy in related technologies.

[0006] According to one aspect of the embodiments of this application, a tree-structured document retrieval method is provided, including:

[0007] Obtain a pre-stored document tree, where leaf nodes correspond to document content and non-leaf nodes correspond to directory information;

[0008] Initialize the task tree representing the retrieval path. The initial state of the task tree includes a root node. The four-tuple information of the root node includes the original question, the root node path of the document tree, the root node content of the document tree, and an empty history list.

[0009] The information on the current task tree is input into the large language model, which plans a retrieval path based on the task tree and outputs the text information returned by the root node of the task tree.

[0010] The search results are obtained based on the text information returned by the root node of the task tree.

[0011] In one implementation, inputting the information from the current task tree into the large language model includes:

[0012] Obtain all four-tuple information of the current node and its ancestor nodes in the task tree using a preorder traversal.

[0013] A survey record is generated based on all the quadruple information, and the survey record is input into the large language model.

[0014] In one implementation, the information on the current task tree is input into a large language model, which plans a retrieval path based on the task tree and outputs the text information returned by the root node of the task tree, including:

[0015] Based on the information in the current task tree, the survey record is obtained. The large language model makes a decision based on the survey record, choosing to enter the child node of the document tree or return to the parent node.

[0016] If you choose to enter the target child node of the document tree, assign a problem to the target child node, and add a child node to the current node of the task tree. Based on the information of the target child node of the document tree, obtain the four-tuple information of the newly added child node in the task tree; switch the current node of the task tree to the newly added child node.

[0017] If you choose to return to the parent node, return the text information to the parent node of the current node in the task tree, and switch the current node in the task tree to its parent node;

[0018] Repeat the above steps until you receive the text information returned by the root node of the task tree.

[0019] In one implementation, the large language model makes a decision based on the survey records, choosing to enter a child node of the document tree or return to the parent node, including:

[0020] When the document tree node is a non-leaf node, the large language model makes a decision based on the survey record, choosing to enter the document tree child node or return to the parent node;

[0021] When the document tree node is a leaf node, the large language model makes a decision based on the survey records and chooses to return to the parent node.

[0022] In one implementation, after selecting to enter the target child node of the document tree, the method further includes:

[0023] The large language model generates path information for the target child nodes of the document tree and assigns a problem to the target child nodes.

[0024] In one implementation, if the option to return to the parent node is selected, text information is returned to the parent node of the current node in the task tree, and the current node in the task tree is switched to its parent node, including:

[0025] If the parent node is selected to be returned, the large language model returns text information to the parent node of the current task tree node;

[0026] Append a triple consisting of the question of the current task tree node, the path of the corresponding document tree node, and the returned text information to the history list of the parent node.

[0027] Switch the current node in the task tree to its parent node.

[0028] In one implementation, it further includes:

[0029] Construct prompts, which are used to standardize the thinking process and output results;

[0030] Each time the large language model is invoked, the prompt information is input into the large language model.

[0031] According to another aspect of the embodiments of this application, a tree-structured document retrieval device is provided, comprising:

[0032] The acquisition module is used to acquire a pre-stored document tree, wherein the leaf nodes of the document tree correspond to the document content and the non-leaf nodes correspond to the directory information.

[0033] The task tree construction module is used to initialize the task tree representing the retrieval path. The initial state of the task tree includes a root node. The four-tuple information of the root node includes the original question, the path of the document tree root node, the content of the document tree root node, and an empty history list.

[0034] The retrieval module is used to input the information on the current task tree into the large language model, the large language model plans the retrieval path based on the task tree, and outputs the text information returned by the root node of the task tree;

[0035] The results output module is used to obtain search results based on the text information returned by the root node of the task tree.

[0036] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described tree-structured document retrieval method through the computer program.

[0037] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described tree-structured document retrieval method at runtime.

[0038] The technical solutions provided in this application embodiment may include the following beneficial effects:

[0039] This application proposes a retrieval method based on task trees and document trees. It fully leverages the reasoning and multi-step thinking capabilities of large language models, enabling the model to plan retrieval paths based on a constructed tree structure. Through multiple retrievals and progressively deeper thinking, the model can further explore and reason based on existing information, thereby generating a more accurate and comprehensive answer. For complex questions, a single retrieval may not retrieve all relevant information. This application, through progressively deeper exploration using a tree structure, can better handle complex questions, ensuring that all relevant information is retrieved and integrated into the final answer.

[0040] Furthermore, this application, through structured management of task trees and document trees, ensures that the contextual information of each step is effectively utilized, avoiding problems such as excessively long historical records and missing information. This significantly improves retrieval efficiency and accuracy, ensuring that key information is not overlooked. It also significantly enhances the performance of large language models in handling complex problems and multi-step reasoning. Attached Figure Description

[0041] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0042] Figure 1 This is a flowchart of a tree-structured document retrieval method according to an embodiment of this application;

[0043] Figure 2 This is a schematic diagram of a tree-structured document retrieval method according to an embodiment of this application;

[0044] Figure 3 This is a schematic diagram of a node-level state transition according to an embodiment of this application;

[0045] Figure 4 This is a schematic diagram of a document tree according to an embodiment of this application;

[0046] Figure 5 This is a schematic diagram of a task tree according to an embodiment of this application;

[0047] Figure 6 This is a schematic diagram of a tree-structured document retrieval device according to an embodiment of this application;

[0048] Figure 7 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0049] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0050] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0051] This application provides a tree-structured offline document retrieval method, specifically designed for enterprise-level tree-structured document architectures. Each retrieval targets a specific question, and the model determines whether to delve deeper into child nodes or return to the parent node based on information from the current task tree node. The retrieval process is entirely offline, independent of real-time user interaction, ensuring efficient operation even without a network connection. This method is particularly suitable for handling complex problems, progressively exploring the document tree, refining the question, and ultimately generating an accurate answer. In this way, enterprises can better utilize internal document resources, improving the accuracy and efficiency of information retrieval.

[0052] The tree-structured document retrieval method of this application, as described below with reference to the accompanying drawings, will be described in detail. For example... Figure 1 As shown, the method mainly includes the following steps:

[0053] S101 retrieves the pre-stored document tree. The leaf nodes of the document tree correspond to the document content, and the non-leaf nodes correspond to the directory information.

[0054] In one implementation, a document tree is derived based on the enterprise's internal tree-like document structure. A document tree is a hierarchical data structure used to organize and manage document content. It is similar to a directory structure in a file system, classifying and organizing document content according to a logical hierarchy.

[0055] The structure of a document tree includes a root node, which is the entry point to the entire document tree and usually represents the beginning of the entire collection of documents or a large document.

[0056] This includes internal nodes (child nodes), which represent categories or directories within the document and are used to further organize the document content. Each internal node can contain multiple child nodes. The identifier of an internal node is typically a path indicating its position in the document tree.

[0057] This includes leaf nodes, which represent actual document content and are the lowest-level nodes. Leaf nodes typically contain actual document data, such as text, tables, and images. The identifier of a leaf node is also a path, indicating its specific location in the document tree.

[0058] like Figure 4 The image shows a document tree diagram. This document tree illustrates the document structure of an internal enterprise development platform, with the root node "301: Internal Development Platform Documentation," which is divided into three main directories: 311 "CI / CD," 312 "Service Gateway," and 313 "Microservice Deployment." Under the "CI / CD" directory, there are two leaf nodes: "321 Document: Jenkins Job Templates" and "322 Document: Runner Security Guide." The "Service Gateway" directory contains two leaf nodes: "331 Document: Rate Limiting Policy Configuration" and "322 Document: Circuit Breaker and Degradation." The "Microservice Deployment" directory contains "341 Document: Blue-Green Deployment Process" and "342 Document: Canary Deployment Operation Guide." The entire document tree structure is clear, allowing users to quickly locate and retrieve relevant document content based on specific issues.

[0059] S102 initializes the task tree representing the retrieval path. The initial state of the task tree includes the root node. The four-tuple information of the root node includes the original question, the path of the root node of the document tree, the content of the root node of the document tree, and an empty history list.

[0060] In one implementation, a task tree representing the retrieval path is constructed. The task tree initially has only one root node, and as the retrieval progresses, the task tree will gradually add child nodes as needed.

[0061] Specifically, the task tree representing the retrieval path is initialized. The initial state of the task tree includes the root node. The four-tuple information of the root node includes the original question, the path of the root node of the document tree, the content of the root node of the document tree, and an empty history list.

[0062] Each node in the task tree is a quadruple consisting of (question, document tree node path, document tree node content (single-level directory or specific document content), and a list of historical questions asked down from the current node).

[0063] like Figure 5 The image shows a schematic diagram of a task tree, illustrating an example task tree used to address the specific steps involved in implementing blue-green deployments with rollback capabilities on a company's Kubernetes cluster. The task tree begins with the root task node 401, which poses the question "How to perform a blue-green deployment with rollback?" and points to the root directory of the documentation tree. Subsequently, the task tree branches to child node 402, refining the question to "Focusing on Deployment Strategies," and further branches to leaf nodes 403 and 404, corresponding to the questions "What are the steps for a blue-green deployment?" and "How to rollback?" respectively. Each leaf node links to specific documentation content and records the question history. Finally, the task tree, through steps S1 to S7, summarizes the information and returns the final answer to the root node 408, completing the entire retrieval process.

[0064] S103 inputs the information from the current task tree into the large language model, which plans the retrieval path based on the task tree and outputs the text information returned by the root node of the task tree.

[0065] In one implementation, inputting information from the current task tree into a large language model includes: obtaining all four-tuple information of the current node and its ancestor nodes in the task tree using a preorder traversal; generating survey records based on all four-tuple information; and inputting the survey records into the large language model. The large language model can be any existing large language model, and this application does not impose specific limitations.

[0066] First, starting from the current node in the task tree, a preorder traversal is used to sequentially visit and collect the quadruples of information from the current node and all its ancestor nodes. Each quadruple contains the question, the identifier of the document tree node, the content of the document tree node, and a list of historical queries. Next, these collected quadruples are integrated to generate a detailed research record. Finally, this research record is fed as input to the large language model to guide its next steps in the thinking and decision-making process, thereby planning an appropriate retrieval path or generating the corresponding answer. This method ensures that the large language model can operate based on complete contextual information, improving the accuracy and efficiency of retrieval.

[0067] Specifically, the large language model plans the retrieval path based on the task tree and outputs the text information returned by the root node of the task tree.

[0068] First, the survey records are obtained based on the information on the current task tree. The large language model makes a decision based on the survey records, choosing to enter the child node of the document tree or return to the parent node.

[0069] Using a preorder traversal, obtain all four-tuple information of the current node and its ancestor nodes in the task tree. Generate a survey record based on all four-tuple information and input the survey record into the large language model. The large language model makes a decision based on the survey record, choosing to enter the child node of the document tree or return to the parent node.

[0070] When a node in the document tree is not a leaf node, the large language model makes a decision based on the survey records, choosing to either enter a child node of the document tree or return to the parent node. In other words, when a node is not a leaf node, it can choose to delve deeper into the child nodes of the document tree or return to the parent node.

[0071] Understandably, when the document tree node is a leaf node, the large language model makes decisions based on the survey records and can only choose to return to the parent node.

[0072] If the target child node in the document tree is selected, the large language model generates the path information for the target child node and assigns a question to it. A new child node is then added to the current node in the task tree. Based on the target child node information, the four-tuple information for the new child node is obtained. This four-tuple includes the question, path, and content of the target child node. The history list of downward queries is empty. The current node in the task tree is then switched to the newly added child node.

[0073] If you choose to return to the parent node, return the text information to the parent node of the current node in the task tree, and switch the current node in the task tree to its parent node.

[0074] Specifically, if the parent node is selected to be returned, the large language model returns text information to the parent node of the current task tree node; the triple consisting of the question of the current task tree node, the path of the corresponding document tree node, and the returned text information is appended to the history list of the parent node, and the current node of the task tree is switched to its parent node.

[0075] Repeat the above steps until the text information returned by the root node of the task tree is obtained, at which point the retrieval terminates.

[0076] In one implementation, the method further includes constructing prompts to guide the thought process and output. These prompts are input into the large language model each time it is invoked.

[0077] For example, each time the large language model is invoked, it should output the following fields in sequence:

[0078] 1. Thinking process: Let the model think for itself. All conclusions that can be reached without additional information are considered here. Then, it can decide whether to go into a sub-node to conduct further research. If so, it should first enter which sub-node in the document tree to investigate what question. If not, it should return what information to ensure that even if it will not see the details of this part of the research in the future and does not need to read the original text, it can clearly know the details of the results obtained from this part of the research.

[0079] 2. Choose to enter a child node of the document tree or return to the parent node.

[0080] If you choose to enter a child node, output the identifier (path) of the child node in the document tree and the corresponding subquestion.

[0081] If you choose to return to the parent node, output the text information returned to the parent node.

[0082] like Figure 3 As shown in the image, this diagram illustrates a flowchart of node-level state transitions and data structures, used to describe the operational flow of nodes in the task tree. The flow begins at node 201, the current task tree node, which includes the question, the path to the corresponding document tree node, the content of the corresponding document tree node, and a list of downward question history.

[0083] Further, the survey record is constructed using the 202 context, including a preorder traversal of the ancestor chain and the current node. Next, the process proceeds to the 203 decision node, determining whether to drill down to a child node of the document tree (provided the current node is not a leaf node). If necessary, the process proceeds to the 204 document tree child node, selects a sub-path, generates a sub-question, adds a new child node to the task tree, and generates a four-tuple. The current node in the task tree is then switched to the newly added child node. Finally, the document tree content is read according to the sub-path.

[0084] If drilling down is not required, the process proceeds to step 205, returning to the parent node, generating text information and appending it to the parent node's history, then switching the current node in the task tree to the parent node. Ultimately, the process may reach step 206, the termination node, where the root node returns the answer, ending the retrieval process. The entire flowchart clearly illustrates how task tree nodes transition between different states and interact with the document tree to obtain the required information.

[0085] S104 obtains the search results based on the text information returned by the root node of the task tree.

[0086] In one implementation, the process continues until the root node has collected enough information to answer the question. The root node then integrates the research results from its child nodes, returning textual information to form a complete search result. This implementation ensures the systematic and comprehensive nature of the search process, making the final answer based on thorough document analysis and logical reasoning.

[0087] To facilitate understanding of the tree-structured offline document retrieval method provided in the embodiments of this application, the following is in conjunction with the appendix. Figure 2 Further description.

[0088] like Figure 2 As shown in the image, this diagram illustrates a flowchart of a document retrieval system, which is divided into an offline preparation stage and a retrieval and aggregation stage.

[0089] During the offline preparation phase, the system uses a document tree builder to parse the enterprise's internal tree-like documents, generating a document tree that includes information such as paths, whether a node is a leaf node, content, or directory. The generated document tree is then stored offline.

[0090] During the retrieval and aggregation phase, the system receives the original questions to be investigated, initializes the root node of the task tree, and the task tree node contains a four-tuple of information including the question, path, content, and history of downward queries.

[0091] Furthermore, a survey record is constructed by pre-order traversing the ancestor chain of the task tree and the current node using a context constructor. This survey record is then input into the LLM planner, and the system decides whether to proceed to a child node or return to the parent node. The action executor, based on the decision, creates a child node in the task tree or rewrites the history of the parent node, and switches the current node. The document tree node content is read along the path until the root node of the task tree returns the final answer, completing the retrieval.

[0092] This solution implements an efficient tree-structured offline document retrieval method by constructing a task tree and a document tree, which has significant beneficial effects.

[0093] This solution innovatively combines task trees and document trees, fully leveraging the reasoning and multi-step thinking capabilities of large language models. This allows them to plan more rational retrieval paths within the constructed tree structure. Through sequential, in-depth retrieval and reasoning, the model can not only conduct deeper exploration and reasoning based on existing information but also provide more comprehensive and accurate answers to complex problems.

[0094] Furthermore, the structured management mechanism of this solution ensures the effective use of contextual information during the retrieval process, effectively avoiding the problem of reduced retrieval results due to excessively long historical records or missing information. It ensures comprehensive coverage of key information, improving the comprehensiveness and accuracy of the retrieval.

[0095] According to another aspect of the embodiments of this application, a tree-structured document retrieval apparatus for implementing the above-described tree-structured document retrieval method is also provided. For example... Figure 6 As shown, the device includes:

[0096] The acquisition module 601 is used to acquire a pre-stored document tree. The leaf nodes of the document tree correspond to the document content, and the non-leaf nodes correspond to the directory information.

[0097] The task tree building module 602 is used to initialize the task tree representing the retrieval path. The initial state of the task tree includes the root node. The four-tuple information of the root node includes the original question, the path of the document tree root node, the content of the document tree root node, and an empty history list.

[0098] The retrieval module 603 is used to input the information on the current task tree into the large language model. The large language model plans the retrieval path based on the task tree and outputs the text information returned by the root node of the task tree.

[0099] The result output module 604 is used to obtain the search results based on the text information returned by the root node of the task tree.

[0100] It should be noted that the tree-structured document retrieval device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the tree-structured document retrieval method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the tree-structured document retrieval device and the tree-structured document retrieval method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0101] According to another aspect of the embodiments of this application, an electronic device corresponding to the tree-structured document retrieval method provided in the foregoing embodiments is also provided to execute the tree-structured document retrieval method described above.

[0102] Please refer to Figure 7 This illustrates a schematic diagram of an electronic device provided by some embodiments of this application. For example... Figure 7 As shown, the electronic device includes: a processor 700, a memory 701, a bus 702, and a communication interface 703. The processor 700, the communication interface 703, and the memory 701 are connected via the bus 702. The memory 701 stores a computer program that can run on the processor 700. When the processor 700 runs the computer program, it executes the tree-structured document retrieval method provided in any of the foregoing embodiments of this application.

[0103] The memory 701 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 703 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network.

[0104] Bus 702 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. Memory 701 is used to store programs. After receiving execution instructions, processor 700 executes the program. The tree-structured document retrieval method disclosed in any of the aforementioned embodiments of this application can be applied to processor 700, or implemented by processor 700.

[0105] The processor 700 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 700 or by instructions in software form. The processor 700 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 701. Processor 700 reads the information in memory 701 and, in conjunction with its hardware, completes the steps of the above method.

[0106] The electronic device provided in this application embodiment and the tree-structured document retrieval method provided in this application embodiment are based on the same inventive concept and have the same beneficial effects as the methods they adopt, operate or implement.

[0107] According to another aspect of the embodiments of this application, a computer-readable storage medium corresponding to the tree-structured document retrieval method provided in the foregoing embodiments is also provided, wherein a computer program (i.e., a program product) is stored thereon, and the computer program, when run by a processor, executes the tree-structured document retrieval method provided in any of the foregoing embodiments.

[0108] It should be noted that examples of computer-readable storage media may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.

[0109] The computer-readable storage medium provided in the above embodiments of this application and the tree-structured document retrieval method provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.

[0110] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0111] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this patent should be determined by the appended claims.

Claims

1. A tree-structured document retrieval method, characterized in that, include: Obtain a pre-stored document tree, where leaf nodes correspond to document content and non-leaf nodes correspond to directory information; Initialize the task tree representing the retrieval path. The initial state of the task tree includes a root node. The four-tuple information of the root node includes the original question, the root node path of the document tree, the root node content of the document tree, and an empty history list. The information on the current task tree is input into the large language model, which plans a retrieval path based on the task tree and outputs the text information returned by the root node of the task tree. This includes: obtaining survey records based on the information on the current task tree; the large language model making a decision based on the survey records, choosing to enter a child node of the document tree or return to the parent node; if entering the target child node of the document tree is chosen, a question is assigned to the target child node, and a new child node is added to the current node of the task tree; the four-tuple information of the newly added child node is obtained based on the information of the target child node of the document tree; the current node of the task tree is switched to the newly added child node; if returning to the parent node is chosen, text information is returned to the parent node of the current node of the task tree, and the current node of the task tree is switched to its parent node; the above steps are repeated until the text information returned by the root node of the task tree is obtained. The search results are obtained based on the text information returned by the root node of the task tree.

2. The method according to claim 1, characterized in that, Input the information from the current task tree into the large language model, including: Obtain all four-tuple information of the current node and its ancestor nodes in the task tree by preorder traversal; A survey record is generated based on all the quadruple information, and the survey record is input into the large language model.

3. The method according to claim 1, characterized in that, The large language model makes decisions based on the survey records, choosing to enter a child node of the document tree or return to the parent node, including: When the node in the document tree is a non-leaf node, the large language model makes a decision based on the survey record, choosing to enter the child node of the document tree or return to the parent node; When the node in the document tree is a leaf node, the large language model makes a decision based on the survey records and chooses to return to the parent node.

4. The method according to claim 1, characterized in that, If you choose to enter the target child node of the document tree, it also includes: The large language model generates path information for the target child nodes of the document tree and assigns a problem to the target child nodes.

5. The method according to claim 1, characterized in that, If the option to return to the parent node is selected, the text information is returned to the parent node of the current node in the task tree, and the current node in the task tree is switched to its parent node, including: If the parent node is selected to be returned, the large language model returns text information to the parent node of the current task tree node; Append a triple consisting of the question of the current task tree node, the path of the corresponding document tree node, and the returned text information to the history list of the parent node. Switch the current node in the task tree to its parent node.

6. The method according to claim 1, characterized in that, Also includes: Construct prompts, which are used to standardize the thinking process and output results; Each time the large language model is invoked, the prompt information is input into the large language model.

7. A tree-structured document retrieval device, characterized in that, include: The acquisition module is used to acquire a pre-stored document tree, wherein the leaf nodes of the document tree correspond to the document content and the non-leaf nodes correspond to the directory information. The task tree construction module is used to initialize the task tree representing the retrieval path. The initial state of the task tree includes a root node. The four-tuple information of the root node includes the original question, the path of the document tree root node, the content of the document tree root node, and an empty history list. The retrieval module is used to input the information on the current task tree into a large language model. The large language model plans a retrieval path based on the task tree and outputs the text information returned by the root node of the task tree. This includes: obtaining survey records based on the information on the current task tree; the large language model making a decision based on the survey records, choosing to enter a child node of the document tree or return to the parent node; if entering a target child node of the document tree is selected, assigning a question to the target child node and adding a child node to the current node of the task tree; obtaining the four-tuple information of the newly added child node of the task tree based on the information of the target child node of the document tree; switching the current node of the task tree to the newly added child node; if returning to the parent node is selected, returning text information to the parent node of the current node of the task tree and switching the current node of the task tree to its parent node; repeating the above steps until the text information returned by the root node of the task tree is obtained. The results output module is used to obtain search results based on the text information returned by the root node of the task tree.

8. An electronic device, characterized in that, It includes a processor and a memory storing program instructions, the processor being configured to perform the tree-structured document retrieval method as described in any one of claims 1 to 6 when executing the program instructions.

9. A computer-readable medium, characterized in that, It stores computer-readable instructions, which are executed by a processor to implement a tree-structured document retrieval method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Knowledge graph question and answer retrieval method based on large language model and MCTS algorithm

    CN118296114A

  • Large model retrieval question and answer method and device based on document structure tree

    CN120104727A