Medical Question Answering System

The two-stage search process with neural networks and hallucination detection enhances the accuracy and efficiency of medical question-answering systems, providing reliable and timely answers while reducing resource consumption.

JP7862623B2Active Publication Date: 2026-05-19OPEN EVIDENCE INC
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
OPEN EVIDENCE INC
Filing Date
2025-02-18
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing medical question-answering systems often generate inaccurate or misleading answers due to hallucinations and lack of timely, reliable information, and they consume excessive computational resources when searching vast medical databases.

Method used

A two-stage search process involving an embedded model neural network for initial filtering and a ranking neural network for fine-grained ranking, combined with a hallucination detection mechanism, to retrieve and generate accurate answers from a medical database, using a generative neural network.

Benefits of technology

The system provides scientifically reliable and timely answers with reduced computational resources, minimizing hallucinations and improving user interface clarity by distinguishing between guideline-based and non-guideline-based responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007862623000001
    Figure 0007862623000001
  • Figure 0007862623000002
    Figure 0007862623000002
  • Figure 0007862623000003
    Figure 0007862623000003
Patent Text Reader

Abstract

To provide a method, system, and apparatus, including a computer program encoded on a computer storage medium, for generating answers to medical questions using neural networks and other components. [Solution] In one embodiment, the method includes the steps of: receiving a query for medical information from a user via a user interface presented to the user on the display of the user device; generating a plurality of responses to the query from the user by automatically retrieving and analyzing data from a document corpus; and presenting, via the user interface, a first user interface element on the display of the user device that presents a first response generated solely based on clinical practice guideline documents, and a second user interface element that presents a second response generated at least partially based on documents other than clinical practice guideline documents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Cross - reference to Related Applications This application claims priority to U.S. Provisional Application No. 63 / 695,309, filed on September 16, 2024; U.S. Patent Application No. 18 / 975,621, filed on December 10, 2024; and U.S. Patent Application No. 18 / 975,915, filed on December 10, 2024. The disclosure of each of the prior applications is considered to be part of the disclosure of this application and is incorporated herein by reference.

[0002] This specification relates to question - answering (QA). Question - answering is, in many cases, in the field of computer technology that attempts to automatically provide answers to questions entered by humans in a natural - language format.

Background Art

[0003] For example, in response to the input question "What is POTS?", a medical question - answering system may use one or more machine - learning models to process the input question and, optionally, other text data, and output an answer that begins with "Postural Orthostatic Tachycardia Syndrome (POTS) is a chronic disorder of the autonomic nervous system characterized by orthostatic intolerance and an excessive increase in heart rate upon standing."

[0004] A machine - learning model receives an input and generates an output, for example, a predicted output, based on the received input. Some machine - learning models are parametric models and generate an output based on the received input and the values of the model's parameters.

[0005] Some machine learning models are deep models that use multiple layers of the model to produce an output based on the input they receive. For example, a deep neural network is a deep machine learning model that includes an output layer and one or more hidden layers, each applying a nonlinear transformation to the inputs it receives in order to produce an output. [Prior art documents] [Non-patent literature]

[0006] [Non-Patent Document 1] Anil, Rohan et al., “Palm 2 technical report”, arXiv preprint arXiv:2305.10403 [Non-Patent Document 2] Touvron, Hugo et al., “Llama 2: Open foundation and fine-tuned chat models,” arXiv preprint arXiv:2307.09288 (2023) [Non-Patent Document 3] Jiang, Albert Q. et al., “Mistral 7B”, arXiv preprint arXiv:2310.06825 (2023) [Non-Patent Document 4] Devlin, Jacob, “Bert: Pre-training of deep bidirectional transformers for language understanding,” arXiv preprint arXiv:1810.04805 (2018) [Non-Patent Document 5] Chen, T., Kornblith, S., Norouzi, M., Hinton, G. (2020), "A Simple Framework for Contrastive Learning of Visual Representations", Proceedings of the 37th International Conference on Machine Learning (ICML) [Non-Patent Document 6] Hadsell, R., Chopra, S., and LeCun, Y. (2006), “Dimensionality Reduction by Learning an Invariant Mapping”, Proceedings of the 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR). [Overview of the Initiative] [Problems that the invention aims to solve]

[0007] This specification describes a medical question answering system implemented as a computer program on one or more computers in one or more locations, which receives a medical question and generates an answer to the medical question using a neural network and other components of the system. [Means for solving the problem]

[0008] To generate an answer, the medical question answering system searches a medical database that stores medical documents and retrieves a set of document snippets relevant to the medical question from the medical database. Then, the medical question answering system incorporates the set of relevant document snippets into a prompt before processing the prompt using a generative neural network to generate an answer to the medical question.

[0009] In some embodiments, a method is provided which is performed by one or more computers, comprising the steps of: obtaining question data representing a medical question; obtaining a plurality of document snippets from a medical database storing medical documents, wherein the method is to perform a search within the medical database for document snippets related to the medical question using (i) the respective embeddings of each of the plurality of document snippets and (ii) the embedding of the medical question; determining a relevance score for each of the plurality of document snippets using a ranking neural network based on the document snippet and the medical question; selecting a subset of the plurality of document snippets at least in part on the relevance score; generating a prompt including (i) the medical question and (ii) the subset of the plurality of document snippets; and generating an answer to the medical question based on processing the prompt using a generative neural network.

[0010] For each document snippet among multiple document snippets, the step of determining the relevance score of the document snippet may include the steps of processing an input, which includes (i) a medical question and (ii) a document snippet, by a ranking neural network to generate a score for each of several different levels of relevance, wherein for each level of relevance, the score indicates the probability that the relevance between the medical question and the document snippet is at that level of relevance; and determining the relevance score of the document snippet based on the respective scores for each of the multiple levels of relevance.

[0011] The step of determining the relevance score of a document snippet may include the step of determining a linear combination of the respective scores.

[0012] The step of selecting a subset of multiple document snippets based at least in part on relevance scores may include the steps of selecting the highest-scoring document snippet with the highest relevance score from the multiple document snippets as an initial subset of the multiple document snippets; assigning a weight to each of the multiple aspects for that aspect to each document snippet in the initial subset of the multiple document snippets; and selecting one or more document snippets from the document snippets in the initial subset of the multiple document snippets based on the respective weights assigned to each document snippet.

[0013] Multiple aspects may include one or more of the following: the timeliness of the medical document, including document snippets; the quality of the provider of the medical document; or the relevance between the user who submitted the medical question and the author of the medical document.

[0014] The step of selecting a subset of multiple document snippets based at least in part on relevance scores may include the steps of combining one or more document snippets selected for each of several aspects to generate a combined set of document snippets, and applying semantic filtering, deduplication, or both to the combined set of document snippets to generate a subset of multiple document snippets.

[0015] A prompt may include (iii) metadata associated with each document snippet in a subset of multiple document snippets, or (iv) one or both of the prescribed instructions.

[0016] Answers to medical questions may include (i) responses generated by a generative neural network from processing prompts, (ii) a list of medical document citations including a subset of multiple document snippets, and (iii) data identifying the rationale for which the medical documents are cited.

[0017] The reason is that, for each document snippet within a subset of a plurality of document snippets, it may include one or more of an explanation of similarity, an explanation of impact, or an explanation of currency.

[0018] The step of generating an answer to a medical question includes at least processing the answer using a hallucination detection neural network to determine (i) whether there is any contradiction between (a) the answer generated by the generation neural network from processing the prompt and (b) a subset of a plurality of document snippets, (ii) whether at least one document snippet within the subset of the plurality of document snippets supports the response generated by the generation neural network from processing the prompt, or generating one or more hallucination detection outputs indicating both (i) and (ii).

[0019] The method may further include the step of determining that there is a contradiction and, in response thereto, modifying the response generated by the generation neural network to generate a modified response.

[0020] The step of obtaining question data representing a medical question includes the step of receiving an initial user input and preprocessing the initial user input to generate a medical question, where the medical question is (i) in a predetermined natural language, (ii) has a question format, (iii) expands all acronyms or abbreviations within the initial input, and (iv) replaces all brand names within the initial input with common names.

[0021] The ranking neural network may be trained based on optimizing a supervised learning objective function with a ranking training dataset including a plurality of ranking training pairs, where each ranking training pair includes (i) a medical question and a document snippet and (ii) is associated with a ground truth score for each of a plurality of different levels of relevance.

[0022] The step of obtaining a plurality of document snippets may include, for each document snippet, the step of determining the distance between (i) each embedding of the document snippet and (ii) the embedding of the medical question, and the step of selecting the document snippet as one of the plurality of document snippets based on the distance.

[0023] For each of the plurality of document snippets, each embedding may be generated by an embedding model from processing the document snippet.

[0024] The embedding model may be trained based on optimizing a contrastive learning objective function on an embedding training dataset including a plurality of embedding training pairs, each embedding training pair including a medical question and a document snippet.

[0025] For each embedding training pair, the document snippet may be extracted from the original medical document, and the medical question may be generated by a language model neural network based on processing the document snippet.

[0026] Two or more of the plurality of embedding training pairs may include the same document snippet, and the contrastive learning objective function may include a term that penalizes the embedding model for generating different respective embeddings of the medical questions included in those two or more of the plurality of embedding training pairs.

[0027] In another embodiment, a method performed by one or more computers, comprising the steps of: receiving a query for medical information from a user via a user interface presented to the user on the display of a user device; generating a response to the query from the user by automatically searching and analyzing data from a document corpus, wherein, based on the automatic search of the document corpus, one or more clinical practice guideline documents from the document corpus contain information that responds to the query; and, in response to the determination that one or more clinical practice guideline documents contain information that responds to the query, generating a first response to the query based solely on the clinical practice guideline documents; and clinical practice guidelines A method is provided which includes the step of generating a second response to a query based at least partially on one or more other documents that are not documents, and the step of presenting a first user interface element on the display of a user device via a user interface, the first user interface element presenting a first response generated based solely on clinical practice guideline documents, the first user interface element visually highlighting that the first response originates solely from clinical practice guideline documents and identifying one or more clinical practice guideline documents processed to generate the first response, and a second user interface element presenting a second response generated based at least partially on documents that are not clinical practice guideline documents.

[0028] The first user interface element may be presented above the second user interface element within the user interface, but temporally before the second user interface element.

[0029] The first user interface element may include a walled garden environment presented within the user interface, and the first response, which may be generated solely based on clinical practice guideline documents, is presented within the walled garden environment.

[0030] The first user interface element may include a heading indicating that the first response is generated solely based on clinical practice guideline documents.

[0031] The step of generating a first response to a query based solely on clinical practice guideline documents may include the step of making a first call to the generative neural network, and the step of generating a second response to a query based at least partially on one or more other documents that are not clinical practice guideline documents may include the step of making a second call to the generative neural network after the generative neural network has generated a first response in response to the first call.

[0032] The step of generating a first response to a query based solely on clinical practice guideline documents may include the step of using a generative neural network to process a first prompt, which includes (i) a query for medical information and (ii) a clinical practice guideline document, to generate a first response.

[0033] The step of generating a second response to a query based at least in part on one or more other documents that are not clinical practice guideline documents may include the step of generating a second response by processing a second prompt, which includes (i) a query for medical information, (ii) one or more other documents, and (iii) the first response generated by the generative neural network.

[0034] In another embodiment, one or more computer-readable storage media are provided, on which instructions are encoded causing one or more computers to perform the operations of the above-described method when executed by one or more computers.

[0035] In a further embodiment, a system is provided that includes one or more computers and one or more storage devices that store instructions causing one or more computers to perform each of the operations of the above-described method when executed by the one or more computers.

[0036] The subjects described herein may be implemented in specific embodiments to achieve one or more of the following advantages:

[0037] A vast amount of specialized knowledge is stored in the database, for example, in the form of medical documents describing clinical trials and articles from academic journals describing scientific and medical research. By performing the two-step process described herein to retrieve the most relevant and up-to-date information from the database in a computationally efficient and accurate manner, and then having the generative neural network generate answers in response to questions by utilizing the retrieved information (instead of simply older information that was available when the generative neural network was trained), the medical question-answering system can produce more accurate and timely answers.

[0038] Compared to existing question-answering systems, the medical question-answering systems described herein are far less likely to contain any hallucination as part of the answer, but are far more likely to produce answers that are scientifically reliable and factually accurate, for example, answers that are more likely to be based on external, verified medical databases or other knowledge repositories such as published articles, medical guidelines, or established reference materials that are kept up to date.

[0039] Medical question-answering systems are particularly advantageous in a wide range of real-world scenarios involving evidence-based clinical decision-making. For example, medical question-answering systems can generate answers that help clinicians in active settings (such as treatment rooms) respond quickly and efficiently to free-form questions related to a patient's past and future treatment, such as dosage, contraindications, side effects, drug interactions, condition symptoms, possible second and third-line treatments, and safety considerations.

[0040] From another perspective, medical question-answering systems function as an interface between the user and a large corpus of medical documents, otherwise the corpus would be too large to search in response to the questions a user might ask about medical documents. This interface makes it practical for users to leverage the information contained within an unmanageably large corpus of medical documents to search for a reliable set of information, and in particular, verifiable correct information.

[0041] The various techniques described herein enable medical question answering systems to achieve these advantages while reducing the consumption of computing resources. For example, by using a two-stage search process described herein, which includes a relatively low-computational first stage followed by a relatively high-computational second stage, medical question answering systems can generate answers while reducing the consumption of computing resources such as memory and computing power. In other words, the two-stage search process described herein makes it computationally feasible to search a large corpus of documents.

[0042] In particular, the first stage of the two-stage search process involves performing a rough filtering based on embeddings, which is relatively computationally intensive as it involves computing embeddings for medical questions and then measuring the similarity between medical question embeddings and multiple pre-calculated medical snippet embeddings that can be reused for different medical question embeddings. On the other hand, the second stage of the two-stage search process involves performing a fine-grained ranking using a ranking neural network, which is more computationally intensive as it requires processing each of multiple document snippets using a ranking neural network.

[0043] Another point is that many existing question-answering systems often generate answers that contain hallucinations. In contrast, the described hallucination detection technique increases the likelihood that answers generated by a medical question-answering system are scientifically reliable, factually accurate, and free of hallucinations by performing hallucination detection at various levels of content in the generated answers, such as sentence level and paragraph level, based on the content of medical documents stored in a medical database. Therefore, the medical question-answering systems described herein are suitable for deployment in production environments, such as within educational or medical organizations, where false or misleading information can have serious consequences.

[0044] Another aspect of the techniques described in relation to contrastive training is the increased computational resource efficiency when training an embedded model neural network used to facilitate a two-stage retrieval process. Unlike many typical contrastive training setups where an equal or nearly equal number of medical question embeddings and document snippet embeddings are required to be generated during training, this specification describes a training setup configured so that the embedded model neural network generates more medical question embeddings than document snippet embeddings. Since medical questions may be shorter than document snippets, generating medical question embeddings can save computational costs compared to generating document snippet embeddings, as less data needs to be processed by the embedded model neural network.

[0045] The savings in computational cost can be significant when only a relatively small number of document snippet embeddings need to be generated relative to the number of medical questions, for example, when generating one document snippet embedding for every three, five, or ten medical question embeddings, rather than generating one document snippet embedding for every single medical question embedding.

[0046] Another aspect is that the described technology related to the improved user interface can help users more clearly distinguish between answers generated solely based on clinical practice guideline documents and those that are not, thereby helping them gain insights that improve the efficiency of their review. The described technology also demonstrates improvements in user interface technology. By generating answers based on clinical practice guidelines, presenting those answers to the user with appropriate visual indications, and then, after presenting the answers to the user, generating alternative answers based on other medical documents to be presented to the user later with different visual indications, the described technology provides content that meets the user's information needs, reduces latency during presentation, and minimizes potential confusion regarding different answers to the same medical question generated based on different source documents.

[0047] Details of one or more embodiments of the subject matter of this specification are described in the accompanying drawings and the following description. Other features, aspects, and advantages of the subject matter will become apparent from the description, drawings, and claims. [Brief explanation of the drawing]

[0048] [Figure 1] This is a diagram illustrating an exemplary medical question-answering system. [Figure 2] This is an example diagram of a medical database. [Figure 3] This is a diagram illustrating exemplary actions performed by the planner. [Figure 4] This is an illustrative process flowchart for generating answers to medical questions. [Figure 5] This is a flowchart of a substep of one of the steps in the process shown in Figure 4 for determining the relevance score of a document snippet. [Figure 6] This is a flowchart of a substep of another step in the process shown in Figure 4, for selecting the appropriate subset of multiple document snippets. [Figure 7]This is an illustrative process flowchart for generating responses to user queries. [Figure 8] This is a diagram illustrating an example of a user interface. [Modes for carrying out the invention]

[0049] Similar reference numbers and reference indications in various drawings refer to the same elements.

[0050] Figure 1 shows an exemplary medical question answering system 100. The medical question answering system 100 is an example of a system implemented as a computer program on one or more computers in one or more locations that receives a medical question 102 and generates an answer 126 to the medical question using a neural network and other components of the system.

[0051] The medical question answering system 100 can obtain data representing the medical question 102 in one of several ways. In some cases, the data representing the medical question 102 is also called "question data." In some cases, the medical question 102 is also called a "query," "prompt," or "question."

[0052] In some cases, the question data may include text data, and the medical question answering system 100 receives the question data as text queries from the user sent through the user interface of the user device. For example, a medical question 102 may be entered by the user by typing using a data input device, such as a keyboard, touchscreen, wearable device (such as a smartwatch), smart home device (such as a smart speaker), or another handheld or desktop input device.

[0053] In some other cases, the question data includes audio data, and the medical question answering system 100 receives the question data from the user as a natural language speech query and converts the speech into a medical question 102 by applying a speech recognition engine to the speech. For example, the medical question 102 is received in the form of an audio (speech) signal captured by the microphone of the user's computer, and that audio (speech) signal is converted by a speech recognition engine, i.e., a speech-to-text converter, to form the medical question 102.

[0054] The medical question answering system 100 can access the medical database 150. The medical database 150 can be any database that stores a corpus of medical documents in the form of document snippets. That is, the medical database 150 stores multiple document snippets contained in the corpus of medical documents.

[0055] Medical documents are electronic documents containing medical-related content. Examples of medical documents include web pages, word processing documents, spreadsheets, presentation documents, and Portable Document Format (PDF) documents.

[0056] In practice, the medical database 150 may contain a vast number of medical documents, for example, at least 100,000 medical documents, or at least 1,000,000 medical documents, or at least 10,000,000 medical documents. Furthermore, the medical database 150 may change dynamically over time, for example, when new medical documents are added or medical documents are deleted (for example, when new clinical practice guidelines replace older ones, or when published papers are retracted).

[0057] A corpus of medical documents may include, for example, web pages and other electronic documents accessible via the internet. Additionally or alternatively, a corpus of medical documents may be part of the proprietary medical databases of, for example, scientific content publishers (e.g., physical science content publishers, life science content publishers, health science content publishers, or social science content publishers), technology content publishers, medical content publishers, or other organizations. Optionally, a corpus of medical documents may include clinical practice guideline documents.

[0058] Clinical practice guidelines are documents that contain information about clinical practice guidelines. Clinical practice guidelines are discourses that include recommendations intended to optimize patient care, characterized by a systematic review of evidence and an assessment of the benefits and harms of alternative care options. Clinical practice guidelines can be used, for example, to inform individual clinical decision-making, to provide recommendations for best practices for the treatment and care of people by healthcare professionals, to develop standards for guiding and evaluating the clinical practice of individual healthcare professionals and healthcare organizations, to assist in the education and training of healthcare professionals, and to help patients make informed decisions.

[0059] A "document snippet" contains at least a portion of the content of a complete electronic document. In some implementations, multiple document snippets can vary in length. For example, each document snippet may correspond to a paragraph, page, or chapter of the electronic document.

[0060] In some implementations, multiple document snippets can have approximately equal lengths. For example, each document snippet could have about 100, 300, or 500 words. Another example is that each document snippet could have about 100 subwords, 300 subwords, or 500 subwords. While some vocabulary words may have subwords corresponding to complete words, subwords are generally incomplete words. For example, the word "certainly" may contain the subwords "certain" and "ly".

[0061] In some implementations, the medical question answering system 100 or another database system can generate multiple document snippets by applying sliding window technology to each medical document in a corpus of medical documents to extract each possible sequence of a predetermined length of words or subwords from the medical document. The extracted sequences of words or subwords can then be stored as document snippets in the medical database 150.

[0062] Figure 2 shows an example of a medical database, number 150.

[0063] As shown, the medical database 150 may store document snippets contained in multiple guideline documents, such as clinical practice guideline documents or regulatory guideline documents, which contain information about guidelines, standards, and regulations. The medical database 150 may store document snippets contained in multiple clinical trial documents, which contain clinical information about different entities, such as disease entities, drug names, and treatment lines. The medical database 150 may store document snippets contained in medical label documents, such as drug label documents, which contain labels for formulations approved by the Food and Drug Administration (FDA) or other government agencies. The medical database 150 may store document snippets contained in multiple agency notice documents, such as copies of notices issued by the Centers for Disease Control and Prevention (CDC) or other government agencies. The medical database 150 may also store document snippets contained in multiple clinical research documents, such as scientific or clinical research publications.

[0064] Upon receiving a medical question 102, the medical question answering system 100 uses a planner 110 to organize the actions to be performed by the neural network and other components of the system when generating an answer 126 in response to the medical question 102.

[0065] Figure 3 is a diagram illustrating an exemplary operation performed by the planner 110.

[0066] In some implementations, the medical question answering system 100 may include or have access to multiple candidate generative neural networks, and the planner 110 may act as a module selector. The module selector may select one of the multiple candidate generative neural networks as the generative neural network 120 for generating the answer 126 in response to the medical question 102. The module selector may use any preferred method to select from the multiple candidate generative neural networks.

[0067] For example, a module selector could make this selection based on a medical question, such as its length, the time it takes to receive the question, or another aspect. Alternatively, a module selector could make this selection based on the availability or utilization rate of multiple candidate-generating neural networks.

[0068] As another example, the module selector can make this selection based on the availability of computing resources (e.g., processing power, memory and other storage, bandwidth, etc.) of the medical question answering system 100—for example, by selecting a candidate generative neural network with a larger memory footprint and higher processing power consumption requirements when a larger amount of computing resources is available, and conversely, by selecting a candidate generative neural network with a smaller memory footprint and lower processing power consumption requirements when only a reduced amount of computing resources is available.

[0069] Generally, candidate generative neural networks with more parameters or, for example, more complex architectures including more layers, have a larger memory footprint and higher processing power consumption than other candidate generative neural networks with fewer model parameters or, for example, less complex architectures including fewer layers.

[0070] The availability of computing resources can vary based on the total number of medical questions received simultaneously, the geographical region from which the medical questions were received, or other factors. As a specific example, a module selector might select a lightweight candidate generative neural network when a threshold number of medical questions are received within a given timeframe, or it might select a lightweight generative neural network for medical questions received from users located in geographical regions further than a threshold distance from the medical question answering system 100.

[0071] In some implementations, the planner 110 can act as a gatekeeper. The gatekeeper ensures that the medical question answering system 100 does not waste computing resources responding to irrelevant queries that the system may receive from various users.

[0072] To that end, the gatekeeper can analyze the question data sent to system 100 to determine whether the question data contains medical questions, that is, whether the questions sent by the user are about medical topics. For example, the gatekeeper can process the question data using a generative neural network 120 or some other text classification machine learning model to generate a classification output that indicates whether the questions represented by the question data are medical questions.

[0073] If the gatekeeper determines that a question does not contain a medical question, the gatekeeper may reject the question—for example, the gatekeeper may provide the user with a predetermined response without further processing the question data using other components of system 100. For example, the gatekeeper may reject the question "What is 2 + 2?" by providing a predetermined response "That question is outside the scope of the medical question answering system."

[0074] The gatekeeper can also convert the medical questions submitted by the user, which may be in their initial format (such as free text format), into an improved format more suitable for further processing by other components of system 100.

[0075] In some implementations, the gatekeeper can remove errors such as typos or grammatical errors from the initial medical question. In some implementations, the gatekeeper can expand acronyms, abbreviations, and other contractions contained in the initial medical question. In some implementations, the gatekeeper can replace certain words or phrases contained in the initial medical question with more precise medical terminology. For example, the gatekeeper can transform the initial medical question "How does the keto diet affect diabetes?" into the improved medical question "How does the ketogenic diet affect type 2 diabetes?".

[0076] In some implementations, upon receiving an initial medical question, the gatekeeper may preprocess the initial medical question to generate a predetermined improved medical question. Specifically, the predetermined improved medical question is (i) in a predetermined natural language, (ii) has a question format, (iii) expands all acronyms or abbreviations that may be included in the initial medical question, and (iv) replaces all brand names that may be included in the initial medical question with common names.

[0077] For example, the gatekeeper can do this by transforming a medical question from its initial form to a predetermined improved form, based on the use of a predetermined transformation template. Alternatively, the gatekeeper can do this by using the generative neural network 120 or another neural network—for example, by using the generative neural network 120 to process an input containing a medical question in its initial form and data defining a predetermined improved form, thereby generating an output containing a medical question in a predetermined improved form.

[0078] In some implementations, planner 110 can act as a translator, for example, an omni translator that translates different source natural language texts into a common target natural language text. For example, the translator can translate a medical question, which is in the form of a sequence of words in the source natural language, into a medical question, which is in the form of a sequence of words in the target natural language. In this example, answer 126 could similarly be in the form of another sequence of words in the source natural language.

[0079] In some implementations, the medical question answering system 100 may include or have access to multiple external tools, and the planner 110 may act as a tool selector. The multiple external tools are separate from the generative neural network 120, and in some implementations, they are separate from the system 100, for example, remotely.

[0080] Generally, external tools can be any software function that can be queried by the medical question answering system 100, for example, through an application programming interface (API) call, in order to provide data in response to queries. Just a few examples of these external tools include calculator tools (such as drug dosage calculators) and calendar tools.

[0081] The tool selector can select one or more of several external tools to generate a response that can be incorporated into the answer 126 generated by the generative neural network 120 in response to the medical question 102. Similar to the module selector, the tool selector can use any preferred method to select among several external tools, for example, based on the medical question, the availability or utilization rate of the multiple external tools, etc.

[0082] In some implementations, planner 110 may function as an ontology incorporator. The ontology incorporator maps specific words or phrases of a medical question to nodes in an ontology graph, and the ontology graph is used to augment the search process performed by the search engine 130 by providing the search engine 130 with access to synonyms, sub-terms, or other terms. The ontology graph contains a set of nodes connected by edges. Nodes in the ontology graph may represent medical concepts such as drug names or medical conditions. Edges in the ontology graph may represent relationships between drugs, such as "~ is a precursor to ~", "~ is equivalent to ~", "~ is a type of ~", or other relationships.

[0083] In some implementations, the planner 110 can act as a question intent analyzer, which can augment the search process performed by the search engine 130. The question intent analyzer can use a generative neural network 120 or some other text classification model to determine the intent of a medical question, and then, based on that intent, determine which group of document snippets contained in the medical database 150 should be searched.

[0084] For example, a question intent analyzer might determine, in response to a determination that the intent of a medical question relates to the purpose of a clinical trial, that document snippets contained in clinical trial documents should be searched. Alternatively, in response to a determination that the intent of a medical question relates to the purpose of academic research, the question intent analyzer might determine that document snippets contained in academic journal articles should be searched.

[0085] Thus, since a comprehensive search of the entire medical database 150 can be avoided, the question intent analyzer can reduce the consumption of computational resources by the medical question answering system 100. In some implementations, the question intent analyzer may be implemented as a classification model, such as a classification neural network, configured to process medical questions and generate a classification output containing a score distribution across a set of possible categories of documents. Correspondingly, only documents from certain categories within the set that have scores that meet a threshold need to be searched. For example, the group of document snippets that need to be searched in response to a medical question based on the classification output may be less than 50%, or less than 10%, or less than 5% of the entire medical database.

[0086] In order to generate an answer 126 in response to medical question 102, the medical question answering system 100 searches the medical database 150 using the search engine 130 to obtain a smaller subset of document snippets related to medical question 102 from the medical database 150, based on the medical question 102.

[0087] Then, the medical question answering system 100 incorporates a smaller subset of the document snippet into prompt 118 before using the generative neural network 120 to process prompt 118 and generate an answer 126 to medical question 102.

[0088] For example, the medical question answering system 100 can generate a prompt 118 containing a smaller subset of medical questions and document snippets, and then have the generative neural network 120 generate an answer 126 to the medical question 102 based on processing the prompt 118.

[0089] Optionally, prompt 118 also includes a predetermined set of system instructions. For example, a predetermined set of system instructions may be represented by some natural language text, such as text describing what may or may not be included in response 126. Optionally, prompt 118 also includes results received from one or more external tools, such as dosage amounts calculated by a drug dosage calculator tool. Optionally, prompt 118 further includes one or more historical medical questions received by system 100 and one or more answers generated by system 100 in response to the historical medical questions. Optionally, prompt 118 also includes metadata associated with each document snippet within a subset of document snippets. For example, the metadata may include the publication date of the medical document from which the document snippets within the subset are retrieved.

[0090] In this way, Answer 126 will incorporate information contained in a smaller subset of the document snippet, including up-to-date information that was not available during the training of the generative neural network, and / or proprietary information that is not publicly available and therefore may have been excluded from the training data used to train the generative neural network, and thus improve the quality of Answer 126, for example, its usefulness, factual accuracy, comprehensiveness, timeliness, or any combination thereof, in light of Medical Question 102.

[0091] The generative neural network 120 is or may contain a (large-scale) language model, which is trained to receive an input sequence consisting of tokens selected from a vocabulary and autoregressively generate an output sequence consisting of tokens from the vocabulary. For example, the input sequence may represent a prompt 118, while the output sequence may represent an answer 126 to a medical question 102.

[0092] A token vocabulary may include any of the various tokens that represent text symbols or other symbols. For example, a token vocabulary may include one or more letters, subwords, words, punctuation marks, numbers, or other symbols that appear in a corpus of natural language text.

[0093] For example, a language model may have one of several transformer-based neural network architectures, such as an encoder-only transformer architecture, an encoder-decoder transformer architecture, a decoder-only transformer architecture, or other attention-based architectures. Another example is that a language model may have one of several recurrent neural network architectures.

[0094] Exemplary implementations of such language models are described in detail in Anil, Rohan et al., "Palm 2 technical report," arXiv preprint arXiv:2305.10403, Touvron, Hugo et al., "Llama 2: Open foundation and fine-tuned chat models," arXiv preprint arXiv:2307.09288 (2023), and Jiang, Albert Q. et al., "Mistral 7B," arXiv preprint arXiv:2310.06825 (2023), but other implementations may also be used.

[0095] More specifically, the autoregressively generated output is created by generating each particular token in the output sequence, given the current input sequence which includes any tokens preceding any token in the output sequence that precedes a particular token in the text, i.e., tokens already generated for any previous position in the output sequence that precedes a particular position in the output sequence, and the tokens contained in prompt 118.

[0096] To generate a specific token at a specific position in the output sequence, the generative neural network 120 can process the current input sequence to generate a score distribution, such as a probability distribution, that assigns a score, such as a probability, to each token in the token vocabulary. The generative neural network 120 can then use the score distribution to select a token from the vocabulary as the specific token. For example, the neural network of the generative neural network 120 can greedily select the token with the highest score, or it can sample tokens from the distribution using, for example, nuclear sampling or another sampling technique.

[0097] In many scenarios, a medical database 150 can be a massive database storing a very large number of medical documents, and therefore, even more—for example, 10 million, 100 million, 1 billion, or more—and thus, even more document snippets. This vast number of document snippets that need to be retrieved in these scenarios presents a challenge to a system configured to computationally efficiently search the medical database and accurately select a smaller number of document snippets from the database that are relevant to a medical question.

[0098] To address these challenges, as will be further discussed below with reference to Figures 4-5, some implementations of the medical question answering system 100 use a search engine 130 to search for a smaller subset of document snippets by performing a search using a two-step process: an initial search step of searching for multiple document snippets from the document snippets stored in the medical database 150, and a subsequent reranking step of selecting an appropriate subset of document snippets from the multiple document snippets retrieved from the medical database 150 in the initial search step.

[0099] A “suitable subset” of multiple document snippets includes at least one, but fewer than all, of the multiple document snippets retrieved in the initial search step from the document snippets stored in the medical database 150.

[0100] The search engine 130 performs a two-stage process using multiple neural networks. The initial search step is performed using the embedded model neural network 134. Then, the re-ranking step is performed using the ranking neural network 136.

[0101] The embedded model neural network 134 (or simply "embedded model 134") may have any suitable neural network architecture that enables the embedded model 134 to process medical questions and generate medical question embeddings ("medical question embeddings") or to process document snippets and generate document embeddings ("document snippet embeddings").

[0102] An embedding is an ordered collection of numbers within an embedding space. For example, an embedding may contain one or more vectors of floating-point or other numbers having a fixed dimension. Medical question embeddings and document snippet embeddings generally have the same dimension; that is, medical question embeddings and each document snippet embedding have the same number of numbers.

[0103] For example, the embedding model 134 may include any number of any suitable neural network layers of any suitable type (e.g., 5, 10, or 20 layers) connected in any suitable configuration (e.g., as a linear sequence of layers) (e.g., fully connected layers, embedding layers, attention layers, etc.).

[0104] In some implementations, the embedding model 134 may be initialized using a base language model pre-trained using unsupervised learning. That is, the embedding model 134 may start with the same architecture and weights as a base language model (or at least part of it) trained on a corpus of texts to perform one or more language modeling tasks that do not require labeled training examples. For example, the embedding model 134 may be initialized using the base language model described in Devlin, Jacob, "Bert: Pre-training of deep bidirectional transformers for language understanding", arXiv preprint arXiv:1810.04805 (2018).

[0105] After initialization, the embedding model 134 can be fine-tuned on a custom embedding training dataset to learn fine-tuned weights based on optimizing the fine-tuned objective function. The custom embedding training dataset contains multiple embedding training pairs. Each embedding training pair contains a medical question and a document snippet.

[0106] Depending on the configuration, each embedding training pair can be a positive embedding training pair, where the document snippet contains information relevant to the answer to the medical question, or alternatively, a negative embedding training pair, where the document snippet contains information irrelevant to the answer to the medical question.

[0107] Such custom embedded training datasets can be automatically generated by system 100 or another training system based on available medical documents, for example, medical documents stored in a medical database 150. In some implementations, for each embedded training pair, the document snippet can be one of several document snippets extracted from the original medical document, and the medical question can be generated by a language model neural network based on processing the document snippet. For example, the language model neural network can be used to generate a medical question that can be at least partially answered (or not answered) by the document snippet by processing (i) the document snippet and (ii) a prompt containing some natural language text.

[0108] In some implementations, multiple medical questions can be generated using a language model neural network based on processing the same medical document, or even the same document snippet. Therefore, two or more of multiple embedding training pairs may contain the same document snippet.

[0109] Since medical questions may be shorter than document snippets, generating embeddings for medical questions can save computational costs compared to generating embeddings for document snippets, as less data needs to be processed by the embedding model 134. The computational cost savings during training can be significant, for example, in a training setup where embeddings for only a relatively small number of document snippets need to be generated relative to the number of medical questions, and the embedding model 134 is configured to generate multiple medical question embeddings for every document snippet.

[0110] In an implementation where multiple medical questions are generated in relation to a document snippet, these medical questions can be generated in such a way that one of the medical questions can be answered by the document snippet, while the others cannot. After generating the multiple medical questions, multiple embedding training pairs—including positive embedding training pairs and one or more negative embedding training pairs—can be generated.

[0111] In other words, positive embedding training pairs can be generated, each containing a document snippet and a medical question that can be answered by that document snippet. Alternatively, one or more negative embedding training pairs can be generated, each containing a document snippet and a medical question that cannot be answered by that document snippet.

[0112] In these implementations, the fine-tuning objective function can be a controlled learning objective function. The controlled learning objective function includes a term that prompts the embedding model 134 to generate similar embeddings (according to some measure of similarity) with respect to the medical questions and document snippets included in each positive embedding training pair.

[0113] For example, the similarity measure could be a measure of distance in the embedding space determined based on one of the following: Euclidean distance, Manhattan distance, or another measure of distance, and the term (when used to compute gradient-based updates for the parameters of the embedding model 134) can bring the embeddings generated by the embedding model 134 with respect to the medical questions and document snippets included in each positive embedding training pair closer together in the embedding space, i.e., shortening the distance between the medical question embedding and the document snippet embedding generated by the embedding model 134.

[0114] The controlled learning objective function also includes another term that prompts the embedding model 134 to generate different embeddings (according to some measure of similarity) with respect to the medical questions and document snippets included in each negative embedding training pair. In other words, for each negative embedding training pair, another term penalizes the embedding model 134 for generating similar embeddings (according to some measure of similarity) with respect to the medical questions and document snippets included in the negative embedding training pair.

[0115] For example, the measure of similarity can similarly be a measure of distance within the embedding space, and another term (when used to compute gradient-based updates for the parameters of the embedding model 134) can separate the embeddings generated by the embedding model 134 with respect to the medical questions and document snippets included in each negative embedding training pair within the embedding space, i.e., lengthen the distance between the medical question embedding and the document snippet embedding generated by the embedding model 134.

[0116] Examples of contrast loss functions that a system can use to train an embedded model are described in Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. (2020), "A Simple Framework for Contrastive Learning of Visual Representations," Proceedings of the 37th International Conference on Machine Learning (ICML), and Hadsell, R., Chopra, S., and LeCun, Y. (2006), "Dimensionality Reduction by Learning an Invariant Mapping," Proceedings of the 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR).

[0117] Generally, for some or all of the training pairs (i.e., each containing a medical question and a document snippet), the medical questions are shorter in length than the document snippets. For example, a medical question may be <50%, <10%, or <5% the length of a document snippet. In particular, a medical question may contain a sentence, or paragraph, or a series of paragraphs, while a document snippet may contain part or all of an entire document containing many paragraphs of text. Therefore, processing medical questions using an embedding model to generate embeddings for medical questions may consume significantly fewer computational resources (e.g., memory and computing power) than processing document snippets using an embedding model to generate embeddings for document snippets.

[0118] The system can leverage the asymmetry in the length of medical questions compared to document snippets to improve the efficiency of training the embedding model. Specifically, in each training iteration, the system can identify, for each of one or more document snippets, one "positive" medical question to which the document snippet responds, and N "negative" medical questions to which the document snippet does not respond, where N is any positive integer value, for example, N=3, or N=5, or N=10, or N=100. The system then processes the document snippet, the positive medical question, and the N medical questions using the embedding model (and according to the current values ​​of the set of embedding model parameters) to generate corresponding embeddings. The system then measures the distance between the embeddings and backpropagates the gradient of the contrasting loss objective function that depends on those embeddings through the embedding model (e.g., an embedding neural network). In this way, the system can dramatically reduce the consumption of computational resources compared to an implementation where, for each of one or more medical questions, the system identifies one "positive" document snippet that answers the medical question and N "negative" document snippets that do not answer the medical question.

[0119] The ranking neural network 136 is configured to process inputs including (i) a medical question and (ii) a document snippet to produce an output that includes a score for each of several different levels of relevance with respect to the document snippet. For each level of relevance, the score can be a probability score (e.g., between 0 and 1, including 0 and 1) indicating the probability that the relevance between the medical question and the document snippet has that level of relevance.

[0120] The ranking neural network 136 may have any suitable neural network architecture that enables the ranking neural network 136 to perform its described function. For example, the ranking neural network 136 may include any suitable number (e.g., 5, 10, or 20) of any suitable type of neural network layers (e.g., fully connected layers, activation layers, attention layers, etc.) connected in any suitable configuration (e.g., as a linear sequence of layers).

[0121] In some implementations, the ranked neural network 136 is initialized using a base language model pre-trained using unsupervised learning, and then fine-tuned with a custom dataset containing relevance-annotated question-document snippet pairs. For example, the ranked neural network 136 may be initialized using the base language model described in Touvron, Hugo et al., "Llama 2: Open foundation and fine-tuned chat models", arXiv preprint arXiv:2307.09288 (2023).

[0122] In other words, the ranking neural network 136 may start with the same architecture and weights as the basic language model (or at least part of it), which is trained on a corpus of texts to perform one or more language modeling tasks that do not require labeled training examples, and is subsequently trained on custom data to learn fine-tuned weights based on a fine-tuning objective function, e.g., optimizing a supervised learning objective function. For example, the custom data may include multiple ranking training pairs. Each ranking training pair includes (i) a medical question and a document snippet, and (ii) is associated with their respective ground truth scores at multiple different levels of relevance.

[0123] After performing a two-step process to search for a subset of document snippets, the medical question answering system 100 incorporates the subset of document snippets into prompt 118, and then causes the generative neural network 120 to generate an answer 126 to the medical question 102 based on processing prompt 118.

[0124] Therefore, the answer 126 to medical question 102 includes a token output sequence generated by a generative neural network 120 based on processing a prompt 118, which is represented as a token input sequence.

[0125] In some implementations, response 126 includes a list of medical document citations from which a subset of multiple document snippets is retrieved. In some implementations, response 126 includes data that identifies the rationale for which the medical documents are cited. For example, the rationale may include, for each document snippet within the subset of document snippets, one or more of the following: a description of similarity, a description of impact, or a description of timeliness.

[0126] For example, in response to the medical question "What are the health risks associated with GLP-1 receptor agonists such as Ozempic and Manjaro?", the medical question answering system 100 may generate an answer that includes the following: Glucagon-like peptide-1 receptor agonists (GLP-1 RAs), such as semaglutide (Ozempic) and tilzepatide (Manjaro), are associated with several health risks. The most common adverse events are primarily gastrointestinal (GI), including nausea, vomiting, diarrhea, and abdominal pain. [1-2] There is also a risk of pancreatitis and biliary tract disease. [1] ... References 1. GLP-1 Agonists: A Review for Emergency Clinicians Long B, Pelletier J, Koyfman A, Bridwell RE The American Journal of Emergency Medicine, 2024;78:89~94, doi:10.1016 / j.ajem.2024.01.010 New research 2. Gucagon-Like Peptide-1 Receptor Agonists Associated Gastrointestinal Adverse Events: A Cross-Sectional Analysis of the National Institutes of Health All of Us Cohort Aldhaleei WA, Abegaz TM, Bhagavathula AS Pharmaceuticals (Basel, Switzerland), 2024;17(2):199, doi:10.3390 / ph17020199 New research

[0127] In this example, the group of tokens beginning with “semaglutide (Ozempic)” and ending with “is” represents the answer to the question, "[1]" and "[1-2]" are tokens representing citation marks in the text, the group of tokens under “References” represents a list of citations of medical documents, including a subset of multiple document snippets, and “New Research” is a token representing the rationale for which the medical documents are cited (in this example, because those medical documents were published within a given period of time when the question is received, e.g., within the last week, last month, or last year). If available, the publication date may be stored as metadata related to the medical documents in the medical database. In other examples, the rationale for medical documents may be different rationales, e.g., an explanation of similarity or an explanation of impact.

[0128] The similarity description is based on medical question embeddings and document snippet embeddings generated using a neural network of embedding models. For example, if the measure of similarity between a document snippet embedding for a particular document snippet and a medical question embedding for a medical question meets a predetermined threshold (e.g., a distance threshold in the embedding space), the answer to the medical question may include the token “highly relevant” as part of the citation list to highlight the similarity between the original medical document with the particular document snippet and the medical question.

[0129] The explanation of impact is based on citation metrics of the original medical document to quantify its impact on the research community. If the original medical document is published in a journal ranked above the 90th or 95th percentile in impact factor, the answer to the medical question may include the token “Influential Journal” or “First-Class Journal” as part of the citation list to highlight the impact of the original medical document. Where available, the journal’s impact factor may be stored as metadata in relation to the medical document in the medical database.

[0130] In some implementations, the medical question answering system 100 can use the same generative neural network to generate multiple different candidate answers in response to a medical question. For example, when the generative neural network 120 is configured as an autoregressive language model, some implementations of the medical question answering system 100 can do this by using beam search decoding from the score distribution generated by the generative neural network 120, using a sample-and-rank decoding strategy, or using another decoding strategy that leverages the autoregressive properties of the generative neural network 120.

[0131] The medical question answering system 100 can respond to a medical question 102 and select one or more selected candidate answers from a group of different candidate answers as the final answer 126 for output to be presented on the user device's display.

[0132] For example, selection may be based on using an evaluation model that implements an evaluation function. Alternatively, selection may be made by “discriminating” the generated candidate answers using a generative neural network 120 to determine which candidate answers should be provided in response to the medical question 102, if any.

[0133] In some implementations, after obtaining question data representing a medical question 102, the medical question answering system 100 can generate different prompts 118 based on the same medical question 102, and then, for each different prompt, generate candidate answers by processing the prompts 118 using a generative neural network 120. For example, the different prompts 118 may include document snippets selected from different types of medical documents stored in a medical database 150.

[0134] For example, as further explained below with reference to Figures 6-7, a partial implementation of the medical question answering system 100 may generate a first prompt containing a document snippet obtained only from one or more clinical practice guideline documents stored in the medical database 150 (and not from any other medical documents stored in the medical database), and a second prompt containing a document snippet obtained from other medical documents stored in the medical database 150.

[0135] In this example, the first response generated by the generative neural network 120 in response to the first prompt may be presented using a first user interface element that is different from the second user interface element that presents the second response generated by the generative neural network 120 in response to the second prompt.

[0136] After generating the answer 126, and before providing the generated answer for display on the screen, the medical question answering system 100 can use a quality assurance engine 140 to check the quality of the generated answer 126 by using a generative neural network 120 to ensure the quality of the answer.

[0137] In some implementations, the quality assurance engine 140 may use a hallucination detection neural network configured to process a hallucination detection input, which includes the response 126 and a subset of document snippets, in order to determine whether the response 126 contains any hallucination content, i.e., whether the generative neural network 120 has synthesized any nonexistent, distorted, or inaccurate information.

[0138] A hallucination detection network can have any suitable neural network architecture that enables the hallucination detection neural network to perform its described function. For example, a hallucination detection neural network may include any suitable number (e.g., 5, 10, or 20) of any suitable type of neural network layers (e.g., fully connected layers, embedding layers, attention layers, etc.) connected in any suitable configuration (e.g., as a linear sequence of layers).

[0139] In some implementations, the hallucination detection neural network is initialized using a base language model pre-trained with unsupervised learning, and then fine-tuned, for example, with supervised fine-tuning on a custom dataset containing multiple hallucination detection training examples.

[0140] For example, each hallucination detection training example may include a hallucination detection training input and a hallucination detection target output. The hallucination detection training input may include a first sequence of text and a second sequence of text. The hallucination detection target output may indicate whether the first sequence of text contains content that contradicts the content of the second sequence of text, or whether the first sequence of text contains content that relates to, is similar to, or supports the content of the second sequence of text.

[0141] In practice, hallucination detection can be performed at various levels, such as sentence level, paragraph level, etc. For example, one or more hallucination detection outputs may include hallucination detection outputs indicating whether there is any inconsistency between (i) each sentence or paragraph in the response generated by the generative neural network 120 from processing prompt 118 and (ii) a subset of document snippets.

[0142] As another example, one or more hallucination detection outputs may include hallucination detection outputs indicating whether at least one document snippet within a subset of document snippets supports each sentence or paragraph contained in the response generated by the generative neural network from processing a prompt.

[0143] In these implementations, if the system determines that an answer is inconsistent or lacks support from a document snippet, the medical question answering system 100 may refrain from providing an answer to the user. Instead, the system 100 may enhance the answer generated by the generative neural network 120, for example, by applying modifications or corrections to the answer to produce an enhanced answer. As another example, the system 100 may be rerun to generate a different answer.

[0144] Once the answer 126 generated by the generative neural network 120 is checked for quality by the quality assurance engine 140, the medical question answering system 100 can provide the answer 126 to the user. Additionally or alternatively, the system 100 can provide the answer 126 to another system for further processing or store the answer 126 in a storage device for some future purpose.

[0145] For example, the medical question answering system 100 can provide an answer 126 to be presented on a user device, for example, on the user interface of a user device to which a user has sent a medical question 102.

[0146] As another example, the medical question answering system 100 can be implemented as part of a digital assistant device, such as a mobile device, smartwatch or other wearable device, or smart speaker device, or can communicate with a digital assistant device, which can provide the answer 126 to the user by, for example, generating a speech representing the answer 126 and playing the speech to the user via a speaker.

[0147] Figure 4 is a flowchart of an exemplary process 400 for generating answers to medical questions. For convenience, the process 400 is described as being performed by a system of one or more computers located in one or more locations. For example, a medical question answering system appropriately programmed according to this specification, such as the medical question answering system 100 in Figure 1, may perform the process 400.

[0148] The system obtains question data representing medical questions from the user, for example, through a user interface (step 402).

[0149] The system retrieves multiple document snippets from a medical database that stores medical documents (step 404). Step 404 may correspond to the initial search step of a two-stage search process.

[0150] To retrieve multiple document snippets, the system retrieves medical question embeddings ("medical question embeddings") generated by the embedding model based on medical questions, and for each document snippet stored in the medical database, document snippet embeddings ("document snippet embeddings") generated by the embedding model based on the document snippet. In some implementations, document snippet embeddings may be pre-computed and stored in data storage to reduce runtime latency, allowing those embeddings to be reused in each iteration of process 400.

[0151] The system then searches for k document snippet embeddings that are most similar to the medical question embedding according to some measure of similarity. k can generally be any positive integer, i.e., any integer greater than or equal to 1, but generally much smaller than the total number of document snippets N stored in the medical database. In fact, the system performs a search within the medical database to find multiple document snippets corresponding to each of the k document snippet embeddings.

[0152] With respect to some measures of similarity, such as Manhattan distance, Euclidean distance, or other distance measures, the most similar document snippet embedding is the document snippet embedding that is closest to the medical question embedding (having the smallest similarity measure with the medical question embedding). With respect to some other measures of similarity, such as the inner product, the most similar document snippet embedding is the document snippet embedding that has the largest similarity measure with the medical question embedding.

[0153] For each document snippet among multiple document snippets, the system uses a ranking neural network to determine the relevance score of the document snippet based on the document snippet and the medical question (step 406). Then, the system selects an appropriate subset of the multiple document snippets based at least in part on the relevance scores determined for the multiple document snippets (step 408). Steps 406-408 may correspond to a reranking step in a two-stage search process. By performing the reranking step, the system further trims the multiple document snippets into an appropriate subset of the multiple document snippets.

[0154] Determining the relevance score of a document snippet is explained below in Figure 5, which is a flowchart of substeps 502-504 of step 406 of process 400 in Figure 4.

[0155] For each document snippet among multiple document snippets, the system uses a ranking neural network to process the input, which includes the medical question and the document snippet, and generates a score for each of several different levels of relevance (step 502). For each level of relevance, the score indicates the probability that the relevance between the medical question and the document snippet is at that level of relevance.

[0156] For example, for each document snippet among multiple document snippets, the output of the ranking neural network is: P(A|question, snippet), P(B|question, snippet), ... P(F|question, snippet) It can include, where A, B, ... F are tokens representing different levels of relevance. For example, A represents the highest level of relevance (i.e., the document snippet is very relevant to the question), B represents the second highest level of relevance (i.e., the document snippet is somewhat relevant to the question), and so on. In other examples, there may be more or fewer different levels of relevance. Different levels of relevance can also be represented using different tokens.

[0157] For each document snippet among multiple document snippets, the system determines the relevance score of the document snippet based on the output of the ranking neural network, that is, based on the respective scores generated by the ranking neural network for multiple levels of relevance (step 504).

[0158] For example, the relevance score is a linear combination of the scores, i.e., X_0 * P(A|question, snippet) + X_1 * P(B|question, snippet) + ... X_6 * P(F|question, snippet) It is possible to determine that X_0, X_1, ... X_6 are predetermined weights, and these predetermined weights may be, for example, tunable hyperparameters of the system.

[0159] Selecting an appropriate subset of multiple document snippets based at least partially on the relevance score is illustrated below in Figure 6, which is a flowchart of substeps 602-608 of step 408 of process 400 in Figure 4.

[0160] The system generates a ranking of multiple document snippets based on a relevance score determined for each document snippet by using a ranking neural network (step 602). For example, multiple document snippets are arranged in a ranking, with the document snippet with the highest score placed at the top of the ranking and the document snippet with the lowest score placed at the bottom.

[0161] The system selects the highest-scoring document snippet with the highest relevance score according to its ranking as an initial subset of multiple document snippets (step 604). The initial subset of multiple document snippets includes the document snippet with the highest relevance score among the multiple document snippets. For example, the system can select the document snippet that is placed at the top of the ranking.

[0162] For each of the multiple aspects, the system assigns a weight to each document snippet in an initial subset of multiple document snippets for that aspect (step 606), and then selects one or more document snippets from the document snippets in the initial subset of multiple document snippets based on the respective weights assigned to each document snippet (step 608), for example, selecting one or more document snippets with the largest weights. The weights assigned to the same document snippet may differ with respect to different aspects.

[0163] For example, multiple aspects may include one or more of the following: the recency of the original medical document containing the document snippet (i.e., the difference between the publication date and the date the medical question is received), the quality of the provider of the medical document (e.g., the impact factor of the journal in which the medical document is published), or the relevance between the user who submitted the medical question and the author of the medical document (e.g., affiliation or other relationship). As a specific example of this, with respect to a given medical document, if the user who submitted the medical question is also the author of the given medical document, the system may generate a greater weight for relevance.

[0164] In some implementations, the system selects the same fixed number of document snippets based on the respective weights for each of several aspects, while in other implementations, the system selects different numbers of document snippets based on the respective weights for each of several aspects; that is, the system may select more document snippets for one aspect than for another.

[0165] The system combines one or more document snippets selected for each of several aspects, for example by linking them together, to generate a combined set of document snippets (step 610). This combined set of document snippets can then be used as a suitable subset of multiple document snippets. In some implementations, the system applies further processing to the combined set of document snippets, such as semantic filtering, deduplication, or both, to generate a subset of multiple document snippets.

[0166] The system generates a prompt that includes at least a medical question and an appropriate subset of multiple document snippets (step 410). Optionally, the prompt may also include additional data, such as one or more of the types of data (or metadata) described above, with reference to Figure 1.

[0167] The system causes a generative neural network to process prompts as input in order to generate an answer to a medical question as output (step 412). For example, the answer can be represented as an output sequence containing tokens selected from a vocabulary, and the generative neural network can autoregressively generate the answer by successively generating tokens that make up the output sequence, given any already generated tokens in the output sequence.

[0168] Figure 7 is a flowchart of an exemplary process 700 for generating responses to user queries. For convenience, the process 700 is described as being performed by a system of one or more computers located in one or more locations. For example, a medical question answering system appropriately programmed according to this specification, such as the medical question answering system 100 in Figure 1, may perform the process 700.

[0169] The system receives queries for medical information from the user via a user interface presented to the user on the user device's display (step 702).

[0170] The system uses a generative neural network to automatically retrieve and analyze data from a corpus of medical documents stored in a medical database, thereby generating multiple responses to a query received from the user (step 704). These multiple responses may include a first response and a second response.

[0171] A generative neural network is configured to generate responses based on the processing of prompts generated by the system based on queries and data retrieved from a corpus of medical documents, such as document snippets. Specifically, the system generates different prompts based on queries, and then uses the same generative neural network to process each of these different prompts to generate corresponding responses to those prompts.

[0172] As part of generating the first response, the system determines, based on an automated search of the medical document corpus, that one or more clinical practice guideline documents from the medical document corpus contain information that responds to or is relevant to the query (step 706).

[0173] In some implementations, automated search can be a two-step process performed using an embedding model and a ranking neural network, as discussed above. For example, each document snippet selected in the reranking step has a measure of similarity with respect to medical question embeddings that satisfies a similarity threshold (e.g., a distance threshold in the embedding space).

[0174] In some other implementations, automated search can be a one-step process performed using an embedding model. This one-step process may include an initial search step but exclude a re-ranking step. For example, the system can select document snippets from those stored in a medical database according to a similarity measure. The selected document snippets have a similarity measure for medical question embeddings that meet a similarity threshold.

[0175] In response to a determination that one or more clinical practice guideline documents contain information that responds to or is relevant to the query, the system generates a first prompt that includes (i) a query for medical information and (ii) data extracted from one or more clinical practice guideline documents, for example, one or more document snippets contained in one or more clinical practice guideline documents, and then processes the first prompt using a generative neural network to generate a first response to the query (step 708).

[0176] In particular, the first prompt includes data extracted from one or more clinical practice guideline documents, but excludes, i.e., does not include, all data extracted from other medical documents that are not clinical practice guideline documents but may be stored in a medical database.

[0177] For example, the first prompt does not include any data extracted from clinical trial documents. Furthermore, the first prompt does not include any data extracted from medical label documents. Furthermore, the first prompt does not include any data extracted from institutional notification documents. Furthermore, the first prompt does not include any data extracted from clinical research documents.

[0178] The system generates a second prompt which includes at least (i) a query for medical information and (ii) data extracted from one or more other medical documents that are not clinical practice guideline documents, for example, one or more document snippets contained in one or more other medical documents, and then processes the second prompt using a generative neural network to generate a second response to the query (step 710). In some implementations, the second prompt may also include the first prompt, the first response, or both.

[0179] For example, one or more other medical documents could be retrieved using the same automated search that also retrieved one or more clinical practice guideline documents, or using a different automated search of the medical database. Generally, one or more other medical documents differ from one or more clinical practice guideline documents in that, for example, one or more other medical documents may include one or more clinical trial documents, one or more medical label documents, or both.

[0180] In an implementation, the system may generate a first response to a query and a second response to a query by making separate calls to the generative neural network. In other words, the system may make a first call to the generative neural network to cause it to generate a first response to a query based on a first prompt. After the generative neural network has generated the first response in response to the first call, the system may make a second call to the generative neural network to cause it to generate a second response to the query based on a second prompt.

[0181] The system presents a first user interface element on the user device's display via a user interface (step 712). The first user interface element presents a first response that is generated based on clinical practice guideline documents but not on any other medical documents.

[0182] The first user interface element visually emphasizes that the first response originates solely from clinical practice guideline documents (and not from any other medical documents that are not clinical practice guideline documents) and identifies one or more clinical practice guideline documents that were processed to generate the first response.

[0183] The system presents a second user interface element on the user device's display via the user interface (step 714). The second user interface element presents a second response generated at least partially based on medical documents other than clinical practice guideline documents. That is, the second user interface element is presented within the same user interface but does not have a visual indication that the second response originates solely from clinical practice guideline documents.

[0184] Figure 8 shows an example of user interface 800.

[0185] The user interface 800 presents an input window 810 for the user to enter a query. In the example in Figure 8, the user enters "What are the treatments for psoriasis?", and in response, the user interface 800 presents a first user interface element 820 which may display a first response 825 "Treatments for psoriasis include a multifaceted approach depending on the severity and extent of the disease...", and also presents a second user interface element 830 which may display a second response 835 "In addition to guidelines from the American Academy of Dermatology and the National Psoriasis Foundation...".

[0186] In the example in Figure 8, the first user interface element 820 is presented above the second user interface element 830 within the user interface 800, but temporally before the second user interface element 830. Furthermore, in the example in Figure 8, the first user interface element 820 is a walled garden environment presented within the user interface 800. The first response 825, which is generated based on clinical practice guideline documents but not on any other medical documents, is presented within the walled garden environment.

[0187] Presented within the walled garden environment is a list of citations of one or more clinical practice guideline documents (including, in the example in Figure 8, three clinical practice guideline documents published by the American Academy of Dermatology) on which the first response 825 is generated.

[0188] Optionally, the first user interface element 820 may include a heading 826 “Clinical Practice Guidelines” indicating that the first response 825 is generated based on a clinical practice guideline document but not on any other medical document.

[0189] Optionally, the first user interface element 820 may be displayed as a short summary that can be expanded upon selection (e.g., double-click, hover, etc.) to display a more complete presentation.

[0190] This specification uses the term “configured” in relation to systems and components of computer programs. One or more computer systems being configured to perform a particular operation or action means that the system has installed software, firmware, hardware, or a combination thereof that causes the system to perform the operation or action while in operation. One or more computer programs being configured to perform a particular operation or action means that one or more programs contain instructions that cause a data processing device to perform the operation or action when executed by the device.

[0191] The embodiments and functional operations described herein can be implemented in digital electronic circuits, tangibly embodied computer software or firmware, computer hardware, or one or more combinations thereof, including the structures disclosed herein and their structural equivalents. The embodiments described herein can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible non-temporary storage medium for execution by a data processing device or for controlling the operation of a data processing device. The computer storage medium can be a machine-readable storage device, a machine-readable storage board, a random or serial access memory device, or one or more combinations thereof. Alternatively or additionally, the program instructions can be encoded on artificially generated propagating signals, such as machine-generated electrical, optical, or electromagnetic signals, which are generated to encode information for transmission to a receiver device suitable for execution by a data processing device.

[0192] The term “data processing device” refers to data processing hardware and encompasses all types of devices, machines, and equipment for processing data, including, for example, a single programmable processor, a single computer, or multiple processors or computers. A device may also be a dedicated logic circuit, such as an FPGA (Field-Programmable Gate Array) or ASIC (Application-Specific Integrated Circuit), or may further include such dedicated logic circuits. Optionally, in addition to hardware, a device may include code that creates an execution environment for computer programs, such as processor firmware, a protocol stack, a database management system, an operating system, or code that constitutes one or more of these.

[0193] Computer programs, sometimes called or described as programs, software, software applications, apps, modules, software modules, scripts, or code, can be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and can be deployed in any form, including as standalone programs or as modules, components, subroutines, or other units suitable for use within a computing environment. A program may, but not necessarily, correspond to a file in a file system. A program may be stored in part of a file that holds other programs or data, for example, one or more scripts stored in a markup language document, a single file dedicated to the program in question, or multiple organized files, for example, one or more modules, subprograms, or files that store parts of code. A computer program can be deployed to run on one computer, located in one place, or distributed across multiple computers connected to each other by a data communication network.

[0194] In this specification, the term “database” is used broadly to refer to any collection of data, which does not need to be structured in any particular way, or does not need to be structured at all, and may be stored on a storage device in one or more locations. Thus, for example, an index database may contain multiple collections of data, each of which may be organized and accessed in a different way.

[0195] Similarly, in this specification, the term “engine” is used broadly to refer to a system, subsystem, or process based on software programmed to perform one or more specific functions. Generally, an engine is implemented as one or more software modules or components installed on one or more computers in one or more locations. In some cases, one or more computers are dedicated to a particular engine, while in other cases, multiple engines may be installed and running on the same one or more computers.

[0196] The processes and logic flows described herein may be executed by one or more programmable computers executing one or more computer programs to perform functions by performing operations on input data and generating outputs. Alternatively, the processes and logic flows may be executed by dedicated logic circuits, such as FPGAs or ASICs, or by a combination of dedicated logic circuits and one or more programmed computers.

[0197] A computer suitable for running computer programs can be based on a general-purpose microprocessor, a dedicated microprocessor, or both, or any other type of central processing unit. Generally, the central processing unit receives instructions and data from read-only memory, random-access memory, or both. Essential elements of a computer are the central processing unit for executing or running instructions, and one or more memory devices for storing instructions and data. The central processing unit and memory can be complemented by or incorporated into dedicated logic circuits. Also generally, a computer includes one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or is coupled to operate in a manner that it can receive data from such mass storage devices, transfer data to such mass storage devices, or both. However, a computer does not have to have such devices. Furthermore, computers can be integrated into other devices, such as mobile phones, personal digital assistants (PDAs), mobile audio or video players, game consoles, Global Positioning System (GPS) receivers, or portable storage devices, such as Universal Serial Bus (USB) flash drives.

[0198] Computer-readable media suitable for storing computer program instructions and data include, for example, semiconductor memory devices such as EPROM, EEPROM, and flash memory devices, magnetic disks such as internal hard disks or removable disks, magneto-optical disks, and all forms of non-volatile memory, media, and memory devices, including CD-ROM and DVD-ROM disks.

[0199] To provide user interaction, the embodiments described herein may be implemented on a computer having a display device for displaying information to the user, such as a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, and a keyboard and pointing device, such as a mouse or trackball, on which the user can provide input to the computer. Other types of devices may also be used to provide user interaction; for example, the feedback provided to the user may be any form of sensory feedback, such as visual feedback, auditory feedback, or tactile feedback, and input from the user may be received in any form, including acoustic, speech, or tactile input. In addition, the computer may interact with the user by sending documents to and receiving documents from a device used by the user, for example, by sending a web page to the user's device's web browser in response to a request received from a web browser. The computer may also interact with the user by sending text messages or other forms of messages to a personal device running a messaging application, such as a smartphone, and receiving a response message from the user in return.

[0200] Data processing devices for implementing machine learning models may include, for example, dedicated hardware accelerator units for handling the computationally intensive parts of the machine learning training or generation, i.e., inference workload.

[0201] Machine learning models can be implemented and deployed using machine learning frameworks, such as the TensorFlow framework, the Microsoft Cognitive Toolkit framework, the Apache Singa framework, or the Apache MXNet framework.

[0202] The embodiments described herein may be implemented in a computing system that includes, for example, a data server as a backend component, or a middleware component, for example, an application server, or a client computer having a graphical user interface, a web browser, or an application that allows a user to interact with the embodiment described herein, or one or more such backend components, middleware components, or frontend components in any combination. The components of the system may be interconnected by digital data communication in any form or medium, for example, a communication network. Examples of communication networks include local area networks (LANs) and wide area networks (WANs), for example, the Internet.

[0203] A computing system may include a client and a server. The client and server are generally geographically separated and typically interact through a communication network. The relationship between the client and the server arises from computer programs running on each computer that are in a client-server relationship with each other. In some embodiments, the server transmits data, such as an HTML page, to the user device for the purpose of displaying data to a user interacting with a device acting as a client and receiving user input from such a user. Data generated on the user device, such as the results of user interactions, can be received from the device by the server.

[0204] This specification includes many specific implementation details, but these should not be considered as limitations on the scope of any invention or claim, but rather as descriptions of features that may be specific to a particular embodiment of a particular invention. Certain features described herein in the context of separate embodiments may be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may be implemented in multiple embodiments separately or in any preferred partial combination. Furthermore, features may be described above as working in a particular combination, and may even be initially claimed as such, but one or more features of a claimed combination may, in some cases, be removed from the combination, and the claimed combination may cover a partial combination or a variation of a partial combination.

[0205] Similarly, while operations are shown in the drawings and described in the claims in a specific order, this should not be understood as requiring that such operations be performed in the specific order shown or in a sequential order, or that all shown operations be performed to achieve the desired result. In certain circumstances, multitasking and parallel processing may be advantageous. Furthermore, the division of various system modules and components in the embodiments described above should not be understood as requiring such division in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged in multiple software products.

[0206] Specific embodiments of the subject have been described. Other embodiments are within the scope of the appended claims. For example, the actions described in the claims may be performed in a different order and still achieve the desired results. As an example, the process depicted in the appended diagrams does not necessarily require the specific order or sequential order shown to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous. [Explanation of Symbols]

[0207] 100 Medical Question and Answer System 102 Medical Questions 110 Planner 118 Prompt 120 Generative Neural Networks 126 answers 130 search engines 134 Embedded Models Neural Networks, Embedded Models 136 Ranking Neural Networks 140 Quality Assurance Engine 150 Medical Databases 400 processes 700 processes 800 User Interfaces 810 Input Window 820 First User Interface Element 825 First Response 826 Headlines 830 Second User Interface Element 835 Second response

Claims

1. A method performed by one or more computers, The steps include receiving a query for medical information from a user via a user interface presented to the user on the display of the user device, A step of generating multiple responses to the query from the user by automatically searching and analyzing data from a document corpus, A step of determining, based on an automated search of the corpus of documents, that one or more clinical practice guideline documents from the corpus of documents contain information that responds to the query, A step of generating a first response to the query based solely on the clinical practice guideline documents, in response to a determination that one or more clinical practice guideline documents contain information that responds to the query, and A step of generating a second response to the query based at least partially on one or more other medical documents that are not clinical practice guideline documents. Steps including, Through the user interface, on the display of the user device, A first user interface element that presents the first response generated solely based on clinical practice guideline documents, the first user interface element that visually emphasizes that the first response originates solely from clinical practice guideline documents, and identifies one or more clinical practice guideline documents processed to generate the first response, and A second user interface element presenting the second response, which is generated at least partially based on a document that is not a clinical practice guideline document. Steps to present and Methods that include...

2. The method according to claim 1, wherein the first user interface element is presented above the second user interface element within the user interface, and temporally prior to the second user interface element.

3. The first user interface element includes a walled garden environment presented within the user interface, The method according to claim 1, wherein the first response, generated solely based on the aforementioned clinical practice guideline document, is presented within the walled garden environment.

4. The method according to claim 1, wherein the first user interface element includes a heading indicating that the first response is generated based solely on a clinical practice guideline document.

5. The step of generating the first response to the query based solely on clinical practice guideline documents includes the step of making a first call to a generative neural network, The method according to claim 1, wherein the step of generating the second response to the query based at least in part on one or more other medical documents that are not clinical practice guideline documents includes making a second call to the generative neural network after the generative neural network has generated the first response in response to the first call.

6. The step of generating the first response to the query based solely on clinical practice guideline documents is: The method according to claim 5, comprising the step of using the generative neural network to process a first prompt including (i) the query for medical information and (ii) a document snippet contained in the clinical practice guideline document to generate the first response.

7. The step of generating the second response to the query based at least partially on one or more other medical documents that are not clinical practice guideline documents is: The method according to claim 6, comprising the step of using the generative neural network to process a second prompt, which includes (i) the query for medical information, (ii) a document snippet contained in one or more other medical documents, and (iii) the first response generated by the generative neural network, thereby generating the second response.

8. One or more computers, When executed by the one or more computers, one or more storage devices storing instructions causing the one or more computers to perform the operation of each of the methods described in any one of claims 1 to 7, A system that includes this.

9. One or more computer storage media storing instructions that cause one or more computers to perform the operation of each of the methods described in any one of claims 1 to 7 when executed by one or more computers.