Knowledge retrieval enhancement-based oral medical large model question and answer prediction method
By introducing a method based on knowledge retrieval enhancement in the medical question-and-answer system, using the semantic similarity matching of the trigger keywords in the knowledge base with the user's problems, and splicing structured knowledge as model input, the problem of insufficient accuracy and comprehensiveness of the existing system when dealing with complex medical problems is solved, significantly improving the accuracy of the answers and user satisfaction.
Patent Information
- Application Number
- CN202510628584.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2045-05-15
AI Technical Summary
When the existing medical Q&A system deals with long-tail problems, edge problems or vague user expressions, it is difficult to accurately understand user needs, resulting in the model output results deviating from the user's real needs and affecting the user's medical experience.
The oral medical big model question-and-answer prediction method based on knowledge retrieval enhancement is adopted to make up for the blind spots in the knowledge of the generative model by introducing the most relevant information to user questions as context prompts. The specific steps include receiving user input, converting it into a semantic vector representation, obtaining the semantic vector representation of the trigger keywords in the knowledge base, calculating the similarity, and splicing the model input problem based on the similarity, and finally inputting the oral medical model for prediction.
By introducing structured knowledge, the accuracy and comprehensiveness of the model when dealing with complex medical problems are significantly improved, the accuracy of the answers and user satisfaction are ensured, development costs and time are reduced, and system adaptability and maintenance efficiency are improved.
Smart Images

Figure CN120196725A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of medical auxiliary decision-making, and particularly relates to a method for predicting answers to questions of an oral medical large model enhanced by knowledge retrieval. Background Art
[0002] Currently, large-scale pre-trained language models have achieved remarkable results in tasks such as medical Q&A and intelligent medical guidance. However, for medical Q&A, there are still problems in practical applications where individual questions cannot be accurately understood or answered. Especially for some long-tail questions, marginal questions, or situations where the user's expression is vague, it will cause the model's output results to deviate from the user's true needs. For example, in an oral medical large model, when a user inputs an oral-related question and hopes to accurately know the name of the registration department, operation instructions, etc., during the prediction process, due to the user's unfamiliarity with some professional terms, the expression is often vague, resulting in a deviation in the registration department given by the large model and affecting the user's medical treatment.
[0003] To improve the overall system experience, common optimization methods include: further fine-tuning the large model, constructing FAQ templates, rule supplementation, or using artificial prompts, etc. These methods have drawbacks such as poor generality, high maintenance costs, or incomplete coverage of new questions, and it is difficult to effectively handle dynamically updated user expressions.
[0004] Therefore, there is an urgent need for a general, efficient, and scalable lightweight enhancement mechanism to solve the occasional "difficult-to-answer questions" of the model, while having good engineering adaptability and practical effects. Summary of the Invention
[0005] In view of the above deficiencies in the prior art, the method for predicting answers to questions of an oral medical large model enhanced by knowledge retrieval provided by the present invention can introduce the information most relevant to the user's question as context cues before generation, effectively making up for the internal knowledge blind spots of the generation model.
[0006] To achieve the above object of the invention, the technical solution adopted by the present invention is:
[0007] Provide a method for predicting answers to questions of an oral medical large model enhanced by knowledge retrieval, which includes the steps of:
[0008] S1. Receive the question input by the user and convert it into a semantic vector representation using a pre-trained model;
[0009] S2. Obtain the semantic vector representation of each trigger keyword in the knowledge base, and calculate the similarity between the semantic vector representation in step S1 and the semantic vector representation of each trigger keyword;
[0010] S3. Determine whether there is a similarity greater than or equal to the preset threshold among all similarities. If so, proceed to step S4; otherwise, use the question input by the user as the model input question.
[0011] S4. Concatenate the trigger keywords corresponding to the similarities that meet the conditions and their structured prompt information with the question input by the user as the model input question.
[0012] S5. Input the model input question into the oral medical large model for prediction to obtain a question response.
[0013] Furthermore, the preset threshold is obtained by using an adaptive threshold adjustment mechanism:
[0014] S31. According to the question input by the user, use a logistic regression classifier to predict the complexity of the question input by the user:
[0015]
[0016] f1(x) = ‖e x ‖2, f2(x) = count(NER(x))
[0017] f3(x) = depth(DependencyTree(x))
[0018] Among them, Complexity(x) is the complexity of the question input by the user; x is the question input by the user; σ(·) is the logistic regression classifier; n is the total number of features; w i is the weight matrix of the i-th feature; f i (x) is the i-th feature of x; b is the bias obtained through training; ‖e x ‖2 is the semantic density; ‖·‖2 is the L2 norm; count(·) is the number of entities; NER(x) is the set of keywords identified from x; depth(·) is the syntactic complexity; DependencyTree(x) is to analyze the syntactic relationship between words in x, generate a tree structure, and reflect the logical structure of the sentence; f1(x), f2(x), and f3(x) are the functions corresponding to the 1st, 2nd, and 3rd features respectively.
[0019] S32. Calculate the preset threshold according to the complexity of the question input by the user:
[0020]
[0021] Among them, τ y is the preset threshold; τ low and τ high are the lower threshold and the upper threshold respectively; θ is the complexity of the best question input by the user.
[0022] Furthermore, the expression of the knowledge base is:
[0023]
[0024] where K is the knowledge base; S is the natural language sentence space; k i is the i-th trigger keyword; v i is the structured prompt information corresponding to k i ; N is the total number of trigger keywords.
[0025] Furthermore, the oral medical large model question-answering prediction method based on knowledge retrieval enhancement further includes updating the knowledge base every preset time interval:
[0026] S21. During the current preset time interval, obtain the questions of user input where the oral medical large model shows deviations in the actual question-answering process based on the errors predicted by the model or user feedback;
[0027] S22. According to the questions of user input with deviations, respectively compare the corresponding question responses generated by the oral medical large model with the expert-annotated answers to obtain the answer deviation degree:
[0028] Bias(x,a)=α·(1 - Conf(a|x)) + β·KL(P ans ||P ref )
[0029] where Conf(a|x) is the confidence of the model in its generated question response a; x is the question of user input; P ans is the semantic vector distribution of the question response a; P ref is the distribution of the expert-verified answer; α and β are both weight coefficients; KL(·) is the Kullback-Leibler divergence, which measures the difference between two probability distributions and is used to quantify the semantic deviation degree between the generated answer and the standard answer;
[0030] S23. Update the knowledge base according to the answer deviation degree and the deviation threshold:
[0031] KB new =(KB old ∪{(x,a * )}) - {(x,a)|Bias(x,a)>τ x}
[0032] where K Bold and KB new are the knowledge bases before and after the update respectively; a * is the expert-annotated answer; τ xis the deviation threshold; (x, a) is an existing "query - answer" pair in the knowledge base; (x, a * ) is the "query - answer" pair after expert correction;
[0033] S24. When updating the knowledge base, dynamically calculate the structured prompt information v new added to the knowledge base:
[0034] F new ={(v new , v, w(e1)) | v ∈ N k (v new ), w(e1) = f θ (e1)}
[0035] where E new is the set of newly added edges; v is the existing structured prompt information in the knowledge base; w(e1) is the weight of the edge; N k (v new ) is the existing entity with the top - k similarity to v new ; f θ is the edge weight prediction model based on the graph neural network; e1 is the edge between structured prompt information, that is, the relationship.
[0036] Furthermore, when the cache space is insufficient, it also includes updating the knowledge base:
[0037] Calculate the weighted score of each trigger keyword in the knowledge base:
[0038]
[0039] where Freq(k) is the number of accesses of the k - th trigger keyword in the knowledge base within the time window; Age(k) is the number of hours since the k - th trigger keyword was last accessed;
[0040] Retain the trigger keywords in the database whose retention time is less than or equal to the minimum retention time and the trigger keywords whose retention time is greater than the minimum retention time and whose weighted score is greater than the preset score.
[0041] Furthermore, the construction method of the pre - trained model includes: fine - tuning the embedding model SentenceTransformer in the open - source library sentence - transformers using a dataset composed of oral medical - related literature and data; using the maximum mean discrepancy to measure the distribution difference between the general text domain D G and the oral medical domain D M during the fine - tuning process:
[0042]
[0043] Among them, MMD(D G , D M ) is the distribution difference between the general text domain D G and the oral medical domain D M ; is the feature mapping function; n G and n M are the sample numbers of D G and D M respectively; x i and x j are single samples in the dataset; ‖·‖ is used to calculate the difference in the mean of the embedded distributions of the two domains.
[0044] Further, the expression for calculating the similarity is:
[0045]
[0046] Among them, X T is the transpose of the semantic vector representation of the question input by the user; T is the transpose symbol; K i is the semantic vector representation of the i-th trigger keyword in the knowledge base, ‖X‖ = ‖K i ‖ = 1; |·| is the absolute value symbol; ‖·‖ is the modulus;
[0047] The expression of the problem P x input to the model in step S4 is:
[0048]
[0049] M x = {i|S(X T , K i ) ≥ τ y}
[0050] Among them, M x is the set composed of the trigger keywords corresponding to the similarity that meets the conditions and their structured prompt information; τ y is the preset threshold.
[0051] Further, the pre-trained model maps the question x input by the user and each trigger keyword k i in the knowledge base into a normalized semantic vector representation:
[0052]
[0053] Among them, is the vectorized embedding encoder; X is the semantic vector representation corresponding to x; K i is the semantic vector representation corresponding to k i .
[0054] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0055] 1. This solution proposes a problem enhancement strategy, that is, the input problem of the spliced model, which allows intelligent selection of appropriate structured knowledge according to the type, difficulty and context information of the user's question; for simple questions, concise answers can be provided, while for complex questions, more professional knowledge and background information will be injected to ensure the accuracy and comprehensiveness of the answers.
[0056] 2. This solution innovatively introduces a semantic knowledge base, which is specifically used to supplement and strengthen the knowledge blind spots of the language model in dealing with specific fields (such as medical problems). Different from traditional knowledge bases, the semantic knowledge base of this solution is not just a static collection of entries, but an adaptive library that is dynamically updated and has context awareness; it can respond to specific needs in the user input in real time and continuously expand and optimize through expert feedback.
[0057] 3. This solution not only improves the cross-context knowledge matching ability, but also proposes a similarity retrieval method, making semantic retrieval more efficient and accurate. Compared with the traditional keyword-based matching retrieval method, the present invention can understand the semantic similarity between different expressions, contexts and contexts through deep learning technology.
[0058] 4. Compared with the traditional method based on FAQ templates or rule systems, the present invention searches for relevant trigger keywords through the knowledge base, that is, adopts a deep semantic matching method to solve the coverage loss problem caused by expression variation, has stronger generalization ability, and can adapt to different expression methods of users, automatically identify synonyms, context changes and question method differences, so as to cover a wider range of question scenarios and avoid the coverage shortage problem existing in traditional methods.
[0059] 5. For the fine-tuning of the pre-trained model, compared with the method of directly fine-tuning the large model, the present invention does not need to change the main model structure and parameters, and provides enhancement to the original large model through the knowledge base of domain knowledge and the adaptive prompt mechanism, without complex fine-tuning and retraining of the model. This solution reduces manual intervention and computing resource requirements, thus significantly reducing the development cost and time, and improving the adaptability and maintenance efficiency of the system.
[0060] 6. Verification in the actual medical Q&A system shows that the accuracy and user satisfaction of this solution in the medical Q&A task are significantly higher than those of traditional methods. Especially when dealing with complex medical problems, the system can provide more accurate diagnosis and treatment suggestions. This result shows that the solution of the present invention not only has high technical advancement, but also has significant commercial application potential. Brief Description of the Drawings
[0061] Figure 1Flowchart of the question - answering prediction method for an oral medical large model enhanced by knowledge retrieval. Detailed implementation manners
[0062] The following describes the detailed implementation manners of the present invention to facilitate those skilled in the art of this technology to understand the present invention. However, it should be clear that the present invention is not limited to the scope of the detailed implementation manners. For those of ordinary skill in the art of this technology, as long as various changes are within the spirit and scope of the present invention defined and determined by the appended claims, these changes are obvious, and all inventions created using the concept of the present invention are within the scope of protection.
[0063] Refer to Figure 1 , Figure 1 which shows the flowchart of the question - answering prediction method for an oral medical large model enhanced by knowledge retrieval; as Figure 1 shown, this method S includes steps S1 to S5.
[0064] In step S1, receive the question input by the user and convert it into a semantic vector representation using a pre - trained model; in implementation, the preferred method for constructing the pre - trained model in this solution includes:
[0065] Fine - tune the embedding model SentenceTransformer in the open - source library sentence - transformers using a dataset composed of oral medical - related literature and data; during the fine - tuning process, use the maximum mean discrepancy to measure the distribution difference between the general text domain D G and the oral medical domain D M :
[0066]
[0067] where MMD(D G , D M ) is the distribution difference between the general text domain D G and the oral medical domain D M ; is the feature mapping function; n G and n M are the sample numbers of D G and D M respectively; x i and x j are individual samples in the dataset; ‖·‖ is used to calculate the difference in the means of the embedding distributions of the two domains.
[0068] SentenceTransformer is a text vector encoding framework trained based on BERT and its derivative models (such as RoBERTa, DistilBERT, MiniLM, etc.), which is specifically used to map sentences, phrases, or paragraphs in natural language into high-dimensional vector representations in the semantic space. Compared with the original BERT model, it can efficiently process sentence-level semantic comparisons and is applicable to tasks such as question-answer matching, semantic search, and clustering.
[0069] To improve the adaptability of the model, the present invention adopts domain adaptation technology. By fine-tuning on oral medical-related literature and data, the semantic embedding model can focus on specific knowledge in this field, such as oral diseases, treatment methods, dental drugs, etc.
[0070] This solution uses a vectorized embedding encoder based on a pre-trained model (such as Sentence-BERT) to map the user input x and each k in the knowledge base i into a normalized semantic vector representation:
[0071]
[0072] This encoder obtains a unified embedding space through training, where the vectors of X and K i both have a length of 1, and text pairs with similar semantics are closer in distance. After normalization, the similarity can be simplified to the vector dot product.
[0073] In step S2, obtain the semantic vector representation of each trigger keyword in the knowledge base, and calculate the similarity between the semantic vector representation in step S1 and the semantic vector representation of each trigger keyword.
[0074] This solution preferably has the expression of the knowledge base as:
[0075]
[0076] where K is the knowledge base; S is the natural language sentence space; k i is the i-th trigger keyword; v i is the structured prompt information corresponding to k i ; N is the total number of trigger keywords.
[0077] The knowledge base provided by this solution is used to cover typical problem areas where the oral medical large model performs poorly; the knowledge base is organized in the form of key-value pairs: K is the extracted domain high-frequency or error-prone keywords of the oral medical large model, and v is the standard answer or diagnosis guidance advice confirmed by humans or verified by experts.
[0078] In this solution, the expression for calculating the similarity is:
[0079]
[0080] Among them, X T is the transpose of the semantic vector representation of the question input by the user; T is the transpose symbol; K i is the semantic vector representation of the i-th trigger keyword in the knowledge base, ‖X‖ = ‖K i ‖ = 1; |·| is the absolute value symbol; ‖·‖ is to calculate the difference in the mean of the two domain embedding distributions, and the optimization goal is to fine-tune to make MMD(D G , D M ) reduce by more than 50%.
[0081] By reducing the distribution difference between domains, the performance of the pre-trained model in the field of stomatology is improved, ensuring that the pre-trained model can be customized and fine-tuned for the specific needs of the oral medical field. Especially when dealing with some medical terms and complex questions and answers, this solution can understand and match more accurately. Through this technology, it can adapt to the semantic features of different medical fields and quickly improve the performance of the pre-trained model in the oral medical field.
[0082] In step S3, it is judged whether there is a similarity greater than or equal to the preset threshold among all similarities. If so, go to step S4; otherwise, use the question input by the user as the model input question.
[0083] In an embodiment of the present invention, the preset threshold is obtained by using an adaptive threshold adjustment mechanism:
[0084] S31. According to the question input by the user, use a logistic regression classifier to predict the complexity of the question input by the user:
[0085]
[0086] f1(x) = ‖e x ‖2, f2(x) = count(NER(x))
[0087] f3(x) = depth(DependencyTree(x))
[0088] Among them, Complexity(x) is the complexity of the question input by the user; x is the question input by the user; σ(·) is the logistic regression classifier; n is the total number of features; w i is the weight matrix of the i-th feature; f i (x) is the i-th feature of x; b is the bias obtained by training; ‖e x‖2 is the semantic density; ‖·‖2 is the L2 norm; count(·) is the number of entities; NER(x) is the set of keywords identified from x; depth(·) is the syntactic complexity; DependencyTree(x) is to analyze the syntactic relationships between words in x, generate a tree structure, and reflect the logical structure of the sentence; f1(x), f2(x), and f3(x) are the functions corresponding to the 1st, 2nd, and 3rd features respectively;
[0089] S32. Calculate the preset threshold according to the complexity of the question input by the user:
[0090]
[0091] where τ y is the preset threshold; τ low and τ high are the lower limit and upper limit of the threshold respectively; θ is the complexity of the best question input by the user.
[0092] This solution introduces an adaptive threshold adjustment mechanism, which can dynamically adjust the preset threshold for similarity matching, so as to flexibly select the balance between matching accuracy and efficiency according to the actual scenario or user needs. Specifically, this solution uses a deep learning model to gradually optimize the setting of the preset threshold according to the semantic complexity or background information of the user input, enabling this solution to automatically adjust its matching strategy in different environments. For example, for some simple queries, the system may choose a lower similarity threshold to increase the number of matching candidates; while for complex medical problems, the threshold can be increased to ensure that the matching entries are more accurate; this can not only improve the matching accuracy but also enhance the efficiency in a large-scale knowledge base.
[0093] In step S4, splice the trigger keywords corresponding to the satisfied similarity and their structured prompt information with the question input by the user as the model input question; the model input question P x is expressed as:
[0094]
[0095] M x ={i|S(X T ,K i )≥τ y}
[0096] where M x is the set composed of the trigger keywords corresponding to the satisfied similarity and their structured prompt information; τ y is the preset threshold.
[0097] The final model input problem of this solution consists of several knowledge items. After concatenating the original problem, it is input into the oral medical large model for response generation. This method is equivalent to completing a "fine-grained retrieval + information injection" before generation, significantly improving the response quality of the model to the target problem. The finally concatenated complete input will be directly used as a prompt to the oral medical large model (such as a medical Q&A large model) for answer generation. By adding highly relevant structured knowledge prompts before the original problem, the large model can refer to this information during the reasoning stage, thereby improving performance.
[0098] In step S5, the model input problem is input into the oral medical large model for prediction to obtain a problem response.
[0099] During implementation, the preferred method for predicting answers of the oral medical large model enhanced by knowledge retrieval of this solution further includes updating the knowledge base at preset intervals:
[0100] S21. During the current preset time period, based on the errors predicted by the model or user feedback, obtain the questions input by users where the oral medical large model shows deviations during the actual Q&A process;
[0101] S22. According to the questions input by users with deviations, respectively compare the corresponding question responses generated by the oral medical large model with the expert-annotated answers to obtain the answer deviation degree:
[0102] Bias(x,a)=α·(1 - Conf(a|x)) + β·KL(P ans ||P ref )
[0103] Among them, Conf(a|x) is the confidence of the model in the question response a it generates; x is the question input by the user; P ans is the semantic vector distribution of the question response a; P ref is the distribution of the expert-verified answer; both α and β are weight coefficients; KL(·) is the Kullback-Leibler divergence, which measures the difference between two probability distributions and is used to quantify the semantic deviation degree between the generated answer and the standard answer;
[0104] S23. Update the knowledge base according to the answer deviation degree and the deviation threshold:
[0105] KB new =(KB old ∪{(x,a * )}) - {(x,a)|Bias(x,a)>τ x}
[0106] Among them, KB old and KB new are the knowledge bases before and after update respectively; a* is the expert-annotated answer; τ x is the deviation threshold; (x, a) is an existing "query - answer" pair in the knowledge base; (x, a * ) is the "query - answer" pair after expert correction;
[0107] S24. When updating the knowledge base, dynamically calculate the structured hint information v added to the knowledge base new edges:
[0108] E new ={(v new , v, w(e1)) | v ∈ N k (v new ), w(e1) = f θ (e1)}
[0109] where E new is the set of newly added edges; v is the existing structured hint information in the knowledge base; w(e1) is the weight of the edge; N k (v new ) is the existing entity with the top - k similarity to v new ; f θ is the edge weight prediction model based on the graph neural network; e1 is the edge between structured hint information, that is, the relationship.
[0110] In the case where the oral medical large model cannot answer or has low accuracy, experts can directly input verified answers or modification suggestions, which will enter the knowledge base and be used for the next round of model training or update. This dynamic review and feedback mechanism ensures that the knowledge base can be continuously optimized and updated during application. Especially in professional fields such as medicine, the knowledge base must be kept up - to - date and accurate to enhance the system's self - adaptability and long - term applicability.
[0111] At the same time, this solution also introduces a semantic cache hot - loading technology for incremental updates, that is, updating the knowledge base even when the cache space is insufficient, namely an improved LFU cache update strategy. Traditional LFU is a classic cache eviction algorithm used to decide which data should be removed when the cache space is insufficient. Its core idea is: preferentially evict the entries with the lowest access frequency. However, relying solely on the access frequency (Freq) may lead to: long - term hot issues occupying the cache for a long time (such as "how to register"), squeezing the space for new entries; sudden traffic issues where temporary high - frequency queries (such as a certain disease trending on the search) cannot be quickly responded to.
[0112] In response, this solution also includes updating the knowledge base when the cache space is insufficient:
[0113] Calculate the weighted score of each trigger keyword in the knowledge base:
[0114]
[0115] Among them, Freq(k) is the number of accesses of the k-th trigger keyword in the knowledge base within the time window; Age(k) is the number of hours since the k-th trigger keyword was last accessed.
[0116] Retain the trigger keywords in the database whose retention time is less than or equal to the minimum retention time and the trigger keywords whose retention time is greater than the minimum retention time and the weighted score is greater than the preset score.
[0117] Since the present invention is used in a medical scenario, the parameter design is as follows: the time window T = 24h (matching the hospital consultation cycle), and the minimum retention time Age min = 10h (ensuring the temporary cache for emergency-related queries).
[0118] Suppose there are the following entries in the cache:
[0119] Item k Freq(k) Age(k) Traditional LFU Ranking Improved LFU Score "Registration Method" 100 0.1h 1 100 / 1.07≈93.5(1) "Dental Implant Cost" 50 2h 2 50 / 1.48≈33.8(2) "Tooth Extraction for Diabetes" 3 0.5h 3 3 / 1.18≈2.5(4) "Emergency Process" 10 0.1h 4 10 / 1.07≈9.3(3)
[0120] After updating the knowledge base based on the weighted score, the following effects are obtained:
[0121] 1) The ranking of emergency query (low Freq but new) is improved, and the traditional LFU will eliminate it.
[0122] 2) Long-term low-frequency but important medical entries (such as "tooth extraction for diabetes") will not be permanently retained.
[0123] Through the above method, the knowledge base is updated in this solution. Without fine-tuning the parameters of the main model, the directional enhancement of the Q&A effect can be achieved, and it has good scalability and generality.
[0124] In summary, in this solution, the similarity is calculated between the question input by the user and the semantic vector representation of the trigger keyword in the knowledge base, so as to achieve high-precision matching, automatically splice the prompt words, and guide the large model to generate answers more accurately. Compared with the traditional keyword matching or hard-coded rule method, this solution has stronger fault tolerance and expression generalization ability, and can achieve intelligent enhancement without modifying the ontology of the large model.
Claims
1. A large-scale oral medical model question-answering prediction method based on knowledge retrieval enhancement, characterized in that: Includes steps: S1, receiving the user input question and converting it into a semantic vector representation using a pre-trained model; S2, obtaining the semantic vector representation of each trigger keyword in the knowledge base, and calculating the similarity between the semantic vector representation in step S1 and the semantic vector representation of each trigger keyword; S3, determining whether there is a similarity greater than or equal to a preset threshold among all similarities, if so, proceeding to step S4, otherwise, taking the question input by the user as the model input question; S4, concatenating the trigger keywords and their structured prompt information corresponding to the similarity that meets the conditions with the question input by the user as the model input question; S5. Input the model input question into the oral medical big model for prediction and obtain the question response.
2. The oral medical large model question-answering prediction method based on knowledge retrieval enhancement according to claim 1 is characterized in that: The preset threshold is obtained by using an adaptive threshold adjustment mechanism: S31. Based on the question input by the user, a logistic regression classifier is used to predict the complexity of the question input by the user: f1(x)=||e x ||2,f2(x)=count(NER(x)) f3(x)=depth(DependencyTree(x)) Where Complexity(x) is the complexity of the question input by the user; x is the question input by the user; σ(·) is the logistic regression classifier; n is the total number of features; w i is the weight matrix of the i-th feature; f i (x) is the i-th feature of x; b is the bias obtained through training; ||e x ||2 is the semantic density; ||·||2 is the L2 norm; count(·) is the number of entities; NER(x) is the set of keywords identified from x; depth(·) is the grammatical complexity; DependencyTree(x) is to analyze the grammatical relationship between words in x and generate a tree structure to reflect the logical structure of the sentence; f1(x), f2(x) and f3(x) are the functions corresponding to the first, second and third features respectively; S32. Calculate a preset threshold value according to the complexity of the question input by the user: Among them, τ y is the preset threshold; τ low and τ high are the lower and upper thresholds respectively; θ is the complexity of the problem with the optimal user input.
3. The oral medical large model question-answering prediction method based on knowledge retrieval enhancement according to claim 1 is characterized in that: The expression of the knowledge base is: Among them, K is the knowledge base; S is the natural language sentence space; k i is the i-th trigger keyword; v i k i The corresponding structured prompt information; N is the total number of triggered keywords.
4. The oral medical large model question-answering prediction method based on knowledge retrieval enhancement according to claim 3 is characterized in that: It also includes updating the knowledge base at preset intervals: S21. Within the current preset time, based on the model prediction errors or user feedback, the oral medical big model has deviations in the actual question-answering process. User input questions; S22. According to the questions input by the users with deviations, the responses to the questions generated by the corresponding oral medical model are compared with the answers annotated by the experts to obtain the degree of deviation of the answers: Bias(x,a)=α·(1-Conv(a|x))+β·KL(P ans ||P ref ) Where Conf(a|x) is the confidence of the model in the generated question response a; x is the question input by the user; P ans is the semantic vector distribution of question response a; P ref is the distribution of expert-verified answers; α and β are weight coefficients; KL(·) is the Kullback-Leibler divergence, which measures the difference between two probability distributions and is used to quantify the semantic deviation between the generated answer and the standard answer; S23. Update the knowledge base according to the answer deviation and the deviation threshold: KB new =(KB old ∪{(x,a * )})-{(x,a)|Bias(x,a)>τ x } Among them, KB old and KB new are the knowledge bases before and after the update respectively; a * Label the answers for the experts; τ x is the deviation threshold; (x,a) is the existing query-answer pair in the knowledge base; (x,a * ) is the query-answer pair corrected by the expert; S24. When updating the knowledge base, dynamically calculate the structured prompt information v added to the knowledge base new The edge: F new ={(v new ,v,w(e1))|v∈N k (v new ),w(e1)=f θ (e1)} Among them, E new is the newly added edge set; v is the existing structured prompt information in the knowledge base; w(e1) is the edge weight; N k (v new ) is the same as v new Similarity Top-k existing entities; f θ is an edge weight prediction model based on graph neural network; e1 is the edge between structured prompt information, that is, the relationship.
5. The oral medical large model question-answering prediction method based on knowledge retrieval enhancement according to claim 3 is characterized in that: This also includes updating the knowledge base when the cache runs out of space: Calculate the weighted score of each trigger keyword in the knowledge base: Among them, Freq(k) is the number of visits of the k-th trigger keyword in the knowledge base within the time window; Age(k) is the number of hours since the k-th trigger keyword was last visited; Retain the trigger keywords in the database whose retention time is less than or equal to the minimum retention time and the trigger keywords whose retention time is greater than the minimum retention time and whose weighted scores are greater than the preset scores.
6. The oral medical large model question-answering prediction method based on knowledge retrieval enhancement according to claim 1 is characterized in that: The construction method of the pre-training model includes: using a data set consisting of oral medical related literature and data to fine-tune the embedding model SentenceTransformer in the open source library sentence-transformers; in the fine-tuning process, the maximum mean difference is used to measure the general text domain D G D M The distribution difference of Among them, MMD (D G ,D M ) is a general text field D G D M Differences in distribution of is the feature mapping function; n G and n M D G and D M The number of samples; x i and x j are single samples in the dataset respectively; ||·|| is the difference in the mean of the embedding distribution used to calculate the two domains.
7. The oral medical large model question-answer prediction method based on knowledge retrieval enhancement according to any one of claims 1 to 6, characterized in that: The expression for calculating similarity is: Among them, X T is the transposition of the semantic vector representation of the question entered by the user; T is the transposition symbol; K i is the semantic vector representation of the i-th trigger keyword in the knowledge base, ||X||=||K i ||=1; |·| is the absolute value symbol; ||·|| is used to calculate the difference in the mean of the embedding distribution of the two fields; The model input question P in step S4 x The expression is: M x ={i|S(X T ,K i )≥τ y } Among them, M x The set of trigger keywords and their structured prompt information corresponding to the similarity that meets the conditions; τ y is the preset threshold.
8. The oral medical large model question-answer prediction method based on knowledge retrieval enhancement according to any one of claims 1 to 6, characterized in that: The pre-trained model combines the user input question x and each trigger keyword k in the knowledge base i Mapped to normalized semantic vector representation: ||X||=||K i ||=1 in, is the vectorized embedding encoder; X is the semantic vector representation corresponding to x; K i k i The corresponding semantic vector representation.
Citation Information
Patent Citations
An extreme value gradient lifting logistic regression classification prediction method
CN109409426A
Code processing model training method and device, electronic equipment and storage medium
CN116820429A
Medical question and answer text generation method and equipment based on retrieval enhancement generation
CN117763114A
Guide method based on large model
CN118069812A
Method for using small sample lora to finely adjust and pre-train transformer for automatic customer service question and answer
CN118113838A