Explainable dietary recommendation generation method and system based on large language model

CN122930403APending Publication Date: 2026-10-16ZHEJIANG WANLI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611164232.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

部分进阶产品配备了智能厨房秤、智能餐盘等单一功能硬件,用于辅助食材称量或进食监测,但其功能仅限于数据采集,未与推荐系统形成深度集成

Benefits of technology

[0018]The aforementioned interpretable dietary recommendation generation method and system based on a large language model utilizes data fusion and standardization of multi-source heterogeneous user data to generate user data objects. This technology enables the integration, unification, and standardized representation of multi-dimensional dietary-related data, addressing the problems of traditional dietary recommendations relying on a single data source, significant differences in data formats from different sources, and fragmented user information leading to incomplete user profiles and a lack of comprehensive data support for subsequent recommendation analysis. Furthermore, by analyzing nutritional needs and extracting health constraints based on user data objects to construct user nutritional profiles, the system achieves precise quantification of personalized nutritional needs and systematic organization of health constraints. This addresses the issues of traditional dietary recommendations relying solely on general nutritional standards, neglecting individual health limitations and personalized differences, resulting in poor adaptability and content that does not align with users' actual health conditions. Finally, by constructing a nutritional knowledge graph and combining it with user nutritional profiles, the system further enhances the understanding of nutritional needs and health conditions. The technology of performing multi-hop reasoning on knowledge graphs to obtain recommended recipes and corresponding knowledge paths enables intelligent matching of personalized recipes based on knowledge associations and traceability of recommendation criteria. This solves the problems of opaque logic, a black-box recommendation process, and unverifiable recommendation criteria in traditional dietary recommendations, which result in a lack of scientific persuasiveness. Furthermore, the technology of mapping knowledge paths to structured explanation templates, assembling structured prompts based on these templates, and then inputting these prompts into a large language model to generate interpretable dietary recommendation text enables the natural language conversion of professional recommendation criteria and the humanized and comprehensible expression of dietary recommendation content. This addresses the problem of traditional dietary recommendations only outputting recipe lists without easily understandable explanations, leading to low user compliance due to users' inability to understand the nutritional and health logic behind the recommendations. This technology improves the accuracy and user acceptance of dietary recommendations and ensures the professionalism and fluency of the explanations provided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122930403A_ABST
    Figure CN122930403A_ABST
Patent Text Reader

Abstract

The application relates to an interpretable meal recommendation generation method and system based on a large language model. The method comprises the following steps: acquiring multi-source heterogeneous user data, obtaining a user data object through data fusion and standardization processing; based on the user data object, performing nutrition demand analysis and health constraint extraction to generate a user nutrition portrait; constructing a nutrition knowledge graph, combining the user nutrition portrait to perform multi-hop reasoning to obtain a recommended recipe and a corresponding knowledge path; mapping the knowledge path to a structured explanation template to assemble and generate a structured prompt word; inputting the structured prompt word into a large language model to generate an interpretable text, and outputting an interpretable meal recommendation text. By using the method, the scientificity and traceability of meal recommendations can be guaranteed by relying on the knowledge graph, understandable explanation content can be generated by combining the large language model, and the accuracy, individuality and interpretability of meal recommendations can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer and artificial intelligence algorithms, and in particular relates to interpretable dietary recommendation generation based on large language models. Background Technology

[0002] With the rapid development of artificial intelligence technology, personalized dietary recommendation systems have received widespread attention in chronic disease prevention and health management. Existing dietary recommendation technologies are mainly divided into two categories: one is collaborative filtering recommendation based on users' historical behavioral data, and the other is rule-based reasoning recommendation based on a nutritional knowledge base. To improve the interactive experience of recommendation results, some solutions in recent years have attempted to introduce large language models for natural language interaction and recommendation explanation generation.

[0003] In traditional technologies, mainstream dietary management products typically employ a pure software architecture, relying on users to manually input dietary information such as ingredient names, quantities, and cooking methods. The system calculates calorie and nutrient intake based on the input data and outputs recipe recommendations based on simple rules or collaborative filtering algorithms. Some advanced products are equipped with single-function hardware such as smart kitchen scales and smart plates to assist in weighing ingredients or monitoring food intake, but their function is limited to data collection and is not deeply integrated with the recommendation system.

[0004] The existing solutions described above have the following technical problems: First, data collection relies on manual user input. Users need to enter the types, quantities, and cooking methods of ingredients for each meal, which is cumbersome and prone to recall bias and estimation errors, resulting in low data quality and poor user engagement. Second, the recommendation results lack interpretability. Existing recommendation algorithms only output binary conclusions of "recommended to eat" or "not recommended to eat," or only provide recipe names and nutritional values. Users cannot understand the nutritional basis and individual adaptation logic behind the recommendations, leading to low trust in the results and weak willingness to follow them. Third, large language models pose a "hallucination" risk in health scenarios. When large language models are used alone for dietary recommendations, they may generate statements that contradict authoritative nutritional science, posing an unacceptable risk in the high-risk scenario of health management, and their reasoning process lacks traceable medical and nutritional evidence. Fourth, the integration scheme of knowledge graphs and large language models is still imperfect. While existing research attempts to combine knowledge graphs and large language models, there is a lack of structured bridging mechanisms between knowledge graph reasoning and large language model generation. Information loss occurs in the mapping process from reasoning results to natural language interpretation. Constraint decoding is mostly coarse-grained graph structure constraints, which fail to be refined to the semantic level of specific entities and relationships, making it difficult to achieve accurate factual consistency guarantees in the generation stage. Summary of the Invention

[0005] Therefore, it is necessary to provide an interpretable dietary recommendation generation method and system based on a large language model that can achieve full-process data collection, reasoning based on authoritative knowledge, and ensure factual consistency, in order to address the above-mentioned technical problems.

[0006] Firstly, this application provides an interpretable dietary recommendation generation method based on a large language model, including:

[0007] Acquire multi-source heterogeneous user data, perform data fusion and standardization on the multi-source heterogeneous user data to obtain user data objects;

[0008] Based on user data objects, nutritional needs are analyzed and health constraints are extracted to generate user nutritional profiles.

[0009] Construct a nutrition knowledge graph, and based on the user's nutrition profile, perform multi-hop reasoning on the nutrition knowledge graph to obtain recommended recipes and the knowledge paths corresponding to the recommended recipes;

[0010] The knowledge path is mapped to a structured explanation template, and structured prompt words are assembled based on the structured explanation template;

[0011] The structured prompts are input into a large language model to generate interpretable text, resulting in interpretable dietary recommendation text.

[0012] Secondly, this application also provides an interpretable dietary recommendation generation system based on a large language model, the system comprising:

[0013] The data acquisition module is used to acquire multi-source heterogeneous user data, perform data fusion and standardization on the multi-source heterogeneous user data, and obtain user data objects;

[0014] The nutrition profile generation module is used to analyze nutritional needs and extract health constraints based on user data objects, and generate user nutrition profiles.

[0015] The nutrition knowledge graph construction module is used to build a nutrition knowledge graph. Based on the user's nutrition profile, it performs multi-hop reasoning on the nutrition knowledge graph to obtain recommended recipes and the knowledge paths corresponding to the recommended recipes.

[0016] The prompt word generation module is used to map knowledge paths into structured explanation templates, and assemble structured prompt words based on the structured explanation templates;

[0017] The recommended text generation module is used to input structured prompts into a large language model to generate interpretable text, resulting in interpretable dietary recommendation text.

[0018] The aforementioned interpretable dietary recommendation generation method and system based on a large language model utilizes data fusion and standardization of multi-source heterogeneous user data to generate user data objects. This technology enables the integration, unification, and standardized representation of multi-dimensional dietary-related data, addressing the problems of traditional dietary recommendations relying on a single data source, significant differences in data formats from different sources, and fragmented user information leading to incomplete user profiles and a lack of comprehensive data support for subsequent recommendation analysis. Furthermore, by analyzing nutritional needs and extracting health constraints based on user data objects to construct user nutritional profiles, the system achieves precise quantification of personalized nutritional needs and systematic organization of health constraints. This addresses the issues of traditional dietary recommendations relying solely on general nutritional standards, neglecting individual health limitations and personalized differences, resulting in poor adaptability and content that does not align with users' actual health conditions. Finally, by constructing a nutritional knowledge graph and combining it with user nutritional profiles, the system further enhances the understanding of nutritional needs and health conditions. The technology of performing multi-hop reasoning on knowledge graphs to obtain recommended recipes and corresponding knowledge paths enables intelligent matching of personalized recipes based on knowledge associations and traceability of recommendation criteria. This solves the problems of opaque logic, a black-box recommendation process, and unverifiable recommendation criteria in traditional dietary recommendations, which result in a lack of scientific persuasiveness. Furthermore, the technology of mapping knowledge paths to structured explanation templates, assembling structured prompts based on these templates, and then inputting these prompts into a large language model to generate interpretable dietary recommendation text enables the natural language conversion of professional recommendation criteria and the humanized and comprehensible expression of dietary recommendation content. This addresses the problem of traditional dietary recommendations only outputting recipe lists without easily understandable explanations, leading to low user compliance due to users' inability to understand the nutritional and health logic behind the recommendations. This technology improves the accuracy and user acceptance of dietary recommendations and ensures the professionalism and fluency of the explanations provided. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart of an interpretable dietary recommendation generation method based on a large language model according to the present invention;

[0021] Figure 2 This is a flowchart illustrating the generation of a user data object in one optional embodiment of the present invention;

[0022] Figure 3This is a structural diagram of an interpretable dietary recommendation generation system based on a large language model according to the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0024] In one embodiment, such as Figure 1 As shown, an interpretable dietary recommendation generation method based on a large language model is provided. This embodiment illustrates the application of this method to a dietary recommendation terminal. It is understood that this method can also be applied to a dietary recommendation server, and further to a dietary recommendation system including both a dietary recommendation terminal and a dietary recommendation server, and is implemented through the interaction between the two. In this embodiment, the method includes the following steps:

[0025] Step S101: Obtain multi-source heterogeneous user data, perform data fusion and standardization on the multi-source heterogeneous user data to obtain user data objects.

[0026] Optionally, the dietary recommendation terminal can acquire user-related data from different sources and in different formats through various data collection channels to obtain multi-source heterogeneous user data; the dietary recommendation terminal can perform time-dimensional alignment processing and structural-dimensional unified transformation on the multi-source heterogeneous user data to obtain fused user data; the dietary recommendation terminal can perform anomaly cleaning and smoothing processing on the fused user data to obtain user data objects.

[0027] Specifically, multi-source heterogeneous user data can be user-related data from different collection channels with different data structures and formats. Multi-source heterogeneous user data can include, but is not limited to, questionnaire survey data, smart hardware collection data, and historical data. Data fusion can be a process of aligning, mapping, and integrating data from multiple sources and in multiple formats. Data fusion can be used to eliminate format differences and time deviations between data. Standardization can be a process of converting multi-source data into a unified data model. User data objects can be a structured set of user data obtained after data fusion and standardization.

[0028] Step S102: Based on the user data object, analyze nutritional needs and extract health constraints to generate a user nutrition profile.

[0029] Optionally, the dietary recommendation terminal can extract the user's basic physiological information from the user data object, and calculate the user's daily energy requirements and recommended intake ranges for various macronutrients based on the basic physiological information; the dietary recommendation terminal can parse the health status information in the user data object and extract nutritional constraint rules; the dietary recommendation terminal can integrate the user's daily energy requirements, recommended intake ranges for various macronutrients, and nutritional constraint rules to construct a user nutritional profile.

[0030] Specifically, nutritional needs analysis can be an analytical process that calculates the recommended daily intake of energy and nutrients based on the user's physiological characteristics; health constraint extraction can be a process of extracting nutritional restriction rules from the user's health status; and user nutrition profile can be a user profile that depicts the user's nutritional needs, health constraints, and intake characteristics.

[0031] Step S103: Construct a nutrition knowledge graph. Based on the user's nutrition profile, perform multi-hop reasoning on the nutrition knowledge graph to obtain recommended recipes and the knowledge paths corresponding to the recommended recipes.

[0032] Optionally, the dietary recommendation terminal can integrate authoritative dietary information, scientific research results, and personalized user data to construct a nutrition knowledge graph. Starting from the needs and constraints in the user's nutrition profile, the dietary recommendation terminal can perform multi-step chain reasoning on the nutrition knowledge graph, gradually select ingredients, combine recipes, and verify health compliance, output recommended recipes that meet the requirements, and at the same time record the entities and relationships passed through in the reasoning process to generate corresponding knowledge paths.

[0033] Specifically, a nutrition knowledge graph can be a structured knowledge network that stores entities such as ingredients, nutrients, diseases, and dietary standards, as well as their interrelationships. A nutrition knowledge graph can be a carrier for knowledge reasoning. Multi-hop reasoning can be a process of reasoning and filtering from a starting node on the knowledge graph through multiple relationship jumps. Multi-hop reasoning can be used to realize the link-based derivation from needs to recipes. Recommended recipes can be dietary plans that meet the user's nutritional needs and health constraints, obtained through reasoning and filtering. A knowledge path can be a complete reasoning link from user needs to recommended recipes.

[0034] Step S104: Map the knowledge path to a structured explanation template, and assemble structured prompt words according to the structured explanation template.

[0035] Optionally, the dietary recommendation terminal can perform triplet splitting and semantic role labeling on entities and relations in the knowledge path, map the knowledge path to different slots of the explanation template, and generate a structured explanation template; the dietary recommendation terminal can concatenate system-level instructions and constraints before the structured explanation template to assemble structured prompt words.

[0036] Specifically, a structured explanation template can be an explanation text framework with fixed slots, where different slots correspond to different explanation elements. The structured explanation template can be used to standardize the structure of the explanation content. Structured prompts can be structured instruction text input into a large language model. Structured prompts can include, but are not limited to, task requirements, explanation elements, and generation constraints. Structured prompts can be used to guide the large language model to generate recommended explanations that meet the requirements.

[0037] Step S105: Input the structured prompts into the large language model to generate interpretable text and obtain interpretable dietary recommendation text.

[0038] Optionally, the dietary recommendation terminal can generate a constrained prefix tree based on the knowledge path; the dietary recommendation terminal can input structured prompt words into a large language model, perform autoregressive token-by-token generation, and constrain the token sampling space during the text generation process according to the constrained prefix tree, and output interpretable dietary recommendation text.

[0039] Specifically, a large language model can be a generative language model pre-trained on a large-scale corpus, possessing the ability to generate and understand natural language, and used to generate fluent and natural recommendation explanation text; interpretable dietary recommendation text can be natural language text containing recommended recipes and corresponding reasons for recommendation, nutritional benefits, and precautions, enabling users to clearly understand the basis for recommendation and improving the interpretability and user acceptance of recommendations.

[0040] In the aforementioned method for generating interpretable dietary recommendations based on a large language model, multi-source heterogeneous user data is acquired and processed through data fusion and standardization to obtain user data objects. Based on these user data objects, nutritional needs are analyzed and health constraints are extracted to generate user nutritional profiles. A nutritional knowledge graph is constructed, and multi-hop reasoning is performed in conjunction with the user nutritional profiles to obtain recommended recipes and corresponding knowledge paths. These knowledge paths are mapped to structured explanation templates and assembled to generate structured prompt words. The structured prompt words are then input into the large language model to generate interpretable text, outputting interpretable dietary recommendation text. This method leverages the knowledge graph to ensure the scientific validity and traceability of dietary recommendations, and combines the large language model to generate easily understandable explanations, thereby improving the accuracy, personalization, and interpretability of dietary recommendations.

[0041] In one embodiment, such as Figure 2 As shown, multi-source heterogeneous user data is acquired, and data fusion and standardization are performed on the multi-source heterogeneous user data to obtain user data objects, which may include:

[0042] Step S201: Obtain the structured questionnaire data returned by the user, acquire real-time collected food spectral data, seasoning measurement data and meal image weight data from the smart hardware terminal, and read the user's historical dietary record data from local persistent storage.

[0043] Optionally, the dietary recommendation terminal can collect structured questionnaire data filled in by users through an online questionnaire interface to obtain information such as users' basic information, health status and dietary preferences; the dietary recommendation terminal can obtain food spectral data output by the food spectral pen, condiment measurement data output by the smart seasoning ring, and food image weight data output by the smart diet plate; the dietary recommendation terminal can read users' past dietary intake from the local database to obtain users' historical dietary record data.

[0044] Specifically, structured questionnaire data can be structured personal information filled in by users through standardized questionnaires. Structured questionnaire data can include, but is not limited to, data such as gender, age, height, weight, medical history, and dietary preferences; food spectral data can be spectral information of food components collected by a food spectral pen. Food spectral data can be used to identify food types and nutritional components; condiment measurement data can be condiment usage data collected by a smart condiment ring. Condiment measurement data can be used to calculate dietary intake of sodium and oil; meal image and weight data can be meal images and corresponding weight data collected by a smart meal plate. Meal image and weight data can be used to estimate meal intake; historical dietary record data can be users' dietary intake records over a period of time. Historical dietary record data can be used to analyze users' eating habits.

[0045] Step S202: Based on a unified time reference, time-aligned multi-source data is obtained by aligning structured questionnaire data, food spectral data, condiment measurement data, meal image weight data, and historical dietary record data.

[0046] Optionally, the dietary recommendation terminal can use a standard timestamp as a unified time reference to add corresponding timestamps to structured questionnaire data, food spectral data, condiment measurement data, meal image weight data and historical dietary record data, and sort and align all data according to the time dimension to obtain time-aligned multi-source data.

[0047] Specifically, a unified time base can be a standard time reference used to unify the time dimension of all data, and a unified time base can be used to eliminate time deviations between different data; time alignment can be a process of matching and aligning data from different sources according to timestamps, and time alignment can be used to ensure the consistency of data in the time dimension; time-aligned multi-source data can be a collection of multi-source data after time alignment processing.

[0048] Step S203: Based on a fixed data pattern, perform field mapping and type conversion on time-aligned multi-source data to obtain multi-source data with a unified structure.

[0049] Optionally, the dietary recommendation terminal can set unified field definitions and data type standards as a fixed data pattern; the dietary recommendation terminal can map time-aligned multi-source data to a unified field and perform unified data type conversion on the time-aligned multi-source data to obtain multi-source data with a unified structure.

[0050] Specifically, a fixed data pattern can be a pre-set unified data structure specification, which may include, but is not limited to, standards such as field names, data types, and units of measurement; field mapping can be the process of mapping heteronymous fields from different sources to unified standard fields; type conversion can be the process of converting data of different formats and units into a unified type and unit; and structured multi-source data can be a collection of multi-source data that has a unified data structure after field mapping and type conversion.

[0051] Step S204: Perform outlier removal and smoothing operations on the structured multi-source data to obtain the user data object.

[0052] Optionally, the dietary recommendation terminal can identify and remove outliers in structured multi-source data using statistical discrimination methods to obtain outlier-removed data; the dietary recommendation terminal can then smooth the outlier-removed data to eliminate data fluctuation noise and obtain user data objects.

[0053] Specifically, outlier removal can be the process of identifying and deleting outlier data points that are obviously inconsistent with common sense. Outlier removal can be used to avoid outlier data from interfering with analysis results. Smoothing operation can be the process of smoothing data fluctuations. Smoothing operation can be used to reduce the impact of random noise. User data object can be the final set of user data obtained after outlier removal and smoothing operation. User data object can include, but is not limited to, the user's basic information, health information, and historical dietary information.

[0054] In one embodiment, a nutrition knowledge graph may include a core layer, an extension layer, and a personalization layer; constructing a nutrition knowledge graph may include:

[0055] Step S301: Obtain nutritional data, disease contraindication data, and dietary standard data from dietary guidelines and food composition data, and analyze the nutritional data, disease contraindication data, and dietary standard data to obtain food entities, nutrient entities, disease entities, and dietary standard entities, as well as the content relationships between food entities and nutrient entities, the contraindication relationships between food entities and disease entities, and the influence relationships between nutrient entities and disease entities.

[0056] Optionally, the dietary recommendation terminal can extract nutritional data of ingredients, disease contraindications data, and dietary standard data from dietary guidelines and food composition data. The dietary recommendation terminal can perform entity extraction and relation extraction on the nutritional data of ingredients, disease contraindications data, and dietary standard data to obtain food entities, nutrient entities, disease entities, and dietary standard entities, as well as the content relationships between food entities and nutrient entities, the contraindication relationships between food entities and disease entities, and the influence relationships between nutrient entities and disease entities.

[0057] Specifically, dietary guidelines and food composition data can be authoritative dietary guidelines, national food composition tables, and other official documents, including but not limited to the "Chinese Dietary Guidelines" and the "Chinese Food Composition Tables"; food entities can be knowledge nodes representing various food ingredients; nutrient entities can be knowledge nodes representing various nutrient components; disease entities can be knowledge nodes representing various diseases and health conditions; dietary standard entities can be knowledge nodes representing various dietary intake standards; the "containing" relationship can represent the relationship that food ingredients contain corresponding nutrients; the "contraindication" relationship can represent the relationship that patients with a certain type of disease should not eat corresponding food ingredients; and the "influence" relationship can represent the relationship that a certain type of nutrient has a positive, negative, or neutral effect on a certain type of disease.

[0058] Step S302: Using food ingredients, nutrients, diseases, and dietary standards as nodes, and containing relationships, taboo relationships, and influencing relationships as edges, the core layer is constructed.

[0059] Optionally, the dietary recommendation terminal can use food entities, nutrient entities, disease entities, and dietary standard entities as nodes, and the corresponding content relationships, contraindication relationships, and impact relationships as edges to construct the core layer of a nutritional knowledge graph.

[0060] Specifically, the core layer can be the basic core part of the nutrition knowledge graph. The core layer can be built on authoritative and recognized dietary nutrition knowledge and has high reliability.

[0061] Step S303: Obtain regional dietary culture data, special population needs data, and nutritional research results data, and integrate the regional dietary culture data, special population needs data, and nutritional research results data into the core layer to obtain the extended layer.

[0062] Optionally, the dietary recommendation terminal can acquire regional dietary culture data, special population needs data such as pregnant women and the elderly, and nutritional research data. The dietary recommendation terminal can extract corresponding entities and relationships from the regional dietary culture data, special population needs data, and nutritional research data, and integrate them into the core layer of the knowledge system to generate an extended layer of the nutritional knowledge graph.

[0063] Specifically, the extension layer can be a level that expands knowledge based on the core layer. The extension layer can cover regional culture, special populations, and cutting-edge scientific research results. The extension layer can be used to improve the coverage and timeliness of the knowledge graph. Regional food culture data can be data related to the dietary habits, special ingredients, and dietary taboos of different regions. Special population needs data can be exclusive dietary needs data for special populations such as pregnant women, children, the elderly, and patients with chronic diseases. Nutritional research results data can be the latest research results in the field of nutrition. Nutritional research results data can be used to update and supplement nutritional knowledge.

[0064] Step S304: Obtain historical preference data and system recommendation feedback data for each user, and based on the historical preference data, system recommendation feedback data, and historical dietary record data, filter the node entities and relationship edges that match each user from the core layer and the extended layer to construct the personalized layer.

[0065] Optionally, the dietary recommendation terminal can collect each user's historical dietary preference data and user feedback data on past system recommendations; the dietary recommendation terminal can combine the user's historical dietary record data to filter out entities and relationships matching the user from the core layer and extended layer, construct a personalized knowledge subset for the user, and generate a personalized layer of the nutrition knowledge graph.

[0066] Specifically, the personalization layer can be a personalized knowledge layer for individual users. The personalization layer can filter and match content from the full knowledge base based on the user's personal data to achieve personalized adaptation of the knowledge graph to the user. Historical preference data can be data related to the user's historical dietary preferences and aversions. System recommendation feedback data can be feedback data such as the user's rating, acceptance or rejection of past system recommendations.

[0067] Step S305: Integrate the core layer, extension layer, and personalization layer to construct a nutrition knowledge graph.

[0068] Optionally, the dietary recommendation terminal can hierarchically integrate the core layer, extended layer, and personalized layer to generate a preliminary nutrition knowledge graph; the dietary recommendation terminal can set different weight priorities for different layers in the preliminary nutrition knowledge graph to obtain the nutrition knowledge graph.

[0069] Specifically, a nutrition knowledge graph can be a three-layered knowledge network consisting of a core layer, an extension layer, and a personalized layer. A nutrition knowledge graph can be authoritative, rich, and personalized, and can serve as the core knowledge foundation for conducting personalized dietary reasoning.

[0070] In one embodiment, the user data object may include a basic information vector and a health status vector; based on the user data object, nutritional needs analysis and health constraint extraction are performed to generate a user nutritional profile, which may include:

[0071] Step S401: Based on the gender, age, height, weight, and physical activity level in the basic information vector, calculate the daily basal energy expenditure. Based on the daily basal energy expenditure and the recommended energy supply ratio of macronutrients, calculate the recommended daily protein intake range, the recommended daily fat intake range, and the recommended daily carbohydrate intake range.

[0072] Optionally, the dietary recommendation terminal can extract parameters such as gender, age, height, weight, and physical activity level from the basic information vector of the user data object; the dietary recommendation terminal can calculate the user's basal metabolic rate using a standard formula, and calculate the user's daily basal energy expenditure by combining the physical activity level; the dietary recommendation terminal can calculate the recommended daily protein intake range, the recommended daily fat intake range, and the recommended daily carbohydrate intake range based on the daily basal energy expenditure and the recommended energy supply ratio of macronutrients.

[0073] Specifically, the basic information vector can be a vector storing the user's basic physiological information, which may include, but is not limited to, fields such as gender, age, height, weight, and physical activity level; daily basal energy expenditure can be the total energy expenditure required by the user to maintain basic life activities and daily activities; the recommended energy supply ratio of macronutrients can be the recommended proportion of energy provided by the three macronutrients—protein, fat, and carbohydrates—to the total energy; and the daily recommended intake ranges for protein, fat, and carbohydrates are the daily recommended intake ranges for the corresponding nutrients.

[0074] Step S402: Parse the health status vector to obtain disease labels, and retrieve the nutritional constraint rules corresponding to the disease labels from the disease-nutrient-food association rule library. Aggregate the nutritional constraint rules to obtain the health constraint set.

[0075] Optionally, the dietary recommendation terminal can parse the health status vector in the user data object to extract the disease tags corresponding to the user's disease or health status; the dietary recommendation terminal can retrieve the nutritional constraint rules corresponding to each disease tag in the disease-nutrient-food association rule library; the dietary recommendation terminal can deduplicate and aggregate all nutritional constraint rules to obtain a health constraint set.

[0076] Specifically, the health status vector can be a vector that stores the user's health status. The health status vector may include, but is not limited to, information such as the user's diseases, allergy history, and abnormal physical indicators; the disease tag can be a tag that marks the user's disease or health status; the disease-nutrient-food association rule base can be a rule base that stores the constraint relationships between diseases and nutrients and food; and the health constraint set can be a set of the user's dietary and nutritional constraint rules.

[0077] Step S403: Integrate daily basal energy expenditure, recommended daily protein intake range, recommended daily fat intake range, recommended daily carbohydrate intake range, and health constraints to generate a user nutrition profile.

[0078] Optionally, the dietary recommendation terminal can structurally integrate daily basal energy consumption, daily recommended protein intake range, daily recommended fat intake range, daily recommended carbohydrate intake range, and health constraint set, and add corresponding weight labels to each dimension of information to generate a user nutrition profile.

[0079] Specifically, a user nutrition profile can be a multi-dimensional user profile that depicts a user's nutritional needs and health limitations.

[0080] In one embodiment, based on gender, age, height, weight, and physical activity level in the basic information vector, daily basal energy expenditure is calculated. Then, based on this daily basal energy expenditure and combined with the recommended macronutrient intake ratios, daily recommended protein intake ranges, daily recommended fat intake ranges, and daily recommended carbohydrate intake ranges are calculated, which may include:

[0081] Step S501: Calculate the basal metabolic rate using the Mifflin-St Jeor formula based on gender, age, height, and weight.

[0082] Optionally, the formula for calculating basal metabolic rate is:

[0083] ;

[0084] In the formula, Basal metabolic rate, Weight is expressed in kilograms. Height in centimeters. Age in years For gender.

[0085] Step S502: Multiply the basal metabolic rate by the level of physical activity to obtain the daily basal energy expenditure.

[0086] Optionally, the dietary recommendation terminal can multiply the basal metabolic rate by the level of physical activity to obtain the daily basal energy expenditure.

[0087] Step S503: Multiply daily basal energy expenditure by the recommended proportion of protein for energy supply and then divide by the energy production coefficient per gram of protein to obtain the daily recommended protein intake range; multiply daily basal energy expenditure by the recommended proportion of fat for energy supply and then divide by the energy production coefficient per gram of fat to obtain the daily recommended fat intake range; multiply daily basal energy expenditure by the recommended proportion of carbohydrates for energy supply and then divide by the energy production coefficient per gram of carbohydrates to obtain the daily recommended carbohydrate intake range.

[0088] Optionally, the dietary recommendation terminal can multiply daily basal energy expenditure by the recommended proportion of energy supplied by protein to obtain the recommended energy expenditure for protein; the dietary recommendation terminal can divide the recommended energy expenditure for protein by the energy production coefficient per gram of protein to obtain the recommended daily protein intake range; the dietary recommendation terminal can multiply daily basal energy expenditure by the recommended proportion of energy supplied by fat to obtain the recommended energy expenditure for fat; the dietary recommendation terminal can divide the recommended energy expenditure for fat by the energy production coefficient per gram of fat to obtain the recommended daily fat intake range; the dietary recommendation terminal can multiply daily basal energy expenditure by the recommended proportion of energy supplied by carbohydrates to obtain the recommended energy expenditure for carbohydrates; the dietary recommendation terminal can divide the recommended energy expenditure for carbohydrates by the energy production coefficient per gram of carbohydrates to obtain the recommended daily carbohydrate intake range.

[0089] In one embodiment, based on the user's nutritional profile, multi-hop reasoning is performed on a nutritional knowledge graph to obtain recommended recipes and the corresponding knowledge paths, which may include:

[0090] Step S601: Integrate the recommended daily protein intake range, recommended daily fat intake range, and recommended daily carbohydrate intake range from the user's nutritional profile to obtain the target nutritional needs.

[0091] Optionally, the dietary recommendation terminal can integrate the recommended daily protein intake range, the recommended daily fat intake range, and the recommended daily carbohydrate intake range to obtain the target nutritional requirements for dietary recommendations.

[0092] Specifically, target nutritional requirements can be the range of nutrient intake targets that need to be met by dietary recommendations.

[0093] Step S602: Based on the target nutritional needs and health constraint set, perform a first-hop search on the nutrition knowledge graph, retrieve food entities that meet the target nutritional needs from the nutrition knowledge graph, and remove food entities that do not meet the health constraint set to obtain a candidate food set.

[0094] Optionally, the dietary recommendation terminal can use the target nutritional needs as the search criteria to perform a first-hop search on the nutritional knowledge graph, filter out food entities that meet the target nutritional needs, and combine them with a set of health constraints to remove food entities that do not meet the set of health constraints, and summarize the remaining food entities into a set of candidate food entities.

[0095] Specifically, the first-hop retrieval can be the first step in multi-hop reasoning. The first-hop retrieval can be used to complete the screening jump from nutritional needs to candidate ingredients. The candidate ingredient set can be the set of alternative ingredients obtained after preliminary nutritional screening and elimination.

[0096] Step S603: Perform a second-hop search on the nutrition knowledge graph, generate multiple recipes to be verified based on the various combinations and proportions of the food entities in the candidate food set; retrieve the nutrient entities corresponding to each food entity in each recipe to be verified from the nutrition knowledge graph based on the content relationship, obtain the nutrient content value of the nutrient entities, and obtain the comprehensive nutritional content of the recipe to be verified.

[0097] Optionally, the dietary recommendation terminal can perform a second-step inference on the nutrition knowledge graph, combining and matching the food entities in the candidate food set, and generating multiple recipes to be verified by combining different portion ratios; the dietary recommendation terminal can query the nutrient entities corresponding to each food entity in each recipe to be verified by the relationship, and the dietary recommendation terminal can accumulate the nutrient content values ​​of each nutrient entity to obtain the comprehensive nutritional content of the recipe to be verified.

[0098] Specifically, the second-hop retrieval can be the second step of multi-hop inference. The second-hop retrieval can be used to complete the combination jump from candidate ingredients to the recipe to be verified. The recipe to be verified can be an alternative recipe generated by the combination of candidate ingredients that has not yet undergone nutritional and compliance verification. The comprehensive nutritional content can be the total content of various nutrients included in a single recipe.

[0099] Step S604: Determine whether the comprehensive nutrient content meets the target nutrient requirements. If it meets the target nutrient requirements, calculate the total energy of the recipe to be verified and determine whether the total energy exceeds the daily basic energy consumption. If it does not exceed the daily basic energy consumption, then the recipe to be verified is used as a candidate recipe to obtain a set of candidate recipes.

[0100] Optionally, the dietary recommendation terminal can set target nutritional requirements; the dietary recommendation terminal can compare the comprehensive nutritional content of the recipes to be verified with the target nutritional requirements, screen out the recipes to be verified whose comprehensive nutritional content meets the target nutritional requirements, and calculate the total energy of the recipes to be verified; the dietary recommendation terminal can determine whether the total energy exceeds the daily basic energy consumption, remove recipes whose total energy exceeds the daily basic energy consumption, and use the remaining recipes to be verified as candidate recipes, and summarize them to obtain a set of candidate recipes.

[0101] Specifically, the candidate recipe set can be a set of alternative recipes obtained after nutritional content verification and energy verification.

[0102] Step S605: Perform a third-hop search on the nutrition knowledge graph to check whether each ingredient entity in each candidate recipe has a contraindication relationship with the disease entity corresponding to the disease label. If there is no contraindication relationship, check the influence relationship between the nutrient entity and the disease entity. If the nutrient entity has a positive or neutral influence on the disease entity, then the candidate recipe is determined as a recommended recipe.

[0103] Optionally, the dietary recommendation terminal can perform a third-step verification on the nutrition knowledge graph, checking the contraindication relationship between each ingredient entity and disease entity in the candidate recipes one by one, and eliminating candidate recipes with contraindications; the dietary recommendation terminal can further verify the influence relationship between nutrient entities and disease entities in the remaining candidate recipes, and select candidate recipes that have a positive or neutral influence on disease entities as recommended recipes.

[0104] Specifically, third-hop retrieval can be the third step in multi-hop reasoning, and it can be used to complete the compliance verification jump from candidate recipes to the final recommended recipe.

[0105] Step S606: Arrange the food entities, nutrient entities, disease entities, content relationships, contraindication relationships, and influence relationships corresponding to the recommended recipe in order to obtain the knowledge path corresponding to the recommended recipe.

[0106] Optionally, the dietary recommendation terminal can arrange the food entities, nutrient entities, disease entities, content relationships, contraindication relationships, and impact relationships involved in the reasoning process of the recommended recipe in the order of reasoning to generate the knowledge path corresponding to the recommended recipe.

[0107] Specifically, a knowledge path can be a complete record of the reasoning chain from a user's disease and nutritional needs to recommended ingredients.

[0108] In one embodiment, mapping a knowledge path to a structured explanation template and assembling structured prompt words based on the structured explanation template may include:

[0109] Step S701: Construct influence triples for disease entities, nutrient entities, and the influence relationships connecting disease entities and nutrient entities in the knowledge path; construct contain triples for nutrient entities, food entities, and the containment relationships connecting nutrient entities and food entities in the knowledge path; and construct taboo triples for disease entities, food entities, and the taboo relationships connecting disease entities and food entities in the knowledge path.

[0110] Optionally, the dietary recommendation terminal can split and reorganize the entities and relationships in the knowledge path. According to the triple structure of head entity-relationship-tail entity, the disease entity, nutrient entity and the influence relationship connecting the disease entity and nutrient entity in the knowledge path are constructed into influence triples, the nutrient entity, food entity and the containment relationship connecting the nutrient entity and food entity in the knowledge path are constructed into containment triples, and the disease entity, food entity and the prohibition relationship connecting the disease entity and food entity in the knowledge path are constructed into prohibition triples.

[0111] Specifically, the influence triple can be a triple consisting of a disease entity, an influence relationship, and a nutrient entity, and the influence triple can be used to characterize the influence of nutrients on diseases; the content triple can be a triple consisting of a food entity, a content relationship, and a nutrient entity, and the content triple can be used to characterize the nutrients contained in the food; the contraindication triple can be a triple consisting of a disease entity, a contraindication relationship, and a food entity, and the contraindication triple can be used to characterize the contraindications of food corresponding to diseases.

[0112] Step S702: Semantic role labeling is performed on the influencing triple, the containing triple, and the prohibition triple. The influencing triple is labeled as the recommendation reason element, the containing triple is labeled as the nutritional benefit element, and the prohibition triple is labeled as the precaution element.

[0113] Optionally, the dietary recommendation terminal can perform semantic role labeling based on the semantic functions of the influencing triple, the containing triple, and the prohibition triple. The influencing triple that explains the rationality of the recommendation is labeled as the recommendation reason element, the containing triple that explains the nutritional value of the food is labeled as the nutritional benefit element, and the prohibition triple that explains dietary taboos is labeled as the precaution element.

[0114] Specifically, semantic role labeling can be the process of assigning corresponding semantic roles to triples. Semantic role labeling can be used to clarify the function of each triple in the explanatory text; the reason for recommendation element can be the element that explains why the recipe is recommended; the nutritional benefit element can be the element that explains the nutritional benefits of the recipe; and the precautions element can be the element that explains dietary precautions and taboos.

[0115] Step S703: Obtain the explanation template, fill the recommendation reason element into the recommendation reason slot of the explanation template, fill the nutritional benefit element into the nutritional benefit slot of the explanation template, fill the precaution element into the precaution slot of the explanation template, and obtain the structured explanation template.

[0116] Optionally, the dietary recommendation terminal can call an explanation template, fill the recommendation reason element into the recommendation reason slot of the explanation template, fill the nutritional benefit element into the nutritional benefit slot of the explanation template, and fill the precaution element into the precaution slot of the explanation template to obtain a structured explanation template.

[0117] Specifically, the explanation template can be a pre-set explanation text framework with fixed slots, and the explanation template can be used to standardize the structure and logic of the explanation content; the structured explanation template can be an explanation template filled with specific elements.

[0118] Step S704: Obtain the system-level instruction prefix, concatenate the system-level instruction prefix and the structured interpretation template to assemble the structured prompt words.

[0119] Optionally, the dietary recommendation terminal can obtain system-level instruction prefixes and concatenate the system-level instruction prefixes and structured interpretation templates to assemble structured prompt words.

[0120] Specifically, the system-level instruction prefix can be instruction text used to constrain the generation behavior of the large language model. The system-level instruction prefix can include, but is not limited to, instructions such as generation task requirements, tone style requirements, and output format requirements. The system-level instruction prefix can be used to clarify the generation task, output style, and constraints. The structured prompt word can be a complete input text composed of the system-level instruction prefix and the structured interpretation template. The structured prompt word can be used to guide the large language model to generate interpretable text that meets the requirements.

[0121] In one embodiment, structured cue words are input into a large language model to generate interpretable text, resulting in interpretable dietary recommendation text, which may include:

[0122] Step S801: Input the structured prompt words into the large language model, initialize the generated token sequence as an empty sequence, and take the position after the last token of the structured prompt words as the current position, perform token-by-token autoregression to obtain the generated token sequence and the current position.

[0123] Optionally, the dietary recommendation terminal can input structured prompts into a large language model, initialize the generated token sequence as empty, and take the position after the last token position as the current position for generation. The dietary recommendation terminal can start a token-by-token autoregressive generation process to generate each token in sequence, thereby obtaining the generated token sequence and the current position.

[0124] Specifically, a token can be the smallest unit of text processed by a large language model. A token can correspond to a character, a word, or a sub-word. A sequence of generated tokens can be a sequence of already generated tokens. Autoregressive generation can be the way a large language model predicts the generation of the next token based on the already generated content. Autoregressive generation can be a typical generation pattern of a large language model.

[0125] Step S802: Based on each entity and relation in the knowledge path, construct a constraint prefix tree using the entity name and relation as the path.

[0126] Optionally, the dietary recommendation terminal can extract all entities and relations in the knowledge path; the dietary recommendation terminal can construct a constraint prefix tree according to the character hierarchy based on all entities and relations in the knowledge path.

[0127] Specifically, a constraint prefix tree can be a tree-structured lexical constraint data structure. Each path in the constraint prefix tree can correspond to a valid entity or relation. Constraint prefix trees can be used to limit the sampling range of tokens during the generation process, ensuring that the generated content and knowledge paths are consistent, and avoiding the generation of false information by large language models.

[0128] In step S803, before each new token is generated, it is determined whether the current position falls within the structured interpretation template. If the current position falls within the structured interpretation template, the token sampling space is restricted to the set of all child nodes of the longest path in the constraint prefix tree that matches the generated token sequence. If the current position does not fall within the structured interpretation template, the token sampling space is set to the full vocabulary set of the large language model.

[0129] Optionally, before generating each new token, the dietary recommendation terminal can first determine whether the current position belongs to the content range corresponding to the structured interpretation template. If the current position belongs to the structured interpretation template range, the dietary recommendation terminal can match the longest path corresponding to the generated token sequence in the constraint prefix tree and use the set of all child nodes of the longest path as the sampling space. If the current position does not belong to the structured interpretation template range, the dietary recommendation terminal can set the entire vocabulary set as the token sampling space.

[0130] Specifically, the token sampling space can be the set of candidate tokens when the large language model generates the next token; the full vocabulary set can be the complete set consisting of all tokens supported by the large language model.

[0131] Step S804: Sample within the token sampling space to obtain a sampled token. Add the sampled token to the end of the generated token sequence and update the position after the end of the generated token sequence to the new current position. Iterate until the sampled token becomes the termination marker of the large language model. Convert the generated token sequence at the end of the iteration into natural language text to obtain interpretable dietary recommendation text.

[0132] Optionally, the dietary recommendation terminal can sample tokens within the token sampling space according to the probability distribution output by the large language model to obtain sampled tokens. The dietary recommendation terminal can append the sampled tokens to the end of the generated token sequence and update the position after the end of the generated token sequence to the new current position. The dietary recommendation terminal can repeat the above generation process until the termination token is sampled and then stop generation, converting the final generated token sequence into natural language text to obtain interpretable dietary recommendation text.

[0133] Specifically, the termination token can be a special token in a large language model that indicates the end of text generation; the interpretable dietary recommendation text can be the final generated natural language text that includes recommended recipes and corresponding explanations.

[0134] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0135] Based on the same inventive concept, this application also provides a system for generating interpretable dietary recommendations based on a large language model, which implements the aforementioned method for generating interpretable dietary recommendations based on a large language model. The solution provided by this system is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the system for generating interpretable dietary recommendations based on a large language model provided below can be found in the limitations of the method for generating interpretable dietary recommendations based on a large language model described above, and will not be repeated here.

[0136] In one exemplary embodiment, such as Figure 3 As shown, an interpretable dietary recommendation generation system 300 based on a large language model is provided, including:

[0137] The data acquisition module 301 can be used to acquire multi-source heterogeneous user data, perform data fusion and standardization on the multi-source heterogeneous user data, and obtain user data objects.

[0138] The nutrition profile generation module 302 can be used to analyze nutritional needs and extract health constraints based on user data objects to generate user nutrition profiles.

[0139] The nutrition knowledge graph construction module 303 can be used to construct a nutrition knowledge graph. Based on the user's nutrition profile, multi-hop reasoning is performed on the nutrition knowledge graph to obtain recommended recipes and the knowledge paths corresponding to the recommended recipes.

[0140] The prompt word generation module 304 can be used to map knowledge paths into structured explanation templates and assemble structured prompt words based on the structured explanation templates.

[0141] The recommended text generation module 305 can be used to input structured prompt words into a large language model to generate interpretable text and obtain interpretable dietary recommendation text.

[0142] The above embodiments merely illustrate several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the embodiments of this application, and these all fall within the protection scope of the embodiments of this application.

Claims

1. A method for generating interpretable dietary recommendations based on a large language model, characterized in that, The method includes: Obtain multi-source heterogeneous user data, perform data fusion and standardization on the multi-source heterogeneous user data, and obtain user data objects; Based on the user data object, nutritional needs are analyzed and health constraints are extracted to generate a user nutritional profile. Construct a nutrition knowledge graph, and based on the user nutrition profile, perform multi-hop reasoning on the nutrition knowledge graph to obtain recommended recipes and the knowledge paths corresponding to the recommended recipes; The knowledge path is mapped to a structured explanation template, and structured prompt words are assembled based on the structured explanation template; The structured prompts are input into a large language model to generate interpretable text, resulting in interpretable dietary recommendation text.

2. The method according to claim 1, characterized in that, The process of acquiring multi-source heterogeneous user data, fusing and standardizing the multi-source heterogeneous user data to obtain user data objects includes: The system acquires structured questionnaire data returned by the user, obtains real-time spectral data of ingredients, measurement data of seasonings, and weight data of meal images from the smart hardware terminal, and reads the user's historical dietary records from local persistent storage. Based on a unified time reference, the structured questionnaire data, the food spectral data, the condiment measurement data, the meal image weight data, and the historical dietary record data are time-aligned to obtain time-aligned multi-source data. Based on a fixed data pattern, the time-aligned multi-source data is subjected to field mapping and type conversion to obtain multi-source data with a unified structure. The user data object is obtained by performing outlier removal and smoothing operations on the structured multi-source data.

3. The method according to claim 2, characterized in that, The nutrition knowledge graph includes a core layer, an extension layer, and a personalized layer; the construction of the nutrition knowledge graph includes: Nutritional data, disease contraindication data, and dietary standard data of food ingredients are obtained from dietary guidelines and food composition data. The nutritional data, disease contraindication data, and dietary standard data of food ingredients are analyzed to obtain food ingredient entities, nutrient entities, disease entities, and dietary standard entities, as well as the content relationship between the food ingredient entities and the nutrient entities, the contraindication relationship between the food ingredient entities and the disease entities, and the influence relationship between the nutrient entities and the disease entities. The core layer is constructed using the food entity, nutrient entity, disease entity, and dietary standard entity as nodes, and the containment relationship, the contraindication relationship, and the influence relationship as edges. Data on regional dietary culture, the needs of special populations, and nutritional research findings are acquired and integrated into the core layer to obtain the extended layer. The system acquires historical preference data and system recommendation feedback data for each user, and based on the historical preference data, the system recommendation feedback data, and the historical dietary record data, it filters out node entities and relationship edges that match each user from the core layer and the extended layer to construct the personalized layer. By integrating the core layer, the extended layer, and the personalized layer, the nutritional knowledge graph is constructed.

4. The method according to claim 2, characterized in that, The user data object includes a basic information vector and a health status vector; the step of analyzing nutritional needs and extracting health constraints based on the user data object to generate a user nutritional profile includes: Based on the gender, age, height, weight, and physical activity level in the basic information vector, the daily basal energy expenditure is calculated. Based on the daily basal energy expenditure and the recommended energy supply ratio of macronutrients, the recommended daily protein intake range, the recommended daily fat intake range, and the recommended daily carbohydrate intake range are calculated. The health status vector is parsed to obtain disease labels, and nutritional constraint rules corresponding to the disease labels are retrieved from the disease-nutrient-food association rule library. The nutritional constraint rules are then aggregated to obtain the health constraint set. The user's nutritional profile is generated by integrating the daily basal energy expenditure, the daily recommended protein intake range, the daily recommended fat intake range, the daily recommended carbohydrate intake range, and the set of health constraints.

5. The method according to claim 4, characterized in that, The daily basal energy expenditure is calculated based on the gender, age, height, weight, and physical activity level in the basic information vector. Then, based on the daily basal energy expenditure and the recommended macronutrient intake ratios, the recommended daily protein intake range, recommended daily fat intake range, and recommended daily carbohydrate intake range are calculated, including: Based on the stated gender, age, height, and weight, the basal metabolic rate is calculated using the Mifflin-St Jeor formula; wherein the formula for calculating the basal metabolic rate is: ; In the formula, This refers to the basal metabolic rate. The weight is expressed in kilograms. The height is given and the unit is centimeters. The age is stated in years. The gender; Multiplying the basal metabolic rate by the physical activity level yields the daily basal energy expenditure. The recommended daily protein intake range is obtained by multiplying the daily basal energy expenditure by the recommended proportion of energy supplied by protein and then dividing by the energy production coefficient per gram of protein. The recommended daily fat intake range is obtained by multiplying the daily basal energy expenditure by the recommended proportion of energy supplied by fat and then dividing by the energy production coefficient per gram of fat. The recommended daily carbohydrate intake range is obtained by multiplying the daily basal energy expenditure by the recommended proportion of energy supplied by carbohydrates and then dividing by the energy production coefficient per gram of carbohydrates.

6. The method according to claim 3 or 4, characterized in that, The process of performing multi-hop reasoning on the nutrition knowledge graph based on the user's nutrition profile to obtain recommended recipes and the corresponding knowledge paths for those recipes includes: By integrating the recommended daily protein intake range, the recommended daily fat intake range, and the recommended daily carbohydrate intake range from the user's nutritional profile, the target nutritional needs are obtained. Based on the target nutritional requirements and the set of health constraints, a first-hop search is performed on the nutritional knowledge graph to retrieve the food entities that meet the target nutritional requirements from the nutritional knowledge graph, and to remove the food entities that do not meet the set of health constraints, thereby obtaining a set of candidate food entities. A second-hop search is performed on the nutritional knowledge graph to generate multiple recipes to be verified based on various combinations and proportions of the food entities in the candidate food set. Based on the content relationship, the nutrient entities corresponding to each food entity in each recipe to be verified are retrieved from the nutritional knowledge graph, and the nutrient content value of the nutrient entities is obtained to obtain the comprehensive nutritional content of the recipe to be verified. Determine whether the comprehensive nutritional content meets the target nutritional requirements. If it does, calculate the total energy of the recipe to be verified and determine whether the total energy exceeds the daily basic energy consumption. If it does not exceed the daily basic energy consumption, then use the recipe to be verified as a candidate recipe to obtain a set of candidate recipes. A third-hop search is performed on the nutritional knowledge graph to check whether each ingredient entity in each candidate recipe has a contraindication relationship with the disease entity corresponding to the disease tag. If no contraindication relationship exists, the influence relationship of the nutrient entity on the disease entity is checked. If the nutrient entity has a positive or neutral influence on the disease entity, the candidate recipe is determined as the recommended recipe. Arrange the food entity, nutrient entity, disease entity, content relationship, contraindication relationship and influence relationship corresponding to the recommended recipe in sequence to obtain the knowledge path corresponding to the recommended recipe.

7. The method according to claim 6, characterized in that, The process of mapping the knowledge path to a structured explanation template and assembling structured prompt words based on the structured explanation template includes: The disease entity, the nutrient entity, and the influence relationship connecting the disease entity and the nutrient entity in the knowledge path are constructed into influence triples; the nutrient entity, the food entity, and the containment relationship connecting the nutrient entity and the food entity in the knowledge path are constructed into containment triples; and the disease entity, the food entity, and the taboo relationship connecting the disease entity and the food entity in the knowledge path are constructed into taboo triples. Semantic role labeling is performed on the influencing triple, the containing triple, and the prohibition triple. The influencing triple is labeled as a recommendation reason element, the containing triple is labeled as a nutritional benefit element, and the prohibition triple is labeled as a precaution element. Obtain the explanation template, fill the recommendation reason element into the recommendation reason slot of the explanation template, fill the nutritional benefit element into the nutritional benefit slot of the explanation template, and fill the precaution element into the precaution slot of the explanation template to obtain the structured explanation template; Obtain the system-level instruction prefix, and concatenate the system-level instruction prefix with the structured interpretation template to assemble the structured prompt word.

8. The method according to claim 7, characterized in that, The step of inputting the structured prompt words into a large language model to generate interpretable text and obtain interpretable dietary recommendation text includes: The structured prompt words are input into the large language model, the generated token sequence is initialized as an empty sequence, and the position after the last token of the structured prompt words is taken as the current position. Token-by-token autoregression is performed to generate the generated token sequence and the current position. Based on each entity and relation in the knowledge path, a constraint prefix tree is constructed using each entity name and each relation as the path. Before each new token is generated, it is determined whether the current position falls within the structured interpretation template. If the current position falls within the structured interpretation template, the token sampling space is restricted to the set of all child nodes of the longest path in the constraint prefix tree that matches the generated token sequence. If the current position does not fall within the structured interpretation template, the token sampling space is set to the full vocabulary set of the large language model. Sampling is performed within the token sampling space to obtain a sampled token. The sampled token is added to the end of the generated token sequence, and the position after the end of the generated token sequence is updated to the new current position. This process is repeated until the sampled token becomes the termination marker of the large language model. The generated token sequence at the end of the iteration is then converted into natural language text to obtain the interpretable dietary recommendation text.

9. An interpretable dietary recommendation generation system based on a large language model, characterized in that, The system includes: The data acquisition module is used to acquire multi-source heterogeneous user data, perform data fusion and standardization on the multi-source heterogeneous user data, and obtain user data objects. The nutrition profile generation module is used to analyze nutritional needs and extract health constraints based on the user data object to generate a user nutrition profile. The nutrition knowledge graph construction module is used to construct a nutrition knowledge graph. Based on the user nutrition profile, multi-hop reasoning is performed on the nutrition knowledge graph to obtain recommended recipes and the knowledge paths corresponding to the recommended recipes. The prompt word generation module is used to map the knowledge path into a structured explanation template, and assemble structured prompt words according to the structured explanation template; The recommended text generation module is used to input the structured prompt words into the large language model to generate interpretable text and obtain interpretable dietary recommendation text.