Language model question and answer process acceleration method for medical consultation scene

By setting time windows in medical consultation scenarios and using medical entity dictionary to generate predictive problems, the traditional question-and-answer process is solved, and a more efficient question-and-answer process and easier-to-use intelligent services are achieved.

CN119761486AActive Publication Date: 2025-04-04CHONGQING UNIV OF POSTS & TELECOMM
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411966825.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-04
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

The traditional language model has lengthy and inefficiency in the Q&A process in medical consultation scenarios, especially in multiple rounds of conversations, which leads to excessive consumption of computing resources and memory, increasing the difficulty of edge deployment.

Method used

By setting a time window, the cache area integrates user questions in batches, reduces the frequency of language model response, and uses medical entity dictionary to perform entity recognition and classification, generates prediction questions based on classification results, helping users quickly conceive new questions.

Benefits of technology

It effectively shortens the time of the Q&A process, improves process efficiency and interaction efficiency, reduces the difficulty of edge deployment and user operation complexity, and enhances the inclusiveness and ease of use of intelligent services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119761486A_ABST
    Figure CN119761486A_ABST
Patent Text Reader

Abstract

The invention relates to a medical consultation scene-oriented language model question and answer process acceleration method, and belongs to the field of prompt engineering. The method comprises the following steps: S1, starting a time window timer, initializing a cache region, and receiving a user question through an event-driven framework; s2, judging whether the time window is overtime or not, if the time window is not overtime, receiving continuous questions of a user by the cache region, refreshing the time window, and asynchronously executing a step S4; otherwise, executing the step S3; s3, integrating all questions in the cache region and transmitting the questions to a language model, generating corresponding replies by the language model, and then skipping to the step S1; s4, performing entity identification and classification on the question set in the cache region in the step S2 by using a medical entity dictionary; and S5, generating a plurality of predicted questions for the medical entities identified and classified in the step S4 according to rules. If the question is predicted to be clicked and confirmed by the user, submitting the question to a language model to generate a corresponding reply; otherwise, skipping to the step S2; according to the invention, the problem of lengthy and low-efficiency question and answer process caused by a'question-answer 'chain mode of the current language model can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of prompt engineering in edge environments and relates to a language model question-answering process acceleration method for medical consultation scenarios. Background Art

[0002] Large language models (LLMs) have attracted widespread attention due to their superior performance in various tasks. In the field of prompted learning, researchers focus on designing effective prompt strategies to wrap the original input to maximize the potential of stimulating LLMs. For example, In-Context Learning (ICL) stimulates the model to use analogy learning to improve performance by adding multiple relevant examples to the prompt. The Chain of Thought (CoT) method proposes to add intermediate reasoning steps to the context to assist LLMs in complex reasoning. These strategies often lead to an increase in prompt length, which poses challenges to the reasoning efficiency and edge-side deployment of language models, given that the computational cost and memory requirements of LLMs are quadratic with the prompt length.

[0003] To meet this challenge, current work on optimizing inference efficiency is mainly carried out at three levels: data level, model level, and system level. These methods are mainly focused on improving the efficiency of LLM in the "one question, one answer" scenario, and experimental results show that they have indeed achieved significant results.

[0004] However, as LLM is gradually applied to more scenarios, the traditional "one question and one answer" model has gradually exposed its shortcomings. In this mode, LLM needs to respond to each user input one by one. This leads to a lengthy and inefficient question-and-answer process, making it difficult to adapt to medical consultation scenarios where multiple rounds of conversations are required to gradually clarify needs. In addition, this chain interaction method often consumes a lot of computing resources and memory, increasing the difficulty of deploying LLM on the edge. Therefore, optimizing the question-and-answer efficiency of LLM in medical consultation scenarios can not only improve the fluency of conversations and the efficiency of LLM use, but also reduce the difficulty of scenario deployment and the complexity of user operations, and enhance the inclusiveness and ease of use of intelligent services. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a method for accelerating the question-answering process of a language model for medical consultation scenarios. While setting a time window, the method batch-integrates user questions through the cache area to reduce the LLM response frequency, and also classifies the questions in the cache area based on the medical entity dictionary, and generates predicted questions according to the rule template based on the classification results, helping users to quickly conceive new questions. Therefore, this method can solve the problem of lengthy and inefficient question-answering process caused by the "one question and one answer" chain mode of the current language model.

[0006] In order to achieve the above object, the present invention provides the following technical solutions:

[0007] A method for accelerating a language model question-answering process for a medical consultation scenario, the method comprising the following steps:

[0008] S1: Start the time window timer, initialize the buffer area, and receive user questions through the event-driven framework;

[0009] S2: Determine whether the time window has timed out. If not, the buffer receives continuous questions from the user, refreshes the time window, and asynchronously executes step S4; otherwise, executes step S3;

[0010] S3: Integrate all questions in the buffer and pass them to the language model, which generates corresponding replies, and then jumps to step S1;

[0011] S4: using the medical entity dictionary to perform entity recognition and classification on the question set in the buffer area in step S2;

[0012] S5: Generate several prediction questions for the medical entities identified and classified in step S4 according to the rules. If the prediction question is confirmed by the user, it is submitted to the language model to generate a corresponding reply; otherwise, jump to step S2;

[0013] Further, the step S1 specifically includes the following steps:

[0014] S11: Set the time window timer state to start, set the time window parameter value and clear the buffer area;

[0015] S12: Initialize the event-driven framework and start the asynchronous callback process to continuously monitor and capture user input signals;

[0016] Further, the step S2 specifically includes the following steps:

[0017] S21: After the question input by the user is captured through the event-driven framework, it is determined whether the time window has timed out. If not, steps S22 and S23 are executed, otherwise, step S24 is executed;

[0018] S22: Write the user's question into the buffer area immediately;

[0019] S23: Refresh the time window to ensure that the user has enough time for the next input;

[0020] S24: stop receiving new questions and set the time window to a timeout state;

[0021] Further, the step S3 specifically includes the following steps:

[0022] S31: The event-driven framework detects a time window timeout event and integrates the questions in the buffer into a unified question input format;

[0023] S32: Call the language model to process the integrated question input, generate and return the answer, and jump to step S1;

[0024] Further, the step S4 specifically includes the following steps:

[0025] S41: Use query statements to extract medical entity sets from the medical knowledge graph to build an entity classification dictionary;

[0026] S42: using a string search algorithm to match the user's question in the buffer area in step S2 with the entity classification dictionary, and identifying and classifying the medical entity in the user's question;

[0027] Further, the step S5 specifically includes the following steps:

[0028] S51: using the classification results of step S4 as clues, and obtaining a coarse-grained or fine-grained user intention type by connecting these clues;

[0029] S52: According to the intent type, a rule-based method is first used to generate corresponding prediction questions;

[0030] S53: The user makes a choice based on the predicted question obtained in step S52. If the user chooses to confirm, the predicted question is passed to the language model to generate a corresponding reply. Otherwise, the process jumps to step S2.

[0031] The beneficial effects of the present invention are:

[0032] 1) The time window mechanism effectively integrates users’ continuous questions, freeing the language model from responding to users’ questions frequently, greatly shortening the time required for the question-answering process and improving process efficiency.

[0033] 2) The intent prediction mechanism can quickly and simply generate predicted questions for user reference, increasing the possibility that user questions will be captured by the cache and further processed, thereby improving the efficiency of process interaction.

[0034] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0036] Figure 1 Input template diagram for;

[0037] Figure 2 The following is a schematic diagram of the timing window process time consumption:

[0038] Figure 3 For: Schematic diagram of entity recognition classification;

[0039] Figure 4 To: Generate schematic diagrams for predicting questions;

[0040] Figure 5 The following are: a summary of the specification; DETAILED DESCRIPTION

[0041] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0042] Figure 1 Schematic diagram of the input template. Figure 2 This is a time-consuming diagram of the timing window process. Figure 3 This is a schematic diagram of entity recognition classification. Figure 4 Generate diagrams for predictive questions.

[0043] The present invention provides a method for accelerating a language model question-answering process for a medical consultation scenario, the method mainly comprising the following steps:

[0044] Step 1: Start the time window timer, initialize the buffer area, and receive user questions through the event-driven framework;

[0045] Step 2: Determine whether the time window has timed out. If not, the buffer area receives the user's continuous questions, refreshes the time window, and asynchronously executes step S4; otherwise, executes step S3;

[0046] Step 3: Integrate all questions in the buffer and pass them to the language model, which generates corresponding responses, and then jumps to step S1;

[0047] Step 4: Use the medical entity dictionary to perform entity recognition and classification on the question set in the buffer area in step S2;

[0048] Step 5: Generate several prediction questions for the medical entities identified and classified in step S4 according to the rules. If the prediction question is confirmed by the user, it is submitted to the language model to generate a corresponding response; otherwise, jump to step S2;

[0049] Step 1 specifically includes:

[0050] (1) Initialize the data structure. Create the buffer area Buffer and the input time queue Time inputTo store the user's continuous questions Q = [q1, q2, ..., q n ] and the time it takes for the user to enter the question input =[t input1 ,t input2 ,...,t inputk ];

[0051] (2) Initialization parameters. Initialize parameters such as the time window length w and the maximum capacity of the input time queue k. k is used to dynamically adjust the time window length w to ensure that the time window fits the user's input speed.

[0052] (3) Bind an input event listener to the user input device (such as a keyboard or input box). Each time an input event is captured, the start and end time of the input is recorded and the duration of a single input is calculated.

[0053] Step 2 specifically includes:

[0054] (1) Capture user input. The system monitors the user's input signals through an event-driven mechanism. Whenever the user enters a question q i When the event-driven framework captures the input and triggers the callback function, the input takes the required time t input Will be recorded in the time queue Time input =[t input1 ,t input2 ,...,t inputk ].

[0055] (2) Determine whether the time window has timed out. When the user enters the time t input If it is less than or equal to the time window value w, execute (3), otherwise execute (4);

[0056] (3) The cache receives the user's question and refreshes the time window. i Write to the buffer area Buffer, and then the system immediately refreshes the time window. If the dynamic adjustment mechanism is enabled, input Reset w = median(t input1 ,t input2 ,...,t inputk ).

[0057] (4) Time window timeout processing. When the user enters the time t input When it is greater than the time window value w, the cache area will prohibit further writing and force the time window timeout state to be triggered.

[0058] Step 3 specifically includes:

[0059] (1) Question integration. When the time window timeout signal is detected, the questions in the buffer are integrated into a unified prompt template in chronological order. The prompt template can be divided into two parts: instructions and questions. The instruction part clarifies the role and answer structure of the model, making the answer logic generated by the model clear and comprehensive. The question part connects the questions that the user has entered to provide the necessary information for the model to generate answers. Figure 1 shown.

[0060] (2) Call the language model for processing. The integrated question is passed to the language model for processing. After analyzing the context of the question, the language model returns the generated overall response to the user.

[0061] Specifically, the time-consuming question-answering process can be roughly divided into three parts: the time-consuming user question input t input , Language model response time t model and time window waiting time t window .like Figure 2 As shown in the figure, in the absence of a timing window, each question entered by the user is sent to the language model, and the language model needs to respond multiple times to give a satisfactory answer. When there is a timing window, if the user can enter each question within each time window and does not trigger the timeout processing mechanism during the input process, a satisfactory answer can be obtained at one time. Conversely, if the user triggers the timeout processing mechanism during the input process, the questions that have been entered before will be sent to the language model first to obtain an intermediate answer, and then the user still needs to continue to enter the remaining questions to complete the information required by the language model to obtain the final answer. When the timeout mechanism is triggered, the questions that the user has not yet completed entering will not be cleared, and the user can continue to enter, but they need to wait until the language model returns the intermediate answer before sending it.

[0062] like Figure 3 As shown, step 4 is as follows:

[0063] (1) Construct a medical entity classification dictionary. Use the Cypher query statement MATCH(m:{EntityType}) to retrieve medical entity sets by category from the open source medical knowledge graph to construct a classification dictionary D. There are five categories: disease, symptoms, medicine, food, and examination, that is, D = {E disease ,E symptom ,E medicine ,E food ,E check}, where E disease Represents the disease-related medical entity set, E symptom ,E medicine ,E food ,E check And so on.

[0064] (2) Construct a medical entity prefix tree. Initialize an empty root node, then traverse the classification dictionary D, and for each entity in it, insert it into the Trie tree character by character. If a character does not exist in the child node set of the current node, create a new node and add it to the child node of the current node; when all the characters of an entity are inserted, mark the last character node of the entity as the word end node. The constructed medical entity prefix tree can complete the insertion operation of a single entity within O(L) time complexity (where L is the average length of the entity) and form a hierarchical structure in the tree, which effectively supports subsequent matching tasks.

[0065] (3) Matching medical entities. Using the constructed Trie tree, we write the user question Q = [q1, q2, ..., q n ] are matched character by character with the known entity set. Starting from the starting character input by the user, the Trie tree is searched down layer by layer to try to find a matching path. If the match is successful and the current node is marked as the end of the word, a complete entity is identified. For the identified medical entity, we can know its category based on the classification dictionary D. If the match cannot continue at a certain node, the failure pointer jumps to the longest suffix path node and continues to try to match, thereby avoiding repeated scanning of processed characters.

[0066] The failure pointer is calculated through breadth-first search, which provides a backtracking path for each node, pointing to the node location where a match may exist. During the matching process, when the path is interrupted, the failure pointer is used for fast jumps, combined with the character-by-character search process, which can effectively skip unnecessary paths. In addition, in order to support the simultaneous recognition of multiple entities, when a character matches multiple terminal nodes, we will record all possible entities and continue to search downward to ensure that all valid paths are covered.

[0067] Step 5 is as follows:

[0068] (1) Predicting the user’s intention type. In this process, each result identified and classified in the user’s question is first used as a clue. i , each clue includes a medical entity e and its type y, namely Clue i ={e,y}, where e∈{E disease ∪E symptom ∪E medicine ∪E food ∪E check}, y∈{disease,symptom,medicine,food,check}. Then these clues are concatenated. If the number of clue types extracted from the user description is 1, coarse-grained intent inference is performed to identify the user's basic needs; if the number of clue types extracted is greater than or equal to 2, fine-grained intent inference is performed to more accurately analyze the user's complex needs. For example, Figure 4 For the first conversation, step 4 extracts clues such as Clue1={gallstones, disease}, and we infer the user's intention as "disease-related" intention in a coarse-grained manner; while for the second conversation, step 4 extracts clues such as Clue1={rhinitis, disease} and Clue2={amoxicillin, medicine}, and we infer the user's intention as a mixed intention of "medicine and disease" in a fine-grained manner.

[0069] (2) Generate predicted questions based on rules. Based on the inferred user intent type, we use a rule-based approach to generate common medical field questions. Question templates usually consist of two parts: entities and fixed template statements. Entities refer to specific medical concepts, such as Figure 4 The fixed template statements are determined by the user's intention type. Specifically, the predicate in the template usually expresses the action or state of the core question (such as "what is it" or "what are there"), and the object supplements the specific information of the question. (For example, "symptoms" and "treatment methods"). It should be noted that the prediction question usually generates more than one, but multiple for users to choose from, increasing the success rate of the prediction.

Claims

1. A language model question-answering process acceleration method for medical consultation scenarios, characterized in that: The method comprises the following steps: S1: Start the time window timer, initialize the buffer area, and receive user questions through the event-driven framework; S2: Determine whether the time window has timed out. If not, the buffer receives continuous questions from the user, refreshes the time window, and asynchronously executes step S4; otherwise, executes step S3; S3: Integrate all questions in the buffer and pass them to the language model, which generates corresponding replies, and then jumps to step S1; S4: using the medical entity dictionary to perform entity recognition and classification on the question set in the buffer area in step S2; S5: Generate several prediction questions according to the rules for the medical entities identified and classified in step S4. If the prediction question is confirmed by the user, it is submitted to the language model to generate a corresponding reply; otherwise, jump to step S2.

2. According to claim 1, a method for accelerating the language model question-answering process for medical consultation scenarios is characterized in that: In step S1, it specifically includes: S11: Set the time window timer state to start, set the time window parameter value and clear the buffer area; S12: Initialize the event-driven framework and start the asynchronous callback process to continuously monitor and capture user input signals.

3. According to claim 1, a method for accelerating the language model question-answering process for medical consultation scenarios is characterized in that: In step S2, it specifically includes: S21: After the question input by the user is captured through the event-driven framework, it is determined whether the time window has timed out. If not, steps S22 and S23 are executed, otherwise, step S24 is executed; S22: Write the user's question into the buffer area immediately; S23: Refresh the time window to ensure that the user has enough time for the next input; S24: Stop receiving new questions and set the time window to a timeout state.

4. According to claim 1, a method for accelerating the language model question-answering process for medical consultation scenarios is characterized in that: In step S3, it specifically includes: S31: The event-driven framework detects a time window timeout event and integrates the questions in the buffer into a unified question input format; S32: Call the language model to process the integrated question input, generate and return the answer, and jump to step S1.

5. According to claim 1, a method for accelerating the language model question-answering process for medical consultation scenarios is characterized in that: In step S4, it specifically includes: S41: Use query statements to extract medical entity sets from the medical knowledge graph to build an entity classification dictionary; S42: Use a string search algorithm to match the user's question in the cache area in step S2 with the entity classification dictionary to identify and classify the medical entities in the user's question.

6. According to claim 1, a method for accelerating the language model question-answering process for medical consultation scenarios is characterized in that: In step S5, it specifically includes: S51: using the classification results of step S4 as clues, and obtaining a coarse-grained or fine-grained user intention type by connecting these clues; S52: According to the intent type, a rule-based method is first used to generate corresponding prediction questions; S53: The user makes a choice based on the predicted question obtained in step S52. If the user chooses to confirm, the predicted question is passed to the language model to generate a corresponding reply. Otherwise, the process jumps to step S2.

Citation Information

Patent Citations

  • Question behavior data collection method and device and server

    CN111078972A

  • Event question-answering method, device and equipment based on artificial intelligence and storage medium

    CN111368043A

  • Intelligent question-answering method and device, computer equipment and storage medium

    CN111368044A

  • Intention prediction method, electronic equipment and readable storage medium

    CN117708284A

  • Method and system for answering question and recording medium with recorded question answering program

    JP2002132812A