Dietary nutrition survey method and device based on large model and storage medium
Through the circular question-and-answer survey method based on the big model, the dietary nutrition data of the target users were obtained, and the problem that the existing survey methods were not convenient and accurate was solved, and more efficient and accurate generation of dietary nutrition survey reports was achieved.
Patent Information
- Application Number
- CN202411979217.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
AI Technical Summary
The existing dietary nutrition survey methods are not convenient and accurate enough, making it difficult for patients to recall their diet accurately, and the number of nutritionists is insufficient and the ability is uneven, resulting in inaccurate investigation results.
A dietary nutrition survey method based on a large model is used to send question information to the target user through circular question-and-answer methods, obtain their health data, including medical history, recent health status and living and eating habits, and generate a dietary nutrition survey report based on the user's answers.
It improves the convenience and accuracy of dietary nutrition surveys, ensures that the multi-round conversation process does not deviate from the predetermined direction, and dynamically adjusts the Q&A content, thereby improving the accuracy of survey reports.
Smart Images

Figure CN119920388A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to a dietary nutrition survey method, device and storage medium based on a large model. Background Art
[0002] Dietary nutrition surveys are a key means of understanding the nutrition and health status of a population. Survey methods based on manual statistics mainly rely on the cooperation of patients and nutritionists, but patients often cannot accurately recall their diets over the past few days, and the amount of food they eat cannot be assessed, which increases the inaccuracy of the survey results. At the same time, there is a shortage of nutritionists, their abilities vary, and dietary nutrition surveys rely on manual work, with limited personal time and a limited number of people who can be managed, which increases the difficulty of conducting dietary nutrition surveys. Most of the methods that use dietary survey auxiliary tools are based on statistical analysis of data collected by sensors. On the one hand, it is inconvenient to use, and on the other hand, the collected data also needs to be evaluated by professional nutritionists after processing to obtain relatively accurate results. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a dietary nutrition survey method, device and storage medium based on a large model, so as to solve the problem that dietary nutrition surveys in the prior art are not convenient and accurate enough.
[0004] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a dietary nutrition survey method based on a macro model, the method comprising:
[0005] In response to the dietary nutrition survey needs of the target user, the dietary nutrition big model is controlled to send multiple question information to the target user; the multiple question information is sent based on a circular question-answering method and is used to obtain the health data of the target user, and the health data at least includes medical history, recent health status and living and eating habits; the remaining question information except the first question information is generated by the dietary nutrition big model based on the target user's answer text of all the aforementioned question information;
[0006] When the health data of the target user is obtained according to the answer text of the target user to each question information, the dietary nutrition model is controlled to generate a dietary nutrition survey report of the target user.
[0007] In an embodiment of the present application, the steps for generating any question information except the first question information include: obtaining the features to be compared in the answer text of the target user of all the aforementioned question information; comparing the features to be compared with the expected features based on the log-likelihood loss algorithm; the expected features correspond to all the aforementioned question information; and generating the current question information based on the comparison results.
[0008] In an embodiment of the present application, the steps of constructing a dietary nutrition big model include: obtaining dietary nutrition knowledge text and medical field knowledge text; respectively determining the medical category corresponding to each medical entity in the medical field knowledge text; determining the relationship between different medical entities in the medical field knowledge text according to the medical category corresponding to each medical entity; determining the attribute value corresponding to each medical entity according to the medical field knowledge text; determining the first similarity between different medical entities; determining the second similarity between different relationships; determining a medical knowledge graph according to the first similarity, the second similarity, and the attribute value; vectorizing the dietary nutrition knowledge text to determine a dietary nutrition vector library; and constructing a dietary nutrition big model based on the medical knowledge graph and the dietary nutrition vector library.
[0009] In an embodiment of the present application, respectively determining the medical category corresponding to each medical entity in the medical field knowledge text includes: annotating each medical entity in the medical field knowledge text based on the BIO annotation method to obtain the corresponding annotated text; inputting the annotated text into a pre-trained BERT model for encoding to obtain vector information of each word in the annotated text; inputting the vector information into a Softmax classifier to determine the medical category corresponding to each word; the medical category includes at least diseases, symptoms and drugs.
[0010] In an embodiment of the present application, determining the relationship between different medical entities in a medical field knowledge text according to the medical category corresponding to each medical entity includes: determining the vocabulary-level features in the medical field knowledge text based on the medical category corresponding to each medical entity; determining the sentence-level features in the medical field knowledge text based on a convolutional method; inputting the comprehensive feature vector into a classifier to predict the relationship between different medical entities in the medical field knowledge text; the comprehensive feature vector is obtained by concatenating vocabulary-level features and sentence-level features.
[0011] In an embodiment of the present application, determining the attribute value corresponding to each medical entity based on the medical field knowledge text includes: identifying the sentence pattern text in the medical field knowledge text based on the MetaPAD method; filtering the sentence pattern text through a preset high-quality sentence pattern library, and using the noun phrases in the filtered sentence pattern text as candidate attribute words; generating an attribute dictionary based on all candidate attribute words; performing attribute matching on the noun phrases in each medical entity based on the attribute dictionary, and using the successfully matched noun phrases as the attribute values of the corresponding medical entity.
[0012] In an embodiment of the present application, determining the first similarity between different medical entities includes: determining the first similarity between different medical entities based on a pre-trained Word2Vec model and a cosine similarity algorithm.
[0013] In an embodiment of the present application, determining the second similarity between different relationships includes: determining the feature set corresponding to each relationship respectively; the feature set includes vocabulary-level features and sentence-level features corresponding to the relationship; and calculating the Jaccard coefficient value of the feature set corresponding to different relationships to determine the second similarity between different relationships.
[0014] In an embodiment of the present application, the method also includes: constructing a basic question and answer data set for a dietary nutrition big model; the basic question and answer data set is used to train the dietary nutrition big model to learn basic knowledge in the medical field and the dietary nutrition field; constructing a reasoning question and answer data set for the dietary nutrition big model; the reasoning question and answer data set is used to train the dietary nutrition big model to perform logical association reasoning on multiple knowledge points in the medical field and the dietary nutrition field; constructing a task question and answer data set for the dietary nutrition big model; the task question and answer data set is used to train the dietary nutrition big model to integrate and output multiple knowledge points in the medical field and the dietary nutrition field; and gradually optimizing the dietary nutrition big model based on the basic question and answer data set, the reasoning question and answer data set, and the task question and answer data set.
[0015] In an embodiment of the present application, in response to the active question text of the target user, the field to which the active question text belongs is determined; when the field is the medical field, the dietary nutrition big model is controlled to search the active question text in the medical knowledge graph based on the graph retrieval enhancement generation technology and the graph traversal algorithm, and generate answer information for the active question text based on the retrieved relevant information; when the field is the dietary nutrition field, the dietary nutrition big model is controlled to search the active question text in the dietary nutrition vector library based on the named entity full-text retrieval technology, and generate answer information for the active question text based on the retrieved relevant information.
[0016] The second aspect of the present application provides a dietary nutrition survey device based on a large model, including: a question information sending module, which is used to respond to the dietary nutrition survey needs of the target user and control the dietary nutrition large model to send multiple question information to the target user; the multiple question information is sent based on a circular question and answer method and is used to obtain the health characteristics of the target user, and the health characteristics include at least medical history, recent health status and living and eating habits; the remaining question information except the first question information is generated by the dietary nutrition large model based on the target user's answer text of all the aforementioned question information; a report generation module is used to obtain the health characteristics of the target user in the answer text of each question information, and control the dietary nutrition large model to generate a dietary nutrition survey report for the target user according to the health characteristics.
[0017] The third aspect of the present application provides a dietary nutrition survey device based on a large model, comprising:
[0018] a memory configured to store instructions; and
[0019] The processor is configured to call instructions from the memory and implement the above-mentioned dietary nutrition survey method based on the large model when executing the instructions.
[0020] A fourth aspect of the present application provides a machine-readable storage medium having stored thereon instructions for enabling a machine to execute the above-mentioned large-model-based dietary nutrition survey method.
[0021] Through the above technical scheme, in response to the dietary nutrition survey needs of the target user, the dietary nutrition big model is controlled to send multiple question information to the target user based on a circular question-and-answer method and obtain the health characteristics of the target user; the remaining question information except the first question information is generated by the dietary nutrition big model based on the target user's answer text of all the aforementioned question information; the health characteristics of the target user in the answer text for each question information are obtained, and the dietary nutrition big model is controlled to generate a dietary nutrition survey report for the target user based on the health characteristics. Thus, the dietary nutrition big model can be driven according to the target user's answer text and health characteristics after each round of question-and-answer, ensuring that the multi-round conversation process does not deviate from the predetermined direction and can dynamically adjust the question-and-answer content, thereby improving the accuracy of the dietary nutrition survey report.
[0022] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0024] Figure 1 A flowchart of a dietary nutrition survey method based on a large model according to an embodiment of the present application is schematically shown;
[0025] Figure 2 The structure block diagram of a dietary nutrition investigation device based on a large model according to an embodiment of the present application is schematically shown;
[0026] Figure 3 The structural block diagram of a dietary nutrition survey device based on a large model according to an embodiment of the present application is schematically shown;
[0027] Figure 4 A flowchart of another dietary nutrition survey method based on a large model according to an embodiment of the present application is schematically shown;
[0028] Figure 5 A flowchart for constructing a general medicine knowledge graph according to an embodiment of the present application is schematically shown;
[0029] Figure 6 A tree diagram of dietary nutrition survey directions based on a large model according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0031] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0032] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0033] Figure 1 The flowchart of a dietary nutrition survey method based on a large model according to an embodiment of the present application is schematically shown. Figure 1 As shown, an embodiment of the present application provides a dietary nutrition survey method based on a large model, which may include the following steps.
[0034] Step 101: In response to the dietary nutrition survey needs of the target user, control the dietary nutrition big model to send multiple question information to the target user; the multiple question information is sent based on a circular question-and-answer method and is used to obtain the health data of the target user, and the health data at least includes medical history, recent health status and living and eating habits; the remaining question information except the first question information is generated by the dietary nutrition big model based on the target user's answer text of all the aforementioned question information.
[0035] In an embodiment of the present application, the dietary nutrition model can be a large language model based on artificial intelligence, which is specifically used to process dietary and nutrition-related data. Through the dietary nutrition model, the dietary nutrition survey results can be automatically collected, analyzed and generated. The dietary nutrition model can combine medical field knowledge (such as diseases, symptoms and treatment methods, etc.) and dietary nutrition knowledge to support more accurate nutritional analysis and personalized dietary recommendations. Question information can refer to the questions asked by the large model to the user, aiming to collect information such as the user's health data and eating habits. The user is gradually guided to answer questions through a series of continuous question-and-answer processes. In each round of questions and answers, the large model can dynamically adjust subsequent questions according to the user's answers to ensure the depth and accuracy of the investigation. Each round of questions and answers focuses on different health dimensions, such as asking about medical history, living habits, etc., to ensure that the investigation comprehensively covers all types of health data of the user. The circular question-and-answer method can make the investigation process more flexible, and can also adjust subsequent questions according to the user's answers to adapt to the specific circumstances of different users.
[0036] Step 102: When the health data of the target user is obtained according to the answer text of the target user to each question information, the dietary nutrition model is controlled to generate a dietary nutrition survey report of the target user.
[0037] In an embodiment of the present application, the large model may first ask the target user a basic survey question (for example, asking about the user's health status or eating habits). This question is the starting point of the survey and is used to construct the user's health feature map. After the user answers the first question, subsequent questions will be dynamically adjusted based on all previous answers. This dynamic adjustment ensures that the large model can gradually gain a deeper understanding of its dietary status and health needs based on the health feature information provided by the user. Each new question is based on the answers to all the aforementioned questions and further guides the model to collect more relevant data. The large model can adjust subsequent questions based on health features based on the answers to all the aforementioned questions. For example, if the user mentions that he has high blood pressure, the model may then ask about eating habits, such as "Is your diet high in salt? How much sodium do you usually consume?" Based on the user's health and dietary characteristics, the dietary nutrition large model can generate specific dietary recommendations and can be optimized and adjusted based on user feedback. The generation process of the entire dietary nutrition survey report is based on multiple rounds of dynamic questions and answers, and each question is adjusted around the answers to all the aforementioned questions. In this way, the model can generate personalized dietary nutrition recommendations while continuously gaining a deeper understanding of the health characteristics of the target user.
[0038] Through the above technical solution, the dietary nutrition model will first obtain the user's health characteristics, and conduct multiple rounds of conversations with the target user driven by health characteristics, and generate a dietary nutrition survey report based on the user's answer information and the information collected by the big model. The question information and the final report generated by the big model each time are based on the user's health characteristics. Therefore, the accuracy of the dietary nutrition report can be improved.
[0039] In an embodiment of the present application, the steps for generating any question information except the first question information include: obtaining the features to be compared in the answer text of the target user of all the aforementioned question information; comparing the features to be compared with the expected features based on the log-likelihood loss algorithm; the expected features correspond to all the aforementioned question information; and generating the current question information based on the comparison results.
[0040] In the embodiment of the present application, the features to be compared are key information extracted from the user's answer text, such as the user's dietary preferences, weight changes, etc. The expected feature refers to the preset characteristic value of the large model for a certain question, such as the range of possible answers to the question "weight change". The log-likelihood loss algorithm is a mathematical method used to calculate the degree of match between the user's answer and the expected feature and output a score. The log-likelihood loss algorithm is shown in formula (1):
[0041]
[0042] Among them, K represents the scaling factor, which is used to scale the loss; represents the expectation on the sample set D, (x,y + ,y - ) represents an input sample and its positive label y+ and negative label y-. θ (x,y + ) and r θ (x,y - ) represents the score of the large model for the input sample x and label y+ or y-.
[0043] In an embodiment of the present application, the steps of constructing a dietary nutrition big model include: obtaining dietary nutrition knowledge text and medical field knowledge text; respectively determining the medical category corresponding to each medical entity in the medical field knowledge text; determining the relationship between different medical entities in the medical field knowledge text according to the medical category corresponding to each medical entity; determining the attribute value corresponding to each medical entity according to the medical field knowledge text; determining the first similarity between different medical entities; determining the second similarity between different relationships; determining a medical knowledge graph according to the first similarity, the second similarity, and the attribute value; vectorizing the dietary nutrition knowledge text to determine a dietary nutrition vector library; and constructing a dietary nutrition big model based on the medical knowledge graph and the dietary nutrition vector library.
[0044] In the embodiment of the present application, the dietary nutrition knowledge text may include dietary guidelines, nutrition books, academic articles, knowledge related to nutrients and food, etc. The medical field knowledge text may include professional knowledge in related fields such as medical literature, disease symptoms, drug information, treatment plans, medical research reports, etc. These texts will be used as data sources for further knowledge graph construction and model training. Medical entities such as diseases (such as "diabetes"), symptoms (such as "headache"), drugs (such as "aspirin"), etc. are identified from the medical field knowledge text. According to the identified medical entities, the corresponding medical categories are classified. For example, "diabetes" belongs to the "disease" category, "headache" belongs to the "symptom" category, and "aspirin" belongs to the "drug" category. According to the description related to each medical entity in the medical text, the corresponding attribute values are extracted. For example, the attribute values of "aspirin" may include "anti-inflammatory drugs", "antipyretic analgesic", etc. The attribute values of each medical entity describe its functions, effects, side effects, etc. Details. These attribute values are an important part of building a medical knowledge graph. By analyzing the sentence structure in the medical field knowledge text, the relationship between multiple medical entities is determined. For example, "aspirin for headache" indicates the therapeutic relationship between "aspirin" and "headache". To calculate the similarity between two medical entities, word vectors (such as Word2Vec, BERT and other models) are usually used to measure their semantic similarity. It can be determined whether the relationship between the two entities is close in medical knowledge. The similarity of the relationship between medical entities is further calculated. For example, "treatment" and "prevention" may belong to similar relationship categories. Similarity algorithms (such as cosine similarity) are used to judge the similarity between different types of relationships to ensure that different relationships are properly classified in the graph. All identified medical entities, attribute values, relationships and their similarities are integrated into the medical knowledge graph. The graph can comprehensively reflect the complex relationships between different entities in the medical field. Specifically, the structure in the graph may include: nodes: representing medical entities, such as diseases, symptoms, drugs, etc.; edges: representing the relationships between these entities, such as treatment, initiation, prevention, etc.; attributes: each entity and relationship will be accompanied by attribute values to enhance the richness of the graph.
[0045] Use vectorization technology (such as BERT, TF-IDF or Word2Vec) to convert dietary nutrition knowledge text into vector representation. This process converts text data in the field of dietary nutrition into a digital format that can be processed by machine learning models. The vectorized dietary nutrition knowledge text is stored as a dietary nutrition vector library for subsequent retrieval, matching and generation tasks. The library includes knowledge related to diet and nutrition, and is effectively represented by vectorization. Based on the already constructed medical knowledge graph and dietary nutrition vector library, combined with large-scale pre-trained models (such as GPT, BERT, etc.), a dietary nutrition model is constructed. By integrating knowledge in the fields of medicine and dietary nutrition, the dietary nutrition model can provide scientific and personalized solutions when facing complex health problems, such as dietary intervention for a certain disease, nutritional intake recommendations, etc.
[0046] In an embodiment of the present application, respectively determining the medical category corresponding to each medical entity in the medical field knowledge text includes: annotating each medical entity in the medical field knowledge text based on the BIO annotation method to obtain the corresponding annotated text; inputting the annotated text into a pre-trained BERT model for encoding to obtain vector information of each word in the annotated text; inputting the vector information into a Softmax classifier to determine the medical category corresponding to each word; the medical category includes at least diseases, symptoms and drugs.
[0047] In an embodiment of the present application, in natural language processing (NLP), BIO annotation is a standard method commonly used to annotate entities. This method marks each word of the entity in the text, and the annotation format is: B-(Begin): indicates the beginning part of the entity. I-(Inside): indicates the internal part of the entity. O(Outside): indicates that the word is not part of any entity. For example, for the text "Aspirin for headache treatment", the annotation result can be: "Aspirin" → B-drug; "Treatment" → O; "Headache" → B-symptom. BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language representation model that can understand the meaning of words in context. BERT generates a context-aware representation (i.e., word vector) for each word through bidirectional context learning, which contains the semantic information of the vocabulary. The annotated medical text (e.g., "B-drug aspirin") is passed as input to the pre-trained BERT model. The BERT model converts each word into a word vector, which is multidimensional and contains the semantic information of the word in a specific context. The word vectors generated by BERT not only consider the meaning of the word itself, but also include the relationship between the word and other words in the context, which makes the large model more accurate when dealing with polysemous words or complex sentences. Softmax is a commonly used multi-class classification method that converts the continuous value output by the model into a probability distribution. For each input word vector, the Softmax classifier calculates the probability of each category and takes the category with the highest probability as the predicted category of the word. The word vector output by the BERT model is input into the Softmax classifier; the Softmax classifier calculates the category probability for each word vector; and the category with the highest probability is selected as the final classification result of the word. For example, for the text "Aspirin for headache", the Softmax classifier will recognize that "aspirin" belongs to the drug category and "headache" belongs to the symptom category. Each word output in the end will be classified into the corresponding medical category, such as drugs, diseases, symptoms, etc.
[0048] In an embodiment of the present application, determining the relationship between different medical entities in a medical field knowledge text according to the medical category corresponding to each medical entity includes: determining the vocabulary-level features in the medical field knowledge text based on the medical category corresponding to each medical entity; determining the sentence-level features in the medical field knowledge text based on a convolutional method; inputting the comprehensive feature vector into a classifier to predict the relationship between different medical entities in the medical field knowledge text; the comprehensive feature vector is obtained by concatenating vocabulary-level features and sentence-level features.
[0049] In an embodiment of the present application, determining the attribute value corresponding to each medical entity based on the medical field knowledge text includes: identifying the sentence pattern text in the medical field knowledge text based on the MetaPAD method; filtering the sentence pattern text through a preset high-quality sentence pattern library, and using the noun phrases in the filtered sentence pattern text as candidate attribute words; generating an attribute dictionary based on all candidate attribute words; performing attribute matching on the noun phrases in each medical entity based on the attribute dictionary, and using the successfully matched noun phrases as the attribute values of the corresponding medical entity.
[0050] In the embodiment of the present application, the MetaPAD method is a technology that focuses on mining fixed patterns from text. By identifying common sentence structures, MetaPAD can extract sentence patterns with specific semantic features. For example, for the medical text "Aspirin has anti-inflammatory and antipyretic and analgesic effects", MetaPAD can identify the sentence pattern "[entity] has [effect]". Sentence pattern text refers to semantically structured fragments extracted from medical field knowledge text by MetaPAD. These patterns are often used to describe medical entities and their attributes. A high-quality sentence pattern feature recognition library can be a preset library containing common and high-quality sentence patterns for screening out meaningful sentences. For example: "[entity] has [effect]"; "[entity] leads to [result]"; "[entity] contains [ingredients]". The sentence pattern text identified by the MetaPAD method is matched with the recognition library, and only the text matching the high-quality sentence pattern features is retained. Before filtering: irrelevant patterns may be included, such as "patients rest after taking aspirin". After filtering: only patterns with clear attribute descriptions are retained, such as "Aspirin has anti-inflammatory effects". Extract noun phrases from the filtered sentence patterns. Noun phrases are usually used to describe the attributes of medical entities. For example, the sentence pattern: "Aspirin has anti-inflammatory effects", the extracted noun phrase: "anti-inflammatory effect". These noun phrases are initially screened as candidate attribute words, which may contain keywords related to the attributes of medical entities. A high-quality term list can be an optimized set of medical terms used to describe the characteristics of medical entities. After further screening and cleaning, the candidate attribute words are added to the term list to ensure their high quality and accuracy. Match the terms in the high-quality term list with the medical domain knowledge text to identify noun phrases in the text that are consistent with the term list. For example, the text: "Ibuprofen is an antipyretic and analgesic drug", matching term: "antipyretic and analgesic". The successfully matched noun phrases are used as attribute values of the medical entity to describe the characteristics of the entity. For example, entity: ibuprofen; attribute value: antipyretic and analgesic, anti-inflammatory.
[0051] In an embodiment of the present application, determining the first similarity between different medical entities includes: determining the first similarity between different medical entities based on a pre-trained Word2Vec model and a cosine similarity algorithm.
[0052] In an embodiment of the present application, the vocabulary-level feature may refer to the semantic information of each word in the context, which is usually represented by a word vector. The text in the medical field is input into the model to extract the semantic features of each word; the medical entities (such as diseases, drugs, symptoms) in the text are marked using medical entity recognition technology (such as NER); the vocabulary-level features of each word are extracted to represent the meaning and function of the word in the context. By analyzing the overall structure of the sentence, the relationship between words and contextual information are captured. This feature helps the model understand the meaning of the entire sentence, not just the semantics of a single word. The word vectors of the text are processed using a convolutional neural network (CNN); the convolution kernel (Filters) can capture patterns within a fixed window size (such as "drugs to treat diseases"); semantic features in the sentence are extracted through multiple levels of convolution to generate sentence-level feature vectors. Combined with sentence-level features, the model can better understand the semantic relationship between medical entities. For example, the sentence-level features in "aspirin treats headaches" emphasize the action of "treatment" and establish a relationship between "aspirin" and "headaches." Combine vocabulary-level features (information at the word level) and sentence-level features (information at the whole sentence level) and input them into a classifier (such as a Softmax classifier). The classifier predicts the specific relationship between two medical entities based on the preset relationship categories (such as treatment, initiation, prevention, etc.). For example, the text: "Aspirin treats headaches", medical entity 1: aspirin (drug), medical entity 2: headache (symptom), relationship: treatment. The output can be: the specific relationship between different medical entities (such as "treatment", "initiation", "prevention", etc.).
[0053] The pre-trained Word2Vec model maps each word or entity to a high-dimensional vector (word vector), which retains the semantic information of the word or entity. The similarity between entities can be calculated by comparing their vector representations. Cosine similarity is used to measure the similarity between two vectors, and its value is between 0 and 1. As shown in formula (2):
[0054]
[0055] Among them, A and B represent the word vector representations of two different entities respectively, and · represents the dot product operation.
[0056] The first similarity is used to quantify the semantic proximity of two medical entities. For example, entity 1: "hypertension", entity 2: "elevated blood pressure", by calculating the cosine similarity, determine whether the similarity between the two is high enough to determine whether they can be regarded as associated entities. Vocabulary-level features and sentence-level features can be used to capture the semantic information of medical entities in the text. Relationship prediction combines medical categories and text features to determine the specific relationship between entities (such as "treatment" or "initiation"). Cosine similarity can provide support for the construction of medical knowledge graphs by quantifying the similarity between entities (first similarity).
[0057] In an embodiment of the present application, determining the second similarity between different relationships includes: determining the feature set corresponding to each relationship respectively; the feature set includes vocabulary-level features and sentence-level features corresponding to the relationship; and calculating the Jaccard coefficient value of the feature set corresponding to different relationships to determine the second similarity between different relationships.
[0058] In the embodiment of the present application, the characteristic value of a relationship refers to the core attribute or content of the relationship between medical entities. For example, the characteristic value of the relationship "Aspirin for headache treatment" may include: participating entities: aspirin (drug), headache (symptom); relationship type: treatment; related description: relieve symptoms. The characteristic value of each relationship can be represented as a set, which contains the important characteristics of the relationship. For example, relationship A ("Aspirin for headache treatment"): {aspirin, headache, treatment}; relationship B ("Ibuprofen for headache treatment"): {ibuprofen, headache, treatment}. The Jaccard algorithm is used to measure the similarity between two sets, as shown in formula (3):
[0059]
[0060] Among them, |C∩D| represents the size of the intersection of two sets (the number of common features), |C∪D| represents the size of the union of two sets (the total number of all features, without duplication), and C and D represent the eigenvalue sets of the two relations.
[0061] Prepare the feature set corresponding to the relationship: For each relationship of the medical entity, extract its feature value and represent it as a set. For example, relationship A: Aspirin treats headache → feature value set {aspirin, headache, treatment}, relationship B: Ibuprofen treats headache → feature value set {ibuprofen, headache, treatment}, relationship C: Aspirin triggers allergy → feature value set {aspirin, allergy, trigger}. Calculate the intersection and union: Calculate the intersection and union between the feature value sets of two relationships. For example, relationship A and relationship B: intersection: {headache, treatment}; union: {aspirin, ibuprofen, headache, treatment}. Relationship A and relationship C: intersection: {aspirin}; union: {aspirin, headache, treatment, allergy, trigger}. Apply the Jaccard algorithm: Calculate the Jaccard similarity based on the size of the intersection and union: The similarity between relationship A and relationship B is 2 / 4 = 0.5. The similarity between relationship A and relationship C is 1 / 5 = 0.2. Jaccard similarity provides a standard for quantifying the similarity between two relations. The similarity value ranges from 0 to 1: 0 means completely dissimilar, and 1 means exactly the same. If the similarity of two relations is higher than a set threshold (for example, 0.7), they can be merged into one relation. By calculating the second similarity, the redundancy of relations in the graph can be simplified and the quality of the graph can be improved.
[0062] In an embodiment of the present application, the method also includes: constructing a basic question and answer data set for a dietary nutrition big model; the basic question and answer data set is used to train the dietary nutrition big model to learn basic knowledge in the medical field and the dietary nutrition field; constructing a reasoning question and answer data set for the dietary nutrition big model; the reasoning question and answer data set is used to train the dietary nutrition big model to perform logical association reasoning on multiple knowledge points in the medical field and the dietary nutrition field; constructing a task question and answer data set for the dietary nutrition big model; the task question and answer data set is used to train the dietary nutrition big model to integrate and output multiple knowledge points in the medical field and the dietary nutrition field; and gradually optimizing the dietary nutrition big model based on the basic question and answer data set, the reasoning question and answer data set, and the task question and answer data set.
[0063] In an embodiment of the present application, the method also includes: responding to the active question text of the target user, determining the field to which the active question text belongs; when the field is the medical field, controlling the dietary nutrition big model to search the active question text in the medical knowledge graph based on the graph retrieval enhancement generation technology and the graph traversal algorithm, and generating answer information for the active question text based on the retrieved relevant information; when the field is the dietary nutrition field, controlling the dietary nutrition big model to search the active question text in the dietary nutrition vector library based on the named entity full-text retrieval technology, and generating answer information for the active question text based on the retrieved relevant information.
[0064] In an embodiment of the present application, in the training of a large model, the following two control strategies are added by extending the loss function to optimize the output: a length penalty strategy, which can be used to control the length of the output text so that it is close to the preset expected length. It is used to ensure that the length of the text generated by the model is close to the preset target length to avoid output that is too long or too short. The output text length generated by the calculation model is compared with the preset text length. If the text length deviates from the preset length range, the penalty signal is fed back to the model during training. The intensity of the penalty signal is adjusted according to the degree of deviation (for example, the greater the length deviation, the stronger the penalty). A length penalty term is introduced in the original loss function (such as cross entropy loss), as shown in formula (4):
[0065]
[0066] Among them, L new (θ) is the loss for the new task; F i is the Fisher information matrix; θ i is the current parameter, θ i * is the optimal parameter for the old task; λ is the regularization parameter used to control the balance between new and old knowledge.
[0067] The logical consistency loss strategy can be used to optimize the semantic coherence and logical accuracy of the output text. It is used to ensure that the output text is semantically and logically coherent to avoid contradictory, inaccurate or contextually incoherent content. Logical consistency evaluation: Perform logical consistency detection on the generated text to evaluate the following aspects: semantic consistency: whether the content between sentences is logically coherent; contextual coherence: whether the output text is related to the input question and whether it conforms to the expected logic; causal correctness: whether the causal relationship is expressed correctly. Logical consistency loss: The deviation of the logical consistency score is incorporated into the loss function as an optimization target. If the generated text is logically incoherent, the model will receive an optimization signal and reduce the logically inconsistent output by adjusting the parameters. As shown in formula (1):
[0068]
[0069] Among them, K represents the scaling factor, which is used to scale the loss; represents the expectation on the sample set D, (x,y + ,y - ) represents an input sample and its positive label y+ and negative label y-. θ (x,y + ) and r θ (x,y - ) represents the score of the large model for the input sample x and label y+ or y-.
[0070] In an embodiment of the present application, the method also includes: responding to the active question text of the target user, determining the field to which the active question text belongs; when the field is the medical field, controlling the dietary nutrition big model to search the active question text in the medical knowledge graph based on the graph retrieval enhancement generation technology and the graph traversal algorithm, and generating an answer text for the active question text based on the retrieved relevant information; when the field is the dietary nutrition field, controlling the dietary nutrition big model to search the question information in the dietary nutrition vector library based on the named entity full-text retrieval technology, and generating an answer text for the active question text based on the retrieved relevant information.
[0071] In the embodiment of the present application, if the question text of the target user involves health, disease, medicine, treatment and other related content, it can be determined that the question belongs to the medical field. If the question text focuses on food, nutrients, eating habits, meal plans and other content, it can be determined that the question belongs to the field of dietary nutrition. First, the big model will use the graph traversal algorithm to traverse the medical knowledge graph. The medical knowledge graph usually contains a large number of medical entities (such as diseases, symptoms, drugs, etc.) and the relationships between them (such as treatment, initiation, prevention, etc.). The user's active question text is matched in the medical knowledge graph according to the graph traversal algorithm, and the nodes and edges related to the question content are found to obtain relevant medical information. According to the retrieved relevant information, the dietary nutrition big model will generate an answer to the active question text. The answer text will be based on the information of the relevant nodes and edges in the graph to ensure medical accuracy and relevance. For example, the user's active question text is "What are the common symptoms of hypertension?" After receiving the active question text, the big model first judges the field to which it belongs, and can determine that it belongs to the medical field. Then, based on the medical knowledge graph, the knowledge of "hypertension" and its related symptoms is searched. And generate relevant answer text, the answer text can be "Common symptoms of hypertension include headache, dizziness, chest pain, etc., and the specific manifestations vary from individual to individual". In the field of dietary nutrition, the dietary nutrition large model will identify named entities in the active question text (for example, food names, nutrients, health indicators, etc.), such as "vitamin D" or "low-fat diet". The named entities in the active question text are converted into vectors and matched with the existing vectors in the dietary nutrition vector library for similarity. The dietary nutrition vector library contains a large amount of vector representation of dietary and nutrition-related knowledge. Based on the retrieved entity information related to the question, generate answer text in the field of dietary nutrition. The intelligent answer mechanism based on domain identification and professional retrieval technology can ensure efficient response to user questions and provide domain-related and accurate answers.
[0072] Through the above technical solutions, we build a medical knowledge graph and a dietary nutrition vector library, combine hierarchical tuning and control strategies, optimize the dietary nutrition model, and drive the question-and-answer content of each round of the model based on the user's health characteristics. This enables the model to have logical reasoning and high-quality text generation in the fields of medicine and diet, and can provide users with personalized and accurate dietary nutrition survey reports.
[0073] The following is a specific embodiment:
[0074] Figure 4 A flowchart of another dietary nutrition survey method based on a large model according to an embodiment of the present application is schematically shown; Figure 4 As shown, in the embodiment of the present application, the process of the dietary nutrition survey method based on the large model can be divided into the following steps.
[0075] 1. Build a knowledge base in the field of dietary nutrition.
[0076] Obtain medical and dietary nutrition related knowledge from multiple channels, including literature from the Chinese Medical Association, Pubmed medical literature, dietary nutrition guidelines, expert consensus, and examination questions for registered dietitians in China and the United States.
[0077] Figure 5 A flowchart of constructing a general medical knowledge graph according to an embodiment of the present application is schematically shown. Figure 5 As shown, in an embodiment of the present application, the process of constructing a general medicine knowledge graph can be divided into the following steps.
[0078] 1.1. Construct a general medicine knowledge graph.
[0079] 1.1.1. Medical entity recognition.
[0080] The BIO annotation method is used to annotate medical entities (including influenza, fever, ibuprofen, etc.) in the medical field knowledge, such as B-diseases represents the beginning of the disease name, I-diseases represents the middle part of the disease name, and O represents non-disease name entities. The text with annotation information is input into the pre-trained BERT model, the text is encoded, and the vector representation of each word is obtained. Finally, these vectors are classified by the Softmax classifier to determine the entity category (including disease, symptom, drug, etc.) to which each word belongs.
[0081] 1.1.2. Medical relationship extraction.
[0082] Convert the words in the text into vectors and learn the vocabulary-level features based on the medical entities extracted in step 1.1.1. Then, use the convolution method to learn the sentence-level features in the text. Concatenate the features of the two levels to form the final extracted feature vector. Finally, input the features into the Softmax classifier to predict the relationship between different entities. Its formula is shown in formula (5), which can be expressed as:
[0083]
[0084] Among them, P(yF) is the predicted probability distribution, W is the convolution kernel, K is the total number of relationship categories, and F is the concatenated feature vector.
[0085] Specifically, for the sentence "The patient took aspirin to relieve headache symptoms", first decompose it into words, such as "patient", "took", "aspirin", "with", etc. And convert each word into a vector representation, such as "aspirin" is represented as a vector [0.5, 0.3, ..., 0.1], and "headache" is represented as a vector [0.4, 0.7, ..., 0.2]. Based on the entities identified in step 1.1.1), the two entities "aspirin" and "headache" are drug and symptom categories, respectively. Next, use a 3-word convolution kernel to extract vocabulary-level features related to "drug" from the phrase "aspirin to relieve", and use a 5-word convolution kernel to extract sentence-level features from "The patient took aspirin to relieve". The two features are concatenated into a comprehensive vector F, which is then input into the Softmax classifier to output the probability distribution of the relationship category, such as "treatment" 0.85, "cause" 0.10, and "irrelevant" 0.05, thereby predicting that the relationship between "aspirin" and "headache" is "treatment", thereby realizing the extraction of the relationship.
[0086] 1.1.3. Medical attribute extraction.
[0087] The MetaPAD method is used to extract patterns from data in the medical field knowledge, and the frequency of different patterns is counted to screen out high-quality sentence patterns that describe entity attributes, and noun phrases are extracted as candidate attribute words. Then, all candidate attribute words are generated into a dictionary, the corpus is re-segmented, and all attribute words are marked as "Attribute". The second pattern extraction is performed, and only patterns related to "Attribute" type words are taken, and the text in them is screened out as attribute values. If some attribute values are found to be complete sentences in the second pattern extraction, the relevant sentences are directly intercepted as attribute values.
[0088] Specifically, take a corpus in the medical field as an example, "Aspirin has anti-inflammatory and antipyretic and analgesic effects", "Vitamin D helps calcium absorption", etc. Using the MetaPAD method, common patterns are extracted, such as "[entity] has [effect]" and "[entity] helps [effect]", and their frequencies are counted. By screening high-quality patterns, such as "has", noun phrases are extracted as candidate attribute words, such as "anti-inflammatory", "antipyretic and analgesic", etc. After generating the attribute dictionary, the original corpus is segmented and the attribute word type is marked as "Attribute", followed by a second pattern extraction, focusing on patterns related to "Attribute", and finally extracting attribute values. For example, "anti-inflammatory" and "antipyretic and analgesic" are extracted as attribute values from "Aspirin has anti-inflammatory and antipyretic and analgesic effects". At this point, the pattern extraction and attribute word generation in the medical field knowledge are completed.
[0089] 1.1.4. Cross-source entity alignment.
[0090] Based on the medical entities from different sources identified in step 1.1.1, the cosine similarity algorithm based on Word2Vec is used to calculate the similarity between entities to determine whether the entities from different sources are the same entity, as shown in formula (2).
[0091]
[0092] Among them, A and B represent the word vector representations of two different entities respectively, and · represents the dot product operation.
[0093] Specifically, data source A contains the entity "hypertension", and data source B contains "blood pressure increase". First, the Word2Vec model is trained using the relevant corpus, and the vector representation of "hypertension" is [0.2, 0.1, 0.3], while the vector of "blood pressure increase" is [0.21, 0.09, 0.31]. The similarity between the two is calculated using the cosine similarity formula. The vector dot product is 0.144, and the vector modulus is 0.1435. The similarity is close to 1, indicating that "hypertension" and "blood pressure increase" are very similar, so they can be judged as the same entity and merged.
[0094] 1.1.5. Relationship alignment and consistency maintenance.
[0095] Based on the medical relationships extracted in step 1.1.2, the Jaccard algorithm is used to calculate the similarity of the relationships and merge the same relationships to ensure that the same relationships under different expressions are unified. The Jaccard algorithm is shown in formula (3):
[0096]
[0097] Among them, C∩D represents the size of the intersection of two sets (the number of common features), C∪D represents the size of the union of two sets (the total number of all features without duplication), and C and D represent the sets of eigenvalues of two relations.
[0098] Specifically, two relations A and B are extracted based on step 1.1.2). Relation A is to lower blood pressure, and its feature set A = {drugs, lifestyle changes, dietary control}; Relation B is to control blood pressure, and its feature set B = {drugs, dietary control, regular exercise, lifestyle changes}. First, calculate the size of the intersection of the two sets A and B, that is; secondly, calculate the size of the union of the two sets A and B, that is; finally, calculate the Jaccard value to be 0.75. At this point, the Jaccard values of relations A and B are greater than the threshold value of 0.7, and the two relations are merged into the same relation.
[0099] 1.1.6. Build a knowledge graph.
[0100] Based on steps 1.1.4 and 1.1.5, a hierarchical knowledge fusion algorithm was used to merge the same or similar entities from multiple sources and accurately identify them based on contextual information. Finally, a general medicine knowledge graph was constructed, with 104.42 million triples, 22.35 million concepts, and 46.43 million terms, involving 43 types of relationships such as genetic factors, etiology, clinical manifestations, pathogenesis, and high-risk factors.
[0101] Specifically, we first build a hierarchical graph structure based on the semantics and contextual information of entities and relationships. For example, we take "antibiotics" as a subclass and aggregate similar "drug" entities. And based on the similarity-based merging strategy, we use contextual information to enhance the accuracy of the merging. Then, we design the knowledge graph structure, clarify the various entities (such as diseases, drugs, etc.) and their attributes (such as name, category, efficacy, etc.) in the knowledge graph, define the relationships between entities (such as "treatment", "having", "influence", etc.), and establish semantics for each relationship.
[0102] 1.2. Build a dietary nutrition vector library.
[0103] First, regular expressions are used to identify and remove special characters, punctuation marks and extra blanks in the dietary nutrition knowledge text. Spelling and grammatical errors are checked and corrected by the Hunspell tool to ensure that the dietary nutrition knowledge text content is accurate. Secondly, based on punctuation marks such as periods, question marks, exclamation marks, the dietary nutrition knowledge text is segmented into sentences using the NLTK tool. Then, the segmented dietary nutrition knowledge text is input into the BGE model, and each input dietary nutrition knowledge text is converted into a vector of a fixed dimension to vectorize the dietary nutrition knowledge text, and a dietary nutrition vector library is constructed. The dietary nutrition vector library constructed by the present invention includes 3.89 million vectors such as dietary nutrition guidelines, expert consensus, and standards.
[0104] 2. Build a big model in the field of dietary nutrition.
[0105] On the basis of the general large model, external knowledge enhancement is performed by building a combination of general medical knowledge graph and dietary nutrition vector library. The general large model is tuned using continuous learning algorithm and instruction fine-tuning technology to build a dietary nutrition large model. The specific steps are as follows:
[0106] 2.1. External knowledge enhancement.
[0107] Through hybrid knowledge retrieval, the ability to utilize external knowledge is enhanced.
[0108] For the general medicine knowledge graph, the present invention adopts graph retrieval enhancement generation technology, which searches the user input text information and the information in the knowledge graph through the graph traversal algorithm to find the nodes and edges related to the user input. The retrieved relevant information is used as context, combined with the user input, to generate more accurate and in-depth text content.
[0109] For the dietary nutrition vector library, the present invention adopts the named entity full-text search technology, extracts the entity of the user input text information, and then converts the entity into a vector, performs similarity matching with the vector in the dietary nutrition vector library, finds the most relevant entity information, and then generates relevant answers.
[0110] 2.2. Optimization of large models in the field of dietary nutrition.
[0111] 2.2.1. Continuous learning based on EWC algorithm.
[0112] The EWC continuous learning algorithm can be used to dynamically adjust model parameters to ensure that the original knowledge is not forgotten while absorbing knowledge in the fields of medicine and dietary nutrition. The loss function of the EWC algorithm is shown in formula (4):
[0113]
[0114] Among them, L new(θ) is the loss for the new task; F i is the Fisher information matrix; θ i is the current parameter, θ i * is the optimal parameter for the old task; λ is the regularization parameter used to control the balance between new and old knowledge.
[0115] Specifically, the Fisher information matrix is first calculated on the pre-training data using a general large model to identify the parameters in the original knowledge that have the greatest impact on the overall model's understanding ability. Then, when training new tasks (knowledge in the fields of medicine and dietary nutrition), the EWC regularization term is introduced to limit the update of important parameters. The high weights in the Fisher information matrix (i.e., parameters with larger Fisher values) will be more protected, and the updates of these parameters will be subject to more constraints to ensure that they do not deviate from the optimal values of the general large model. In order to ensure that the original knowledge is not forgotten, preferably, the regularization parameter is set to 1000.
[0116] 2.2.2. Instruction fine-tuning technology for layered strategy.
[0117] Design instruction fine-tuning datasets covering complex question-answering, analytical reasoning and other tasks in the fields of medicine and dietary nutrition. In the fine-tuning process, a hierarchical strategy is used for gradual optimization: starting from basic knowledge question-answering, gradually adding cross-knowledge point association reasoning and complex generation tasks to enhance the model's reasoning and generation capabilities in the fields of medicine and dietary nutrition. At the same time, a control strategy term is introduced into the loss function. In the short answer task, a length penalty is set so that the model automatically adjusts the output length; in the detailed answer, the coherence and accuracy of the output are optimized through the logical consistency loss. The length penalty can be expressed as shown in formula (6):
[0118] L total =L cross-entropy +α×length penalty (6)
[0119] Among them, L cross-entropy is the original cross entropy loss, which is used to measure the accuracy of the generated content; α is the penalty coefficient, which is used to adjust the length of the short answer; length penalty is the penalty length, which is used to control the output length of the dietary nutrition large model answer.
[0120] Specifically, the instruction fine-tuning dataset is divided into three layers according to the complexity of the task: Basic knowledge question-answering layer: contains simple medical and nutritional questions, such as "What is the main function of vitamin D?". The purpose of this layer is to help the model master basic knowledge. Cross-knowledge point association reasoning layer: design complex questions that need to associate multiple knowledge points, such as "What symptoms does vitamin D deficiency cause? Explain its mechanism." This layer strengthens the model's logical reasoning ability. Complex generation task layer: includes generation tasks that require the integration of multiple knowledge points, such as "Design a one-week meal plan for an elderly person with diabetes." This layer aims to improve the model's ability to generate coherent and personalized long texts.
[0121] 3. Dietary nutrition survey based on large models.
[0122] 3.1. Construct a target graph that matches user characteristics.
[0123] Figure 6 A tree diagram of a dietary nutrition survey direction based on a large model according to an embodiment of the present application is schematically shown, such as Figure 6 As shown, in the embodiment of the present application, with dietary nutrition survey as the core, the three dimensions of health history and medical history, recent health changes, and lifestyle and eating habits are used as branches to construct a target graph of user characteristics. Specifically, with a tree diagram as the carrier and dietary nutrition survey as the root node, the three dimensions of health history and medical history, recent health changes, and lifestyle and eating habits are used as branches, and each branch has its own sub-branches. The sub-branches of health history and medical history are family medical history and past medical history. The sub-branches of recent health changes are medication status, nutritional supplements, weight changes, and food intake changes. The sub-branches of lifestyle and eating habits are dietary history, exercise status, and sleep status.
[0124] 3.2. Implement purpose-driven multi-round conversations.
[0125] The large model divides the user's dietary nutrition survey into a series of sub-questions, and gradually guides the user to answer each question through a circular question-and-answer method. In each round of interaction, the large model compares the user's answer with the target graph in real time, and dynamically adjusts the content and direction of subsequent questions and answers. The multi-round conversation process uses a ranking loss function based on log-likelihood, which enables the model to better judge the positive and negative examples of the user's answer, as shown in formula (1).
[0126]
[0127] Among them, K represents the scaling factor, which is used to scale the loss; represents the expectation on the sample set D, (x,y + ,y - ) represents an input sample and its positive label y+ and negative label y-. θ(x,y + ) and r θ (x,y - ) represents the score of the large model for the input sample x and label y+ or y-.
[0128] Specifically, the overall questions of the dietary nutrition survey are first broken down into a series of sub-questions, including the user's basic information, daily dietary preferences, whether there is a family history of disease, etc. The big model asks these sub-questions to the user in turn based on the constructed target graph, and gradually guides the user to answer through multiple rounds of questions and answers. In each round of interaction, the big model compares the user's answer with the expected characteristics of the target graph, and dynamically adjusts the content of subsequent questions and answers in real time based on similarities or differences.
[0129] 3.3. Generate dietary nutrition survey results.
[0130] Based on the results of multiple rounds of conversations between users and a large model in the field of dietary nutrition, specific dietary nutrition survey results are generated.
[0131] Figure 2 The structural block diagram of a dietary nutrition survey device based on a large model according to an embodiment of the present application is schematically shown. Figure 2 The present application also provides a dietary nutrition survey device, including: a question information sending module 210, which is used to respond to the dietary nutrition survey needs of the target user and control the dietary nutrition big model to send multiple question information to the target user; the multiple question information is sent based on a circular question-answering method and is used to obtain the health characteristics of the target user, and the health characteristics at least include medical history, recent health status and living and eating habits; a report generation module 220, which is used to control the dietary nutrition big model to generate a dietary nutrition survey report according to the target user's answer text for each question information; the remaining question information except the first question information is generated by the dietary nutrition big model based on the answer text and health characteristics of all the aforementioned question information.
[0132] Through the above technical solution, the question information sending module 210 responds to the dietary nutrition survey needs of the target user, controls the dietary nutrition model to obtain the health characteristics of the target user, and sends multiple question information to the target user based on a circular question-and-answer method; the remaining question information except the first question information is generated by the dietary nutrition model based on the answer text of all the aforementioned question information and the health characteristics of the target user; the report generation module 220 controls the dietary nutrition model to generate a dietary nutrition survey report according to the target user's answer text for each question information. Thus, the dietary nutrition model can be driven according to the answer information and health characteristics of the target user after each round of question-and-answer, ensuring that the multi-round conversation process does not deviate from the predetermined direction and can dynamically adjust the question-and-answer content, thereby improving the accuracy of the dietary nutrition survey report.
[0133] Figure 3 The structural block diagram of a dietary nutrition survey device based on a large model according to an embodiment of the present application is schematically shown. Figure 3 The present application also provides a dietary nutrition survey device based on a large model, comprising:
[0134] Memory 310, configured to store instructions; and
[0135] The processor 320 is configured to call instructions from the memory and implement the above-mentioned dietary nutrition survey method when executing the instructions.
[0136] Through the above technical solution, the processor 320 responds to the dietary nutrition survey needs of the target user, controls the dietary nutrition model to obtain the health characteristics of the target user, and sends multiple question information to the target user based on a circular question-and-answer method; the remaining question information except the first question information is generated by the dietary nutrition model based on the answer text of all the aforementioned question information and the health characteristics of the target user; the processor 320 controls the dietary nutrition model to generate a dietary nutrition survey report according to the target user's answer text for each question information. As a result, the dietary nutrition model can be driven according to the answer information and health characteristics of the target user after each round of question-and-answer, ensuring that the multi-round conversation process does not deviate from the predetermined direction and can dynamically adjust the question-and-answer content, thereby improving the accuracy of the dietary nutrition survey report.
[0137] The present application also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned large model-based dietary nutrition survey method.
[0138] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0139] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0140] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0141] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0142] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0143] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0144] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0145] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0146] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A dietary nutrition survey method based on a large model, characterized in that: The method comprises: In response to the dietary nutrition survey needs of the target user, the dietary nutrition big model is controlled to send a plurality of question information to the target user; the plurality of question information is sent in a circular question-answering manner and is used to obtain the health data of the target user, the health data at least including medical history, recent health status and living and eating habits; the remaining question information except the first question information is generated by the dietary nutrition big model based on the answer text of the target user of all the aforementioned question information; When the health data of the target user is acquired according to the answer text of the target user to each question information, the dietary nutrition model is controlled to generate a dietary nutrition survey report of the target user.
2. The method according to claim 1, characterized in that The steps for generating any question information other than the first question information include: Obtain the features to be compared in the answer texts of the target user of all the aforementioned question information; Comparing the to-be-compared feature with the expected feature based on a log-likelihood loss algorithm; the expected feature corresponds to all the aforementioned question information; The current question information is generated according to the comparison result.
3. The method according to claim 1 or 2, characterized in that: The steps of constructing the dietary nutrition model include: Obtain dietary nutrition knowledge texts and medical knowledge texts; Determine the medical category corresponding to each medical entity in the medical field knowledge text respectively; Determining the relationship between different medical entities in the medical field knowledge text according to the medical category corresponding to each medical entity; Determine the attribute value corresponding to each medical entity according to the medical field knowledge text; determining a first similarity between different medical entities; determining a second similarity between different of said relations; Determine a medical knowledge graph according to the first similarity, the second similarity, and the attribute value; Vectorizing the dietary nutrition knowledge text to determine a dietary nutrition vector library; The dietary nutrition macro model is constructed based on the medical knowledge graph and the dietary nutrition vector library.
4. The method according to claim 3, characterized in that: The step of respectively determining the medical category corresponding to each medical entity in the medical field knowledge text comprises: Annotate each medical entity in the medical field knowledge text based on the BIO annotation method to obtain a corresponding annotated text; Input the annotated text into the pre-trained BERT model for encoding to obtain vector information of each word in the annotated text; The vector information is input into a Softmax classifier to determine the medical category corresponding to each word; the medical category includes at least diseases, symptoms and drugs.
5. The method according to claim 3, characterized in that: Determining the relationship between different medical entities in the medical field knowledge text according to the medical category corresponding to each medical entity includes: Based on the medical category corresponding to each medical entity, determining the vocabulary-level features in the medical domain knowledge text; Determining sentence-level features in the medical field knowledge text based on a convolutional approach; The comprehensive feature vector is input into the classifier to predict the relationship between different medical entities in the medical field knowledge text; the comprehensive feature vector is obtained by concatenating the vocabulary-level features and the sentence-level features.
6. The method according to claim 3, characterized in that Determining the attribute value corresponding to each medical entity according to the medical field knowledge text includes: Identifying sentence pattern text in the medical field knowledge text based on the MetaPAD method; The sentence pattern text is filtered through a preset high-quality sentence pattern library, and noun phrases in the filtered sentence pattern text are used as candidate attribute words; Generate an attribute dictionary based on all the candidate attribute words; Attribute matching is performed on the noun phrases in each medical entity based on the attribute dictionary, and the successfully matched noun phrases are used as attribute values of the corresponding medical entity.
7. The method according to claim 3, characterized in that Determining the first similarity between different medical entities comprises: Based on the pre-trained Word2Vec model and the cosine similarity algorithm, the first similarity between different medical entities is determined.
8. The method according to claim 5, characterized in that Determining the second similarity between different relationships comprises: Determine the feature set corresponding to each of the relationships respectively; the feature set includes the word-level features and the sentence-level features corresponding to the relationship; The Jaccard coefficient values of the feature sets corresponding to the different relationships are calculated to determine the second similarities between the different relationships.
9. The method according to claim 1 or 2, characterized in that: The method further comprises: Constructing a basic question-answering data set for the dietary nutrition model; the basic question-answering data set is used to train the dietary nutrition model to learn basic knowledge in the medical field and the dietary nutrition field; Constructing a reasoning question-answering dataset of the dietary nutrition big model; the reasoning question-answering dataset is used to train the dietary nutrition big model to perform logical association reasoning on multiple knowledge points in the medical field and the dietary nutrition field; Constructing a task question-answering dataset for the dietary nutrition model; the task question-answering dataset is used to train the dietary nutrition model to integrate and output multiple knowledge points in the medical field and the dietary nutrition field; The dietary nutrition model is gradually tuned based on the basic question and answer dataset, the reasoning question and answer dataset and the task question and answer dataset.
10. The method according to claim 1 or 2, characterized in that: The method further comprises: In response to the active question text of the target user, determining the field to which the active question text belongs; In the case where the field is the medical field, the dietary nutrition macromodel is controlled to search the active question text in the medical knowledge graph based on the graph retrieval enhancement generation technology and the graph traversal algorithm, and generate answer information for the active question text based on the retrieved relevant information; When the field is the dietary nutrition field, the dietary nutrition big model is controlled to search the active question text in the dietary nutrition vector library based on the named entity full-text retrieval technology, and generate answer information for the active question text based on the retrieved relevant information.
11. A dietary nutrition survey device based on a large model, characterized in that: include: A question information sending module, used for responding to the dietary nutrition survey needs of the target user and controlling the dietary nutrition big model to send a plurality of question information to the target user; The multiple question information is sent in a circular question-answering manner and is used to obtain health characteristics of the target user, wherein the health characteristics at least include medical history, recent health conditions, and living and eating habits; The remaining question information except the first question information is generated by the dietary nutrition model based on the target user's answer text of all the aforementioned question information; The report generation module is used to obtain the health characteristics in the answer text of the target user to each question information, and control the dietary nutrition model to generate a dietary nutrition survey report for the target user according to the health characteristics.
12. A dietary nutrition survey device based on a large model, characterized in that: include: a memory configured to store instructions; as well as A processor is configured to call the instructions from the memory and implement the dietary nutrition survey method based on a large model according to any one of claims 1 to 10 when executing the instructions.
13. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores instructions for causing a machine to execute the dietary nutrition survey method based on a large model according to any one of claims 1 to 10.
Citation Information
Cited By
Vaccination question and answer method and device, electronic equipment and storage medium
CN121235126A
Vaccine inoculation question and answer method and device, electronic device, storage medium
CN121235126B