A medical logic knowledge extraction method and medical assistance system
By generating first-order logic formulas for medical logic rules through a large language model and combining entity verification and similarity verification, the problem of representing complex logic and semantic relationships in medical information in existing technologies is solved, achieving higher accuracy and completeness.
Patent Information
- Application Number
- CN202411621993.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-14
AI Technical Summary
Existing technologies struggle to effectively represent the complex logic and semantic relationships in medical information, especially when using knowledge graphs and logical reasoning methods, where limitations exist.
We employ a prompting engineering approach based on a large language model to generate medical logic rules in the format of first-order logic formulas. We ensure the completeness and accuracy of the rules through entity verification and similarity verification, including minimum to maximum prompting strategies, thought chain strategies, and self-verification strategies.
It can represent many-to-many relationships, nested relationships, and complex conditional logic, supports quantification terms and variables, accurately represents the temporal changes of medical information, and improves the completeness and accuracy of medical logic rules.
Smart Images

Figure CN119476462B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical data processing technology, and more specifically, to a method for extracting medical logical knowledge and a medical assistance system. Background Technology
[0002] Medical logical knowledge refers to textual information that uses logical reasoning and formalization methods to represent knowledge in the medical field, such as the etiology of diseases, pathophysiological processes, and drug action mechanisms.
[0003] Currently, medical logical knowledge is mainly represented and processed through knowledge graphs and logical reasoning methods. Most medical knowledge is in the form of knowledge graphs, which use simple triples to represent binary relations. Although this can represent simple medical knowledge, it is difficult to effectively represent the complex logical and semantic relationships in medical information, and thus has limitations. Summary of the Invention
[0004] The problem addressed by this invention is how to effectively represent the complex logical and semantic relationships in medical information.
[0005] To address the above problems, this invention provides a method for extracting medical logical knowledge and a medical assistance system.
[0006] In a first aspect, the present invention provides a method for extracting medical logical knowledge, comprising:
[0007] Based on prompting engineering, the acquired medical natural language text is input into a large language model to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula.
[0008] The medical logic rules are subjected to entity verification, and verification results are generated. When the verification result is incorrect, the large language model regenerates the medical logic rules.
[0009] When the verification result is correct, the similarity between the medical logic rule and the medical natural language text is determined.
[0010] Based on the similarity and the medical logic rules, the final medical logic rules are generated.
[0011] Optionally, the prompting-based engineering involves inputting the acquired medical natural language text into a large language model to generate medical logic rules, including:
[0012] Based on the aforementioned prompting process, the extraction task of the large language model is determined;
[0013] The extraction task is decomposed into at least one subtask using a minimum to maximum prompt strategy;
[0014] The subtasks are executed sequentially through the large language model to generate a subtask result for each subtask. The input of the first subtask is the medical natural language text, the input of the other subtasks is the subtask result output by the previous subtask, and the subtask result output by the last subtask is the medical logic rule.
[0015] Optionally, the step of sequentially executing the subtasks through the large language model to generate the subtask result for each subtask includes:
[0016] For a given subtask, a thought chain strategy is used to decompose the subtask into at least one sub-step;
[0017] The sub-steps are executed through the large language model, generating the sub-step results and corresponding sub-task results of all the sub-steps at once.
[0018] Optionally, the step of sequentially executing the subtasks through the large language model to generate the subtask result for each subtask includes:
[0019] The large language model executes the subtasks sequentially. For each subtask, a self-verification strategy using the mind chain is adopted. The large language model repeatedly executes the subtask multiple times to construct a subtask result dataset, wherein the subtask result dataset includes multiple candidate subtask results.
[0020] Determine the self-consistency of each candidate subtask result in the subtask result dataset, and determine the subtask result of the subtask based on the self-consistency.
[0021] Optionally, determining the self-consistency of each candidate subtask result in the subtask result dataset includes:
[0022] The self-consistency of each candidate subtask result in the subtask result dataset is determined based on a set of self-consistency formulas, wherein the set of self-consistency formulas includes:
[0023]
[0024] in, For the self-consistency of the i-th candidate subtask result, A is the subtask result dataset, α i For the result of the i-th candidate subtask, α j For the j-th candidate subtask result, The number of elements in the subtask result dataset.
[0025] Optionally, determining the similarity between the medical logic rule and the medical natural language text includes:
[0026] A recursive syntax analysis algorithm is used to extract the syntactic structure of the medical logic rules;
[0027] The grammatical structure is recursively parsed, and logical natural language text is generated based on the natural language template.
[0028] A similarity model is used to determine the similarity between the logical natural language text and the medical natural language text.
[0029] Optionally, generating the final medical logic rule based on the similarity and the medical logic rule includes:
[0030] When the similarity is greater than or equal to a preset threshold, the medical logic rule is used as the final medical logic rule;
[0031] When the similarity is less than a preset threshold, the above steps are iterated and repeated.
[0032] Optionally, the step of performing entity verification on the medical logic rule and generating a verification result includes:
[0033] Based on the entity verification formula set, the overlap between the medical logic rules and the medical natural language text is determined. The entity verification formula set includes:
[0034]
[0035] Wherein, α is the degree of overlap, M is the logical entity set of the medical natural language text, M' is the logical entity set of the medical logical rules, e is an entity, N is the number of entities in M, and N' is the number of entities in M';
[0036] The medical logic rules are validated based on the degree of overlap, and the validation result is generated.
[0037] In a second aspect, the present invention provides a medical assistance system that applies the medical logic knowledge extraction method described in the first aspect, the medical assistance system comprising:
[0038] The generation module is used to input the acquired medical natural language text into the large language model based on the prompting engineering to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula.
[0039] The verification module is used to perform entity verification on the medical logic rules and generate verification results. When the verification result is incorrect, the large language model regenerates the medical logic rules.
[0040] A similarity module is used to determine the similarity between the medical logic rule and the medical natural language text when the verification result is correct.
[0041] The final module is used to generate the final medical logic rules based on the similarity and the medical logic rules.
[0042] Optionally, the medical assistance system further includes a prediction module, which is used to determine the symptom similarity between the final medical logic rule and each clinical data in the clinical entity dataset.
[0043] Thirdly, the present invention provides an electronic device, including a memory and a processor;
[0044] The memory is used to store computer programs;
[0045] The processor is configured to implement the medical logic knowledge extraction method as described in the first aspect when executing the computer program.
[0046] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the medical logic knowledge extraction method as described in the first aspect.
[0047] The beneficial effects of the medical logic knowledge extraction method and medical assistance system of the present invention are:
[0048] Based on prompting engineering, the medical logic rules in the first-order logic formula format obtained through the large language model can not only represent many-to-many relationships, nested relationships, and complex conditional logic, but also support quantifiers and variables, enabling the representation of general rules and individual situations. Furthermore, the first-order logic formula format of medical logic rules supports compound logic operators, accurately describing complex medical conditions and recommendations. Simultaneously, by introducing context variables and a time dimension, it can accurately represent the temporal changes in medical information, such as the efficacy of drugs under different conditions. This solves the problem that existing technologies using triples to represent binary relationships struggle to effectively represent complex logical and semantic relationships in medical information. In addition, entity verification of the medical logic rules can determine whether the medical logic rules generated by the large language model fully contain the entities in the medical natural language text. If the verification result is incorrect, meaning the medical logic rules do not fully contain the entities in the medical natural language text, the large language model will re-extract and generate until all entities are included, thereby ensuring the completeness of the medical logic rules and improving accuracy. When the verification result is correct, the similarity between the medical logic rules and the medical natural language text is then judged. By using the similarity, it is determined whether the logic of the medical logic rules and the medical natural language text is the same, thereby further improving the accuracy and obtaining the most accurate final medical logic rules. Attached Figure Description
[0049] Figure 1 A flowchart illustrating the medical logic knowledge extraction method provided in this embodiment of the invention;
[0050] Figure 2 This is one of the structural schematic diagrams of a medical auxiliary system provided in an embodiment of the present invention;
[0051] Figure 3 This is a second schematic diagram of the structure of a medical assistance system provided in an embodiment of the present invention;
[0052] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0053] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the accompanying drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
[0054] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0055] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to"; the term "based on" means "at least partially based on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments"; and the term "optionally" means "optional embodiments". Definitions of other terms will be given in the following description. It should be noted that the concepts of "first," "second," etc., mentioned in this invention are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0056] It should be noted that the terms "one" and "more" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0057] The names of the messages or information exchanged between the multiple devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of these messages or information.
[0058] In existing technologies, medical knowledge is primarily represented by simple triples to represent binary relations. For example, the Unified Medical Language System (UMLS) is a knowledge graph integrating various medical terms, diseases, drugs, and medical concepts; SNOMED CT is an international medical terminology and coding system used to describe diseases, symptoms, processes, drugs, and medical procedures; and the I2B2 2010 corpus is a knowledge base built for empirical knowledge in the medical field. These methods struggle to effectively represent medical textual knowledge, such as the complex logical and semantic relationships in electronic medical records, medical books, professional medical website texts, and medical literature. They also fail to support stronger interpretability and in-depth reasoning methods, and struggle to capture contextual dependencies and temporal changes in medical literature. Furthermore, existing logical knowledge mining methods, whether rule-based or deep learning-based, suffer from poor generalization ability and dependence on large amounts of labeled data. These problems limit the effectiveness and reliability of medical logical knowledge in practical applications.
[0059] To address the problems existing in the aforementioned related technologies, this embodiment provides a medical logic knowledge extraction method and a medical assistance system.
[0060] like Figure 1 As shown in the figure, an embodiment of the present invention provides a method for extracting medical logical knowledge, including:
[0061] Based on prompting engineering, the acquired medical natural language text is input into a large language model to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula.
[0062] Specifically, first-order logic (FOL) formulas are used to describe and reason about relationships involving individuals and predicates. By introducing symbols such as quantifiers, predicates, and functions, FOL formulas extend the functionality of propositional logic, enabling the handling of more complex logical relationships. A prompt project provides hints to the data processing of a Large Language Model (LLM). The performance of the LLM's output is highly sensitive to prompts; different input prompts can lead to significant differences in the quality of the LLM's output. A prompt is an instruction given to the LLM to execute rules, automate processes, and ensure specific quality (and quantity) of the generated output. A prompt is also a form of programming, allowing for customization of output and interaction with the LLM. The prompt project includes task requirements, logical rule format and type definitions, FOL definitions, input / output examples, and the text to be processed. By defining the FOL format, describing the task context and purpose, defining the relationship types represented by the FOL formula, and standardizing the output format of the LLM, the prompt project facilitates subsequent processing of the LLM's output text. Based on prompting engineering, the preprocessed medical natural language text is input into a large language model. The large language model performs knowledge mining on the medical natural language text to generate medical logic rules in the format of first-order logic formulas. These medical logic rules are logical rules for medical text knowledge, such as those found in electronic medical records, medical books, professional medical website texts, and medical literature. For example, if the medical natural language text is "Female patients with chronic bacterial cystitis often experience symptoms of urinary frequency and urgency," the medical logic rule could be "Female (x)^Urinary frequency (x)^Urinary urgency (x) → Chronic bacterial cystitis (x, True)".
[0063] The medical logic rules are subjected to entity verification, and verification results are generated. When the verification result is incorrect, the large language model regenerates the medical logic rules.
[0064] Specifically, entity verification methods, such as similarity verification, overlap verification, and Hamming distance verification, are used to perform entity verification on the medical logic rules, generating verification results to determine whether the medical logic rules generated by the large language model have extracted all entities from the medical natural language text. When the verification result is incorrect, it indicates that the large language model has not extracted all entities from the medical natural language text, and the large language model needs to re-extract and generate new medical logic rules, and then verify the new medical logic rules until all entities from the medical natural language text are extracted, thereby improving the completeness and accuracy of the medical logic rules.
[0065] When the verification result is correct, the similarity between the medical logic rule and the medical natural language text is determined.
[0066] Specifically, when the verification result is correct, it indicates that the large language model has extracted all entities from the medical natural language text. At this point, it is necessary to perform a logical verification of the medical logic rules to determine their correctness. This can be achieved by calculating the similarity between the medical logic rules and the medical natural language text, thus facilitating subsequent execution of corresponding steps based on the similarity score.
[0067] Based on the similarity and the medical logic rules, the final medical logic rules are generated.
[0068] Specifically, the medical logic rules may include logical rules for different outputs of the same input medical natural language text. Among the different logical rules for the same input medical natural language text, the logical rule with a similarity greater than a high-quality preset threshold is selected as the high-quality final medical logic rule. If multiple logical rules for the same input medical natural language text have a similarity greater than the high-quality preset threshold, the logical rule with the highest similarity is selected as the final medical logic rule. If all logical rules for the same input medical natural language text have a similarity less than a low-quality preset threshold, the large language model regenerates the medical logic rules, and the above steps are repeated until the final medical logic rule is obtained. For example, when the above steps are repeated to answer the prediction number, the corresponding medical natural language text is deleted.
[0069] In this embodiment, based on prompting engineering, the medical logic rules in the first-order logic formula format obtained through the large language model can not only represent many-to-many relationships, nested relationships, and complex conditional logic, but also support quantifiers and variables, enabling the representation of general rules and individual situations. Furthermore, the first-order logic formula format of the medical logic rules supports compound logic operators, enabling precise description of complex medical conditions and recommendations. Simultaneously, by introducing context variables and a time dimension, it can accurately represent the temporal changes in medical information, such as the efficacy of drugs under different conditions. This solves the problem that existing technologies using triples to represent binary relationships are unable to effectively represent complex logical and semantic relationships in medical information. In addition, by performing entity verification on the medical logic rules, it can be determined whether the medical logic rules generated by the large language model fully contain the entities in the medical natural language text. If the verification result is incorrect, meaning the medical logic rules do not fully contain the entities in the medical natural language text, the large language model will re-extract and generate until all entities are included, thereby ensuring the completeness of the medical logic rules and improving accuracy. When the verification result is correct, the similarity between the medical logic rules and the medical natural language text is then judged. By using the similarity, it is determined whether the logic of the medical logic rules and the medical natural language text is the same, thereby further improving the accuracy and obtaining the most accurate final medical logic rules.
[0070] Optionally, the prompting-based engineering involves inputting the acquired medical natural language text into a large language model to generate medical logic rules, including:
[0071] Based on the aforementioned prompting process, the extraction task of the large language model is determined;
[0072] The extraction task is decomposed into at least one subtask using a minimum to maximum prompt strategy;
[0073] The subtasks are executed sequentially through the large language model to generate a subtask result for each subtask. The input of the first subtask is the medical natural language text, the input of the other subtasks is the subtask result output by the previous subtask, and the subtask result output by the last subtask is the medical logic rule.
[0074] Specifically, when large language models encounter tasks that are more complex than the examples provided in the prompting process during knowledge mining, the quality of the logical rules mined by the model drops significantly. In such cases, a Least-To-Most Prompting strategy can be employed. This strategy breaks down the complex extraction task of the large language model into a series of simpler subtasks, which are then solved sequentially. The first subtask takes medical natural language text as input, the subsequent subtasks take the results of the previous subtask as input, and the last subtask outputs medical logical rules. This progressive prompting guides the large language model's mining process, enabling it to more easily solve problems more difficult than the examples. Applying the Least-To-Most Prompting strategy to logical knowledge mining tasks can, to some extent, prevent the large language model from misclassifying logical knowledge rule types. For example, the extraction task of the large language model can be decomposed into three subtasks: sentence logical type classification, named entity recognition, and logical knowledge mining. Sentence logic type classification involves analyzing each input sentence to determine if it contains logical relationships of interest to the task. For example, for the input "symptoms of cerebral hypoperfusion: headache, dizziness, which are exacerbated by exercise, emotional excitement, and stress;", it determines whether it contains clinical symptoms. Named entity recognition involves identifying target entities of interest for sentences containing specified logical relationships. For example, if the above sentence contains clinical symptoms, disease and symptom entities, such as headache and dizziness, are extracted. Logical knowledge mining involves extracting the logical types from sentences containing target logical types based on the outputs of the previous two subtasks. In this process, the entities identified in the second subtask are used for constraints.
[0075] Optionally, the step of sequentially executing the subtasks through the large language model to generate the subtask result for each subtask includes:
[0076] For a given subtask, a thought chain strategy is used to decompose the subtask into at least one sub-step;
[0077] The sub-steps are executed through the large language model, generating the sub-step results and corresponding sub-task results of all the sub-steps at once.
[0078] Specifically, when processing each subtask, a thought chain strategy can be adopted. The thought chain can guide the large language model to generate the correct reasoning steps based on the input medical natural language text and the subtask. That is, the logical knowledge mining task is decomposed into multiple intermediate steps, i.e., sub-steps. The large language model executes all intermediate steps of each subtask in sequence to generate the sub-step result of each sub-step, as well as the sub-task result of the subtask. By decomposing the subtask into at least one sub-step through the thought chain strategy, the burden on the large language model in terms of analyzing reasoning steps can be reduced, while constraining the solution of the large language model to solve the problem, thereby making the output more stable.
[0079] Optionally, the step of sequentially executing the subtasks through the large language model to generate the subtask result for each subtask includes:
[0080] The large language model executes the subtasks sequentially. For each subtask, a self-verification strategy using the mind chain is adopted. The large language model repeatedly executes the subtask multiple times to construct a subtask result dataset, wherein the subtask result dataset includes multiple candidate subtask results.
[0081] Determine the self-consistency of each candidate subtask result in the subtask result dataset, and determine the subtask result of the subtask based on the self-consistency.
[0082] Specifically, since large language models may output multiple seemingly reasonable answers for logical knowledge mining tasks, the answer with the highest consistency is more likely to be the correct one. Conversely, answers that are incorrect due to flawed reasoning paths or steps are unlikely to appear multiple times in multiple rounds of output. That is, even if correct reasoning paths are diverse, the final answers derived from them tend to be consistent. Therefore, when calculating the subtask results for each subtask, a self-verification strategy using a thought chain can be employed. This involves the large language model repeatedly executing the subtask multiple times to obtain multiple different or identical candidate subtask results for the same input, constructing a subtask result dataset. Simultaneously, the self-consistency of candidate subtask results in the dataset is assessed, and those with self-consistency exceeding a preset threshold are taken as the final subtask results. If all self-consistencies do not exceed the preset threshold, the thought chain self-verification strategy is re-executed to obtain a new subtask result dataset, until the final subtask results are obtained. This thought chain self-verification strategy significantly reduces the randomness of the results generated by the large language model, thereby improving the reliability and accuracy of logical rule extraction.
[0083] Optionally, determining the self-consistency of each candidate subtask result in the subtask result dataset includes:
[0084] The self-consistency of each candidate subtask result in the subtask result dataset is determined based on a set of self-consistency formulas, wherein the set of self-consistency formulas includes:
[0085]
[0086] in, For the self-consistency of the i-th candidate subtask result, A is the subtask result dataset, α i For the result of the i-th candidate subtask, α j For the j-th candidate subtask result, The number of elements in the subtask result dataset.
[0087] Specifically, a set of self-consistency formulas can be used to determine the self-consistency between candidate subtask results in the subtask result dataset.
[0088] Optionally, determining the similarity between the medical logic rule and the medical natural language text includes:
[0089] A recursive syntax analysis algorithm is used to extract the syntactic structure of the medical logic rules;
[0090] The grammatical structure is recursively parsed, and logical natural language text is generated based on the natural language template.
[0091] A similarity model is used to determine the similarity between the logical natural language text and the medical natural language text.
[0092] Specifically, medical logic rules include first-order logic operators, quantifiers, and Chinese characters. First, a small parser based on first-order logic knowledge, employing a recursive parsing algorithm, deconstructs the medical logic rules into grammatical structures based on the syntax of first-order logic formulas, such as a tree structure composed of entities and logical relations. The parser recursively analyzes the grammatical structure using compound formulas as the basic unit. Let the parser function be GrammarRead. For an input first-order logic rule, first, it identifies the correspondence of brackets to extract the current highest-priority compound formula; then, it analyzes the structural relations of the current highest-priority compound formula. For example, if the current highest-priority compound formula is an OR relation (A∨B, where A and B represent combinations of lower-priority predicates), then the current function output is [∨, GrammarRead(A), GrammarRead(B)], representing the semantic relation of the current highest priority. GrammarRead(A) is the recursive call to continue analyzing the semantic structure of compound formula A. Specifically, if the semantic analyzer's current input is not a conforming formula but an atomic formula, it indicates that the recursion has reached a leaf node and stops, directly outputting the grammatical structure of the medical logic rules. Using this recursive parsing algorithm, the grammatical hierarchy of the model's output first-order logic rules can be parsed and stored in a tree structure, providing a data foundation for automatically generating natural language text based on the first-order logic rule structure. Then, each grammatical structure is recursively parsed, and logical natural language text is generated based on natural language templates. Each grammatical structure's logic rule formula corresponds to multiple natural language templates, avoiding the problem of the uniformity of automatic sentence format translation, and then translating it into logical natural language text. For example, when the input formula satisfies the form P(c), it is translated into a corresponding subject-related pattern according to the predicate type. For example, "headache (x)" is translated into "x has clinical symptoms of headache". When the input formula satisfies the form P(c,True), it is also translated into a corresponding subject-related pattern according to the predicate type. For example, "diabetes (x,True)" is translated into "x has diabetes". When the input formula is a compound formula including conjunctions such as "or", "and", and "if and only if", it is also translated into a specified pattern that follows their semantics. Formulas at lower levels are recursively analyzed, for example, A in A∨B. Finally, a similarity model, such as a transformer-based pre-trained language model, is used to determine the similarity between the logical natural language text and the medical natural language text.
[0093] Optionally, generating the final medical logic rule based on the similarity and the medical logic rule includes:
[0094] When the similarity is greater than or equal to a preset threshold, the medical logic rule is used as the final medical logic rule;
[0095] When the similarity is less than a preset threshold, the above steps are iterated and repeated.
[0096] Specifically, when the similarity is greater than or equal to a preset threshold, the medical logic rule is used as the final medical logic rule; when the similarity is less than the preset threshold, the above steps are iterated and recalculated to obtain the most accurate final medical logic rule.
[0097] Optionally, the step of performing entity verification on the medical logic rule and generating a verification result includes:
[0098] Based on the entity verification formula set, the overlap between the medical logic rules and the medical natural language text is determined. The entity verification formula set includes:
[0099]
[0100] Wherein, α is the degree of overlap, M is the logical entity set of the medical natural language text, M' is the logical entity set of the medical logical rules, e is an entity, N is the number of entities in M, and N' is the number of entities in M';
[0101] The medical logic rules are validated based on the degree of overlap, and the validation result is generated.
[0102] Specifically, entity verification formulas can be used to determine the degree of overlap between medical logic rules and medical natural language text for accurate verification.
[0103] like Figure 2 As shown, an embodiment of the present invention provides a medical assistance system 200, comprising:
[0104] The generation module 210 is used to input the acquired medical natural language text into a large language model based on prompting engineering to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula.
[0105] The verification module 220 is used to perform entity verification on the medical logic rules and generate verification results. When the verification result is incorrect, the large language model regenerates the medical logic rules.
[0106] The similarity module 230 is used to determine the similarity between the medical logic rule and the medical natural language text when the verification result is correct.
[0107] The final module 240 is used to generate the final medical logic rules based on the similarity and the medical logic rules.
[0108] Optionally, such as Figure 3 As shown, the medical assistance system also includes a prediction module 250, which is used to determine the symptom similarity between the final medical logic rule and each clinical data in the clinical entity dataset.
[0109] Specifically, after obtaining the final medical logic rules, a prediction module can be used to determine the symptom similarity between the final medical logic rules and each clinical data point in the clinical entity dataset. The prediction module uses probabilistic logical reasoning methods to calculate the symptom similarity between the final medical logic rules and each clinical data point in the clinical entity dataset, obtaining a preset number of symptoms with the highest similarity ranking to assist in the medical process. For example, based on the symptom similarity, inference algorithms, such as ProbLog, can be used to calculate the probability of each symptom, obtaining the final symptom prediction probability. In this way, the prediction model can leverage the powerful representational capabilities of logical knowledge and enhance generalization ability to more flexibly handle incomplete information and unknown data, thereby improving the accuracy and robustness of reasoning. Furthermore, by combining probabilistic logic and reasoning, the complexity and uncertainty in medical data can be better handled, facilitating the assistance in the medical process.
[0110] like Figure 4 As shown, an electronic device 400 provided in this embodiment of the invention includes a memory 410 and a processor 420; the memory 410 is used to store a computer program; the processor 420 is used to implement the medical logic knowledge extraction method as described above when the computer program is executed.
[0111] Alternatively, an electronic device 400 includes a memory 410 and a processor 420 coupled to the memory 410; the memory 410 is configured to store a computer program; and the processor 420 is configured to perform the following operations when the computer program is executed:
[0112] Based on prompting engineering, the acquired medical natural language text is input into a large language model to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula.
[0113] The medical logic rules are subjected to entity verification, and verification results are generated. When the verification result is incorrect, the large language model regenerates the medical logic rules.
[0114] When the verification result is correct, the similarity between the medical logic rule and the medical natural language text is determined.
[0115] Based on the similarity and the medical logic rules, the final medical logic rules are generated.
[0116] This invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the medical logic knowledge extraction method described above.
[0117] In other words, a non-volatile computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following operations:
[0118] Based on prompting engineering, the acquired medical natural language text is input into a large language model to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula.
[0119] The medical logic rules are subjected to entity verification, and verification results are generated. When the verification result is incorrect, the large language model regenerates the medical logic rules.
[0120] When the verification result is correct, the similarity between the medical logic rule and the medical natural language text is determined.
[0121] Based on the similarity and the medical logic rules, the final medical logic rules are generated.
[0122] The present invention will now be described an electronic device 400 that can serve as a server or client of the present invention, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic device 400 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 400 can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0123] Electronic device 400 includes a computing unit that can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) or a computer program loaded from a storage unit into random access memory (RAM). The RAM may also store various programs and data required for device operation. The computing unit, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0124] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. In this application, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention according to actual needs. Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units can be implemented in hardware or as software functional units.
[0125] While the present invention has been disclosed above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and all such changes and modifications will fall within the scope of protection of the present invention.
Claims
1. A method for extracting medical logical knowledge, characterized in that, include: Based on prompting engineering, the acquired medical natural language text is input into a large language model to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula. The medical logic rules are subjected to entity verification, and verification results are generated. When the verification result is incorrect, the large language model regenerates the medical logic rules. When the verification result is correct, the similarity between the medical logic rule and the medical natural language text is determined. Based on the similarity and the medical logic rules, the final medical logic rules are generated; The step of performing entity verification on the medical logic rules and generating verification results includes: Based on the entity verification formula set, the overlap between the medical logic rules and the medical natural language text is determined. The entity verification formula set includes: ; ; in, Let M be the degree of overlap, and M be the logical entity set of the medical natural language text. Let M be the logical entity set of the medical logic rules, where e is an entity and N is the number of entities in M. for The number of entities in; The medical logic rules are validated based on the degree of overlap, and the validation result is generated.
2. The medical logic knowledge extraction method according to claim 1, characterized in that, The prompting-based engineering process involves inputting the acquired medical natural language text into a large language model to generate medical logic rules, including: Based on the aforementioned prompting process, the extraction task of the large language model is determined; The extraction task is decomposed into at least one subtask using a minimum to maximum prompt strategy; The subtasks are executed sequentially through the large language model to generate a subtask result for each subtask. The input of the first subtask is the medical natural language text, the input of the other subtasks is the subtask result output by the previous subtask, and the subtask result output by the last subtask is the medical logic rule.
3. The medical logic knowledge extraction method according to claim 2, characterized in that, The step of sequentially executing the subtasks through the large language model to generate the subtask result for each subtask includes: For a given subtask, a thought chain strategy is used to decompose the subtask into at least one sub-step; The sub-steps are executed through the large language model, generating the sub-step results and corresponding sub-task results of all the sub-steps at once.
4. The medical logic knowledge extraction method according to claim 2, characterized in that, The step of sequentially executing the subtasks through the large language model to generate the subtask result for each subtask includes: The large language model executes the subtasks sequentially. For each subtask, a self-verification strategy using the mind chain is adopted. The large language model repeatedly executes the subtask multiple times to construct a subtask result dataset, wherein the subtask result dataset includes multiple candidate subtask results. Determine the self-consistency of each candidate subtask result in the subtask result dataset, and determine the subtask result of the subtask based on the self-consistency.
5. The medical logic knowledge extraction method according to claim 4, characterized in that, Determining the self-consistency of each candidate subtask result in the subtask result dataset includes: The self-consistency of each candidate subtask result in the subtask result dataset is determined based on a set of self-consistency formulas, wherein the set of self-consistency formulas includes: ; ; in, For the first i The self-consistency of the results of the candidate subtasks, where A is the dataset of the subtask results. For the first i The results of the candidate subtasks. For the first j The results of the candidate subtasks. The number of elements in the subtask result dataset.
6. The medical logic knowledge extraction method according to claim 1, characterized in that, Determining the similarity between the medical logic rule and the medical natural language text includes: A recursive syntax analysis algorithm is used to extract the syntactic structure of the medical logic rules; The grammatical structure is recursively parsed, and logical natural language text is generated based on the natural language template. A similarity model is used to determine the similarity between the logical natural language text and the medical natural language text.
7. The medical logic knowledge extraction method according to claim 1, characterized in that, The step of generating the final medical logic rules based on the similarity and the medical logic rules includes: When the similarity is greater than or equal to a preset threshold, the medical logic rule is used as the final medical logic rule; When the similarity is less than a preset threshold, the above steps are iterated and repeated.
8. A medical auxiliary system, characterized in that, The medical assistance system, employing the medical logic knowledge extraction method as described in any one of claims 1-7, comprises: The generation module is used to input the acquired medical natural language text into the large language model based on the prompting engineering to generate medical logic rules, wherein the format of the medical logic rules is a first-order logic formula. The verification module is used to perform entity verification on the medical logic rules and generate verification results. When the verification result is incorrect, the large language model regenerates the medical logic rules. A similarity module is used to determine the similarity between the medical logic rule and the medical natural language text when the verification result is correct. The final module is used to generate the final medical logic rules based on the similarity and the medical logic rules.
9. The medical auxiliary system according to claim 8, characterized in that, It also includes a prediction module, which is used to determine the symptom similarity between the final medical logic rule and each clinical data in the clinical entity dataset.
Citation Information
Patent Citations
Method for solving reading comprehension question based on semantic analysis and SMT solution
CN108829666A
Constraint solving method of symbolic execution system for vulnerability detection
CN116382653A