Inference method based on Monte Carlo tree search and electronic equipment
By combining the Monte Carlo tree search algorithm with knowledge graphs, a multi-level reasoning action space was designed to solve the uncertainty problem of LLM in high-risk, knowledge-intensive, and complex reasoning tasks, thereby improving the accuracy and interpretability of reasoning.
Patent Information
- Application Number
- CN202511476658.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-01-23
AI Technical Summary
Existing technologies struggle to effectively perform high-risk, knowledge-intensive, and complex reasoning tasks, especially under conditions of uncertainty, where LLM reasoning performs poorly, such as in medical auxiliary diagnostic tasks.
Combining the Monte Carlo tree search algorithm with knowledge graphs, an action space consisting of multi-level reasoning actions is designed. Reasoning tasks are executed through LLM, and domain knowledge provided by knowledge graphs is used as context to construct Monte Carlo trees for multiple rounds of node expansion to determine the target reasoning result.
It improves interpretability and accuracy in knowledge-intensive and complex reasoning tasks, without requiring additional knowledge domain fine-tuning training of LLM, and significantly enhances the performance of uncertain reasoning tasks.
Smart Images

Figure CN121390286A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] One or more embodiments of the present specification relate to the technical field of artificial intelligence, and in particular to a reasoning method based on Monte Carlo tree search and an electronic device. BACKGROUND
[0002] With the breakthrough progress of LLM (Large Language Model) in the field of natural language understanding and generation, by letting LLM simulate the thinking mechanism of human beings, the performance of LLM in performing some complex reasoning tasks can be significantly improved.
[0003] However, there are still great challenges in using LLM to perform some high-risk, knowledge-intensive complex reasoning tasks. SUMMARY
[0004] Therefore, one or more embodiments of the present specification provide technical solutions as follows: According to a first aspect of one or more embodiments of the present specification, a reasoning method based on Monte Carlo tree search is provided, which is applied to an LLM-based service program; wherein the service program accesses a knowledge graph corresponding to a knowledge domain to which a target reasoning task belongs; comprising: obtaining reasoning data related to a target reasoning task input by a user; wherein the target reasoning task includes multiple levels of reasoning actions performed in sequence; generating a root node of a Monte Carlo tree based on the reasoning data; wherein the Monte Carlo tree includes multiple layers of nodes corresponding one-to-one to the multiple levels of reasoning actions; any layer of nodes contained in the Monte Carlo tree is used to save an intermediate reasoning result generated by performing a reasoning action corresponding to the layer of nodes; running a Monte Carlo tree search algorithm, iteratively performing multiple rounds of node expansion on the Monte Carlo tree based on the root node to construct the Monte Carlo tree; wherein any round of node expansion performed on the Monte Carlo tree includes: calling the LLM, performing a next level of reasoning action of a reasoning action corresponding to a target leaf node to be expanded selected from the Monte Carlo tree by the LLM, generating an expansion node of the next level for the target leaf node; the LLM retrieves domain knowledge related to at least one level of reasoning action from the knowledge graph as reasoning context in the process of performing the at least one level of reasoning action in the multiple levels of reasoning actions; evaluating the reasoning results of each reasoning path contained in the constructed Monte Carlo tree, and determining a target reasoning result corresponding to the reasoning data from the reasoning results of each reasoning path contained in the Monte Carlo tree based on the evaluation results.
[0005] Optionally, the target reasoning task includes an uncertain reasoning task with multiple reasoning actions executed in sequence.
[0006] Optionally, the multiple reasoning actions include: a first reasoning action for extracting a key reasoning entity corresponding to the target reasoning task from the reasoning data; a second reasoning action for generating a potential reasoning result corresponding to the target reasoning task based on the key reasoning entity; a third reasoning action for generating a reasoning verification entity corresponding to the potential reasoning result; a fourth reasoning action for verifying whether the potential reasoning result is a target reasoning result corresponding to the target reasoning task based on the reasoning verification entity; Correspondingly, the Monte Carlo tree includes a first layer of nodes for saving the key reasoning entity, a second layer of nodes for saving the potential reasoning result, a third layer of nodes for saving the reasoning verification entity, and a fourth layer of nodes for saving a verification result of verifying whether the potential reasoning result is the target reasoning result corresponding to the target reasoning task.
[0007] Optionally, the LLM takes a set of potential reasoning results related to the key reasoning entity retrieved from the knowledge graph as reasoning context in the process of executing the second reasoning action in the multiple reasoning actions; and the LLM takes a set of reasoning verification entities related to the potential reasoning result retrieved from the knowledge graph as reasoning context in the process of executing the third reasoning action in the multiple reasoning actions. Correspondingly, the second reasoning action takes a set of potential reasoning results related to the key reasoning entity retrieved from the knowledge graph as reasoning context to generate the potential reasoning result corresponding to the target reasoning task. The third reasoning action takes a set of reasoning verification entities related to the potential reasoning result retrieved from the knowledge graph as reasoning context to generate the reasoning verification entity corresponding to the potential reasoning result.
[0008] Optionally, a Monte Carlo tree search algorithm is run to perform node expansion of any one of the multiple rounds of node expansion on the Monte Carlo tree based on the root node, including: selecting a target leaf node to be expanded from the current Monte Carlo tree based on a preset strategy; calling the LLM, and performing, by the LLM, a next-level inference action corresponding to the target leaf node to generate a next-level child node set corresponding to the target leaf node; randomly selecting a target child node from the child node set, and adding the target child node as an expanded node corresponding to the target leaf node to the Monte Carlo tree at the next level to perform node expansion on the target leaf node; calling the LLM, and continuing, by the LLM, to perform, in sequence, each of the remaining next-level inference actions in the multi-level inference actions except for the inference action corresponding to the expanded node at the next level to perform node simulation on the expanded node until a target inference result corresponding to the inference data is obtained.
[0009] Optionally, the verification result obtained by the LLM when performing the fourth-level inference action includes: a first verification result indicating that the potential inference result is verified by the inference verification entity to be a target inference result corresponding to the target inference task; a second verification result indicating that the inference verification entity is included in the inference data input by the user, but there is still uncertainty about whether the potential inference result is the target inference result corresponding to the target inference task, and the inference verification entity needs to be regenerated, and the potential inference result is further verified based on the regenerated inference verification entity to determine whether it is the target inference result corresponding to the target inference task; a third verification result indicating that the potential inference result is verified by the inference verification entity to be not the target inference result corresponding to the target inference task; a fourth verification result indicating that the inference verification entity is not included in the inference data input by the user, but other key inference entities included in the inference data support the conclusion that the potential inference result is the target inference result corresponding to the target inference task, and the inference verification entity needs to be regenerated, and the potential inference result is further verified based on the regenerated inference verification entity to determine whether it is the target inference result corresponding to the target inference task.
[0010] Optionally, calling the LLM, and performing, by the LLM, a next-level inference action corresponding to the target leaf node to generate a next-level child node set corresponding to the target leaf node, and randomly selecting a target child node from the child node set, and adding the target child node as an expanded node corresponding to the target leaf node to the Monte Carlo tree at the next level to perform node expansion on the target leaf node, includes: If the inference action corresponding to the target leaf node is the fourth-level inference action, and the verification result saved in the target leaf node is the first verification result, stopping node expansion on the target leaf node; If the inference action corresponding to the target leaf node is the fourth-level inference action, and the verification result saved in the target leaf node is the second verification result, returning the third-level inference action, and calling the LLM to continue executing the third-level inference action by the LLM to generate a child node set of the next level corresponding to the target leaf node; randomly selecting a target child node from the child node set, and adding the target child node as an expansion node of the next level corresponding to the target leaf node to the Monte Carlo tree; If the inference action corresponding to the target leaf node is the fourth-level inference action, and the verification result saved in the target leaf node is the third verification result, returning the second-level inference action, and calling the LLM to continue executing the second-level inference action by the LLM to generate a child node set of the next level corresponding to the target leaf node; randomly selecting a target child node from the child node set, and adding the target child node as an expansion node of the next level corresponding to the target leaf node to the Monte Carlo tree; If the inference action corresponding to the target leaf node is the fourth-level inference action, and the verification result saved in the target leaf node is the fourth verification result, returning the third-level inference action, and calling the LLM to continue executing the third-level inference action by the LLM to generate a child node set of the next level corresponding to the target leaf node; randomly selecting a target child node from the child node set, and adding the target child node as an expansion node of the next level corresponding to the target leaf node to the Monte Carlo tree.
[0011] Optionally, calling the LLM to continue executing the inference actions of the multiple levels of inference actions in sequence except for the inference action corresponding to the expansion node of the next level, to perform node simulation on the expansion node until a target inference result corresponding to the inference data is obtained, comprising: If the inference action corresponding to the expansion node of the next level is the fourth-level inference action, and the verification result saved in the expansion node is the first verification result, stopping node simulation on the expansion node; If the inference action corresponding to the extension node of the next level is the fourth-level inference action, and the verification result saved in the extension node is the second verification result, the third-level inference action is returned, the LLM is invoked, the LLM continues to re-execute the third-level inference action and the fourth-level inference action in sequence, and the above process is repeated until the LLM stops when the verification result obtained by executing the fourth-level inference action is the first verification result; If the inference action corresponding to the extension node of the next level is the fourth-level inference action, and the verification result saved in the extension node is the third verification result, the second-level inference action is returned, the LLM is invoked, the LLM continues to re-execute the second-level inference action, the third-level inference action and the fourth-level inference action in sequence, and the above process is repeated until the LLM stops when the verification result obtained by executing the fourth-level inference action is the first verification result; If the inference action corresponding to the extension node of the next level is the fourth-level inference action, and the verification result saved in the extension node is the fourth verification result, the third-level inference action is returned, the LLM is invoked, the LLM continues to re-execute the third-level inference action and the fourth-level inference action in sequence, and the above process is repeated until the LLM stops when the verification result obtained by executing the fourth-level inference action is the first verification result.
[0012] Optionally, the inference results of each inference path contained in the constructed Monte Carlo tree are evaluated, and a target inference result corresponding to the inference data is determined from the inference results of each inference path contained in the Monte Carlo tree based on the evaluation results, including: The inference results of each inference path contained in the Monte Carlo tree are summarized to obtain a set of inference results; The first score, the second score and the third score corresponding to each inference result in the set of inference results are calculated respectively; wherein the first score corresponding to any inference result in the set of inference results represents the consistency degree of each inference path having the inference result; the second score corresponding to any inference result in the set of inference results represents the diversity degree of each inference path having the inference result; and the third score corresponding to any inference result in the set of inference results represents the inference accuracy degree of each inference path having the inference result; The first score, the second score and the third score are weighted calculated to obtain a comprehensive score corresponding to each inference result in the set of inference results; wherein the first score and the third score are positively correlated with the comprehensive score; and the second score is negatively correlated with the comprehensive score. The reasoning result with the highest comprehensive score in the set of reasoning results is determined as the target reasoning result corresponding to the reasoning data.
[0013] Optionally, the first score corresponding to any inference result in the inference result set includes: the ratio of the number of inference paths with the inference result to the total number of inference paths contained in the Monte Carlo tree; the second score corresponding to any inference result in the inference result set includes: the sum of similarities between the various inference paths with the inference result; and the third score corresponding to any inference result in the inference result set includes: the sum of quality scores obtained by evaluating the inference accuracy of the various inference paths with the inference result based on LLM.
[0014] Optionally, the target reasoning task includes a medical auxiliary diagnosis task; the reasoning data includes symptom descriptions input by the user; the key reasoning entities include key clinical feature entities; the potential reasoning results include potential disease types; the knowledge graph includes a medical knowledge graph for medical auxiliary diagnosis; and the reasoning verification entity includes typical clinical feature entities corresponding to the potential disease types. The multi-level reasoning actions include: The first-level reasoning action is used to extract key clinical feature entities corresponding to the medical auxiliary diagnosis from the symptom description; The second-level reasoning action is used as the reasoning context to generate potential disease types corresponding to the medical auxiliary diagnosis task, using the set of potential diseases related to the key clinical feature entities retrieved from the medical knowledge graph as the reasoning context. The third-level reasoning action is used to generate typical clinical feature entities corresponding to the potential disease type by using the set of typical clinical feature entities retrieved from the medical knowledge graph that are related to the potential disease type as the reasoning context. The fourth level of reasoning is used to verify, based on the typical clinical characteristics, whether the potential disease type is the target disease type corresponding to the medical auxiliary diagnostic task; Accordingly, the nodes in the first layer of the Monte Carlo tree are used to store the key clinical features; the nodes in the second layer of the Monte Carlo tree are used to store the potential disease type; the nodes in the third layer of the Monte Carlo tree are used to store the typical clinical feature entities; and the nodes in the fourth layer of the Monte Carlo tree are used to store the verification results of whether the potential disease type is the target disease type corresponding to the disease auxiliary diagnosis task.
[0015] Optionally, the LLM-based service program includes an agent intelligent body built based on LLM.
[0016] According to a second aspect of one or more embodiments of this specification, an electronic device is also provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor performs the executable instructions to implement the steps of the method as described in any of the first aspects above.
[0017] According to a third aspect of one or more embodiments of this specification, a computer-readable storage medium is also provided, having stored thereon computer instructions that, when executed by a processor, implement the steps of the method as described in any of the first aspects above.
[0018] According to a fourth aspect of one or more embodiments of this specification, a computer program product is also provided, comprising a computer program / instructions that, when executed by a processor, implement the steps of the method as described in any of the first aspects above.
[0019] In the above embodiments, by combining the Monte Carlo tree search algorithm with knowledge graphs and designing a hierarchical action space consisting of multiple reasoning actions executed in sequence for the target reasoning task, general-purpose LLMs can perform some knowledge-intensive complex reasoning tasks without additional fine-tuning training in the relevant knowledge domains, and significantly improve interpretability and accuracy when performing knowledge-intensive complex reasoning tasks. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of the architecture of an inference service system provided in an exemplary embodiment.
[0021] Figure 2 This is a flowchart illustrating an exemplary embodiment of a reasoning method based on Monte Carlo tree search.
[0022] Figure 3 This is a schematic diagram of a Monte Carlo tree provided in an exemplary embodiment.
[0023] Figure 4 This is an exemplary embodiment of a diagram illustrating the construction of a Monte Carlo tree in a disease-aided diagnosis scenario.
[0024] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an exemplary embodiment.
[0025] Figure 6 This is a block diagram of an LLM-based data analysis device provided in an exemplary embodiment. Detailed Implementation
[0026] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0027] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties. The collection, use and processing of related data shall comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals shall be provided for users to choose to authorize or refuse.
[0028] While LLMs can perform some complex reasoning tasks by simulating human thinking mechanisms, they still face significant challenges when performing high-risk, knowledge-intensive, and uncertain reasoning tasks.
[0029] In this context, uncertain reasoning refers specifically to the process of reasoning using methods such as probability theory and fuzzy logic under conditions of incomplete knowledge, ambiguous evidence, or multiple unique conclusions.
[0030] For example, medical auxiliary diagnosis is a typical uncertainty reasoning task.
[0031] Medical diagnostic aids typically involve the complex integration of structured and unstructured data, requiring iterative optimization and reasoning that combines physician experience with external medical knowledge. Furthermore, patients often do not exhibit all clinical manifestations of a disease, but rather present with partial or atypical symptoms, which further increases the reasoning complexity of such tasks.
[0032] Currently, for uncertain reasoning tasks such as medical auxiliary diagnosis, the task decomposition strategies used for deterministic reasoning tasks (such as mathematical reasoning tasks) are mostly followed. This not only fails to fully integrate medical knowledge to adapt to the complexity of clinical diagnosis, but also, because uncertain reasoning tasks are usually indivisible, it is difficult to achieve good results when reasoning for such uncertain reasoning tasks based on LLM.
[0033] Based on this, this specification proposes an LLM reasoning framework that combines the Monte Carlo tree search algorithm with knowledge graphs.
[0034] Within this reasoning framework, by combining the Monte Carlo tree search algorithm with knowledge graphs and designing a hierarchical action space consisting of multiple reasoning actions executed sequentially for reasoning tasks, general-purpose LLMs can perform knowledge-intensive complex reasoning tasks without additional fine-tuning training in the relevant knowledge domains, and significantly improve interpretability and accuracy when performing knowledge-intensive complex reasoning tasks.
[0035] Figure 1 This is a schematic diagram of the architecture of an inference service system provided in an exemplary embodiment.
[0036] like Figure 1 As shown, the system may include a server 11, a network 12, and several electronic devices, such as a PC (Personal Computer) 13, a mobile phone 14, etc.
[0037] Server 11 can be a physical server containing an independent host, or server 11 can be a virtual server hosted in a host cluster. During operation, server 11 can run a server-side program to implement the relevant functions of the inference service. For example, when server 11 runs an LLM-based service program (such as an agent built based on LLM), it can act as the server side of that service program.
[0038] PC13 and mobile phone14 are just some of the types of electronic devices that users can use. In reality, users can obviously also use electronic devices such as tablets, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smartwatches, etc.), etc., and one or more embodiments in this specification do not limit this. During operation, the electronic device can also run a client-side program to implement the relevant functions of the inference service. For example, when the electronic device runs an LLM-based inference service program, it can act as a client of the inference service system. The client-side application of the aforementioned inference service system can be launched and run on the electronic device. This client-side program can be a native application installed on the electronic device, or it can be a mini-program, quick app, or other similar form. Of course, when using web technologies such as HTML5 or similar, the relevant functions can be implemented through a page displayed by a browser. This browser can be a standalone browser application or a browser module embedded in some applications.
[0039] As for the network 12 that enables interaction between electronic devices such as PC13 and mobile phone 14 and server 11, communication can be achieved using either wired or wireless networks, depending on the communication methods supported by the respective electronic devices. This specification does not impose any restrictions on this. For example, PC13 can support both wired and wireless communication, so it can use either wired or wireless networks as needed. Mobile phone 14 typically only supports wireless communication, so it can use a wireless network for communication.
[0040] The technical solution of this specification will be described in detail below with reference to the accompanying drawings.
[0041] Please see Figure 2 , Figure 2 This document presents a flowchart of a reasoning method based on Monte Carlo tree search, the method comprising the following execution process: Step 202: Obtain the reasoning data related to the target reasoning task input by the user; wherein, the target reasoning task includes multi-level reasoning actions executed in sequence; The entity executing the above method may specifically include a service program built based on LLM.
[0042] It should be noted that the service program built on LLM can specifically include using LLM as the core computing engine, with the LLM responsible for providing services such as natural language understanding, generation, reasoning, and decision-making capabilities.
[0043] For example, in some embodiments, the aforementioned service program may specifically include an agent built on an LLM (Liquidity, Machine Learning) foundation. For instance, in some examples, it could be an AI assistant that provides users with inference services based on Monte Carlo Tree Search (MCTS). This AI assistant can intelligently generate inference results based on the inference data input by the user.
[0044] In practical applications, the aforementioned service program may specifically include a server program and a client program. The server program and the client program work together to provide users with inference services based on MCTS (Monte Carlo Tree Search).
[0045] For example, in some embodiments, the executing entity of the above method process can be either the client program of the above service program or the server program of the above service program; or, some steps in the above method can run on the client program and some steps can run on the server program, and the process corresponding to the above method can be jointly executed through the mutual cooperation of the server program and the client program.
[0046] The aforementioned target reasoning service may specifically include any type of knowledge-intensive reasoning task with multi-level reasoning actions executed in sequence.
[0047] In some embodiments, the target reasoning task described above specifically includes an indeterminate reasoning task having multi-level reasoning actions performed in sequence.
[0048] For example, in practical applications, the aforementioned target reasoning tasks can include medical-assisted reasoning tasks. Of course, besides medical-assisted reasoning tasks, they can also include legal reasoning tasks, financial risk reasoning tasks, and so on.
[0049] To ensure the effectiveness of the reasoning, the aforementioned service program can also access a knowledge graph corresponding to the knowledge domain to which the target reasoning task belongs. Thus, during the reasoning process, the structured domain knowledge stored in the knowledge graph can be used as the reasoning context.
[0050] The specific content and form of the aforementioned knowledge graph usually depend on the task type of the aforementioned target reasoning task, and will not be specifically limited in this specification.
[0051] For example, in some embodiments, if the target reasoning task is a medical auxiliary diagnosis task, the knowledge graph may specifically include a medical knowledge graph for medical auxiliary diagnosis. This medical knowledge graph can store the relationships between disease types and clinical characteristics.
[0052] When a user needs to call the MCTS-based inference service provided by the above service program, they can input relevant inference data in the interactive interface provided by the service program. The service program can then obtain the inference data input by the user and perform inference calculations based on the obtained inference data.
[0053] The data type of the aforementioned inference data usually depends on the task type of the target inference task, and will not be specifically limited in this specification.
[0054] For example, in some embodiments, if the target reasoning task is a medical auxiliary diagnosis task, the reasoning data may specifically include symptom description text input by the user.
[0055] Step 204: Generate the root node of the Monte Carlo tree based on the inference data; wherein, the Monte Carlo tree includes multiple layers of nodes that correspond one-to-one with the multi-level inference actions; any layer of nodes in the Monte Carlo tree is used to store intermediate inference results generated by executing the inference action corresponding to that layer of nodes; The aforementioned service procedure can specifically employ an LLM reasoning framework that combines the MCTS algorithm with a knowledge graph.
[0056] Within this reasoning framework, on the one hand, a hierarchical action space consisting of multiple reasoning actions executed in sequence can be designed for the aforementioned target reasoning task. On the other hand, the service program can utilize the reasoning capabilities of LLM and follow the reasoning process of the MCTS algorithm, using the structured domain knowledge stored in the knowledge graph as context to perform the aforementioned target reasoning task.
[0057] In practical applications, the action space of the aforementioned target reasoning task can be designed based on the specific characteristics of the target reasoning task.
[0058] In some embodiments, for knowledge-intensive and complex reasoning tasks, the action space can be uniformly abstracted into the following four levels of reasoning actions: The first level of reasoning action is used to extract key reasoning entities corresponding to the target reasoning task from the reasoning data. The second-level reasoning action is used to generate potential reasoning results corresponding to the target reasoning task based on the key reasoning entity. The third-level reasoning action is used to generate a reasoning verification entity corresponding to the potential reasoning result; The fourth-level reasoning action is used to verify, based on the reasoning verification entity, whether the potential reasoning result is the target reasoning result (i.e., the final reasoning result) corresponding to the target reasoning task.
[0059] It is important to emphasize that the above four levels of reasoning actions can serve as a general action space for knowledge-intensive complex reasoning tasks. In practical applications, regardless of the type of knowledge-intensive complex reasoning task, its action space can be abstracted into the above four levels of reasoning actions.
[0060] For example, in some embodiments, if the target reasoning task is a medical auxiliary diagnosis task, the content of the reasoning elements such as the reasoning data, the key reasoning entities, the potential reasoning results, and the potential reasoning results can be designed in combination with the characteristics of the medical auxiliary diagnosis task (such as simulating the real process of a doctor diagnosing a patient's condition).
[0061] In this scenario, the aforementioned inference data may specifically include symptom descriptions input by the user; the aforementioned key inference entities may specifically include key clinical feature entities (e.g., clinical indicators, user symptoms, etc.); the aforementioned potential inference results may specifically include potential disease types; and the aforementioned potential inference results may specifically include typical clinical feature entities corresponding to potential disease types. Accordingly, the operational space for the aforementioned medical auxiliary diagnosis can specifically include: The first level of reasoning is used to extract key clinical feature entities corresponding to medical auxiliary diagnosis from the symptom descriptions input by the user; for example, extracting key user symptoms and key clinical indicators related to medical auxiliary diagnosis.
[0062] The second-level reasoning action is used to generate potential disease types corresponding to the medical auxiliary diagnosis task based on the aforementioned key clinical feature entities. The third-level reasoning action is used to generate typical clinical feature entities corresponding to potential disease types; The fourth level of reasoning is used to verify, based on typical clinical characteristics, whether the above potential disease types are the target disease types (i.e., the confirmed disease types) corresponding to the medical auxiliary diagnostic task.
[0063] Of course, if the target reasoning task mentioned above is a knowledge-intensive reasoning task other than medical auxiliary diagnosis task, it is usually only necessary to redesign the content of reasoning data, key reasoning entities, potential reasoning results and reasoning verification entities based on the action space described in the four-level reasoning action description above, combined with the characteristics of the task.
[0064] In some embodiments, following the inference process of the MCTS algorithm, multiple rounds of iterative node expansion can be used to construct a Monte Carlo tree (also known as a search tree). The inference results of each inference path on the Monte Carlo tree are then evaluated to determine the final inference result.
[0065] The aforementioned Monte Carlo tree may specifically include multiple layers of nodes that correspond one-to-one with the aforementioned multi-level reasoning actions; any layer of nodes in the Monte Carlo tree can be used to store intermediate reasoning results generated by executing the reasoning action corresponding to that layer of nodes.
[0066] In some embodiments, the Monte Carlo tree may also contain four layers of nodes. The nodes in the first layer of the Monte Carlo tree can be used to store the key reasoning entities extracted by performing the first-level reasoning action. The nodes in the second layer of the Monte Carlo tree can be used to store the potential reasoning results corresponding to the target reasoning task generated by performing the second-level reasoning action. The nodes in the third layer of the Monte Carlo tree can be used to store the reasoning verification entities corresponding to the potential reasoning results generated by performing the third-level reasoning action. The nodes in the fourth layer of the Monte Carlo tree can be used to store the verification results obtained by performing the fourth-level reasoning action.
[0067] Accordingly, if the target reasoning task is a medical auxiliary diagnosis task, the nodes of the first layer of the Monte Carlo tree can be used to store the key clinical features extracted by performing the first-level reasoning action; the nodes of the second layer of the Monte Carlo tree can be used to store the potential disease types corresponding to the medical auxiliary diagnosis task generated by performing the second-level reasoning action; the nodes of the third layer of the Monte Carlo tree can be used to store the typical clinical feature entities corresponding to the potential disease types generated by performing the third-level reasoning action; and the nodes of the fourth layer of the Monte Carlo tree can be used to store the verification results of performing the fourth-level reasoning action to verify whether the potential disease type is the target disease type corresponding to the medical auxiliary diagnosis task.
[0068] For example, see Figure 3 , Figure 3 This is a schematic diagram of a Monte Carlo tree as illustrated in this specification. In practical applications, the edge between the root node of the Monte Carlo tree and the nodes of the first level contained in the Monte Carlo tree can be used to represent the first-level reasoning action corresponding to the node of the first level contained in the Monte Carlo tree; the edge between the node of the first level contained in the Monte Carlo tree and the nodes of the second level contained in the Monte Carlo tree can be used to represent the first-level reasoning action corresponding to the node of the second level contained in the Monte Carlo tree, and so on.
[0069] In this specification, after the service program obtains the inference data input by the user, it can generate the root node of the Monte Carlo tree based on the inference data.
[0070] For example, please continue to see Figure 3 This inference data can be used as the content of the root node to initialize and create a root node. At this point, the inference data can be used to represent the initial inference state of the target inference task.
[0071] Step 206: Run the Monte Carlo Tree Search algorithm. Based on the root node, iteratively expand the Monte Carlo tree through multiple rounds to construct the Monte Carlo tree. Each round of node expansion includes: calling the LLM (Local Level Management) to execute the next-level reasoning action corresponding to the reasoning action selected from the Monte Carlo tree for expansion, generating a next-level expanded node for that target leaf node. During the execution of at least one level of the multi-level reasoning action, the LLM uses domain knowledge retrieved from the knowledge graph related to the at least one level of reasoning action as the reasoning context. In this specification, after the service program generates the root node of the Monte Carlo tree based on the inference data, it can then utilize the inference capabilities of the LLM and follow the inference process of the MCTS algorithm, using the structured domain knowledge stored in the knowledge graph as context to execute the target inference task.
[0072] The process of executing the above-mentioned target reasoning task according to the reasoning flow of the MCTS algorithm can usually be represented as iteratively expanding the Monte Carlo tree in multiple rounds based on the root node to construct the Monte Carlo tree.
[0073] Unlike the traditional inference process based on the MCTS algorithm, in this specification, the above service program can leverage the inference capabilities of LLM to construct a Monte Carlo tree by sequentially executing the multi-level inference actions, iteratively expanding the nodes of the Monte Carlo tree in multiple rounds based on the root node.
[0074] In other words, any round of node expansion in a Monte Carlo tree can specifically include: calling LLM, which executes the next-level reasoning action corresponding to the reasoning action selected from the Monte Carlo tree for expansion, and generating the next-level expanded node for that target leaf node.
[0075] In some embodiments, an iteration of the MCTS algorithm typically includes stages such as selection, expansion, sampling, simulation, and backpropagation.
[0076] The above service program, when running the MCTS algorithm, selects a target leaf node to be expanded from the current Monte Carlo tree (which may not yet be fully constructed) based on a preset strategy during any round of iteration selection of the Monte Carlo tree, based on the root node.
[0077] The aforementioned preset strategies can be flexibly customized based on specific needs.
[0078] For example, in some embodiments, the UCT (Upper Confidence Bound Apply to Tree) algorithm can still be run to select the leaf node with the largest UCT value from the current Monte Carlo tree as the target leaf node to be expanded. The specific process of running the UCT algorithm to select the leaf node with the largest UCT value from the current Monte Carlo tree will not be described in detail in this specification; those skilled in the art can refer to relevant technical records.
[0079] Of course, in addition to using the UCT algorithm, other strategies can also be used in practical applications to select leaf nodes from the current Monte Carlo tree as target leaf nodes to be expanded.
[0080] Furthermore, during the expansion phase, the aforementioned LLM can be invoked to perform the next-level inference action corresponding to the target leaf node, thereby generating a set of child nodes corresponding to the next level of the target leaf node.
[0081] For example, in practical applications, the above-mentioned service program can assign and configure relevant prompt word templates for each level of inference action in the above-mentioned action space. When any level of inference action needs to be executed, the service system can construct a prompt word for calling the LLM to perform the inference calculation corresponding to the level of inference action based on the prompt word template configured for that level of inference action, and then send the prompt word to the LLM so that the LLM can perform the inference calculation corresponding to the level of inference action based on the prompt word.
[0082] It should be noted that the next level of reasoning action corresponding to the leaf node of the target specifically refers to the next level of reasoning action corresponding to the leaf node of the target in the aforementioned action space.
[0083] For example, if the reasoning action corresponding to the target leaf node is the first-level reasoning action mentioned above, then the next level of reasoning action is the second-level reasoning action mentioned above.
[0084] During the sampling phase, a target child node (or multiple targets) can be randomly selected from the above set of child nodes, and this target child node can be added to the Monte Carlo tree as the next-level extension node corresponding to the above target leaf node.
[0085] In this way, a child node can be extended from the aforementioned target leaf node on the Monte Carlo tree (at this time, the child node is a new leaf node extended on the reasoning path).
[0086] During the simulation phase, the LLM mentioned above can be invoked further, and the LLM can continue to execute the remaining lower-level inference actions in the above multi-level inference actions in sequence, except for the inference actions corresponding to the extension nodes of the next level, until the target inference result corresponding to the above inference data is obtained.
[0087] For example, suppose the reasoning action corresponding to the next level of extended nodes is the second level reasoning action in the action space. Then, the LLM can be called to continue executing the third level reasoning action in the multi-level reasoning action in sequence. After the third level reasoning action is completed, the LLM can be called again to continue executing the fourth level reasoning action in the multi-level reasoning action in sequence until the target reasoning result corresponding to the reasoning data is obtained.
[0088] In this way, each reasoning action in the above action space can be executed sequentially to simulate a complete reasoning chain.
[0089] It should be noted that during the simulation phase, only the remaining lower-level reasoning actions in the above multi-level reasoning process are simulated. During this process, no new child nodes are added to the Monte Carlo tree for the aforementioned extension nodes.
[0090] During the backpropagation phase, the target inference result can be propagated back from the extended child node to the root node to all nodes at each level of the current inference path, and the statistical information of each node at each level of the path can be updated; for example, the statistical information may include the number of visits and rewards, etc.
[0091] The aforementioned number of visits could refer to the number of times each node was selected and expanded at the aforementioned selection nodes. The aforementioned reward could specifically be a score obtained by LLM through a quantitative evaluation of the inference result of the current inference path. Through backpropagation, the score of the current inference path and the number of visits to each node can be stored at each node along that inference path.
[0092] It should be noted that the above is only one round of node expansion in the MCTS algorithm of the aforementioned service program, which expands the Monte Carlo tree based on the root node. By iteratively executing the above process, a new leaf node can be continuously expanded downward from the target leaf node to be expanded in each iteration until the number of iterations reaches the specified number or the iteration duration reaches the specified duration, thus completing the construction of the Monte Carlo tree.
[0093] In some embodiments, during the execution of at least one of the multi-level reasoning actions described above, the LLM may use domain knowledge retrieved from the knowledge graph that is related to the at least one level of reasoning action as the reasoning context.
[0094] Among them, the above-mentioned at least one level of reasoning action may only include some of the reasoning actions in the above-mentioned multi-level reasoning actions.
[0095] In some embodiments, during the execution of the second-level reasoning action and the third-level reasoning action, the LLM can use the domain knowledge retrieved from the knowledge graph related to the second-level reasoning action and the third-level reasoning action as the reasoning context, respectively.
[0096] Specifically, during the execution of the second-level reasoning action in the multi-level reasoning process described above, the LLM can use the set of potential reasoning results related to the key reasoning entities retrieved from the knowledge graph as the reasoning context. In this case, the aforementioned second-level reasoning action can be used specifically to generate potential reasoning results corresponding to the aforementioned target reasoning task by using the set of potential reasoning results related to the aforementioned key reasoning entities retrieved from the aforementioned knowledge graph as the reasoning context.
[0097] For example, taking the aforementioned target reasoning task as a medical diagnosis task, the second-level reasoning action can be used to generate potential disease types corresponding to the aforementioned medical auxiliary diagnosis task by using the set of potential diseases related to the aforementioned key clinical feature entities retrieved from the medical knowledge graph as the reasoning context. This process can be described as a process of forward querying the potential disease types to which the key clinical feature may belong based on the key clinical feature.
[0098] In this way, LLM can accurately generate potential disease types corresponding to the aforementioned medical auxiliary diagnostic tasks based on the domain knowledge in the medical knowledge graph, thereby improving the accuracy of reasoning.
[0099] During the execution of the third level of reasoning in the above multi-level reasoning process, LLM can use the set of reasoning verification entities related to the above potential reasoning results retrieved from the above knowledge graph as the reasoning context. In this case, the aforementioned third-level reasoning action can be specifically used to generate reasoning verification entities corresponding to the aforementioned potential reasoning results by using the set of reasoning verification entities retrieved from the aforementioned knowledge graph that are related to the aforementioned potential reasoning results as the reasoning context.
[0100] For example, taking the aforementioned target reasoning task as a medical diagnosis task, the third-level reasoning action can be used to generate typical clinical feature entities corresponding to the aforementioned potential disease type by using the set of clinical feature verification entities retrieved from the aforementioned medical knowledge graph that are related to the aforementioned potential disease type as the reasoning context. This process can be described as a process of querying the typical clinical feature entities of a potential disease type in reverse order based on the potential disease type.
[0101] In this way, LLM can accurately generate typical clinical feature entities corresponding to the potential disease types based on the domain knowledge in the aforementioned medical knowledge graph, thereby improving the accuracy of reasoning.
[0102] In some embodiments, the verification results obtained by LLM in performing the fourth-level inference action described above can, in practical applications, include a variety of verification results.
[0103] For example, the verification results obtained by LLM in performing the fourth-level inference action described above may specifically include the following verification results: The first verification result indicates that, based on the above-mentioned reasoning verification entity, the above-mentioned potential reasoning result is verified to be the target reasoning result corresponding to the above-mentioned target reasoning task. The second verification result indicates that the inference data input by the user contains the above-mentioned inference verification entity, but there is still uncertainty as to whether the above-mentioned potential inference result is the target inference result corresponding to the above-mentioned target inference task. At this time, it is necessary to regenerate the inference verification entity and further verify whether the above-mentioned potential inference result is the target inference result corresponding to the above-mentioned target inference task based on the regenerated inference verification entity. The third verification result indicates that, based on the above-mentioned reasoning verification entity, the potential reasoning result is not the target reasoning result corresponding to the above-mentioned target reasoning task. The fourth verification result indicates that the inference data input by the user does not contain the aforementioned inference verification entity, but other key inference entities contained in the aforementioned inference data support the conclusion that the aforementioned potential inference result is the target inference result corresponding to the aforementioned target inference task. In this case, it is necessary to regenerate the inference verification entity and further verify whether the aforementioned potential inference result is the target inference result corresponding to the aforementioned target inference task based on the regenerated inference verification entity.
[0104] Of course, the four verification results shown above are only illustrative. In practical applications, the other verification results besides the first verification result can be flexibly added or removed.
[0105] In some embodiments, during the expansion phase of an iteration, when the LLM is called and executed by the LLM to perform the next level of reasoning action corresponding to the above-mentioned target leaf node, if the reasoning action corresponding to the above-mentioned target leaf node is not the above-mentioned fourth level reasoning action (that is, the last level reasoning action), the next level of reasoning action can be executed normally, and new expansion nodes can be extended downwards for the above-mentioned target leaf node.
[0106] If the reasoning action corresponding to the target leaf node is already the fourth level of reasoning action, then based on the type of verification result stored in the target leaf node, we can return to a certain level of reasoning action in the multi-level reasoning action to continue node expansion.
[0107] Firstly, if the inference action corresponding to the aforementioned target leaf node is a fourth-level inference action, and the verification result stored in the target leaf node is the aforementioned first verification result, then the target leaf node no longer needs to be expanded downwards, and node expansion for the target leaf node can be stopped. At this point, the inference path containing the target leaf node is completed, and the simulation phase can be skipped. The aforementioned target inference result can be backpropagated to the nodes at each level of the inference path, and the statistical information of the nodes at each level of the path can be updated.
[0108] Secondly, if the reasoning action corresponding to the target leaf node is a fourth-level reasoning action, and the verification result stored in the target leaf node is the second verification result mentioned above, then the third-level reasoning action can be returned to, and the LLM can be called to continue executing the third-level reasoning action to generate a set of child nodes corresponding to the target leaf node; and, a target child node can be randomly selected from the set of child nodes, and the target child node can be added to the Monte Carlo tree as an extension node corresponding to the target leaf node.
[0109] In this way, we can return to the third-level reasoning action described above and continue to expand new child nodes downwards for the target leaf node. The new child nodes expanded from the target leaf node at this point are the nodes generated by the third-level reasoning action described above.
[0110] Thirdly, if the reasoning action corresponding to the target leaf node is a fourth-level reasoning action, and the verification result stored in the target leaf node is the third verification result, then the second-level reasoning action can be returned to, and the LLM can be called to continue executing the second-level reasoning action to generate a set of child nodes corresponding to the target leaf node; and, a target child node is randomly selected from the set of child nodes, and the target child node is added to the Monte Carlo tree as an extension node corresponding to the target leaf node.
[0111] In this way, we can return to the second-level reasoning action described above and continue to expand new child nodes downwards for the target leaf node. The new child nodes expanded from the target leaf node at this point are the nodes generated by the second-level reasoning action described above.
[0112] Fourthly, if the reasoning action corresponding to the aforementioned target leaf node is a fourth-level reasoning action, and the verification result stored in the target leaf node is the aforementioned fourth verification result, then it is also possible to return to the third-level reasoning action and call the LLM, which will continue to execute the third-level reasoning action to generate a set of child nodes corresponding to the next level of the target leaf node; and, randomly select a target child node from the set of child nodes, and add the target child node as an extended node corresponding to the target leaf node to the Monte Carlo tree. The new child node extended from the target leaf node at this time is also a node generated by executing the aforementioned second-level reasoning action.
[0113] In this way, we can also return to the third-level reasoning action described above and continue to expand new child nodes downwards for the target leaf node. The new child nodes expanded from the target leaf node at this point are the nodes generated by the second-level reasoning action described above.
[0114] By introducing the above return mechanism during the expansion phase of an iteration, when the reasoning action corresponding to the target leaf node is a fourth-level reasoning action and the verification result stored in the target leaf node is not the first verification result (i.e., the final reasoning result), the process returns to a certain level of reasoning action in the multi-level reasoning action and continues to expand the target leaf node downwards until the verification result stored in the final expanded target leaf node is the first verification result, at which point the process ends.
[0115] In some embodiments, during the simulation phase of an iteration, when the LLM is called and continues to execute the remaining lower-level inference actions in the above multi-level inference actions in sequence, except for the inference actions corresponding to the next-level extension node, if the inference action corresponding to the next-level extension node is not the fourth-level inference action, the remaining lower-level inference actions can be executed normally, and the above extension node can be simulated.
[0116] If the reasoning action corresponding to the next level of the extended node is already the fourth level of reasoning action, then based on the type of verification result stored in the extended node, we can return to a certain level of reasoning action in the multi-level reasoning action to continue simulating the extended node.
[0117] Firstly, if the inference action corresponding to the next-level extended node is the fourth-level inference action, and the verification result stored in the extended node is the first verification result, the simulation for the extended node has been completed, and the node simulation for the extended node can be stopped. At this time, the inference path where the extended node is located is completed, and the target inference result can continue to be propagated back to the nodes at each level of the inference path, and the statistical information of the nodes at each level of the path can be updated.
[0118] Secondly, if the reasoning action corresponding to the next level of the extended node is the fourth level of reasoning action, and the verification result stored in the extended node is the second verification result, then the third level of reasoning action can be returned, and the LLM can be called. The LLM will continue to re-execute the third level of reasoning action and the fourth level of reasoning action in sequence, and repeat the above process until the verification result obtained by the LLM in executing the fourth level of reasoning action is the first verification result. In this way, the third-level and fourth-level reasoning actions described above can be returned to continue simulating the extended node.
[0119] Thirdly, if the reasoning action corresponding to the next level of extended node is the fourth level of reasoning action mentioned above, and the verification result stored in the extended node is the third verification result mentioned above, then the second level of reasoning action mentioned above can be returned, and LLM can be called. LLM will continue to re-execute the second level of reasoning action mentioned above, the third level of reasoning action mentioned above, and the fourth level of reasoning action mentioned above in sequence, and repeat the above process until the verification result obtained by LLM in executing the fourth level of reasoning action mentioned above is the first verification result mentioned above. In this way, the second-level reasoning action, the third-level reasoning action, and the fourth-level reasoning action described above can be returned to continue simulating the extended node.
[0120] Fourthly, if the reasoning action corresponding to the next level of the extended node is the fourth level of reasoning action, and the verification result stored in the extended node is the fourth verification result, then the third level of reasoning action can be returned, and the LLM can be called. The LLM can then continue to re-execute the third level of reasoning action and the fourth level of reasoning action in sequence, and repeat the above process until the verification result obtained by the LLM in executing the fourth level of reasoning action is the first verification result.
[0121] In this way, the third-level and fourth-level reasoning actions described above can be returned to continue simulating the extended node.
[0122] By introducing the above return mechanism during the simulation phase of an iterative cycle, when the inference action corresponding to the above extended node is a fourth-level inference action and the verification result stored in the extended node is not the first verification result (i.e., the final inference result), the simulation can return to a certain level of inference action in the middle of the above multi-level inference actions and continue to simulate the extended node until the verification result obtained by the LLM in executing the fourth-level inference action is the first verification result mentioned above.
[0123] Step 208: Evaluate the reasoning results of each reasoning path contained in the constructed Monte Carlo tree, and determine the target reasoning result corresponding to the reasoning data from the reasoning results of each reasoning path contained in the Monte Carlo tree based on the evaluation results.
[0124] Following the inference process of the MCTS algorithm, after iteratively expanding the nodes of the Monte Carlo tree multiple times based on the root node to construct the Monte Carlo tree, the Monte Carlo tree usually contains multiple inference paths, and each inference path has a target inference result corresponding to the inference data.
[0125] In practical applications, since the inference results of different inference paths may differ, in order to ultimately determine the accurate target inference result corresponding to the inference data input by the user, it is also possible to evaluate the inference results of each inference path contained in the Monte Carlo tree, and then, based on the evaluation results, determine the final target inference result corresponding to the aforementioned inference data from the inference results of each inference path contained in the Monte Carlo tree.
[0126] In the traditional MCTS algorithm, the optimal inference path is usually determined from the Monte Carlo tree by starting from the root node, selecting the child node with the most visits in each level, and then determining the optimal inference path by following the child node with the most visits in each level.
[0127] Unlike the traditional MCTS algorithm, this specification employs a comprehensive evaluation mechanism based on multiple evaluation methods to determine the optimal inference path from the Monte Carlo tree.
[0128] In some embodiments, when deciding the best reasoning path from the Monte Carlo tree, the reasoning results of each reasoning path contained in the Monte Carlo tree can first be summarized to obtain a set of reasoning results, and then the comprehensive score corresponding to each reasoning result in the set of reasoning results can be calculated respectively.
[0129] For example, in practical applications, all complete inference paths can be extracted from the Monte Carlo tree first. Then, based on the inference results of each inference path, these inference paths can be classified to obtain multiple sets of inference paths corresponding to different inference results. Finally, the inference results corresponding to each set of inference paths can be summarized to obtain the aforementioned set of inference results.
[0130] The comprehensive score mentioned above can specifically include the following types of scores: The first score corresponding to any reasoning result in the set of reasoning results can specifically represent the degree of consistency among the various reasoning paths that have that reasoning result; a high degree of consistency indicates that the reasoning result is supported by most reasoning paths, reflecting the stability and reliability of the reasoning result.
[0131] The second score corresponding to any reasoning result in the set of reasoning results can specifically represent the degree of diversity of the various reasoning paths that have that reasoning result; a high degree of diversity indicates that the same reasoning path can be obtained by reasoning through multiple different reasoning paths, reflecting the comprehensiveness and flexibility of the reasoning process.
[0132] The third score, corresponding to any reasoning result in the set of reasoning results, can specifically represent the reasoning accuracy of each reasoning path with that reasoning result.
[0133] When determining the optimal inference path from the Monte Carlo tree, the first, second, and third scores corresponding to each inference result in the aforementioned inference result set can be calculated separately. Then, a weighted average of these scores is calculated to obtain a comprehensive score corresponding to each inference result in the set. The first and third scores can be positively correlated with the comprehensive score (positive weighting coefficients), while the second score can be negatively correlated with the comprehensive score (negative weighting coefficients). Finally, the inference result with the highest comprehensive score in the aforementioned inference result set can be determined as the target inference result corresponding to the user-input inference data.
[0134] It should be noted that the specific calculation methods for the first, second, and third scores shown above can be flexibly designed in practical applications.
[0135] In some embodiments, the first score corresponding to any inference result in the set of inference results may specifically include: the ratio of the number of inference paths with that inference result to the total number of inference paths contained in the Monte Carlo tree; that is, the ratio can be calculated as the first score for each inference result.
[0136] In some embodiments, the second score corresponding to any reasoning result in the set of reasoning results may specifically include: a summation of the similarities between the various reasoning paths having that reasoning result; For example, each reasoning path with the given reasoning result can be paired and their similarity calculated. Then, all the calculated similarity scores can be summed to obtain a cumulative sum, which can then be used as the second score corresponding to the reasoning result. The specific method for calculating the similarity between reasoning paths will not be detailed in this specification; in practical applications, it can be flexibly designed.
[0137] In some embodiments, the third score corresponding to any inference result in the inference result set may specifically include: the sum of quality scores obtained by evaluating the inference accuracy of each inference path with that inference result based on LLM.
[0138] For example, the inference accuracy of each inference path with the inference result can be evaluated based on LLM to obtain a quality score. Then, all the evaluated quality scores are accumulated to obtain a sum, and finally, the sum is used as the third score corresponding to the inference result.
[0139] The specific methods for evaluating the inference accuracy of each inference path will not be detailed in this specification. In practical applications, flexible designs are possible. For example, in one case, the inference accuracy of each inference path can be evaluated based on the mean absolute error (MAE).
[0140] In addition, to improve the quality of inference accuracy assessment, in practical applications, the inference accuracy of each inference path with the given inference result can be evaluated separately based on multiple LLMs. Then, the evaluation results of each inference path from multiple LLMs can be combined to determine the final quality score. For example, a multi-agent system can be used to evaluate the inference accuracy of each inference path with the given inference result.
[0141] Of course, the first, second, and third scores that make up the above comprehensive score can be flexibly added or removed in practical applications.
[0142] The following will use the aforementioned target reasoning task as a medical auxiliary diagnosis task as an example to illustrate this point.
[0143] For medical auxiliary diagnostic tasks, the action space can be designed to simulate the real process of a doctor diagnosing a patient's condition.
[0144] Please see Figure 4The action space designed for medical auxiliary diagnostic tasks may specifically include: Action A1: Key clinical feature extraction action. This action corresponds to the first-level reasoning action mentioned above.
[0145] To address the inherent variability in real-world clinical presentations, which are often accompanied by a large amount of irrelevant or misleading information, the A1 action was designed to extract key clinical feature entities from complex and unstructured symptom descriptions (text). These include key clinical indicators and key user symptoms. This A1 action, executed at the first level of the Monte Carlo tree, filters out diagnostic noise and extracts core clinical features, enabling MCTS to conduct a systematic and targeted exploration of diagnostic hypotheses based on key evidence.
[0146] Action A2: Action that generates potential disease. This action corresponds to the second-level reasoning action mentioned above.
[0147] The designed A2 action, executed at the second layer of the Monte Carlo tree, can generate potential disease types based on the key clinical feature entities extracted from A1, which serve as the content of the second-layer node of the reasoning tree, and can use domain knowledge stored in an external knowledge graph as the reasoning context.
[0148] Action A3: Evidence verification action. This action corresponds to the third-level reasoning action mentioned above.
[0149] The designed A3 action, executed at the third layer of the Monte Carlo tree, can retrieve typical clinical features corresponding to the potential disease type from an external knowledge graph based on the potential disease type generated in A2, thereby identifying indicators with clinical significance that require further validation.
[0150] A4 Action: Deductive Analysis Action. This action corresponds to the fourth-level reasoning action mentioned above.
[0151] The designed A4 action, performed at the fourth level of the Monte Carlo tree, can further analyze the typical clinical features retrieved in A3 to verify whether the patient's clinical presentation supports the potential disease type generated in A2.
[0152] The verification results obtained by performing the A4 action can include the following four types of verification results: Existence and certainty: This corresponds to the first verification result above. It indicates that the clinical indicator that needs to be verified exists and supports the current hypothesis, thus leading to the final diagnosis.
[0153] Existence but in doubt: This corresponds to the second verification result above. It indicates that the indicator that needs to be verified exists, but there is still uncertainty. Further diagnostic examinations are needed to confirm the hypothesis, i.e., return to action A3.
[0154] "Does not exist and is certain": This corresponds to the third verification result above. It indicates that the indicator to be verified does not exist, thus rejecting the current hypothesis. The model should consider other possible diseases, i.e., return to action A2.
[0155] "Not present but questionable": This corresponds to the fourth validation result above. It indicates that although the indicator requiring validation does not exist, other clinical findings or supporting information may still support the current hypothesis. The model should undergo further pathological analysis to explain this discrepancy and trigger additional diagnostic validation, i.e., return to action A3.
[0156] Please continue reading Figure 4 After the service program obtains the unstructured symptom description input by the user, it can generate the root node of a Monte Carlo tree based on the symptom description. After the service program generates the root node of the Monte Carlo tree, it uses the structured domain knowledge stored in the knowledge graph as context to perform the disease auxiliary diagnosis task, following the reasoning process of the MCTS algorithm.
[0157] like Figure 4 As shown, in the selection phase of the first iteration of the MCTS algorithm, the root node can be selected as the target child node to be expanded by default.
[0158] During the expansion phase, the LLM can be invoked to perform the A1 action (i.e., the reasoning action at the next level of the root node) to extract a set of key clinical features from the symptom description.
[0159] During the sampling phase, a key clinical feature can be randomly selected from the set of key clinical features. Then, node 1 is created based on the randomly selected key clinical feature, and node 1 is added to the Monte Carlo tree as a child node of the root node.
[0160] During the simulation phase, LLM can be called to execute A2, A3, and A4 in sequence, and the type of verification result generated by executing A4 can be determined. If the verification result is "existing and certain", the simulation for node 1 can be terminated directly, and the potential disease type obtained from executing A2 can be used as the final diagnosis result. The diagnosis is then propagated back to node 1 and the root node from the extended child node 1 to the root node, and the access count and reward stored in node 1 and the root node are updated.
[0161] If the verification result is "exists but questionable", you can return to A3, call LLM to execute A3 and A4 again in sequence, and repeat the above process until the verification result generated by executing A4 is "exists and confirmed".
[0162] If the verification result is "does not exist and is certain", you can return to A2, call LLM to execute A2, A3 and A4 in sequence, and repeat the above process until the verification result generated by executing A4 is "exists and is certain".
[0163] If the verification result is "not found but questionable", you can return to A3, call LLM to execute A3 and A4 in sequence, and repeat the above process until the verification result generated by executing A4 is "exists and is certain".
[0164] During the backpropagation phase, the final diagnostic results can be propagated back from the extended child node 1 to the root node to node 1 and the root node, and the access counts and rewards stored in node 1 and the root node can be updated.
[0165] The above is the first iteration for the root node, which expands the root node into a child node 1.
[0166] In the second iteration, assume that node 1 is selected as the target leaf node to be expanded by running the UCT algorithm.
[0167] During the expansion phase, the set of potential diseases related to the key clinical features stored in node 1 can be retrieved from the external medical knowledge graph as the inference context. The LLM is then invoked to execute the A2 action (i.e., the next level of inference action of node 1) to generate the user's set of potential disease types.
[0168] During the sampling phase, a potential disease type can be randomly selected from the user's set of potential disease types. Then, node 2 is created based on the randomly selected potential disease type, and node 2 is added to the Monte Carlo tree as a child node of node 1.
[0169] During the simulation phase, LLM can be called to execute A3 and A4 in sequence, and the type of verification result generated by executing A4 can be determined. If the verification result is "existing and certain", the simulation for node 2 can be terminated directly, and the potential disease type obtained from executing A2 can be used as the final diagnosis result. The diagnosis is then propagated back from the extended child node 2 to the root node, to node 2, node 1 and the root node, and the access count and reward stored in node 2, node 1 and the root node are updated.
[0170] If the verification result is "exists but questionable", you can return to A3, call LLM to execute A3 and A4 again in sequence, and repeat the above process until the verification result generated by executing A4 is "exists and confirmed".
[0171] If the verification result is "does not exist and is certain", you can return to A2, call LLM to execute A2, A3 and A4 in sequence, and repeat the above process until the verification result generated by executing A4 is "exists and is certain".
[0172] If the verification result is "not found but questionable", you can return to A3, call LLM to execute A3 and A4 in sequence, and repeat the above process until the verification result generated by executing A4 is "exists and is certain".
[0173] During the backpropagation phase, the final diagnostic results can be propagated back from the extended child node 2 to the root node, to node 2, node 1, and the root node, and the access counts and rewards stored in node 2, node 1, and the root node can be updated.
[0174] The above is the second iteration for the root node, which extends node 1 to include node 2 as a child node.
[0175] In subsequent iterations, the above process can be repeated, and after several iterations, a complete Monte Carlo tree can be finally constructed.
[0176] Finally, the comprehensive score of each reasoning path on the Monte Carlo tree can be calculated, and the diagnosis result of the reasoning path with the highest comprehensive score can be determined as the final diagnosis result corresponding to the user.
[0177] In the above embodiments, by combining the Monte Carlo tree search algorithm with knowledge graphs and designing a hierarchical action space consisting of multiple reasoning actions executed in sequence for the target reasoning task, general-purpose LLMs can perform some knowledge-intensive complex reasoning tasks without additional fine-tuning training in the relevant knowledge domains, and significantly improve interpretability and accuracy when performing knowledge-intensive complex reasoning tasks.
[0178] For example, by using this reasoning framework, some open-source LLMs that have not undergone fine-tuning in the relevant knowledge domain can achieve or even surpass dedicated LLM models that have been fine-tuned in the relevant knowledge domain in terms of reasoning accuracy and interpretability.
[0179] Figure 5 This is a schematic structural diagram of an electronic device provided in an exemplary embodiment. For example... Figure 5As shown, device 500 mainly consists of a communication interface 502, a user interface 504, a processor 506, and a data storage 508. These components are interconnected and communicate with each other via a system bus, network, or other connection mechanism 610. The communication interface 502 enables device 500 to communicate with other devices, access networks, and transmission networks via analog or digital modulation. For example, the communication interface 502 may include a chipset and antenna for wireless communication with a radio access network or access point. Furthermore, the communication interface 502 can be a wired interface such as Ethernet, Token Ring, or a USB port, or a wireless interface such as Wi-Fi, Bluetooth, Global Positioning System (GPS), or a wide-area wireless interface (e.g., WiMAX or LTE). Of course, the communication interface 502 can also support other forms of physical layer interfaces and standard or proprietary communication protocols. The communication interface 502 may also include multiple physical communication interfaces, such as Wi-Fi, Bluetooth, and wide-area wireless interfaces.
[0180] User interface 504 includes receiving user input and providing output to the user. Therefore, user interface 504 may include input components such as a keypad, keyboard, touch-sensitive or presence-sensitive panel, computer mouse, trackball, joystick, microphone, still camera, and video camera, and output components such as a display screen (which may be combined with a touch-sensitive panel), CRT, LCD, LED, display using DLP technology, printer, and other similar devices known or developed in the future. User interface 504 may also generate auditory output via speakers, speaker jacks, audio output ports, audio output devices, headphones, and other similar devices known or developed in the future. In some embodiments, user interface 504 may include software, circuitry, or other forms of logic capable of transmitting and receiving data from external user input / output devices. Additionally or alternatively, device 500 may support remote access from other devices via communication interface 502 or another physical interface (not shown). User interface 504 may be configured to receive user input, the position and movement of which may be indicated by indicators or cursors described herein. User interface 504 may also be configured as a display device for rendering or displaying text fragments.
[0181] Processor 506 may contain one or more general-purpose processors and / or special-purpose processors.
[0182] Data storage 508 may include one or more volatile and / or non-volatile storage components and may be integrated wholly or partially with processor 506. Data storage 508 may include removable and non-removable components.
[0183] Processor 506 is capable of executing program instructions 518 (e.g., compiled or uncompiled program logic and / or machine code) stored in data storage 508 to perform the various functions described herein. Data storage 508 may contain a non-transitory computer-readable medium on which program instructions are stored, which, when executed by device 500, enable device 500 to perform any methods, processes, or functions disclosed in this specification and / or the accompanying drawings. Execution of program instructions 518 by processor 506 may result in processor 506 using data 512.
[0184] For example, program instructions 518 may include an operating system 522 (e.g., an operating system kernel, device drivers, and / or other modules) installed on device 500 and one or more applications 520 (e.g., a browser, social application, or game application). Similarly, data 512 may include operating system data 516 and application data 514. Operating system data 516 is primarily accessible to the operating system 522, while application data 514 is primarily accessible to one or more applications 520. Application data 514 may reside in a file system visible or hidden from the user of device 500.
[0185] Application 520 can communicate with operating system 522 through one or more application programming interfaces (APIs). These APIs help application 520 read and / or write application data 514, transmit or receive information via communication interface 502, receive or display information on user interface 504, etc.
[0186] In some terminology, application 520 may be simply referred to as "app". Furthermore, application 520 can be downloaded to device 500 through one or more online app stores or app markets. However, applications can also be installed on device 500 in other ways, such as through a web browser or a physical interface on device 500 (e.g., a USB port).
[0187] Please refer to Figure 6 This specification also proposes a reasoning device based on Monte Carlo tree search, which can be applied to applications such as... Figure 6 The device shown implements the technical solution of this specification. The device accesses a knowledge graph corresponding to the knowledge domain to which the target reasoning task belongs; the device may include: The acquisition module 601 acquires reasoning data related to the target reasoning task input by the user; wherein, the target reasoning task includes multi-level reasoning actions executed in sequence; The generation module 602 generates the root node of a Monte Carlo tree based on the inference data; wherein, the Monte Carlo tree includes multiple layers of nodes that correspond one-to-one with the multi-level inference actions; any layer of nodes in the Monte Carlo tree is used to store intermediate inference results generated by executing the inference action corresponding to that layer of nodes; Module 603 is constructed by running the Monte Carlo Tree Search algorithm. Based on the root node, the Monte Carlo tree is iteratively expanded in multiple rounds to construct the Monte Carlo tree. Each round of node expansion in the Monte Carlo tree includes: calling the LLM (Limited Language Management) to execute the next-level reasoning action corresponding to the reasoning action selected from the Monte Carlo tree for expansion, generating a next-level expanded node for that target leaf node. During the execution of at least one level of the multi-level reasoning action, the LLM uses domain knowledge retrieved from the knowledge graph related to the at least one level of reasoning action as the reasoning context. Evaluation module 604 evaluates the reasoning results of each reasoning path contained in the constructed Monte Carlo tree, and determines the target reasoning result corresponding to the reasoning data from the reasoning results of each reasoning path contained in the Monte Carlo tree based on the evaluation results.
[0188] For ease of description, the above devices are described by dividing them into various modules or units based on their functions. Of course, when implementing one or more of these specifications, the functions of each module or unit can be implemented in the same or different software and / or hardware, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0189] Based on the same concept as the methods described above, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor performs the steps of the method as described in any of the above embodiments by executing the executable instructions.
[0190] Based on the same concept as the methods described above, this specification also provides a computer-readable storage medium having computer instructions stored thereon that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.
[0191] Based on the same concept as the methods described above, this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.
[0192] What those skilled in the art will understand is: In this specification, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in a process, method, product, or apparatus that includes said elements is not excluded.
[0193] In this specification, “a,” “an,” and “the” do not specifically refer to the singular, but may also include the plural.
[0194] In this specification, ordinal numbers such as "first," "second," etc., do not necessarily indicate order; they are often used to distinguish between objects. For example, "first server" and "second server" usually refer to two servers. To differentiate between these two servers, they are described as "first server" and "second server." Of course, sometimes these two servers may be the same server.
[0195] In this specification, unless explicitly stated otherwise, "receiving and sending data" does not necessarily mean direct receiving and sending; it can also mean indirect receiving and sending. For example, A receiving data sent by B can be understood as A directly receiving the data sent by B, or it can be understood as A indirectly receiving the data sent by B through other entities such as C. Similarly, B sending data to A can be understood as B sending the data directly to A, or it can be understood as B indirectly sending the data to A through other entities such as C. Here, C can be one entity, or it can be two or more entities.
[0196] In this specification, unless explicitly stated otherwise, the relationships between structures can be direct or indirect. For example, when describing "A is connected to B," unless it is explicitly stated that A and B are directly connected, it should be understood that A can be directly connected to B or indirectly connected to B. Similarly, when describing "A is on top of B," unless it is explicitly stated that A is directly above B (AB is adjacent and A is above B), it should be understood that A can be directly above B or indirectly above B (AB is separated by other elements, and A is above B). And so on.
[0197] This specification uses specific terms to describe embodiments thereof. Terms such as "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic associated with at least one embodiment of this specification. Therefore, it should be emphasized and noted that references to "an embodiment," "one embodiment," or "an alternative embodiment" in different locations throughout this specification do not necessarily refer to the same embodiment. Furthermore, those skilled in the art can combine and integrate the different embodiments or examples described herein, as well as the features of those different embodiments or examples, without contradiction.
[0198] Although one or more embodiments of this specification provide method steps as described in the embodiments or flowcharts, it is understood that the order of steps listed in the embodiments or flowcharts is only one of many possible execution orders and does not represent the only execution order. Therefore, when the claims involve method steps, any changes or adjustments to the order of such steps, or the parallelism between steps, are also within the scope of protection of the claims.
Claims
1. A reasoning method based on Monte Carlo tree search, applied to an LLM-based service application; wherein, The service program accesses a knowledge graph corresponding to the knowledge domain to which the target reasoning task belongs; including: Acquire reasoning data related to the target reasoning task input by the user; wherein the target reasoning task includes multi-level reasoning actions executed in sequence; The root node of the Monte Carlo tree is generated based on the inference data; wherein, the Monte Carlo tree includes multiple layers of nodes that correspond one-to-one with the multi-level inference actions; any layer of nodes in the Monte Carlo tree is used to store intermediate inference results generated by executing the inference action corresponding to that layer of nodes; The Monte Carlo Tree Search algorithm is run, and based on the root node, the Monte Carlo tree is iteratively expanded in multiple rounds to construct the Monte Carlo tree. Each round of node expansion in the Monte Carlo tree includes: calling the LLM (Local Level Management) to execute the next-level inference action corresponding to the inference action selected from the Monte Carlo tree for expansion, generating a next-level expanded node for that target leaf node; during the execution of at least one level of the multi-level inference action, the LLM uses domain knowledge retrieved from the knowledge graph related to the at least one level of inference action as the inference context. The reasoning results of each reasoning path contained in the constructed Monte Carlo tree are evaluated, and the target reasoning result corresponding to the reasoning data is determined from the reasoning results of each reasoning path contained in the Monte Carlo tree based on the evaluation results.
2. The method of claim 1, wherein the target reasoning task includes an indeterminate reasoning task having multi-level reasoning actions executed sequentially.
3. The method as described in claim 2, wherein the multi-level reasoning action includes: The first-level reasoning action is used to extract key reasoning entities corresponding to the target reasoning task from the reasoning data; The second-level reasoning action is used to generate potential reasoning results corresponding to the target reasoning task based on the key reasoning entity; The third-level reasoning action is used to generate a reasoning verification entity corresponding to the potential reasoning result; The fourth-level reasoning action is used to verify, based on the reasoning verification entity, whether the potential reasoning result is the target reasoning result corresponding to the target reasoning task; Accordingly, the Monte Carlo tree contains nodes in the first layer for storing the key reasoning entities; The Monte Carlo tree contains nodes in a second layer, which are used to store the potential inference results; The Monte Carlo tree contains nodes in the third layer, which are used to store the reasoning verification entity; The Monte Carlo tree contains nodes in the fourth layer, which are used to store verification results to confirm whether the potential inference result is the target inference result corresponding to the target inference task.
4. The method of claim 3, wherein during the execution of the second-level reasoning action in the multi-level reasoning action, the LLM uses the set of potential reasoning results related to the key reasoning entity retrieved from the knowledge graph as the reasoning context; During the execution of the third-level reasoning action in the multi-level reasoning action, the LLM will use the set of reasoning verification entities retrieved from the knowledge graph that are related to the potential reasoning result as the reasoning context. Correspondingly, the second-level reasoning action is used to generate potential reasoning results corresponding to the target reasoning task by using the set of potential reasoning results related to the key reasoning entity retrieved from the knowledge graph as the reasoning context; The third-level reasoning action is used to generate a reasoning verification entity corresponding to the potential reasoning result by using the set of reasoning verification entities related to the potential reasoning result retrieved from the knowledge graph as the reasoning context.
5. The method as described in claim 4, wherein the Monte Carlo tree search algorithm is run, and based on the root node, the Monte Carlo tree is expanded in any one of the multiple rounds of node expansion, including: Select a target leaf node to be expanded from the current Monte Carlo tree based on a preset strategy; The LLM is invoked, and the LLM performs the next-level reasoning action corresponding to the target leaf node to generate a set of child nodes corresponding to the next level of the target leaf node; Randomly select a target child node from the set of child nodes, and add the target child node as the next-level extension node corresponding to the target leaf node to the Monte Carlo tree to expand the target leaf node; The LLM is invoked, and the LLM continues to execute the remaining lower-level inference actions in the multi-level inference actions in sequence, except for the inference actions corresponding to the next-level extended node, to perform node simulation on the extended node until the target inference result corresponding to the inference data is obtained.
6. The method of claim 5, wherein the verification result obtained by the LLM in performing the fourth-level inference action includes: The first verification result indicates that, based on the inference verification entity, the potential inference result is verified to be the target inference result corresponding to the target inference task; The second verification result indicates that the reasoning data input by the user contains the reasoning verification entity, but there is still uncertainty as to whether the potential reasoning result is the target reasoning result corresponding to the target reasoning task. It is necessary to regenerate the reasoning verification entity and further verify whether the potential reasoning result is the target reasoning result corresponding to the target reasoning task based on the regenerated reasoning verification entity. The third verification result indicates that, based on the inference verification entity, the potential inference result is not the target inference result corresponding to the target inference task. The fourth verification result indicates that the inference data input by the user does not contain the inference verification entity, but other key inference entities contained in the inference data support the conclusion that the potential inference result is the target inference result corresponding to the target inference task. It is necessary to regenerate the inference verification entity and further verify whether the potential inference result is the target inference result corresponding to the target inference task based on the regenerated inference verification entity.
7. The method of claim 6, wherein the LLM is invoked, and the LLM performs the next-level inference action corresponding to the target leaf node to generate a set of child nodes corresponding to the target leaf node, a target child node is randomly selected from the set of child nodes, and the target child node is added to the Monte Carlo tree as an extension node corresponding to the target leaf node, to extend the target leaf node, comprising: If the reasoning action corresponding to the target leaf node is the fourth-level reasoning action, and the verification result stored in the target leaf node is the first verification result, then stop expanding the target leaf node. If the reasoning action corresponding to the target leaf node is the fourth-level reasoning action, and the verification result stored in the target leaf node is the second verification result, return to the third-level reasoning action and call the LLM, which will continue to execute the third-level reasoning action to generate a set of child nodes corresponding to the next level of the target leaf node; randomly select a target child node from the set of child nodes, and add the target child node as an extended node corresponding to the next level of the target leaf node to the Monte Carlo tree; If the reasoning action corresponding to the target leaf node is the fourth-level reasoning action, and the verification result stored in the target leaf node is the third verification result, return to the second-level reasoning action and call the LLM, which will continue to execute the second-level reasoning action to generate a set of child nodes corresponding to the next level of the target leaf node; randomly select a target child node from the set of child nodes, and add the target child node as an extended node corresponding to the next level of the target leaf node to the Monte Carlo tree; If the reasoning action corresponding to the target leaf node is the fourth-level reasoning action, and the verification result stored in the target leaf node is the fourth verification result, return to the third-level reasoning action and call the LLM, which will continue to execute the third-level reasoning action to generate a set of child nodes corresponding to the next level of the target leaf node; randomly select a target child node from the set of child nodes, and add the target child node as an extended node corresponding to the next level of the target leaf node to the Monte Carlo tree.
8. The method of claim 7, wherein the LLM is invoked, and the LLM continues to execute, in sequence, all the remaining lower-level inference actions in the multi-level inference actions except for the inference action corresponding to the next-level extended node, to perform node simulation on the extended node until the target inference result corresponding to the inference data is obtained, including: If the reasoning action corresponding to the next level of extended node is the fourth level reasoning action, and the verification result stored in the extended node is the first verification result, then stop the node simulation for the extended node. If the inference action corresponding to the next level extension node is the fourth level inference action, and the verification result stored in the extension node is the second verification result, return to the third level inference action and call the LLM. The LLM will continue to re-execute the third level inference action and the fourth level inference action in sequence, and repeat the above process until the verification result obtained by the LLM in executing the fourth level inference action is the first verification result. If the inference action corresponding to the next level extension node is the fourth level inference action, and the verification result stored in the extension node is the third verification result, return to the second level inference action and call the LLM. The LLM will continue to re-execute the second level inference action, the third level inference action, and the fourth level inference action in sequence, and repeat the above process until the verification result obtained by the LLM in executing the fourth level inference action is the first verification result. If the inference action corresponding to the next-level extension node is the fourth-level inference action, and the verification result stored in the extension node is the fourth verification result, the third-level inference action is returned, and the LLM is called. The LLM continues to re-execute the third-level inference action and the fourth-level inference action in sequence, and repeats the above process until the verification result obtained by the LLM in executing the fourth-level inference action is the first verification result.
9. The method of claim 8, wherein evaluating the reasoning results of each reasoning path contained in the constructed Monte Carlo tree, and determining a target reasoning result corresponding to the reasoning data from the reasoning results of each reasoning path contained in the Monte Carlo tree based on the evaluation results, comprises: The reasoning results of each reasoning path contained in the Monte Carlo tree are summarized to obtain a set of reasoning results; Calculate a first score, a second score, and a third score corresponding to each reasoning result in the inference result set; wherein, the first score corresponding to any reasoning result in the inference result set represents the consistency of the various reasoning paths with the inference result; the second score corresponding to any reasoning result in the inference result set represents the diversity of the various reasoning paths with the inference result; and the third score corresponding to any reasoning result in the inference result set represents the accuracy of the reasoning of the various reasoning paths with the inference result. A weighted calculation is performed on the first score, the second score, and the third score to obtain a comprehensive score corresponding to each reasoning result in the reasoning result set; wherein, the first score and the third score are positively correlated with the comprehensive score; and the second score is negatively correlated with the comprehensive score. The reasoning result with the highest comprehensive score in the set of reasoning results is determined as the target reasoning result corresponding to the reasoning data.
10. The method of claim 9, The first score corresponding to any reasoning result in the set of reasoning results includes: The ratio of the number of inference paths with the inference result to the total number of inference paths contained in the Monte Carlo tree; The second score corresponding to any reasoning result in the set of reasoning results includes: the sum of similarities between the various reasoning paths that have the reasoning result; The third score corresponding to any reasoning result in the set of reasoning results includes: the sum of quality scores obtained by evaluating the reasoning accuracy of each reasoning path with the reasoning result based on LLM.
11. The method of claim 10, wherein the target reasoning task includes a medical auxiliary diagnosis task; the reasoning data includes a symptom description input by the user; the key reasoning entities include key clinical feature entities; the potential reasoning results include potential disease types; and the knowledge graph includes a medical knowledge graph for medical auxiliary diagnosis. The reasoning verification entity includes typical clinical feature entities corresponding to the potential disease type; The multi-level reasoning actions include: The first-level reasoning action is used to extract key clinical feature entities corresponding to the medical auxiliary diagnosis from the symptom description; The second-level reasoning action is used as the reasoning context to generate potential disease types corresponding to the medical auxiliary diagnosis task, using the set of potential diseases related to the key clinical feature entities retrieved from the medical knowledge graph as the reasoning context. The third-level reasoning action is used to generate typical clinical feature entities corresponding to the potential disease type by using the set of typical clinical feature entities retrieved from the medical knowledge graph that are related to the potential disease type as the reasoning context. The fourth level of reasoning is used to verify, based on the typical clinical characteristics, whether the potential disease type is the target disease type corresponding to the medical auxiliary diagnostic task; Accordingly, the nodes in the first layer of the Monte Carlo tree are used to store the key clinical features; the nodes in the second layer of the Monte Carlo tree are used to store the potential disease type; the nodes in the third layer of the Monte Carlo tree are used to store the typical clinical feature entities; and the nodes in the fourth layer of the Monte Carlo tree are used to store the verification results of whether the potential disease type is the target disease type corresponding to the disease auxiliary diagnosis task.
12. The method of claim 1, wherein the LLM-based service program includes an agent intelligent body built based on LLM.
13. An electronic device, characterized in that, include: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method as described in any one of claims 1-12 by executing the executable instructions.
14. A computer-readable storage medium, characterized in that, It stores computer instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-12.
15. A computer program product, characterized in that, Includes a computer program / instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-12.