Method and device for medical question and answer, electronic equipment and medium

By using a hybrid AI model architecture that combines lightweight and large-scale language models with a medical knowledge graph database, the contradiction between response speed and accuracy in medical question-answering systems is resolved, enabling fast and reliable medical information retrieval and reducing computational latency and costs in high-concurrency scenarios.

CN121743552APending Publication Date: 2026-03-27BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing medical intelligent question-answering systems, while ensuring the accuracy and reliability of answers, struggle to balance system response speed with the ability to generalize complex queries. Furthermore, they suffer from issues of factual illusion and high computational costs in the medical field.

Method used

Employing a hybrid AI model architecture that combines lightweight and large-scale language models, it leverages intent recognition and collaborative querying of a medical knowledge graph database. By integrating vector retrieval and graph query statements, it ensures automatic switching to vector retrieval when intent matching fails, enabling rapid response and answer generation.

Benefits of technology

It improves the response speed and reliability of the medical question-and-answer system, reduces computational latency and costs in high-concurrency scenarios, and ensures that relevant information can still be provided when graph queries fail, thereby enhancing the continuity and availability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121743552A_ABST
    Figure CN121743552A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for medical question answering, electronic equipment and a medium, and relates to the field of artificial intelligence, in particular to the field of knowledge maps and large language models. The method can comprise the steps of obtaining an intention label and an intention confidence coefficient through a first large language model based on a query text from a user; in response to determining that the intention label is not matched with the intention in the intention list or the intention confidence does not meet a confidence threshold, executing a first query process to obtain a query result; and obtaining a reply text for the query text based on the query result, the first query process comprising: executing vector retrieval based on the query text to obtain a first sub-query result; generating a graph query statement by using a second large language model based on the query text; and obtaining a query result at least based on the first sub-query result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and more particularly to knowledge graphs and large language models, specifically to a method, apparatus, electronic device, computer-readable storage medium, and computer program product for medical question answering. Background Technology

[0002] With the rapid popularization of internet-based healthcare services, more and more users are accustomed to using online platforms for disease consultation, health management, and medical guidance. As a key entry point connecting user needs with professional medical knowledge, the service quality of intelligent question-answering systems directly impacts users' medical experience and treatment efficiency. How to balance the accuracy and reliability of answers with the system's response speed and its ability to generalize complex queries is a pressing technical challenge in the field of intelligent medical question-answering.

[0003] The methods described in this section are not necessarily methods that had been previously conceived or adopted. Unless otherwise specified, no method described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be accepted in any prior art. Summary of the Invention

[0004] This disclosure provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for medical question answering.

[0005] According to one aspect of this disclosure, a method for medical question answering is provided, comprising: obtaining an intent tag and intent confidence based on query text from a user using a first large language model; in response to determining that the intent tag does not match an intent in the intent list or that the intent confidence does not meet a confidence threshold, performing a first query process to obtain a query result; and obtaining a response text for the query text based on the query result, wherein the first query process includes: performing vector retrieval based on the query text to obtain a first subquery result; generating a graph query statement based on the query text using a second large language model; and obtaining the query result based at least on the first subquery result, including performing one of the following: in response to determining that the graph query statement can successfully query a medical knowledge graph database, fusing a second subquery result obtained based on the graph query statement with the first subquery result to obtain the query result; or in response to determining that the generated graph query statement cannot successfully query the graph database, using the first subquery result as the query result.

[0006] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to said at least one processor; wherein said memory stores instructions executable by said at least one processor, said instructions being executed by said at least one processor to enable said at least one processor to perform a method for medical question answering according to one or more embodiments of this disclosure.

[0007] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform a method for medical question answering according to one or more embodiments of this disclosure.

[0008] According to another aspect of this disclosure, a computer program product is provided, including a computer program, wherein the computer program, when executed by a processor, implements a method for medical question answering according to one or more embodiments of this disclosure.

[0009] According to one or more embodiments of this disclosure, medical-related response statements can be effectively generated based on a user's query text.

[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0011] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0012] Figure 1 A schematic diagram of an exemplary system in which the various methods described herein may be implemented according to embodiments of the present disclosure is shown; Figure 2 A flowchart of a method for medical question answering according to an embodiment of the present disclosure is shown; Figure 3 A system architecture according to an embodiment of the present disclosure is shown; Figures 4A-4C A schematic diagram of user intent and data templates according to embodiments of the present disclosure is shown; Figures 5A-5C Examples of graph data types and formats according to embodiments of the present disclosure are shown; Figure 5D A schematic diagram of a data flow according to an embodiment of the present disclosure is shown; Figure 6 A structural block diagram of a device for medical question answering according to an embodiment of the present disclosure is shown; Figure 7 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation

[0013] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0014] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," etc., to describe various elements is not intended to limit the positional, temporal, or importance relationships of these elements; such terms are merely used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of that element, while in other cases, based on the context, they may refer to different instances.

[0015] The terminology used in the description of the various examples described in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context explicitly indicates otherwise, an element may be one or more unless the number of elements is specifically limited. Furthermore, the term "and / or" as used in this disclosure covers any one of the listed items and all possible combinations thereof.

[0016] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.

[0017] Figure 1 A schematic diagram of an exemplary system 100 in which the various methods and apparatus described herein can be implemented according to embodiments of this disclosure is shown. Reference Figure 1 The system 100 includes one or more client devices 101, 102, 103, 104, 105 and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105 and 106 can be configured to execute one or more applications.

[0018] In embodiments of this disclosure, server 120 may run one or more services or software applications that enable the execution of the methods for medical question answering according to this disclosure.

[0019] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtual and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as to users of client devices 101, 102, 103, 104, 105 and / or 106 under a Software as a Service (SaaS) model.

[0020] exist Figure 1 In the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or combinations thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 can sequentially interact with server 120 using one or more client applications to utilize the services provided by these components. It should be understood that various different system configurations are possible and may differ from system 100. Therefore, Figure 1 This is an example of a system used to implement the various methods described herein, and is not intended to be limiting.

[0021] Users can use client devices 101, 102, 103, 104, 105, and / or 106 to ask medical questions, view results, etc. The client devices provide an interface that allows users to interact with them. The client devices can also output information to the user through this interface. Although... Figure 1 Only six client devices are described, but those skilled in the art will understand that this disclosure can support any number of client devices.

[0022] Client devices 101, 102, 103, 104, 105, and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors, or other sensing devices. These computer devices can run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as Google Chrome OS); or include various mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, and Android. Portable handheld devices may include cellular phones, smartphones, tablets, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Gaming systems may include various handheld gaming devices, internet-enabled gaming devices, etc. Client devices are capable of executing various applications, such as various internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.

[0023] Network 110 can be any type of network well known to those skilled in the art, and can support data communication using any of a variety of available protocols (including but not limited to TCP / IP, SNA, IPX, etc.). By way of example only, one or more networks 110 can be a local area network (LAN), an Ethernet-based network, a token ring network, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0024] Server 120 may include one or more general-purpose computers, special-purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for servers). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0025] The computing unit in server 120 can run one or more operating systems, including any of the aforementioned operating systems and any commercially available server operating system. Server 120 can also run any of a variety of additional server applications and / or middleware applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0026] In some implementations, server 120 may include one or more applications to analyze and merge data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.

[0027] In some implementations, server 120 can be a server for a distributed system or a server integrated with blockchain. Server 120 can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Server (VPS) services, such as high management difficulty and weak business scalability.

[0028] System 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. Databases 130 may reside in various locations. For example, a database used by server 120 may be local to server 120, or it may be located away from server 120 and may communicate with server 120 via a network-based or dedicated connection. Databases 130 may be of different types. In some embodiments, the database used by server 120 may be, for example, a relational database. One or more of these databases may store, update, and retrieve data from and from the databases in response to commands.

[0029] In some embodiments, one or more of the databases 130 may also be used by an application to store application data. The databases used by the application may be of different types, such as key-value stores, object stores, or regular stores supported by a file system. Figure 1 The system 100 can be configured and operated in various ways to enable the application of the various methods and apparatus described in this disclosure.

[0030] The following is for reference. Figure 2 A method 200 for medical question answering according to an exemplary embodiment of the present disclosure is described.

[0031] In step S201, based on the query text from the user, the intent label and intent confidence are obtained through the first language model.

[0032] In step S202, in response to determining that the intent tag does not match the intent in the intent list or that the intent confidence does not meet the confidence threshold, a first query process is executed to obtain query results.

[0033] In such an embodiment, the first query process may include: performing vector retrieval based on the query text to obtain a first subquery result; generating a graph query statement based on the query text using a second language model; and obtaining the query result based at least on the first subquery result, including performing one of the following: in response to determining that the graph query statement can successfully query the medical knowledge graph database, fusing the second subquery result obtained based on the graph query statement with the first subquery result to obtain the query result; or in response to determining that the generated graph query statement cannot successfully query the graph database, using the first subquery result as the query result.

[0034] In step S203, based on the query results, a response text is obtained for the query text.

[0035] The method described according to embodiments of this disclosure can effectively generate medical-related response statements based on user query text.

[0036] According to this embodiment, by setting conditional branches to determine whether a graph query statement can be successfully executed, the system can automatically use the subquery results obtained from vector retrieval as the output basis when the graph database query path fails or becomes unavailable. This mechanism ensures that even if graph query generation fails or execution anomalies, the system can still provide relevant information based on vector retrieval, thereby guaranteeing the continuity and availability of the question-and-answer service.

[0037] It is understood that the query text can be natural language text containing medical-related questions. Exemplarily, fusing the results of the first and second subqueries may include deduplicating, sorting, or weighting the text fragments. In some additional embodiments, as will be further elaborated below, the process of obtaining the response text may include inputting the query results as context into a generative large model and generating a natural language answer in conjunction with prompt words. Exemplarily, intent confidence may refer to the highest probability value in the probability distribution output by the model, used to measure the model's confidence in the current judgment. The confidence threshold may be a pre-set value (e.g., 0.8) used to distinguish between high-confidence standard queries and low-confidence or unknown long-tail queries. Graph query statements may be graph database query languages ​​such as Cypher, Gremlin, or SPARQL. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0038] For example, the method may include obtaining intent tags, a set of medical entities, and intent confidence based on query text from a user through a first large language model. For example, the obtained set of medical entities may be used to perform a first query process. For instance, when performing vector retrieval, the extracted medical entities may be used as key index terms for focused matching with node vectors in the graph database to improve retrieval relevance; or, when generating graph query statements using a second large language model, the set of medical entities may be explicitly input as known conditions into the large language model, guiding the large language model to construct query statements using standard entity names existing in the graph (e.g., MATCH (n:Disease {name: "standard entity name"})), thereby avoiding query failures due to inconsistencies between the entity names generated by the large language model and the graph data. For example, as will be further elaborated below, the intent tags and the set of medical entities may be obtained in a single inference process, and it is understood that the above are merely examples, and this disclosure is not limited thereto.

[0039] In some embodiments, the first large language model may be a large language model that is lighter than the second large language model.

[0040] This implementation allows for the use of models with lower computational resource consumption and faster response times at the front end of the processing flow (intent recognition stage), while models with larger parameters and stronger inference capabilities are used at the back end (graph query generation stage) where complex generation capabilities are required. This "big-small model" architecture significantly reduces computational latency and computational costs in high-concurrency scenarios while maintaining the overall system's intelligence level.

[0041] Those skilled in the art will understand that the first large language model can be a finely tuned, lightweight classification model. The first large language model can be designed to quickly determine user intent. It is understood that "lightweight" is a relative concept, typically referring to a model with a significantly smaller number of parameters than another model. For example, the first large language model could be a model with hundreds of millions to billions of parameters (such as the Tiny version), focusing on classification and extraction tasks; while the second large language model could be a general-purpose large model with tens or hundreds of billions of parameters, focusing on logical reasoning and code generation. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0042] In some other embodiments, the first large language model may be a small model distilled for a specific task. Additionally and / or alternatively, the second large language model may be a very large-scale model deployed in the cloud, while the first large language model may be a model deployed at the edge or on a local server.

[0043] In some embodiments, the method may further include obtaining a set of medical entities based on the query text using the first large language model. In such embodiments, the method may further include: in response to determining that the intent tag matches an intent in an intent list and that the intent confidence meets a confidence threshold, performing a second query process to obtain query results. In such embodiments, the second query process may include: querying the graph database based on a query template corresponding to the matched intent and the set of medical entities to obtain the query results.

[0044] According to this embodiment, for high-frequency and clearly defined medical intentions, precise queries can be performed directly through pre-set parameterized templates, without the need for generating query statements using a large model. This not only further improves the system's response speed but also ensures the absolute accuracy and controllability of the answers in standard scenarios, avoiding the uncertainties that generative models may introduce.

[0045] Those skilled in the art will understand that the medical entity set may include key information such as disease names, drug names, and symptom descriptions extracted from the query text. The query template may be a pre-written graph query statement with parameter slots (e.g., MATCH (d:Disease {name: $disease_name}) RETURN d.desc). The matching intent may refer to finding preset processing logic corresponding to the current intent tag. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0046] In some additional embodiments, performing the second query process may also include standardizing or disambiguating the extracted medical entities to ensure alignment with entities in the graph database.

[0047] In some embodiments, the first large language model can be configured to simultaneously predict the intent label and the set of medical entities through different output layers during a single inference process, and calculate the intent confidence based on the probability distribution of intent classification. Exemplarily, the method may include extracting semantic features based on the query text through a shared encoding layer of the first large language model; and simultaneously predicting the intent label and the set of medical entities through different output layers during a single inference process, and calculating the intent confidence based on the probability distribution of intent classification.

[0048] According to this embodiment, through a multi-task learning architecture with a shared encoding layer, the system only needs to perform encoding inference on the query text once to simultaneously obtain intent and entity information. This single-inference mechanism can reduce the number of model inferences and system overhead, thereby improving the system's response speed and processing efficiency.

[0049] It is understood that the shared encoding layer can be the Encoder part of a Transformer, and the different output layers (Heads) can be fully connected layers for sequence labeling (NER) and fully connected layers for text classification, respectively. Simultaneous prediction refers to the outputs of multiple tasks being completed within the same forward propagation process. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0050] In some additional embodiments, the first language model may also simultaneously output a vector representation of the query text. In other embodiments, the output layer may further include a prediction head for sentiment analysis or urgency assessment.

[0051] In some embodiments, the intent list may include at least one of the following: disease inquiry, symptom diagnosis, medication guidance, dietary advice, department navigation, and doctor recommendation.

[0052] This implementation clearly covers the most core and frequent user needs in online medical consultations. By pre-processing these specific intentions, more professional and structured medical advice can be provided to users, enhancing the system's practical value and user experience.

[0053] Those skilled in the art will understand that "symptom diagnosis" can refer to inferring a possible disease based on symptoms described by the user; "department navigation" can refer to recommending departments for registration based on diseases or symptoms. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0054] In some additional embodiments, the intent list may also include interpretation of examination reports, consultation on surgical fees, and inquiries about medical insurance policies. In some other embodiments, the intent list can be dynamically updated or expanded based on the results of background log analysis.

[0055] In some embodiments, obtaining a first subquery result by performing vector retrieval based on the query text may include: obtaining a hybrid vector index constructed for the graph database. In such embodiments, the hybrid vector index may include: node attribute vectors generated based on the unstructured text attributes of entity nodes in the graph database, and relationship path vectors generated based on the semantic description of the relationship paths between entities in the graph database. In such embodiments, this step may further include: obtaining the first subquery result by performing similarity matching between the query vector obtained based on the query text and the hybrid vector index.

[0056] According to this embodiment, vector retrieval is not limited to isolated text fragments, but covers "entity-relationship-entity" paths rich in logical information within the graph. This structured vector index enables the retrieval of knowledge with deep semantic connections through vector matching, thus providing high-quality contextual information even in degraded or auxiliary retrieval scenarios.

[0057] Those skilled in the art will understand that unstructured text attributes can include detailed descriptions of diseases, drug instruction manuals, etc. The semantic description of a relational path can be a vector generated by converting triples (e.g., "cold-accompanied-fever") into natural language sentences (e.g., "colds are often accompanied by fever symptoms"). Hybrid vector indexes can be index structures that support massive vector storage and fast nearest neighbor search (e.g., HNSW, IVF). It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0058] In some additional embodiments, the hybrid vector index may also include interaction vectors constructed based on the user's historical click behavior. In some other embodiments, similarity matching may employ metrics such as cosine similarity, Euclidean distance, or dot product.

[0059] In some embodiments, performing similarity matching between the query vector obtained based on the query text and the hybrid vector index may include: calculating the semantic similarity between the query vector and each vector in the hybrid vector index to obtain a target vector whose semantic similarity meets a similarity threshold; and determining the text fragment and graph entity corresponding to the target vector as the first sub-query result.

[0060] According to this embodiment, by setting a similarity threshold to filter search results, target vectors that are semantically close to the query vector can be retained, while information that does not meet the relevance requirements can be removed. This threshold-based matching mechanism ensures that text fragments and graph entities entering subsequent processing have a certain semantic relevance, providing effective content support for subsequent answer generation. It can use a similarity threshold to filter target vectors and recall corresponding graph entities.

[0061] For example, a high similarity threshold, such as 0.8 or 0.9, can be used to retain only high-confidence knowledge. By setting a high-precision similarity threshold to rigorously filter search results, it is possible to effectively eliminate irrelevant or misleading noise information. In the medical field, such a stringent filtering mechanism is crucial for preventing "factual illusions" and ensuring the rigor and safety of medical advice.

[0062] In some additional embodiments, determining the first subquery result may further include obtaining information about the one-hop or two-hop neighbor nodes of the graph entity. In some other embodiments, if the number of target vectors that meet the threshold is too large, only the Top-K results may be retained.

[0063] In some embodiments, determining that the graph query statement can successfully query the graph database may include: determining that the graph query statement satisfies the syntax security check and is successfully executed in the graph database to obtain the second subquery result.

[0064] This implementation not only requires the query statement to be syntactically correct and free of security risks, but also requires it to return valid data when actually executed in the database. This avoids using empty or incorrect results for subsequent generation, ensuring that the basis for answer generation is reliable.

[0065] Those skilled in the art will understand that syntax safety checks may include checking for the presence of dangerous operation keywords such as DELETE and SET, and checking whether the syntax structure conforms to graph database specifications. Successful execution can mean that the database returns a non-empty result set without throwing a runtime exception. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0066] In some other embodiments, determining that a generated graph query statement cannot successfully query the graph database may include: determining that the graph query statement does not satisfy syntax security checks or fails to execute in the graph database. In some additional embodiments, successful execution may also include ensuring the returned result set size is within a preset range to avoid returning too much data and causing processing timeouts. In some other embodiments, security checks may also include estimating query complexity and rejecting overly complex queries.

[0067] In some embodiments, the method may further include performing a repair operation in response to determining that the graph query statement does not satisfy a syntax security check to obtain a repaired graph query statement, and determining that the generated graph query statement cannot successfully query the graph database includes determining that the repaired graph query statement still cannot successfully query the graph database.

[0068] This implementation introduces a "self-healing" mechanism. When a query is determined to be unavailable, it does not immediately give up but attempts to repair it, thereby reducing degradation caused by occasional generation errors and improving the overall intelligence level of the system.

[0069] Those skilled in the art will understand that the repair operation may involve rewriting the text of the query statement or adjusting its parameters. A repaired graph query statement refers to a statement that has been corrected and resubmitted to the database for execution. It is understood that the above is merely an example, and this disclosure is not limited thereto.

[0070] In some additional embodiments, the repair operation can be configured with a maximum number of retries, such as 1 or 2 retries. In some other embodiments, the repair operation can be logged for subsequent optimization of the large language model generation strategy.

[0071] In some embodiments, the repair operation may include: identifying the anomaly type of the graph query statement; and performing a corresponding repair operation based on the anomaly type.

[0072] This implementation allows for targeted repair strategies to be adopted based on different error causes, rather than blindly retrying. This refined error handling logic significantly improves the success rate and efficiency of repairs, demonstrating the system's deep adaptability to complex medical query scenarios.

[0073] Those skilled in the art will understand that the exception type can be determined by parsing the error code or error message returned by the database. The corresponding repair operation is predefined processing logic. It is understood that the above is merely an example, and this disclosure is not limited thereto.

[0074] In some additional embodiments, the system may maintain a mapping table between anomaly types and remediation strategies. In other embodiments, anomaly type identification may be performed by a specialized classification model.

[0075] In some embodiments, the identified exception type may include a syntax error, and the corresponding repair operation may include invoking a syntax correction model to rewrite the query statement.

[0076] This implementation demonstrates how a specially trained syntax correction model can effectively correct non-standard query statements or those with minor grammatical issues generated by large models. This resolves the occasional syntax drift problem that occurs when large models generate domain-specific programming languages ​​(such as Cypher), ensuring smooth execution.

[0077] Those skilled in the art will understand that the syntax correction model can be a small Seq2Seq model trained on code correction data. Rewriting can refer to correcting spelling errors, adding missing parentheses or keywords, etc. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0078] In some additional embodiments, the syntax correction model may be a rule-based regular expression replacement tool. In some other embodiments, the rewriting operation may include correcting attribute names by referencing the schema information of the graph database.

[0079] In some embodiments, the identified anomaly type may include an empty query result, and the corresponding remediation operation may include removing non-critical constraints from the query statement to broaden the query scope.

[0080] According to this implementation, when a user's query conditions are too stringent, resulting in a lack of exact matching knowledge in the graph database, the system can intelligently relax the conditions to perform a fuzzy search or expand the scope of the search. This avoids directly returning "no results," improving the system's recall rate and user satisfaction.

[0081] Those skilled in the art will understand that non-critical constraints can be, for example, specific time ranges or non-core attribute restrictions. Widening the query scope can be achieved by replacing `MATCH` with `OPTIONAL MATCH` or by removing certain conditions from the `WHERE` clause. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0082] In some additional embodiments, broadening the query scope may also include changing an exact match to a containment match or a fuzzy match. In some other embodiments, the priority of removing constraints can be determined based on the weight of medical knowledge.

[0083] In some embodiments, the identified exception type may include execution timeout, and the corresponding remedial action may include optimizing the path depth of the query statement or adding a quantity limit.

[0084] This implementation allows for automatic optimization of queries that consume excessive resources or take too long to execute, preventing a single query from blocking the entire database service. This ensures system stability and responsiveness under high load, demonstrating a defensive design principle in engineering.

[0085] Those skilled in the art will understand that execution timeout can refer to a query execution time exceeding a system-defined threshold (e.g., 500ms). Optimizing path depth can involve reducing the number of hops in multi-hop queries (e.g., changing from *1..5 to *1..3). Adding quantity limits can involve adding a LIMIT clause. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0086] In some additional embodiments, for queries that time out, the system can log their patterns and perform offline analysis. In other embodiments, optimization operations may also include simplifying the number of fields returned.

[0087] In some embodiments, generating a graph query statement based on the query text using a second large language model may include: identifying the medical scenario intent corresponding to the query text; obtaining a predefined multi-hop inference topology chain corresponding to the medical scenario intent, wherein the multi-hop inference topology chain describes the hierarchical jump relationship between entity nodes; and inputting the multi-hop inference topology chain as prompt information into the large language model to guide the large language model to generate a graph query statement that follows the jump relationship.

[0088] In this embodiment, by introducing a predefined "reasoning topology chain" as guidance, the system forces the large model to think and generate according to a path that conforms to medical logic, rather than freely diverging. This constraint mechanism effectively injects the reasoning knowledge of medical experts into the generation process, ensuring that the generated query statements meet the requirements of medical scenarios in terms of logical depth and professionalism.

[0089] Those skilled in the art will understand that the intent in a medical scenario can be derived from semantic analysis of the query text. The multi-hop inference topology can be a graph-structured metadata description (e.g., Symptom -> Disease -> Check -> Meaning). Guided generation refers to inputting this topology as part of the Prompt into the model. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0090] In some additional embodiments, the inference topology chain can be stored in a configuration center, supporting dynamic distribution and updates. In other embodiments, the system can select topology chains of different lengths based on the complexity of the query text.

[0091] In some embodiments, the multi-hop inference topology chain may include at least one of the following: a path from symptoms to disease to treatment, a path from symptoms to disease to department to doctor, or a path from symptoms to disease to drug to side effects.

[0092] Through these embodiments, the system embodies several of the most typical complex reasoning patterns in the medical field. These paths cover the entire process from diagnosis to treatment, from triage to medication, enabling the handling of complex medical consultations across entities and providing in-depth knowledge services. In some additional embodiments, the topology chain may also include a path from "disease to complication to prevention." In some other embodiments, the definition of the path may be adapted according to medical guidelines, and this disclosure is not limited thereto.

[0093] In some embodiments, obtaining a response text for the query text based on the query results may include: obtaining the response text based on the query results using a second or third language model.

[0094] According to this embodiment, by integrating and refining structured query results using a large model with strong language generation capabilities, fluent, natural, and logically coherent response text can be generated, thus improving the quality of human-computer interaction.

[0095] Those skilled in the art will understand that the same second-largest language model or a different third-largest language model can be used, and the query results can be input to the model as the Context part of the Prompt. In some additional embodiments, obtaining the response text may also include labeling the generated text with knowledge sources or confidence levels. In some other embodiments, if the query results are empty, the response text may generate guiding questions or suggestions.

[0096] In some embodiments, the method may further include: collecting query texts whose intent confidence does not meet the confidence threshold, constructing a long-tailed hard example set; labeling the long-tailed hard example set using a general large language model to generate pseudo-label data; and fine-tuning the first large language model using the pseudo-label data.

[0097] Based on this implementation, a data flywheel mechanism was constructed that can automatically optimize itself using low-confidence (i.e., uncertain model classification) data generated during online operation. This self-evolutionary capability allows the small model to continuously adapt to new query expressions and long-tail medical problems. As usage time increases, the model's generalization ability and accuracy continuously improve, reducing reliance on large amounts of manually labeled data.

[0098] Those skilled in the art will understand that the long-tail hard example set refers to the set of query samples that are not well covered by the current model. Pseudo-label data can refer to data that uses prediction results generated by a larger, stronger model (teacher model) as labels. Fine-tuning training can refer to further training and updating based on the original model parameters. It is understood that the above are merely examples, and this disclosure is not limited thereto. In some additional embodiments, the pseudo-label data may be manually sampled and reviewed before being used for training. In some other embodiments, fine-tuning training may employ parameter-efficient fine-tuning techniques such as LoRA.

[0099] In some embodiments, the method may further include: monitoring change events of medical business data and calculating the difference between the changed data and existing data in the graph database; analyzing the impact of the difference on the connectivity of local subgraphs in the graph database; and incrementally updating the affected entity nodes and relationships based on the analysis results.

[0100] Through this implementation, the system can not only perceive numerical changes in data but also deeply analyze the impact of data changes on the graph structure (connectivity). This graph-based update strategy ensures the topological integrity of the knowledge graph, avoids reasoning interruptions caused by isolated nodes or broken links, and guarantees the real-time performance and reliability of the graph as a knowledge foundation.

[0101] Those skilled in the art will understand that change events can include modifications to physician information, the launch of new drugs, etc. Local subgraph connectivity refers to the reachability between related nodes in a graph. Incremental update refers to updating only the changed parts, rather than reconstructing the entire graph. It is understood that the above are merely examples, and this disclosure is not limited thereto.

[0102] In some additional embodiments, analyzing the impact of connectivity may include calculating the centrality changes of affected nodes. In other embodiments, the update step may be performed in a distributed manner using big data frameworks such as Spark.

[0103] According to one or more aspects of this disclosure, a multi-path collaborative reasoning medical question answering and precise recommendation system based on medical knowledge graphs and hybrid AI models is provided.

[0104] According to one or more aspects of this disclosure, the "reliability-latency" contradiction in medical AI can be resolved. General-purpose large language models suffer from "factual illusion" in the medical field, and their high generation latency and computational cost make them unable to meet the real-time and reliability requirements of high-concurrency online medical services.

[0105] According to one or more aspects of this disclosure, the problem of accurate parsing and routing of complex medical queries can be solved. User medical queries are short, highly ambiguous, and have diverse intents. Existing solutions (rules, traditional NLP, general models) are unable to achieve high-precision intent recognition and entity extraction within milliseconds and intelligently select the optimal solution path.

[0106] According to one or more aspects of this disclosure, the problems of limited knowledge acquisition channels and insufficient context quality can be solved. Existing systems either rely solely on structured queries or use only vector retrieval, making it difficult to simultaneously address accurate facts and semantic relationships, and thus failing to provide generative models with both accurate and rich contextual information.

[0107] According to one or more aspects of this disclosure, the problem of low accuracy in doctor-patient matching can be solved. Existing online medical platforms mainly recommend doctors based on keyword matching and simple screening conditions, lacking a deep understanding and reasoning of the complex semantic relationships between entities such as diseases, symptoms, departments, and doctors' specialties.

[0108] One or more aspects of this disclosure can be widely applied to products such as online medical platforms, intelligent consultation systems, intelligent hospital triage, medical education tools, and large-scale models in the medical vertical field, to provide users with reliable, accurate, and real-time medical knowledge services and resource recommendations.

[0109] According to one or more aspects of this disclosure, a hybrid AI inference system can be constructed that combines "small-model intelligent routing + Neo4j multi-path collaborative retrieval + large-model generation enhancement". The technical solution revolves around the core idea of ​​multi-path collaboration, distributing queries with different characteristics to the optimal solution path through intelligent routing, thereby achieving globally optimal performance and results. The core architecture and data processing flow of the system are shown in the following figure: The following is for reference. Figure 3 The system architecture and data flow are described according to a specific, non-limiting exemplary embodiment of this disclosure.

[0110] like Figure 3 As shown, the system may include a small-model intelligent routing layer, which can act as the system's "scheduling center," responsible for the initial understanding and classification of user queries. For example, this layer can employ a lightweight model fine-tuned from a large amount of medical question-and-answer data. This model can simultaneously perform both intent classification and entity recognition tasks.

[0111] For example, a pre-defined intent list can be set. The system can define an intent list covering common medical scenarios, such as, but not limited to: medical science popularization, including disease inquiry, symptom diagnosis, medication guidance, dietary advice, examination recommendations, complication inquiry, treatment plan, department navigation, etc.; and doctor recommendation, including doctor inquiry, disease treatment pathway, symptom diagnosis assistance, and expertise matching recommendations, etc.

[0112] Next, routing decisions can be made. Based on whether the identified intent is within a pre-defined list, the routing decision-maker will direct the query to different processing paths. If the intent is within the pre-defined intent list, it can jump to path one, which is the precise query channel. If it is not within the pre-defined intent list, it can jump to path two, which is the complex query channel.

[0113] According to embodiments of this disclosure, compared to directly using large models or general NLP models, this dedicated small model achieves the best balance in speed (average response <500ms), accuracy (significantly improved F1 score for medical entity recognition), and resource consumption (reduced by 60%+), making high-concurrency services possible.

[0114] Return to reference Figure 3 As shown, the system can also include a multi-path collaborative retrieval core concept, which serves as the system's "information engine" and enables the collaboration of three retrieval capabilities in a graph database platform such as the Neo4j unified platform.

[0115] For example, path one serves as a precise query channel, enabling template-based Cypher queries. For example, for a predefined intent, the system extracts entities and fills them into the corresponding parameterized Cypher template, executes the query, and retrieves precise structured facts from the knowledge graph.

[0116] As a specific, non-restrictive example, for the intent of "medication instructions" and the entity "acute lung abscess," the Cypher template can be executed: MATCH (d:Disease {name: "Acute lung abscess"})-[:recommand_drug]->(drug:Drug)-[:drugs_of]->(producer:Producer) RETURN drug.name, COLLECT(producer.name) For example, path two, as a complex query channel, can implement a parallel scheme of LLM generation and vector RAG. For complex, fuzzy queries that cannot match the preset intent, the system can launch two sub-paths in parallel. Sub-path A can be called the LLM dynamic generation Cypher, which can send the user query and graph schema to the large model, dynamically generate and execute Cypher queries, and attempt to obtain direct answers.

[0117] Subpath B can be referred to as a high-precision vector (RAG), which can be constructed using vector indexes. For example, vector indexes can be created for key text attributes in graph databases such as Neo4j, including: Disease.desc (disease description), Disease.cause (cause), Drug.desc (drug description), Doctor.description (doctor's specialty), Treatment.desc (treatment description), etc.

[0118] High-precision retrieval is possible. For example, user queries can be vectorized and retrieved using Neo4j's native vector index, with a similarity threshold as high as 0.9, recalling only the most relevant text fragments. Furthermore, the entities associated with these fragments can be obtained through graph relationships.

[0119] As a specific, unrestricted example, a query example could be as follows: CALL db.index.vector.queryNodes('medical_rag_index', 5, $query_embedding) YIELD node, score Where score > 0.9 / / High threshold ensures accuracy RETURN node.desc AS content, score ORDER BY score DESC Next, the results can be fused. The structured answer from sub-path A can be fused with the highly relevant text fragments from sub-path B to form a comprehensive enhanced context.

[0120] According to this implementation, the following can be achieved: Multi-path collaboration: It provides a comprehensive solution capability from "exact matching" to "semantic search" to "dynamic reasoning", covering all types of queries without any blind spots; Balance between accuracy and generalization: The high-threshold RAG ensures the accuracy of the context, while the LLM dynamically generated Cypher provides powerful generalization capabilities; Unified architecture: All retrieval is completed within Neo4j, avoiding the complexity of maintaining multiple databases and ensuring data consistency.

[0121] It is understandable that although the paths and sub-paths have been distinguished above using terms such as "Path One," "Path Two," "Sub-Path A," and "Sub-Path B," this does not require the paths to have this specific order, and this disclosure is not limited to this. For example, for convenience, combining... Figure 2In the described method 200, the first path corresponds to "path two", and the second path corresponds to "path one", and subpaths A and B are described respectively by the first subpath and the second subpath. It is understood that the order of such "first" and "second" can be interchanged, and this disclosure is not limited thereto.

[0122] Return to reference Figure 3 Furthermore, large-scale model generation enhancements can be performed. This layer serves as the system's "expression and polishing center." High-quality, traceable enhanced context obtained through multi-path collaborative retrieval is input into the large language model along with the user's original query and a carefully crafted prompt. The large model plays the final role in information integration and language generation, producing a natural, fluent, accurate, reliable final answer with key sources clearly indicated.

[0123] The following are some exemplary application scenarios in which the methods of the embodiments of this disclosure can be applied.

[0124] As an example, the method according to embodiments of this disclosure can be applied to medical knowledge question-and-answer popularization application scenarios. Exemplarily, the system supports multiple scenarios in medical knowledge question-and-answer, ranging from simple queries to complex reasoning: Simple scenarios: Supports single-hop queries such as disease inquiry, symptom diagnosis, medication guidance, and dietary advice. For example, if a user queries "What is adult respiratory distress syndrome? How to prevent it?", the system directly returns attribute information such as disease description, etiology, and preventive measures.

[0125] Complex scenarios: Supports complex queries requiring multi-hop reasoning, such as comprehensive treatment pathway recommendations, drug indication expansion analysis, and common etiology exploration. For example: Comprehensive treatment pathway: "Give me a complete treatment plan suggestion for acute lung abscess"—the system integrates information from multiple dimensions such as examinations, drugs, treatments, and diet through multi-hop queries; Drug indication expansion: "Besides what's listed in the instructions, what other diseases with similar symptoms might xxxx eye drops be indirectly applicable to?"—the system discovers potential new indications through symptom bridging; Optimal consultation path discovery: "Starting from the symptom 'fatigue,' what steps are needed to quickly diagnose acute lung abscess?"—the system uses the shortestPath algorithm to find the shortest path between symptoms and diseases.

[0126] As an example, the method according to embodiments of this disclosure can be applied to personalized doctor recommendation applications. The system implements multi-level recommendations for doctors, from basic screening to intelligent matching: basic recommendations can support screening doctors by criteria such as hospital, department, and professional title, for example: "Find the chief physician of the respiratory department at xxxx hospital"; intelligent recommendations can be based on comprehensive recommendations of multi-dimensional factors, including but not limited to multi-symptom cross-reasoning, optimal doctor comprehensive recommendations, and a panoramic analysis of hospital-department strength.

[0127] Multisymptom cross-referencing can identify diseases that can simultaneously explain multiple symptoms input by the user, and recommend doctors who are skilled in treating these diseases.

[0128] Optimal doctor recommendations can be tailored to specific diseases by comprehensively considering multiple dimensions such as doctor's expertise, experience, ratings, and service efficiency, resulting in a weighted intelligent recommendation. For example: MATCH (doc:Doctor)-[:specializes_in]->(disease:Disease {name: "acute lung abscess"}) WITH doc, (5.0 + (doc.year_receive_cnt / 1000.0) + (doc.good_comment_rate * 2) - (doc.response_speed * 0.1)) AS recommendation_score RETURN doc.name, doc.title, recommendation_score ORDER BY recommendation_score DESC LIMIT 10 The hospital-department strength overview analysis can analyze the comprehensive strength of a specific department in a certain region, and evaluate it from multiple dimensions such as hospital level, number of doctors, and qualification composition.

[0129] Figures 4A-4C Some specific application scenarios demonstrating user intent are shown. For example, Figure 4A This document illustrates several question types, user intent summaries, and query examples, including but not limited to disease queries, symptom diagnoses, medication guidance, dietary advice, recommended examinations, complication queries, treatment plans, and department navigation. It also provides corresponding query examples. Figure 4B and Figure 4C Examples of other generalized question types and corresponding intent summaries and query statements are shown. For example... Figure 4B As shown, the types of questions include, but are not limited to, doctor search, disease treatment pathways, symptom diagnosis assistance, doctor qualification and service search, hospital department navigation, treatment method search, and doctor competency assessment. As another example, such as... Figure 4CAs shown, the question types can include, but are not limited to, multi-symptom cross-reasoning, optimal doctor comprehensive recommendation, panoramic analysis of hospital department strength, comparative analysis of treatment effectiveness, and doctor career path analysis. Upon receiving a corresponding query, the system can extract the corresponding user intent and match it with the appropriate template. As a specific, non-limiting example, when receiving a user's question, "What other diseases are patients with diabetes likely to suffer from simultaneously?", the user intent can be summarized as "exploring whether there are common symptoms or treatments between two diseases, thereby inferring their potential correlation or complication risk," and the question type can be determined as "disease complication association mining." It is understood that the above is merely an example, and this disclosure is not limited to this.

[0130] The following describes an exemplary data modeling approach. For example, entity extraction and relation extraction can be performed on existing standardized doctor data, hundreds of millions of pieces of popular science data, and standardized hospital data. As a specific, non-limiting example, Figures 5A-5B It illustrates 14 abstract entity types and 22 edge relationships, and Figure 5C An example of graph data is shown.

[0131] According to one or more embodiments of this disclosure, basic materials for constructing a medical knowledge graph can be obtained, and the processed data can be fed into a Hive database.

[0132] According to one or more embodiments of this disclosure, full database construction can be performed. Data in Hive can be read in batches through routine execution scheduling using the Spark big data processing framework, supporting rapid full database construction of the entire dataset. It supports database construction and import of tens of billions of data points per hour.

[0133] According to one or more embodiments of this disclosure, incremental database building can be performed. An engineering system [building a general medical science popularization and personalized doctor recommendation system based on AI large models and knowledge graphs] can be developed to monitor real-time data change events in the business, calculate data diffs in real time, and perform real-time database building and update operations if data diffs exist.

[0134] Figure 5D An exemplary diagram of the core system process components is shown. It is understood that... Figure 6 The system can be applied to the methods and systems described in various aspects of the embodiments of this disclosure, and will not be repeated here.

[0135] According to one or more embodiments of this disclosure, a dynamic Cypher query optimization mechanism is also provided. The Cypher query can be dynamically generated by the LLM in combination with the context. When the Cypher query generated by the LLM is empty or fails to execute, the system automatically degenerates into vector RAG retrieval.

[0136] According to one or more embodiments of this disclosure, a cypher check mechanism is also provided: supporting pre-checking of the syntax and security of cyphers generated by LLM, avoiding a heavy burden on the graph.

[0137] According to one or more embodiments of this disclosure, a processing flow is also provided when the Cypher generated by the LLM fails to execute. First, the execution error type is parsed, such as, but not limited to, syntax error, no results, and timeout. Next, a repair strategy can be selected based on the error type. For syntax errors, the Cypher syntax corrector can be invoked. For no results, query conditions can be relaxed or redirected to an approximate entity query. For timeouts, the query structure can be optimized, and restrictive conditions can be added. Additionally, failure modes can be logged for continuous optimization of subsequent Cypher generation models.

[0138] According to one or more embodiments of this disclosure, a multi-hop inference engine is also provided. As described above... Figure 2 As described in various embodiments, the Cypher generated by LLM is not merely a regular Cypher query, but a complete step-by-step solution path. For example, if the intent is to provide disease information, the relevant entities can be identified step-by-step and in multiple hops based on the following relationships: Symptoms → Disease → Disease Details → Treatment Plan → Prevention Measures. Similarly, if the intent is to provide doctor recommendations, the relevant entities can be identified step-by-step and in multiple hops based on the following relationships: Symptoms → Disease → Department → Doctor → Spatiotemporal Adaptation. For example, if the intent is to provide medication consultation, the relevant entities can be identified step-by-step and in multiple hops based on the following relationships: Symptoms → Disease → Drug → Dosage and Administration → Side Effects. For example, if the intent is to provide examination suggestions, the relevant entities can be identified step-by-step and in multiple hops based on the following relationships: Symptoms → Disease → Examination Items → Examination Significance → Precautions. Thus, the user's intent can be progressively transformed into a deeper answer based on their intent. It is understood that this step-by-step solution path can be parsed, translated, and executed by a multi-hop inference engine.

[0139] According to one or more embodiments of this disclosure, an intelligent routing decision and rejection mechanism is also provided. As described above... Figure 2 Various embodiments have been described, which can control the first model or the small model to simultaneously output the confidence level of the result while recognizing the intent and extracting the entity. At the same time, by configuring a confidence threshold, if the confidence level of the small model is low, the predicted list of intents is directly abandoned and a complex query path is taken to avoid misjudgment.

[0140] According to one or more embodiments of this disclosure, multi-force control of vector retrieval is also provided: not only is entity attribute vectorized, but also the relational path of the entity is vectorized (e.g., symptom-disease-department) to support more complex semantic retrieval.

[0141] According to one or more embodiments of this disclosure, during graph updates, not only are differences in data calculated, but the impact of changes in entity relationships on graph connectivity can also be identified, thereby triggering the recalculation of local knowledge.

[0142] According to one or more embodiments of this disclosure, the system can achieve an evolutionary pre-set intent list and a self-evolving model: the system collects and analyzes the results with low confidence scores output by the first model (e.g., a small model), collects online feedback data of user likes and dislikes, and simultaneously submits them to the second model (e.g., a large model) for initial screening, followed by manual screening, to produce high-quality training data for fine-tuning the small model and to produce an online missed intent list to fill in the gaps, thereby achieving a flywheel evolution of the model and intent list, and thus better adapting to new query distributions.

[0143] According to one or more embodiments of this disclosure, real-time data update capabilities can be achieved: the system can monitor real-time data change events in the business system (factual updates, such as new drug launches, doctor reviews, service quality score improvements, entity classification changes, disease classification system updates, and relationship weight updates), calculate data discrepancies (Diff), and then incrementally update the knowledge graph. This ensures the real-time nature of the knowledge graph, which is particularly important in the medical field.

[0144] According to one or more embodiments of this disclosure, the interpretability of the system can be achieved: by using prompt engineering control, a reasoning path is provided while generating the answer, for example, showing which entities and relationships in the knowledge graph are used, as well as relevant text fragments retrieved by vector retrieval. This can increase user trust in the system. Confidence can be broken down into: entity recognition confidence, knowledge graph query confidence, vector retrieval relevance confidence, LLM generation reasonableness confidence, etc.

[0145] According to one or more embodiments of this disclosure, system performance optimization can be achieved by introducing a caching mechanism to cache common queries and results, thereby speeding up the overall response time.

[0146] According to one or more embodiments of this disclosure, a leap in answer reliability and user experience can be achieved: multi-path retrieval ensures the accuracy of the information source, high-threshold RAG filters noise, making the answer reliability far exceed that of pure large model solutions; intelligent routing ensures millisecond-level response for simple queries and in-depth solutions for complex queries.

[0147] According to one or more embodiments of this disclosure, a revolutionary improvement in system efficiency and cost control can be achieved: small models undertake most of the offloading work, greatly reducing the dependence on large models and waiting time, making high-concurrency, low-cost online medical AI services a reality.

[0148] According to one or more embodiments of this disclosure, scalability can be achieved: the "multi-path collaboration" architecture is complex and has a high barrier to imitation; based on pre-defined intents and Neo4j's unified storage, the system can be smoothly expanded through configuration, making it easy to maintain and iterate.

[0149] According to one or more embodiments of this disclosure, a medical multi-path collaborative question-answering method based on a hybrid AI model and adaptive control mechanism can also be provided, including the following steps: receiving a user's query text, inputting it into a pre-trained single lightweight model, and simultaneously outputting intent labels, entity sets, and intent confidence during a single inference process; performing adaptive routing decisions based on the intent confidence: when the intent confidence meets a preset high confidence condition and the intent belongs to a preset list, entering the precise query channel, filling a preset graph query template with the entity set, and executing; when the intent confidence does not meet the high confidence condition or the intent does not belong to the preset list, entering the complex query channel; the complex query... The execution process of the query channel includes: dynamically generating graph query statements using a large language model based on the query text and graph schema information; performing availability verification and exception handling procedures on the dynamically generated graph query statements: performing syntax security verification before execution, triggering a repair strategy when execution fails or yields no results, and triggering a degradation mechanism if the repair is ineffective, transferring the query request to the vector retrieval logic; performing vector retrieval in parallel or based on the degradation mechanism, retrieving highly relevant text fragments from the vector index of the medical knowledge graph; and fusing the execution results of the precise query channel or the graph database query results from the complex query channel with the vector retrieval results to construct an enhanced context, which is then input into the large language model to generate the final response.

[0150] According to one or more embodiments of this disclosure, the availability verification and exception handling process specifically includes: a pre-verification stage: detecting whether the generated graph query statement has syntax errors or insecure operation instructions; an execution feedback stage: identifying the error type based on the return status of the execution result, the error type including syntax errors, empty result return, and execution timeout; a strategy repair stage: rewriting the query by calling the syntax corrector for syntax errors, relaxing query constraints for empty result return, and optimizing the query path depth for execution timeout; and a fallback stage: when the strategy repair stage still cannot obtain a valid result, automatically abandoning the graph database query and only using the result of the vector retrieval as the context source.

[0151] According to one or more embodiments of this disclosure, the single lightweight model is an end-to-end model fine-tuned with knowledge from the medical vertical domain; the synchronous output may include: within the same inference time step, the model extracts semantic features through a shared encoding layer and predicts the intent classification probability distribution and entity sequence labeling results through different output heads, wherein the intent confidence is determined based on the maximum value of the intent classification probability distribution.

[0152] According to one or more embodiments of this disclosure, the step of dynamically generating graph query statements further includes an intent-based topology path guidance mechanism: pre-defining multi-hop inference topology chains corresponding to different medical intents; identifying the intent type of the current query request and calling the corresponding multi-hop inference topology chain as prompt information input to the large language model; the large language model generates graph query statements containing multi-level node jump relationships based on the multi-hop inference topology chain; the multi-hop inference topology chain includes at least: a path from symptoms to disease to treatment plan, or a path from symptoms to disease to department to doctor.

[0153] According to one or more embodiments of this disclosure, in the vector retrieval step, the vector index of the medical knowledge graph includes: a node attribute index: storing the text attributes of entity nodes in the graph in a vectorized manner; a relation path index: storing the structured path triples of "entity-relationship-entity" in the graph in a semantic vectorized manner; the vector retrieval may include: calculating the similarity between the query request vector and the node attribute index and the relation path index, and filtering low-relevance results using a preset similarity threshold.

[0154] According to one or more embodiments of this disclosure, the knowledge graph update step based on connectivity impact analysis is further included: monitoring source data change events in the medical business system; calculating the difference between the source data change content and the existing data in the graph database; analyzing the impact of the difference on the connectivity of local subgraphs of the graph; and based on the impact analysis results, incrementally updating or partially reconstructing the affected entity nodes, relation edges, and associated vector indexes.

[0155] According to one or more embodiments of this disclosure, the model also includes a self-evolution step: collecting query requests with intent confidence lower than the high confidence condition, and question-and-answer records with negative user feedback, to construct a long-tailed difficult example set; using a large language model to perform pseudo-labeling of intent and entity on the long-tailed difficult example set, and adding it to the training set after manual verification; and using the updated training set to iteratively fine-tune the lightweight model.

[0156] According to one or more embodiments of this disclosure, a medical multi-path collaborative question-answering system based on a hybrid AI model and adaptive control mechanism can also be provided, including: an intelligent routing module configured with a single lightweight model for receiving user queries and outputting intent, entity, and confidence scores in a single inference, and controlling the query flow path based on the scores; a self-healing graph query engine for dynamically generating graph query statements in complex query channels and performing syntax validation, error correction, and failure degradation logic; a structured vector retrieval engine for performing vector retrieval containing node attributes and relationship paths, and serving as a fallback or supplement to the self-healing graph query engine; and a large model generation module for receiving the fused context and generating responses.

[0157] Now for reference Figure 6 This invention describes an apparatus 600 for medical question answering according to embodiments of the present disclosure. The apparatus 600 may include a first obtaining unit 601, a determining unit 602, and a response text obtaining unit 603. The first obtaining unit 601 may be configured to obtain an intent tag and an intent confidence score based on query text from a user, using a first large language model. The determining unit 602 may be configured to, in response to determining that the intent tag does not match an intent in the intent list or that the intent confidence score does not meet a confidence threshold, perform a first query process to obtain a query result, wherein the first query process includes: performing vector retrieval based on the query text to obtain a first subquery result; generating a graph query statement based on the query text using a second large language model; and obtaining the query result at least based on the first subquery result, including performing one of the following: in response to determining that the graph query statement can successfully query the graph database, fusing the second subquery result obtained based on the graph query statement with the first subquery result to obtain the query result; or in response to determining that the generated graph query statement cannot successfully query the graph database, using the first subquery result as the query result. The response text obtaining unit 603 can be used to obtain response text for the query text based on the query results.

[0158] The collection, acquisition, storage, use, processing, transmission, provision, and public application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0159] According to embodiments of this disclosure, an electronic device, a readable storage medium, and a computer program product are also provided.

[0160] refer to Figure 7The present invention describes a structural block diagram of an electronic device 700 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device 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. The electronic device 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 present disclosure described and / or claimed herein.

[0161] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of the electronic device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0162] Multiple components in electronic device 700 are connected to I / O interface 705, including: input unit 706, output unit 707, storage unit 708, and communication unit 709. Input unit 706 can be any type of device capable of inputting information to electronic device 700. Input unit 706 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device, and may include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 707 can be any type of device capable of presenting information, and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 708 may include, but is not limited to, disk and optical disk. Communication unit 709 allows electronic device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.

[0163] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as method 200 and its variations. For example, in some embodiments, method 200 and its variations may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of method 200 and its variations described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to execute method 200 and its variants by any other suitable means (e.g., by means of firmware).

[0164] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0165] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0166] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0167] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0168] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0169] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0170] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0171] While embodiments or examples of this disclosure have been described with reference to the accompanying drawings, it should be understood that the methods, systems, and devices described above are merely exemplary embodiments or examples, and the scope of the invention is not limited by these embodiments or examples, but only by the granted claims and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. Furthermore, the steps may be performed in a different order than that described in this disclosure. Further, various elements in the embodiments or examples may be combined in various ways. Importantly, as the technology evolves, many elements described herein can be replaced by equivalents that appear after this disclosure.

Claims

1. A method for medical question answering, comprising: Based on the query text from the user, the intent label and intent confidence are obtained through the first major language model; In response to determining that the intent tag does not match an intent in the intent list or that the intent confidence does not meet a confidence threshold, a first query process is executed to obtain query results; as well as Based on the query results, a response text is obtained for the query text. The first query process includes: Based on the query text, a vector retrieval is performed to obtain the first subquery result; Based on the query text, a graph query statement is generated using the second largest language model; and Obtaining the query result based at least on the first subquery result includes performing one of the following: in response to determining that the graph query statement can successfully query the medical knowledge graph database, fusing the second subquery result obtained based on the graph query statement with the first subquery result to obtain the query result; or in response to determining that the generated graph query statement cannot successfully query the graph database, using the first subquery result as the query result.

2. The method according to claim 1, wherein, The first large language model is a lightweight large language model compared to the second large language model.

3. The method according to claim 1 or 2, further comprising obtaining a set of medical entities based on the query text using the first large language model, and the method further comprising: In response to determining that the intent tag matches an intent in the intent list and that the intent confidence level meets a confidence threshold, a second query process is executed to obtain query results. The second query process includes: querying the graph database based on a query template corresponding to the matched intent and the set of medical entities to obtain the query results.

4. The method according to claim 3, wherein, The first large language model is configured to simultaneously predict the intent label and the set of medical entities through different output layers during a single inference process, and calculate the intent confidence based on the probability distribution of intent classification.

5. The method according to any one of claims 1-4, wherein, The intent list includes at least one of the following: disease inquiry, symptom diagnosis, medication guidance, dietary advice, department navigation, and doctor recommendation.

6. The method according to any one of claims 1-5, wherein, The first subquery result obtained by performing vector retrieval based on the query text includes: Obtain a hybrid vector index constructed for the graph database, the hybrid vector index comprising: node attribute vectors generated based on the unstructured text attributes of entity nodes in the graph database, and relationship path vectors generated based on the semantic description of the relationship paths between entities in the graph database; and The first subquery result is obtained by performing similarity matching between the query vector obtained based on the query text and the hybrid vector index.

7. The method according to claim 6, wherein, Performing similarity matching between the query vector obtained based on the query text and the hybrid vector index includes: Calculate the semantic similarity between the query vector and each vector in the hybrid vector index to obtain a target vector whose similarity meets a similarity threshold; and The text fragments and graph entities corresponding to the target vector are determined as the first sub-query results.

8. The method according to any one of claims 1-7, wherein, Determining that the graph query statement can successfully query the graph database includes: determining that the graph query statement satisfies the syntax security check and is successfully executed in the graph database to obtain the second subquery result.

9. The method according to any one of claims 1-8, further comprising performing a repair operation in response to determining that the graph query statement does not satisfy the syntax security check to obtain a repaired graph query statement, and determining that the generated graph query statement cannot successfully query the graph database includes determining that the repaired graph query statement still cannot successfully query the graph database.

10. The method according to claim 9, wherein, The repair operation includes: identifying the anomaly type of the graph query statement; and performing the corresponding repair operation based on the anomaly type.

11. The method according to claim 10, wherein, The identified anomaly types include syntax errors, and the corresponding remediation operations include rewriting the query statement by invoking a syntax correction model.

12. The method according to claim 10 or 11, wherein, The identified anomaly types include empty query results, and the corresponding remedial actions include removing non-critical constraints from the query statement to broaden the query scope.

13. The method according to any one of claims 10-12, wherein, The identified exception types include execution timeouts, and the corresponding remedial actions include optimizing the path depth of the query statement or adding quantity limits.

14. The method according to claim 1, wherein, Based on the query text, the second largest language model is used to generate graph query statements, including: Identify the medical scenario intent corresponding to the query text; Obtain a predefined multi-hop inference topology chain corresponding to the medical scenario intent, wherein the multi-hop inference topology chain describes the hierarchical jump relationship between entity nodes; The multi-hop inference topology chain is input as a prompt to the large language model, guiding the large language model to generate a graph query statement that follows the jump relationship.

15. The method according to claim 14, wherein, The multi-hop inference topology chain includes at least one of the following: a path from symptoms to disease to treatment plan, a path from symptoms to disease to department to doctor, or a path from symptoms to disease to drug to side effects.

16. The method according to any one of claims 1-15, wherein, Obtaining a response text based on the query results includes: obtaining the response text using the second or third language model based on the query results.

17. A device for medical question answering, comprising: The first acquisition unit is used to obtain intent labels and intent confidence based on the query text from the user and through the first major language model; A determining unit is configured to, in response to determining that the intent tag does not match an intent in the intent list or that the intent confidence does not meet a confidence threshold, execute a first query process to obtain a query result, wherein the first query process includes: performing vector retrieval based on the query text to obtain a first subquery result; generating a graph query statement based on the query text using a second language model; and obtaining the query result based at least on the first subquery result, including performing one of the following: in response to determining that the graph query statement can successfully query the graph database, fusing the second subquery result obtained based on the graph query statement with the first subquery result to obtain the query result; or in response to determining that the generated graph query statement cannot successfully query the graph database, using the first subquery result as the query result; The response text obtaining unit is used to obtain response text for the query text based on the query results.

18. An electronic device, comprising: At least one processor; as well as A memory that is communicatively connected to the at least one processor; in The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-16.

19. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-16.

20. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the method of any one of claims 1-16.

Citation Information

Cited By

  • Workflow construction method and device fusing thinking chain and execution sandbox self-verification

    CN122388009A