Construction method of breast cancer patient nutrition guidance large model
By using a two-stage fine-tuning framework and a multi-agent collaborative reward system, a large-scale nutritional guidance model for breast cancer patients with strong adaptability and high computational efficiency was constructed. This model solves the problems of insufficient professional corpus, high computational resources, lack of professional style and insufficient personalization in existing technologies, and achieves comprehensive, accurate nutritional guidance and safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG HAIXINZHIHUI TECH CO LTD
- Filing Date
- 2025-09-17
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies lack large-scale models for nutritional guidance for breast cancer patients that are highly professional, adaptable, and computationally efficient. They suffer from problems such as insufficient professional corpus, high computational resource requirements, lack of professional style and personalization, and a single reward mechanism, which cannot comprehensively evaluate the quality of medical nutrition guidance.
A two-stage fine-tuning framework combined with a multi-agent collaborative reward system is adopted. Through reinforcement learning fine-tuning and supervised instruction fine-tuning, a large-scale model for nutritional guidance for breast cancer patients is constructed. The multi-agent collaborative architecture, dynamic weight optimizer and consensus engine are used in conjunction with the PPO algorithm for gradient updates to ensure the comprehensiveness and professionalism of nutritional guidance.
It achieves comprehensive and precise medical nutrition guidance, ensuring medical safety and nutritional science, reducing computing resource requirements, facilitating deployment, and generating detailed and clear nutritional recommendations that are easy for patients to understand.
Smart Images

Figure CN121306427B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence-related technologies, and in particular to a method for constructing a large-scale model for nutritional counseling for breast cancer patients. Background Technology
[0002] The existing technology has the following drawbacks:
[0003] 1. Insufficient professional corpus: There is a lack of professional corpus in the vertical field of nutritional management for breast cancer patients;
[0004] 2. High computational resource requirements: Existing large-scale models have a large number of parameters, making them difficult to deploy in medical institutions;
[0005] 3. Lack of professional style: The generic model lacks the professional explanation style unique to nutritionists;
[0006] 4. Lack of personalization: There is a lack of precise nutritional guidance tailored to the individual differences of patients;
[0007] 5. The reward mechanism is too simplistic: the existing reinforcement learning reward function is too simplified and cannot comprehensively evaluate the quality of medical nutrition guidance. Summary of the Invention
[0008] The present invention aims to overcome the aforementioned shortcomings in the prior art and provides a method for constructing a large-scale nutritional counseling model for breast cancer patients that is highly professional, adaptable, and computationally efficient.
[0009] To achieve the above objectives, the present invention adopts the following technical solution:
[0010] A method for constructing a large-scale nutritional counseling model for breast cancer patients, based on a basic model, employs a two-stage fine-tuning framework combined with a multi-agent collaborative reward system, specifically including the following steps:
[0011] (1) Reinforcement learning fine-tuning: A composite training dataset is constructed by using a high-quality breast cancer nutrition management dataset combined with a local private clinical nutrition guidance dataset. A multi-agent collaborative architecture is constructed based on five professional dimensions: nutrition, medical care, psychology, experience, and family. The current weights are adaptively adjusted based on the patient's status and treatment stage using a dynamic weight optimizer. The evaluation criteria are continuously optimized based on the feedback of the consensus engine. Finally, the reward function is obtained to calculate the final comprehensive reward value. The gradient is updated using the PPO algorithm. The basic agent model is trained and obtained. Nutrition reasoning ability is improved through multi-agent collaborative reinforcement learning.
[0012] (2) Supervised instruction fine-tuning: The nutritionist question-and-answer pair dataset is converted into Alpaca instruction format. The parameters of the basic agent model completed in the first stage of training are frozen. Only the LoRA matrix is trained. The parameters are fine-tuned using the LoRA adapter. The gradient is updated using the PPO algorithm with the Adam optimizer. The nutritionist's professional style is formed through supervised learning.
[0013] This invention pioneers a multi-agent collaborative assessment to ensure comprehensive medical nutrition guidance; it adjusts assessment weights in real time based on the patient's condition to provide precise guidance; a hard constraint mechanism ensures medical safety and nutritional scientific rigor; a multi-agent learning mechanism enables continuous system improvement; compared to large-scale models, it reduces resource requirements and facilitates deployment; and the generated content is detailed, clear, and easy for patients to understand.
[0014] Preferably, in step (1), the construction of the composite training dataset specifically involves: high-quality breast cancer nutrition management datasets sourced from publicly available datasets, medical literature data, clinical guideline data, and professional textbook data; and local private clinical nutrition guidance datasets sourced from nutritionist work records and patient feedback data. The composite training dataset is represented as follows:
[0015] Composite dataset = 40% public dataset + 30% clinical guideline data + 20% expert experience data + 10% patient-collected data;
[0016] The public dataset includes three parts: public datasets from the sources of high-quality breast cancer nutrition management datasets, medical literature data, and professional teaching material data; expert experience data comes from nutritionist work records; patient-collected data comes from patient feedback data; the data fields in the composite training dataset include patient information, nutrition problems, nutrition reasoning process, and nutrition advice, and the data fields are a unified data pattern of the composite training dataset.
[0017] Preferably, in step (2), the multi-agent cooperative architecture is as follows:
[0018] The nutritionist AI provides a comprehensive score for nutritional recommendations, calculated as follows: R_nutrition = 0.4 × Scientific validity + 0.3 × Compatibility + 0.3 × Balance. The scientific validity data is derived from clinical guidelines and medical literature, the compatibility data from professional textbooks, and the balance data from patient information fields.
[0019] The oncologist's intelligent agent comprehensively scores the medical safety of nutritional advice, with the scoring formula: R_oncology = 0.5 × treatment suitability + 0.3 × drug safety + 0.2 × complication prevention; where the data for treatment suitability is obtained from clinical guideline data, the data for drug safety is obtained from expert experience data, and the data for complication prevention is obtained from nutritionist work records.
[0020] The comprehensive score of the psychological support effect of the mental health agent on nutritional advice is calculated using the following formula: R_psychology = 0.4 × Emotional Support + 0.4 × Communication Effectiveness + 0.2 × Psychological Adaptation; where the data for emotional support is obtained from patient feedback data, the data for communication effectiveness is obtained from the nutritional reasoning process data field, and the data for psychological adaptation is obtained from patient feedback data.
[0021] The patient experience agent scores the practicality and operability of the nutritional advice based on a comprehensive evaluation formula: R_experience = 0.4×practicability + 0.3×operability + 0.3×personalization; where practicality data is obtained from patient-collected data, operability data is obtained from nutritional advice data fields, and personalization data is obtained from patient information data fields.
[0022] The family care intelligent agent comprehensively scores the feasibility of implementing nutritional recommendations in families. The scoring formula is: R_family = 0.4 × feasibility + 0.3 × cost + 0.3 × cultural adaptation. Among them, the data source for feasibility support is based on the patient information data field, the data source for cost, and the data source for cultural adaptation are all based on the patient information data field.
[0023] As a preferred option, the adaptive weight adjustment mechanism for the dynamic weight optimizer is as follows:
[0024] R_agents = [R_nutrition, R_oncology, R_psychology, R_experience, R_family]
[0025] W_t = softmax(MLP([R_agents, patient_profile, treatment_stage, historical_performance]))
[0026] in,
[0027] R_agents = [R_nutrition, R_oncology, R_psychology, R_experience, R_family] refers to the 5-dimensional agent rating vector, patient_profile refers to the patient feature vector, treatment_stage refers to the treatment stage encoding, and historical_performance refers to the historical assessment performance vector.
[0028] The weight update strategy is as follows: initial weights W_nutrition=0.25, W_oncology=0.25, W_psychology=0.2, W_experience=0.15, W_family=0.15; the weight allocation is adjusted in real time according to the patient's condition and treatment stage, and the weight distribution is continuously optimized based on patient feedback and expert evaluation.
[0029] As a preferred option, the multi-layered consensus mechanism for consensus engines is as follows:
[0030] The hard constraint consensus includes a nutritionist agent score ≥ 0.7 and an oncologist agent score ≥ 0.8;
[0031] Soft-constraint consensus includes all agents having a score variance ≤ 0.1 and a weighted average score ≥ 0.75;
[0032] When checking hard and soft constraints, a conflict resolution mechanism is preset. If a hard constraint conflict occurs, the expert arbitration module is triggered to record the conflict case for model optimization. If a soft constraint conflict occurs, the iterative optimization process is started, with a maximum of 3 rounds of adjustments.
[0033] As a preferred option, the conflict resolution mechanism is as follows:
[0034] (a) Conflict diagnosis: Identify conflict sources based on security standards for composite training datasets, tracing them back to specific agents and data fields;
[0035] (b) Scoring adjustment: The nutritionist agent is recalibrated based on nutritional data, the oncologist agent adjusts weights based on clinical data, and other agents adjust according to the severity of conflict.
[0036] (c) Weight reallocation: Dynamically adjust the weights of the multi-agent cooperative architecture using a dynamic weight optimizer. Input the adjusted scores of the five agents from step (b), and output the new weight allocation for the five agents.
[0037] (d) Consensus recalculation: Calculate a new consensus score based on the adjusted scores of the five agents and output the new weights of the five agents, and preset the convergence verification conditions;
[0038] (e) Termination judgment: If convergence is successful, output the final consensus; if convergence is not achieved and the number of iterations is less than 3, continue to the next iteration; if convergence is not achieved after 3 iterations, proceed to expert arbitration.
[0039] As a preferred approach, the comprehensive reward calculation for the reward function is as follows:
[0040] R_total = Σ(W_i × R_i) × Consensus_Factor
[0041] in,
[0042] W_i refers to the dynamic weight of the i-th agent.
[0043] R_i refers to the score of the i-th agent;
[0044] Consensus_Factor refers to the consensus factor.
[0045] Preferably, in step (1), the training process for reinforcement learning fine-tuning is as follows:
[0046] (11) Multi-agent parallel evaluation: Five professional agents simultaneously score the generated content, and a dynamic weight optimizer calculates the current weight allocation of the five professional agents;
[0047] (12) Consensus reached: Check the satisfaction of hard and soft constraints, and trigger the conflict resolution mechanism if necessary;
[0048] (13) Reward calculation and feedback: Calculate the final comprehensive reward value, use the PPO algorithm to perform gradient update, and update the knowledge base and dynamic weight optimizer of the five professional agents;
[0049] (14) Adaptive adjustment: Adjust the KL divergence constraint according to the training effect and optimize the evaluation criteria and weight allocation strategy of the five professional agents.
[0050] Preferably, in step (2), the LoRA adapter is used for parameter fine-tuning as follows:
[0051] (i) Enhanced professional knowledge of intelligent agents: Stylized training based on nutritionist professional Q&A pairs to strengthen the ability to assess the scientific nature, matching and balance of nutrition, and enhance the collaborative expression ability of 5 professional intelligent agents;
[0052] (ii) Multimodal data processing optimization: Improve patient profile understanding based on patient information data fields, optimize nutritional reasoning process and personalized suggestion generation, and enhance the professional style and warm interaction of nutritionists.
[0053] The beneficial effects of this invention are: ensuring the comprehensiveness of medical nutrition guidance; providing precise guidance; ensuring medical safety and nutritional science; enabling continuous system improvement; reducing resource requirements and facilitating deployment; and generating detailed and clear content that is easy for patients to understand. Attached Figure Description
[0054] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0055] The present invention will now be further described with reference to the accompanying drawings and specific embodiments.
[0056] like Figure 1 In the embodiments described above, a method for constructing a large-scale nutritional counseling model for breast cancer patients, based on a basic model, employs a two-stage fine-tuning framework combined with a multi-agent collaborative reward system, specifically including the following steps:
[0057] (1) Reinforcement learning fine-tuning: A composite training dataset is constructed by using a high-quality breast cancer nutrition management dataset combined with a local private clinical nutrition guidance dataset. A multi-agent collaborative architecture is constructed based on five professional dimensions: nutrition, medical care, psychology, experience, and family. The current weights are adaptively adjusted based on the patient's status and treatment stage using a dynamic weight optimizer. The evaluation criteria are continuously optimized based on the feedback of the consensus engine. Finally, the reward function is obtained to calculate the final comprehensive reward value. The gradient is updated using the PPO algorithm. The basic agent model is trained and obtained. Nutrition reasoning ability is improved through multi-agent collaborative reinforcement learning.
[0058] (2) Supervised instruction fine-tuning: The nutritionist question-and-answer pair dataset is converted into Alpaca instruction format. The parameters of the basic agent model completed in the first stage of training are frozen. Only the LoRA matrix is trained. The parameters are fine-tuned using the LoRA adapter. The gradient is updated using the PPO algorithm with the Adam optimizer. The nutritionist's professional style is formed through supervised learning.
[0059] Specific implementation examples are as follows:
[0060] The basic model is Qwen3-8B (8 billion parameters, balancing performance and resource requirements).
[0061] Phase 1: Reinforcement Learning Fine-tuning (Enhanced Nutritional Reasoning Ability)
[0062] Step S1: Dataset construction. Detailed explanation of the dataset source is as follows:
[0063] Source of high-quality breast cancer nutrition management dataset:
[0064] Public dataset: Nutrition-related data from the TCGA Breast Cancer Database;
[0065] Medical literature data: Approximately 2,000 research papers on breast cancer nutritional management collected from databases such as PubMed and CNKI.
[0066] Clinical guideline data: Nutritional management chapters in the "Chinese Anti-Cancer Association Guidelines for the Diagnosis and Treatment of Breast Cancer" and the "NCCN Clinical Practice Guidelines for Breast Cancer";
[0067] Professional textbook data: Content from authoritative textbooks such as "Tumor Nutrition", "Clinical Nutrition", "Dietary Guidelines for Chinese Residents" and "Nutritional Therapy Guidelines for Cancer Patients".
[0068] Source of local private clinical nutrition guidance dataset:
[0069] Nutritionist work log: Anonymized nutrition guidance cases provided by 10 senior clinical nutritionists in the company;
[0070] Patient feedback data: Feedback on the effectiveness of nutritional guidance collected through questionnaires.
[0071] Methods for constructing composite training datasets
[0072] Composite dataset = Public dataset (40%) + Clinical guideline data (30%) + Expert experience data (20%) + Patient-collected data (10%).
[0073] The formula includes three parts: public datasets from the source of high-quality breast cancer nutrition management datasets, medical literature data, and professional textbook data; the formula includes clinical guideline data from the source of high-quality breast cancer nutrition management datasets; the formula includes expert experience data from the source of dietitian work records from the source of local private clinical nutrition guidance datasets; and the formula includes patient collection data from the source of patient feedback data from the source of local private clinical nutrition guidance datasets.
[0074] The data fields in the composite training dataset include patient information, nutritional questions, nutritional reasoning processes, and nutritional recommendations. These data fields form a unified data pattern for the composite training dataset, ensuring that data from different sources can participate in model training in a standardized format. This allows the model to learn to start from patient information, go through a professional reasoning process, and ultimately generate personalized nutritional recommendations.
[0075] Data field retrieval:
[0076] Patient information: age, weight, height, ethnicity, region, religion, stage of illness, treatment plan, allergy history, dietary preferences, economic conditions, and other personal profile information; Source: Hospital electronic medical record system (de-identified).
[0077] Nutritional issues: Specific nutrition-related questions raised by patients; Sources: Nutritional consultation records, online consultation records.
[0078] Nutritional Reasoning Process: The analytical thinking and reasoning steps of a nutritionist; Source: Nutritionist's work records, expert interviews.
[0079] Nutritional recommendations: Specific nutritional guidance plans; Sources: Clinical nutrition guidance records, standardized nutrition plans.
[0080] Step S2: Training the multi-agent cooperative reward system
[0081] Multi-agent architecture design
[0082] Core architecture: 5 specialized intelligent agents + dynamic weight optimizer + consensus engine
[0083] Composition of a professional intelligent agent:
[0084] 1. Nutritionist Agent
[0085] R_nutrition means: the overall score of the nutritionist agent on the nutrition advice (value range 0-1).
[0086] Scoring formula: R_nutrition = 0.4×S_scientific + 0.3×S_combination + 0.3×S_balance.
[0087] S_scientific (scientific score) is obtained as follows:
[0088] Data source: Based on clinical guideline data (30%) and medical literature data (2000 papers) constructed in the first phase.
[0089] Calculation method: S_scientific = Σ(evidence_score_i × weight_i) / Σ(weight_i);
[0090] evidence_score_i: The support score of the i-th piece of evidence-based medicine (0-1);
[0091] weight_i: Weight of evidence level (RCT study = 1.0, cohort study = 0.8, case control = 0.6).
[0092] Assessment criteria: Based on the recommendations in the "Chinese Dietary Guidelines" and the "Guidelines for Nutritional Therapy of Cancer Patients".
[0093] S_combination (compatibility score) is obtained as follows:
[0094] Data source: Food composition table from the textbook "Tumor Nutrition";
[0095] Calculation method: S_combination = (nutrient complementarity + absorption promotion - antagonistic effect) / 3;
[0096] Nutrient complementarity: Vitamin C promotes iron absorption by +0.2, while calcium competes with iron for absorption by -0.1.
[0097] Nutrient interaction matrix calculated based on food nutrient database.
[0098] S_balance (balance score) is obtained as follows:
[0099] Data source: Based on patient information data fields (age, weight, height, disease stage, treatment plan);
[0100] Calculation method: S_balance = 1 - |actual intake - recommended intake| / recommended intake;
[0101] Compare with the Chinese Dietary Reference Intakes (DRIs) standards;
[0102] Adjust nutrient requirements according to the patient's treatment stage.
[0103] 2. Oncologist Agent
[0104] R_oncology means: the comprehensive score of the oncologist's intelligence agent on the medical safety of nutritional advice (value range 0-1).
[0105] Scoring formula: R_oncology = 0.5×S_treatment + 0.3×S_drug + 0.2×S_complication.
[0106] S_treatment (treatment suitability score) acquisition:
[0107] Data source: Based on the NCCN Breast Cancer Clinical Practice Guidelines;
[0108] Calculation method: S_treatment = Matching score × Treatment stage weight;
[0109] Preoperative period: High-protein diet weight = 0.8, fat restriction weight = 0.6;
[0110] During chemotherapy: anti-nausea diet weight = 0.9, folic acid supplementation weight = 0.7;
[0111] During the recovery period: Balanced nutrition weight = 0.8, appropriate exercise weight = 0.6.
[0112] S_drug (drug safety score) acquisition:
[0113] Data source: Drug-food interaction records based on expert experience data (20%);
[0114] Calculation method: S_drug = 1 - Σ(conflict risk level_i × severity weight_i);
[0115] Serious conflicts (e.g., warfarin and vitamin K): Risk level = 0.8;
[0116] Moderate conflict (e.g., tamoxifen and soy isoflavones): Risk level = 0.4;
[0117] Minor conflict: Risk level = 0.1.
[0118] S_complication (Complication Prevention Score) Acquisition:
[0119] Data source: Case studies on complication management from nutritionists' work records.
[0120] Calculation method: S_complication = Prevention effectiveness score × Complication risk weight;
[0121] Prevention of nausea and vomiting: Ginger tea recommended = +0.3, avoid greasy food = +0.2;
[0122] Constipation prevention: High-fiber foods = +0.4, sufficient water = +0.2.
[0123] 3. Psychologist Agent
[0124] R_psychology means: the overall score of the psychological support effect of the mental health agent on the nutritional advice (range 0-1).
[0125] Rating formula: R_psychology = 0.4 × Emotional support + 0.4 × Communication effectiveness + 0.2 × Psychological adaptation.
[0126] Emotional support score acquisition:
[0127] Data source: Emotional state assessment based on patient feedback data;
[0128] Calculation method: The warmth of language is assessed using a sentiment analysis model;
[0129] Emotional support = (Number of positive words - Number of negative words) / Total number of words + 0.5;
[0130] Positive vocabulary includes: "care," "support," and "understanding."
[0131] Negative words: "difficulty", "pain", "worry", etc.
[0132] Communication effectiveness score acquisition:
[0133] Data source: Analysis of the expression methods in the data fields of the nutrition reasoning process;
[0134] Calculation method: Communication effectiveness = Comprehensibility score × 0.6 + Acceptability score × 0.4;
[0135] Comprehensibility: The proportion of easily understood vocabulary used;
[0136] Acceptance: The degree of acceptance based on patient feedback.
[0137] Psychological adaptation score acquisition:
[0138] Data source: Based on changes in psychological state in patient feedback data;
[0139] Calculation method: assess the positive impact of recommendations on the patient's psychological state;
[0140] Psychological adaptation = (Psychological score after suggestion - Psychological score before suggestion) / 10.
[0141] 4. Patient Experience Agent
[0142] R_experience means: The patient's overall score on the practicality and operability of the nutritional advice as perceived by the agent (range 0-1).
[0143] Rating formula: R_experience = 0.4×Usefulness + 0.3×Operability + 0.3×Personalization.
[0144] Usability rating obtained:
[0145] Data source: Based on actual implementation data collected from patients (10%);
[0146] Calculation method: Practicality = Actual execution rate × Satisfaction with results;
[0147] Actual implementation rate: The percentage of patients who are able to follow the recommendations;
[0148] Satisfaction with the results: The degree of patient satisfaction with the recommended results (1-5 points).
[0149] Operational feasibility score acquisition:
[0150] Data source: Operational complexity analysis based on the nutrition advice data fields;
[0151] Calculation method: Operability = 1 - (Number of operation steps × 0.1 + Number of special requirements × 0.2);
[0152] Operating procedures: cooking steps, purchasing requirements, etc.;
[0153] Special requirements: special ingredients, special tools, etc.
[0154] Personalized rating acquisition:
[0155] Data source: Based on patient information data fields (dietary preferences, allergy history, economic conditions);
[0156] Calculation method: Personalization = Preference matching degree × 0.5 + Taboo avoidance degree × 0.3 + Economic fitness degree × 0.2;
[0157] Preference matching degree: The degree to which the recommendations match the patient's dietary preferences;
[0158] Contraindications: Whether to avoid foods that the patient is allergic to;
[0159] Economic suitability: Recommendations on the degree to which costs are matched with the patient's financial capacity.
[0160] 5. Family Care Agent
[0161] R_family: A comprehensive score (range 0-1) of the feasibility of implementing nutritional recommendations in a family by the family care agent.
[0162] Scoring formula: R_family = 0.4 × feasibility of support + 0.3 × economic efficiency + 0.3 × cultural adaptation.
[0163] Supports obtaining feasibility scores:
[0164] Data source: Based on family structure and support information in patient information.
[0165] Calculation method: Support feasibility = Family member involvement × 0.6 + Caregiving ability score × 0.4;
[0166] Family member involvement: The percentage of family members willing to participate in nutrition management;
[0167] Caregiving ability score: The level of nutritional knowledge and caregiving skills of family members.
[0168] Economic efficiency score acquisition:
[0169] Data source: Cost analysis based on patient information regarding economic status and nutritional advice;
[0170] Calculation method: Economic efficiency = 1 - (Monthly cost of nutrition plan / Monthly household income);
[0171] When costs account for less than 10% of revenue, the economic efficiency score is greater than 0.9.
[0172] When costs account for more than 30% of revenue, the economic efficiency score is less than 0.7.
[0173] Cultural adaptation score acquisition:
[0174] Data source: Based on patient information regarding geographical, ethnic, and religious background;
[0175] Calculation method: Cultural adaptation = Dietary habit matching degree × 0.5 + Religious taboo compliance degree × 0.3 + Regional characteristic integration degree × 0.2;
[0176] Dietary habit compatibility: Recommendations on how well the food fits the local food culture;
[0177] Religious taboo compliance: Whether religious dietary restrictions are observed;
[0178] Regional characteristics integration: Whether local specialties and cooking methods are incorporated.
[0179] Dynamic weight optimizer
[0180] Adaptive weight adjustment mechanism:
[0181] R_agents = [R_nutrition, R_oncology, R_psychology, R_experience, R_family];
[0182] W_t = softmax(MLP([R_agents, patient_profile, treatment_stage, historical_performance]));
[0183] in,
[0184] R_agents = [R_nutrition, R_oncology, R_psychology, R_experience, R_family] (5-dimensional agent rating vector);
[0185] patient_profile: Patient feature vector (12 dimensions);
[0186] treatment_stage: Treatment stage code (5 dimensions);
[0187] historical_performance: Historical performance vector (5 dimensions).
[0188] Detailed design of MLP network architecture (i.e., multi-agent cooperative architecture network):
[0189] Input layer structure (27 dimensions):
[0190] Input vector = concat([R_agents(5-dimensional), patient_profile(12-dimensional), treatment_stage(5-dimensional), historical_performance(5-dimensional)])
[0191] Network architecture:
[0192] Input layer: 27 dimensions → Hidden layer 1: 64 dimensions → Hidden layer 2: 32 dimensions → Output layer: 5 dimensions;
[0193] Activation functions: ReLU → ReLU → Softmax;
[0194] Detailed calculation process:
[0195] h1 = ReLU(W1 × input + b1) # 64-dimensional
[0196] h2 = ReLU(W2 × h1 + b2) # 32-dimensional
[0197] W_t = Softmax(W3 × h2 + b3) # 5-dimensional weight output
[0198] Mathematical formula embodiment:
[0199] if R_nutrition>0.8 and R_oncology>0.8:
[0200] # Good performance in nutrition and medical care increases the weight of psychological and experiential factors.
[0201] adjustment_factor = [0.95, 0.95, 1.1, 1.05, 1.0]
[0202] else:
[0203] # Prioritize basic safety, and increase the weight of nutrition and medical care.
[0204] adjustment_factor = [1.1, 1.1, 0.9, 0.95, 0.95]
[0205] W_adjusted = W_t * adjustment_factor
[0206] W_final = W_adjusted / sum(W_adjusted) # Normalization
[0207] Weight update strategy:
[0208] Initial weights: W_nutrition=0.25, W_oncology=0.25, W_psychology=0.2, W_experience=0.15, W_family=0.15;
[0209] Dynamic adjustment: The weight allocation is adjusted in real time according to the patient's condition and treatment stage;
[0210] Learning mechanism: Continuously optimize weight distribution based on patient feedback and expert evaluation.
[0211] def update_weight_optimizer(weight_mlp, agent_performance, consensus_history):
[0212] Dynamic weight optimizer updated based on agent performance
[0213] Correlation: Parameter optimization is performed using the previously designed MLP network structure.
[0214] # Step 1: Construct training samples (based on historical consensus results)
[0215] training_samples = []
[0216] for history_item in consensus_history:
[0217] input_features = np.array([
[0218] history_item['agent_scores']['R_nutrition'],
[0219] history_item['agent_scores']['W_oncology'],
[0220] history_item['agent_scores']['W_psychology'],
[0221] history_item['agent_scores']['W_experience'],
[0222] history_item['agent_scores']['R_family'],
[0223] history_item['score_variance'],
[0224] history_item['score_mean'] ])
[0226] # Target weights (calculated in reverse based on the final result)
[0227] target_weights = calculate_optimal_weights(
[0228] history_item['final_reward'],
[0229] history_item['agent_scores'] )
[0231] training_samples.append((input_features, target_weights))
[0232] # Step 2: MLP Network Parameter Update
[0233] for epoch in range(weight_update_epochs):
[0234] for input_features, target_weights in training_samples:
[0235] # Forward Propagation
[0236] predicted_weights = weight_mlp.forward(input_features)
[0237] # Calculate the loss (mean squared error)
[0238] loss = F.mse_loss(predicted_weights, target_weights)
[0239] # Backpropagation
[0240] weight_mlp.optimizer.zero_grad()
[0241] loss.backward()
[0242] weight_mlp.optimizer.step()
[0243] return weight_mlp
[0244] Consensus Engine
[0245] Multi-layered consensus mechanism:
[0246] 1. Hard constraint consensus (must be satisfied)
[0247] Nutritionist intelligence score ≥ 0.7 (ensuring basic nutritional scientific accuracy);
[0248] Oncologists' intelligence score ≥ 0.8 (to ensure medical safety).
[0249] 2. Soft Constraint Consensus (Optimization Objective)
[0250] All agent rating variances ≤ 0.1 (to ensure consistent evaluation) (It is recommended to have a formula to visually represent the rating variance).
[0251] Rating variance = Variance(R) = Σ(R_i - R_mean)² / n;
[0252] Variance threshold source: Based on the evaluation consistency analysis in the expert experience data (20%);
[0253] in,
[0254] R = [R_nutrition, R_oncology, R_psychology, R_experience, R_family];
[0255] R_mean = (R_nutrition + R_oncology + R_psychology + R_experience + R_family) / 5;
[0256] n = 5 (number of agents).
[0257] Specific calculations:
[0258] R_mean = (R_nutrition + R_oncology + R_psychology + R_experience + R_family) / 5;
[0259] Variance = [(R_nutrition - R_mean)² + (R_oncology - R_mean)² + (R_psychology - R_mean)² + (R_experience - R_mean)² + (R_family - R_mean)²] / 5.
[0260] Weighted average score ≥ 0.75 (to ensure overall quality) (It is recommended to have a formula to visually represent the weighted average score).
[0261] Weighted average score = Weighted_Average = Σ(W_i × R_i) / Σ(W_i);
[0262] Quality threshold source: based on satisfaction criteria in patient feedback data (≥0.75 corresponds to a "satisfactory" rating);
[0263] in,
[0264] W_i: The dynamic weights of the i-th agent (from the weight optimizer)
[0265] R_i: The score of the i-th agent
[0266] i ∈ {nutrition, oncology, psychology, experience, family}.
[0267] Specific calculations:
[0268] Weighted_Average = (W_nutrition × R_nutrition + W_oncology × R_oncology + W_psychology × R_psychology + W_experience × R_experience + W_family × R_family) / (W_nutrition + W_oncology + W_psychology + W_experience+ W_family);
[0269] Since the weights are normalized: Σ(W_i) = 1, therefore:
[0270] Weighted_Average = W_nutrition × R_nutrition + W_oncology × R_oncology + W_psychology × R_psychology + W_experience × R_experience + W_family × R_family.
[0271] 3. Conflict resolution mechanism
[0272] Step 1: Conflict Diagnosis
[0273] Identify conflict sources based on dataset security standards;
[0274] Tracing back to the specific intelligent agent and data field.
[0275] Step 2: Score Adjustment
[0276] Nutritionist AI Agent: Recalibrated based on nutrition dataset;
[0277] Medical intelligent agent: Adjusting weights based on clinical datasets;
[0278] Other agents: Adjusted based on the severity of the conflict.
[0279] Step 3: Weight Redistribution
[0280] Use a Dynamic Weight Optimizer (MLP) network;
[0281] Input: Adjusted scores for the five agents;
[0282] Output: New weight assignments W1-W5.
[0283] Step 4: Consensus Recalculation
[0284] New consensus score = Σ(Wi × Ri_adjusted)
[0285] Convergence test = |New consensus - Old consensus| < 0.05.
[0286] Step 5: Termination of judgment
[0287] Convergence successful: Output final consensus;
[0288] If the convergence fails and the iteration time is less than 3 rounds: continue to the next iteration.
[0289] If the problem fails to converge after three rounds, it will be referred to expert arbitration.
[0290] Application Examples
[0291] Scenario: Nutritional plan conflict (dietary therapist 0.85 vs. medical practitioner 0.45)
[0292] Round 1: Identify renal function conflict → Adjust nutritional score to 0.75 → Converge to 0.42;
[0293] Round 2: Introducing patient experience → Weight redistribution → Convergence to 0.78;
[0294] Round 3: Considering family implementation → Final consensus 0.87 → Optimization successful.
[0295] Final reward function
[0296] Total reward calculation: R_total = Σ(W_i × R_i) × Consensus_Factor;
[0297] in,
[0298] W_i: The dynamic weight of the i-th agent;
[0299] R_i: The score of the i-th agent;
[0300] Consensus_Factor: Consensus factor (0.8-1.2).
[0301] def calculate_consensus_factor(agent_scores):
[0302] Consensus factor is calculated based on the consensus scores of five agents.
[0303] Relevance: Directly use the agent scores R1-R5 designed above.
[0304] scores = [agent_scores['R_nutrition'], agent_scores['R_medical'],
[0305] agent_scores['R_psychology'], agent_scores['R_patient'],
[0306] agent_scores['R_family']
[0307] # Calculate the score variance (consistency index)
[0308] variance = np.var(scores)
[0309] # Calculate the standard deviation of the rating
[0310] std_dev = np.std(scores)
[0311] # Consensus Factor Calculation Formula
[0312] consensus_factor = 1.0 + 0.2 * (1 - std_dev) - 0.3 * variance
[0313] # Limited to the range of 0.8-1.2
[0314] consensus_factor = np.clip(consensus_factor, 0.8, 1.2)
[0315] return consensus_factor
[0316] Reward function characteristics:
[0317] Multi-dimensional assessment: covering five dimensions: medical, nutritional, psychological, experiential, and family.
[0318] Dynamic weights: adaptively adjusted based on patient condition and treatment stage;
[0319] Consensus mechanism: Ensures the consistency and reliability of multi-agent evaluation;
[0320] Safety Guarantee: Strict constraints ensure medical safety and nutritional scientific rigor.
[0321] Training process
[0322] 1. Parallel evaluation of multiple agents
[0323] Five specialized intelligent agents simultaneously score the generated content;
[0324] The dynamic weight optimizer calculates the current weight allocation, which is consistent with the weight update strategy.
[0325] 2. Consensus Reached
[0326] Check the satisfaction of hard and soft constraints;
[0327] The conflict resolution mechanism may be triggered if necessary.
[0328] 3. Reward Calculation and Feedback
[0329] Calculate the final overall reward value;
[0330] Use the PPO algorithm for gradient updates;
[0331] def ppo_gradient_update(agent_models, rewards, states, actions, old_log_probs):
[0332] Gradient update process of PPO algorithm
[0333] Correlation: Updating model parameters based on the ratings and rewards of the five agents.
[0334] for epoch in range(ppo_epochs):
[0335] for agent_id, model in agent_models.items():
[0336] # Step 1: Calculate the action probability of the current policy
[0337] new_log_probs = model.get_action_log_probs(states,actions)
[0338] # Step 2: Calculate the importance sampling ratio
[0339] ratio = torch.exp(new_log_probs - old_log_probs[agent_id])
[0340] # Step 3: Calculate the PPO loss function
[0341] surr1 = ratio * rewards[agent_id]
[0342] surr2 = torch.clamp(ratio, 1-clip_epsilon, 1+clip_epsilon) * rewards[agent_id]
[0343] policy_loss = -torch.min(surr1, surr2).mean()
[0344] # Step 4: Calculate the value function loss
[0345] value_loss = F.mse_loss(model.value_head(states),rewards[agent_id])
[0346] # Step 5: Calculate the entropy loss (exploration is encouraged)
[0347] entropy_loss = -model.get_entropy(states).mean()
[0348] # Step 6: Calculate Total Loss
[0349] total_loss = policy_loss + 0.5 * value_loss + 0.01 * entropy_loss
[0350] # Step 7: Backpropagation and Parameter Update
[0351] model.optimizer.zero_grad()
[0352] total_loss.backward()
[0353] torch.nn.utils.clip_grad_norm_(model.parameters(),max_grad_norm=0.5)
[0354] model.optimizer.step()
[0355] return updated_models
[0356] Update the agent's knowledge base and weight optimizer.
[0357] 4. Adaptive adjustment
[0358] Adjust the KL divergence constraint based on the training results;
[0359] def adaptive_kl_constraint_adjustment(training_metrics, current_kl_target=0.01):
[0360] Dynamically adjust KL divergence constraints based on training performance.
[0361] Correlation: Ensures the stability and convergence of agent policy updates.
[0362] # Constraint 1: Policy Update Amplitude Control
[0363] policy_change_threshold = calculate_policy_change_rate(training_metrics)
[0364] # Constraint 2: Maintaining Consistency Among Agents
[0365] inter_agent_consistency = calculate_inter_agent_consistency(training_metrics)
[0366] # Constraint 3: Convergence Stability Monitoring
[0367] convergence_stability = calculate_convergence_stability(training_metrics)
[0368] # KL divergence target value adjustment logic
[0369] if policy_change_threshold > 0.1: # Policy change is too large
[0370] new_kl_target = current_kl_target * 0.8 # Tighten constraints
[0371] elif convergence_stability<0.7: # Unstable convergence
[0372] new_kl_target = current_kl_target * 0.9 # Tighten appropriately
[0373] elif inter_agent_consistency>0.9: # High consistency, possibly overfitting
[0374] new_kl_target = current_kl_target * 1.1 # Moderate relaxation
[0375] else:
[0376] new_kl_target = current_kl_target # Keep the current constraints
[0377] return np.clip(new_kl_target, 0.005, 0.02) # Limit to a reasonable range
[0378] Optimize the evaluation criteria and weight allocation strategy for intelligent agents.
[0379] Phase Two: Fine-tuning of supervisory instructions (formation of nutritionist style)
[0380] Step S3: Stylization Training
[0381] Dataset: 15,000 pairs of questions and answers from nutritionists providing professional guidance;
[0382] Technical methods:
[0383] Convert to Alpaca command format;
[0384] Use the LoRA adapter for efficient parameter fine-tuning;
[0385] Enhanced agent expertise:
[0386] Stylized training based on 15,000 professional Q&As from nutritionists;
[0387] Strengthen the ability to assess the scientific nature, compatibility, and balance of nutrition;
[0388] Enhance the collaborative expression capabilities of the five specialized intelligent agents.
[0389] Multimodal data processing optimization:
[0390] Improve understanding of patient profiles (age, weight, stage of illness, dietary preferences, etc.);
[0391] Optimize the nutritional reasoning process and generate personalized recommendations;
[0392] Enhance the professional style and warm interaction of nutritionists.
[0393] Keep the parameters of the basic agent model that was trained in the first stage frozen, and only train the LoRA matrix;
[0394] The Adam optimizer is used with the PPO algorithm for gradient updates;
[0395] Personalized prompt design:
[0396] Role: Senior Clinical Nutritionist;
[0397] Professional competence: Proficient in the nutritional needs of all stages of breast cancer treatment;
[0398] Interaction style: professional, warm, and aligned with patient cognition;
[0399] Thinking mode: progressive analysis, considering multiple perspectives.
[0400] In summary, the technical features of this method are as follows:
[0401] 1. Two-stage optimization strategy
[0402] Phase 1: Enhancing nutritional reasoning ability through multi-agent collaborative reinforcement learning;
[0403] Phase Two: Developing a professional style as a nutritionist through supervised learning.
[0404] 2. Revolutionary Multi-Agent Reward Mechanism
[0405] Multi-dimensional professional assessment: 5 professional dimensions including nutrition, medical care, psychology, experience, and family;
[0406] Dynamic weight optimization: Adaptively adjusts based on patient condition and treatment stage;
[0407] Intelligent consensus mechanism: Ensures the consistency and security of multi-agent evaluation;
[0408] Continuous learning ability: Continuously optimize evaluation criteria based on feedback.
[0409] 3. Efficient parameter fine-tuning
[0410] Use LoRA technology to reduce computing resource requirements;
[0411] Maintain the stability of the basic model;
[0412] Suitable for deployment in medical institutions.
[0413] 4. Personalized guidance ability
[0414] Consider the stage of treatment, complications, dietary habits, and economic conditions;
[0415] Provide precise nutrition solutions;
[0416] It incorporates elements of humanistic care.
[0417] The data size is as follows
[0418] Reinforcement learning dataset: 5000 nutritional cases of breast cancer;
[0419] Multi-agent training data: 3000-5000 data points for each agent's specialized dataset;
[0420] Stylized dataset: 15,000 Q&As from nutritionists providing professional guidance.
[0421] The expected results of this method are as follows:
[0422] Technical advantages:
[0423] 1. Multi-dimensional professionalism: Pioneering multi-agent collaborative assessment to ensure comprehensive medical nutrition guidance;
[0424] 2. Dynamic adaptability: The assessment weights are adjusted in real time according to the patient's condition, providing precise guidance;
[0425] 3. Safety and Reliability: Rigorous constraints ensure medical safety and nutritional scientific rigor;
[0426] 4. Continuous optimization: The multi-agent learning mechanism enables continuous system improvement;
[0427] 5. Computational efficiency: Compared to large-scale models, resource requirements are reduced, and deployment is easier;
[0428] 6. Ease of use: The generated content is detailed and clear, making it easy for patients to understand.
[0429] Application value:
[0430] Addressing the shortage of nutritionists in medical institutions;
[0431] Provide 24 / 7 professional nutrition counseling for breast cancer patients;
[0432] Standardize nutritional guidance procedures to improve the quality of medical services;
[0433] It can be extended to other cancer types and chronic disease areas.
Claims
1. A method for constructing a large-scale model of nutritional counseling for breast cancer patients, characterized by: Based on the basic model, a two-stage fine-tuning framework combined with a multi-agent collaborative reward system is adopted, which includes the following steps: (1) Reinforcement learning fine-tuning: A composite training dataset is constructed by using a high-quality breast cancer nutrition management dataset combined with a local private clinical nutrition guidance dataset. A multi-agent collaborative architecture is constructed based on five professional dimensions: nutrition, medical care, psychology, experience, and family. The current weights are adaptively adjusted based on the patient's status and treatment stage using a dynamic weight optimizer. The evaluation criteria are continuously optimized based on the feedback of the consensus engine. Finally, the reward function is obtained to calculate the final comprehensive reward value. The gradient is updated using the PPO algorithm. The basic agent model is trained and obtained. Nutrition reasoning ability is improved through multi-agent collaborative reinforcement learning. The multi-agent collaborative architecture is as follows: The nutritionist AI provides a comprehensive score for nutritional advice, calculated as follows: R_nutrition = 0.4 × Scientific validity + 0.3 × Compatibility + 0.3 × Balance. The scientific validity data is derived from clinical guidelines and medical literature, the compatibility data from professional textbooks, and the balance data from patient information fields. The oncologist's intelligent agent comprehensively scores the medical safety of nutritional advice, with the scoring formula: R_oncology = 0.5×treatment adaptability + 0.3×drug safety + 0.2×complication prevention; where the data for treatment adaptability is obtained from clinical guideline data, the data for drug safety is obtained from expert experience data, and the data for complication prevention is obtained from nutritionist work records. The comprehensive score of the psychological support effect of the mental health agent on nutritional advice is calculated using the following formula: R_psychology = 0.4 × emotional support + 0.4 × communication effectiveness + 0.2 × psychological adaptation; where the data for emotional support is based on patient feedback data, the data for communication effectiveness is based on the nutritional reasoning process data field, and the data for psychological adaptation is based on patient feedback data. The patient experience agent scores the practicality and operability of nutritional advice comprehensively. The scoring formula is: R_experience = 0.4 × practicality + 0.3 × operability + 0.3 × personalization. Among them, the data source for practicality is based on patient-collected data, the data source for operability is based on the nutritional advice data field, and the data source for personalization is based on the patient information data field. The family care intelligent agent comprehensively scores the feasibility of implementing nutritional recommendations in families. The scoring formula is: R_family = 0.4×support feasibility + 0.3×economic efficiency + 0.3×cultural adaptation. Among them, the data source for support feasibility is based on the patient information data field, the data source for economic efficiency is based on the patient information data field, and the data source for cultural adaptation is based on the patient information data field. For the dynamic weight optimizer, its adaptive weight adjustment mechanism is as follows: R_agents = [R_nutrition, R_oncology, R_psychology, R_experience, R_family] W_t = softmax(MLP([R_agents, patient_profile, treatment_stage, historical_performance])) in, R_agents = [R_nutrition, R_oncology, R_psychology, R_experience, R_family] refers to the 5-dimensional agent rating vector, patient_profile refers to the patient feature vector, treatment_stage refers to the treatment stage encoding, and historical_performance refers to the historical assessment performance vector. The weight update strategy is as follows: initial weights W_nutrition=0.25, W_oncology=0.25, W_psychology=0.2, W_experience=0.15, W_family=0.15; the weight allocation is adjusted in real time according to the patient's condition and treatment stage, and the weight distribution is continuously optimized based on patient feedback and expert evaluation. Regarding consensus engines, their multi-layered consensus mechanisms are as follows: The hard constraint consensus includes a nutritionist agent score ≥ 0.7 and an oncologist agent score ≥ 0.8; Soft-constraint consensus includes all agents having a score variance ≤ 0.1 and a weighted average score ≥ 0.75; When checking hard and soft constraints, a conflict resolution mechanism is preset. If a hard constraint conflict occurs, the expert arbitration module is triggered to record the conflict case for model optimization. If a soft constraint conflict occurs, the iterative optimization process is started, with a maximum of 3 rounds of adjustments. Regarding the reward function, the overall reward is calculated as follows: R_total = Σ(W_i × R_i) × Consensus_Factor in, W_i refers to the dynamic weight of the i-th agent. R_i refers to the score of the i-th agent; Consensus_Factor refers to the consensus factor, which is calculated based on the consensus of the five agents' scores. (2) Supervised instruction fine-tuning: The nutritionist question-and-answer pair dataset is converted into Alpaca instruction format. The parameters of the basic agent model completed in the first stage of training are frozen. Only the LoRA matrix is trained. The parameters are fine-tuned using the LoRA adapter. The gradient is updated using the PPO algorithm with the Adam optimizer. The nutritionist's professional style is formed through supervised learning.
2. The method for constructing a large-scale nutritional counseling model for breast cancer patients according to claim 1, characterized in that, in In step (1), the construction of the composite training dataset specifically involves: a high-quality breast cancer nutrition management dataset sourced from publicly available datasets, medical literature data, clinical guideline data, and professional textbook data; and a local private clinical nutrition guidance dataset sourced from nutritionist work records and patient feedback data. The composite training dataset is represented as follows: Composite dataset = 40% public dataset + 30% clinical guideline data + 20% expert experience data + 10% patient-collected data; The public dataset includes three parts: public datasets from the sources of high-quality breast cancer nutrition management datasets, medical literature data, and professional teaching material data; expert experience data comes from nutritionist work records; patient-collected data comes from patient feedback data; the data fields in the composite training dataset include patient information, nutrition problems, nutrition reasoning process, and nutrition advice, and the data fields are a unified data pattern of the composite training dataset.
3. The method for constructing a large-scale nutritional counseling model for breast cancer patients according to claim 1, characterized in that, The specific conflict resolution mechanism is as follows: (a) Conflict diagnosis: Identify conflict sources based on security standards for composite training datasets, tracing them back to specific agents and data fields; (b) Scoring adjustment: The nutritionist agent is recalibrated based on nutritional data, the oncologist agent adjusts weights based on clinical data, and other agents adjust according to the severity of conflict. (c) Weight reallocation: Dynamically adjust the weights of the multi-agent cooperative architecture using a dynamic weight optimizer. Input the adjusted scores of the five agents from step (b), and output the new weight allocation for the five agents. (d) Consensus recalculation: Calculate a new consensus score based on the adjusted scores of the five agents and output the new weights of the five agents, and preset the convergence verification conditions; (e) Termination judgment: If convergence is successful, output the final consensus; if convergence is not achieved and the number of iterations is less than 3, continue to the next iteration; if convergence is not achieved after 3 iterations, proceed to expert arbitration.
4. The method for constructing a large-scale nutritional counseling model for breast cancer patients according to claim 1, characterized in that, in In step (1), the training process for reinforcement learning fine-tuning is as follows: (11) Multi-agent parallel evaluation: Five professional agents simultaneously score the generated content, and a dynamic weight optimizer calculates the current weight allocation of the five professional agents; (12) Consensus reached: Check the satisfaction of hard and soft constraints, and trigger the conflict resolution mechanism if necessary; (13) Reward calculation and feedback: Calculate the final comprehensive reward value, use the PPO algorithm to perform gradient update, and update the knowledge base and dynamic weight optimizer of the five professional agents; (14) Adaptive adjustment: Adjust the KL divergence constraint according to the training effect and optimize the evaluation criteria and weight allocation strategy of the five professional agents.
5. The method for constructing a large-scale nutritional counseling model for breast cancer patients according to claim 1, characterized in that, in In step (2), the parameter fine-tuning using the LoRA adapter is as follows: (i) Enhanced professional knowledge of intelligent agents: Stylized training based on nutritionist professional Q&A pairs to strengthen the ability to assess the scientific nature, matching and balance of nutrition, and enhance the collaborative expression ability of 5 professional intelligent agents; (ii) Multimodal data processing optimization: Improve patient profile understanding based on patient information data fields, optimize nutritional reasoning process and personalized suggestion generation, and enhance the professional style and warm interaction of nutritionists.