Health management model training method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202611247628.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-17
- Publication Date
- 2026-10-27
AI Technical Summary
但由于缺少对模型推理过程的偏差纠正,都会导致学生模型无法真正学习到医养场景下的深层推理逻辑,进而训练后的模型输出结果依然存在质量差、准确度不足等问题
[0010]在本申请实施例中,通过第一损失直接对齐预设教师网络输出的标准健康推理序列,让健康管理学生网络在训练初期就学习健康管理场景下的全链路推理流程,而非仅记忆最终答案的表层文本,建立医养专属的结构化推理习惯。同时,依托动态标签调度所确定的预设答案标签,能够在模型训练过程中同时动态兼顾人工标注的正确性、教师模型的暗知识与学生自生成的分布特性,避免单一监督信号的信息缺失,为后续蒸馏提供更全面的监督基础。再通过计算第二损失,让学生网络在自身生成的分布空间内拟合教师网络的全词表相对概率,纠正自回归推理过程中的潜在偏差,而非仅学习独热硬标签,最终通过迭代更新模型参数,兼顾基础推理能力收敛与深层知识对齐,让学生网络真正掌握医养场景的专家级推理逻辑,提升了训练后模型输出的医学正确性与方案合规性,进而提高方案输出质量与准确度。
Smart Images

Figure CN122991663A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of health management technology, specifically relating to a training method, device, electronic device, and storage medium for a health management model. Background Technology
[0002] As the demand for large-scale models to be implemented in demanding vertical scenarios such as health management continues to increase, the requirements for the stability, business consistency, and generalization ability of health management models are also gradually increasing.
[0003] In related technologies, the conventional SFT training mode for health management models only focuses on the surface content of the standard answer itself, without covering the rationality and safety judgment logic of other candidate expressions. Furthermore, if traditional distillation methods are used for model training, the output of the teacher model is often used as a hard label to train the student model. However, due to the lack of bias correction in the model's reasoning process, the student model cannot truly learn the deep reasoning logic in the medical and elderly care scenario, resulting in poor quality and insufficient accuracy in the trained model output. Summary of the Invention
[0004] To overcome the problems existing in related technologies, the present invention provides a training method, device, electronic device and storage medium for a health management model.
[0005] In a first aspect, embodiments of this application provide a method for training a health management model, the method comprising: The health sample data and the standard health inference sequence corresponding to the health sample data output by the preset teacher network are used as inputs to the health management student network, and the first loss corresponding to the health management student network is obtained. The system obtains a first probability distribution from the health management student network based on the health sample data and preset answer labels, and a second probability distribution from the preset teacher network based on the health sample data and preset answer labels; the preset answer labels are student self-sampling sequences, teacher-generated sequences, or manually labeled standard answer sequences dynamically selected based on preset mode selection rules. Calculate the second loss based on the first probability distribution and the second probability distribution; Based on the first loss and the second loss, the parameters of the health management student network are iteratively updated to generate a health management model.
[0006] Secondly, embodiments of this application provide a training device for a health management model, the device comprising: The first acquisition module is used to take health sample data and the standard health inference sequence corresponding to the health sample data output by the preset teacher network as input to the health management student network, and acquire the first loss corresponding to the health management student network. The second acquisition module is used to acquire a first probability distribution obtained by the health management student network based on the health sample data and preset answer labels, and to acquire a second probability distribution obtained by the preset teacher network based on the health sample data and preset answer labels; the preset answer labels are student self-sampling sequences, teacher-generated sequences, or manually labeled standard answer sequences dynamically selected based on preset mode selection rules; The first calculation module is used to calculate the second loss based on the first probability distribution and the second probability distribution; The first generation module is used to iteratively update the parameters of the health management student network based on the first loss and the second loss to generate a health management model.
[0007] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0010] In this embodiment, the first loss directly aligns with the standard health reasoning sequence output by the preset teacher network, allowing the health management student network to learn the entire reasoning process in a health management scenario from the initial training stage, rather than simply memorizing the surface text of the final answer, thus establishing a structured reasoning habit specific to medical and elderly care. Simultaneously, relying on the preset answer labels determined by dynamic label scheduling, the model training process can dynamically consider the correctness of manual annotations, the teacher model's implicit knowledge, and the distribution characteristics generated by the student, avoiding information loss from a single supervisory signal and providing a more comprehensive supervisory foundation for subsequent distillation. Then, by calculating the second loss, the student network fits the relative probability of the teacher network's full vocabulary within its own generated distribution space, correcting potential biases in the autoregressive reasoning process, rather than simply learning one-hot hard labels. Finally, through iterative updates of model parameters, balancing the convergence of basic reasoning ability and the alignment of deep knowledge, the student network truly masters the expert-level reasoning logic of medical and elderly care scenarios, improving the medical correctness and compliance of the model's output after training, thereby enhancing the quality and accuracy of the output solutions. Attached Figure Description
[0011] Figure 1 This is a flowchart illustrating the steps of a training method for a health management model provided in an embodiment of the present invention; Figure 2 This is a structural diagram of a training device for a health management model provided in an embodiment of the present invention; Figure 3 This is a structural diagram of an electronic device provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0014] The training method of the health management model provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0015] The health management vertical model generated by the training method of the health management model provided in the embodiments of the present invention provides health management services for customers in various scenarios. The target customers of the health management services include, but are not limited to, the following scenarios: customers who seek health management consultations in medical institutions, residents living in elderly care institutions and undergoing long-term chronic disease management, home-based elderly care customers who manage chronic diseases through telemedicine and smart devices, customers who experience chronic disease management in physical scenarios such as elderly care institutions and medical institutions, or customers who experience remote chronic disease management through mobile devices (such as mobile APP, large TV screen, smart speaker, etc.).
[0016] The implementers of this solution can include model training and R&D personnel, medical and elderly care business experts, data annotation and evaluation personnel, model maintenance personnel, as well as front-line doctors, health managers, nutritionists, and sports rehabilitation therapists who use the model to generate chronic disease management solutions. The upstream and downstream carriers of the health management model can include cloud-based training clusters, model training frameworks, data construction pipelines, automated evaluation systems, teacher model inference services, student model training services, online chronic disease management workbench, and resident-end applications.
[0017] This solution can be applied to model training systems, including: a data organization module, a supervised fine-tuning training module, a generative knowledge distillation module, an OPSD self-distillation module, a multi-machine MoE parallel training module, and an evaluation and feedback module. These modules are deployed in a training cluster and connected to a business data platform, an expert annotation platform, an automatic evaluation system, and a model deployment system, forming a closed loop from business data accumulation, training sample construction, model training, automatic evaluation to feedback iteration.
[0018] Figure 1 This is a flowchart illustrating the steps of a training method for a health management model provided in an embodiment of the present invention, as follows: Figure 1 As shown, the method may include: Step 101: Use the health sample data and the standard health inference sequence corresponding to the health sample data output by the preset teacher network as input to the health management student network, and obtain the first loss corresponding to the health management student network.
[0019] In this embodiment of the invention, pre-constructed structured health sample data and the corresponding standard health inference sequences are input into a health management student network, and the first loss corresponding to the health management student network is obtained. The health sample data may include multi-source data specific to the medical and elderly care field, such as resident basic profiles, major health problems, chronic disease labels, health risk warning labels, current medications and contraindications, historical follow-up records, expert consensus rules, and medical and elderly care knowledge guidelines (fields such as profile, health_problems, chronic_labels, risk_alerts, medications, follow_up_history, expert_consensus, and care_rules).
[0020] The pre-defined teacher network can be a high-computing-power large-scale model pre-injected with medical and elderly care expert consensus and clinical guideline rules. It can achieve domain adaptation through medical and elderly care domain instructions, knowledge retrieval, expert-reviewed sample SFT, or a combination thereof, and is evaluated using the same automatic assessment threshold as the student model. The standard health reasoning sequence can be a structured standard sequence for the entire expert chain in medical and elderly care chronic disease management scenarios. It consists of multiple structured word segments arranged in a fixed logical order, and can sequentially include seven hierarchical contents: problem analysis, risk stratification, health goal setting, medical care plan, exercise safety constraints, nutritional balance, and risk review (fields: problem_analysis, risk_stratification, health_goals, medical_nursing_plan, exercise_safety_constraints, nutrition_plan, and risk_review). The word segmentation label at each position in the sequence can be used to represent the standard decision output in that scenario. The standard health reasoning sequence carries the observable hierarchical intermediate conclusions, basis labels, field order, and inter-field conditional dependencies of the pre-defined teacher network, serving as a structured carrier of expert-level decision-making logic in medical and elderly care.
[0021] For example, for different users, corresponding resident basic profiles, major health problems, chronic disease tags, health risk warning tags, current medications and contraindications, and historical follow-up records can be obtained. Simultaneously, pre-built medical and elderly care rule constraints, such as expert consensus rules and medical and elderly care knowledge guidelines, can be acquired. Data can be extracted according to user identifiers and time windows, and de-identification, field type unification, medical unit normalization, duplicate record merging, and outlier marking processing can be performed. Historical follow-up records are arranged in ascending order of occurrence time, with the resident static basic profile placed before dynamic follow-up records. Input fields are arranged in a fixed order: resident basic profile, major health problems, chronic disease tags, health risk warning tags, current medications and contraindications, historical follow-up records, expert consensus rules, and medical and elderly care knowledge guidelines. Missing fields are uniformly filled with empty arrays or null, without disrupting the preset field order. When the input content exceeds the token budget, high-risk rules and recent follow-up records are retained first, and low-priority historical text is truncated from oldest to most recent, ultimately obtaining standardized health sample data that conforms to field specifications and length regulations.
[0022] A single health sample data point is input into a pre-defined teacher network, which outputs a corresponding complete standard health inference sequence. The health sample data and this standard health inference sequence are concatenated to form a long context training sequence, which is then input into the health management student network. The cross-entropy loss between the prediction result of the health management student network and the hard labels of the standard health inference sequence is calculated token-by-token through autoregressive forward propagation, yielding the first loss. This first loss can be the Supervised Fine-Tuning (SFT) loss.
[0023] For example, health sample data can be input into a preset teacher network to obtain candidate health management plans that include problem analysis, risk stratification, health goal setting, medical care plan, exercise safety constraints, nutritional balance, and risk review stratification. A three-layer automatic evaluation mechanism verifies the candidate health management plans: First, JSON Schema is used to check field completeness and type compliance. For example, completeness and type checks are performed on all output fields of the candidate plans, specifically checking whether required fields such as chronic disease risk labels, nursing task lists, exercise contraindications, nutrition plan parameters, and risk review instructions are missing. Simultaneously, the numerical ranges of fields such as blood glucose control thresholds, daily purine intake limits, and weekly exercise frequency are verified to conform to medical and elderly care business specifications. String fields are checked for null values, garbled characters, and excessive overflow issues to eliminate format errors in the structured output.
[0024] Next, deterministic rules are used to screen for medical conflicts in the dimensions of contraindications, medication, exercise, and nutrition. For example, medical conflict scenarios in the four core dimensions of contraindications, medication, exercise, and nutrition are traversed in a targeted manner. High-risk errors such as "recommending a high-purine diet during an acute gout attack", "recommending high-intensity resistance training for people at very high risk of hypertension", "allowing alcohol consumption while taking cephalosporin drugs", and "not controlling blood sugar in the dietary plan for diabetic patients" are identified as veto-type errors. All candidate solutions that hit high-risk conflict items in the rule base are directly judged as unqualified and do not need to enter the subsequent model evaluation stage, thus reducing the computational power consumption and the probability of misjudgment in model evaluation.
[0025] Finally, the LLM Judge scores the solutions from six dimensions: medical correctness, business consistency, exercise safety, nutritional balance, structural integrity, and executability. For example, a solution evaluation model specifically tuned for the medical and elderly care field can be invoked. With the medical and elderly care expert consensus knowledge base loaded, it outputs a score of 0-10 for each of the six independent dimensions: medical correctness, business consistency, exercise safety, nutritional balance, structural integrity, and executability. The weighted sum of the six dimension scores yields the total score. Candidate solutions with a total score reaching a preset passing threshold and whose scores in all six dimensions are not lower than the minimum passing line are serialized using a fixed template to generate a JSON format sequence containing the entire expert reasoning process. Standardized health sample data is bound to the JSON format sequence and written into a JSON file with sample data identifiers, data sources, evaluation versions, and rule version traceability identifiers to obtain a standard health reasoning sequence.
[0026] Step 102: Obtain the first probability distribution obtained by the health management student network based on the health sample data and the preset answer labels, and obtain the second probability distribution obtained by the preset teacher network based on the health sample data and the preset answer labels; the preset answer labels are student self-sampling sequences, teacher-generated sequences or manually labeled standard answer sequences dynamically selected based on preset mode selection rules.
[0027] In this embodiment of the invention, health sample data and preset answer labels are concatenated into a unified input sequence, which is then input into a health management student network and a preset teacher network. The two networks output the predicted probability distribution of each token position in the entire sequence in parallel through a single forward propagation, corresponding to the first probability distribution and the second probability distribution, respectively.
[0028] The preset answer labels come from one of three sources: student-sampled sequences, teacher-generated sequences, and manually labeled standard answer sequences. The first probability distribution is the token-level prediction distribution output by the health management student network, and the second probability distribution is the token-level soft probability distribution output by the preset teacher network.
[0029] Standardized health sample data is used as input x, concatenated with preset answer labels y, and a common context is constructed position by position. That is, the input for each token position t is the health sample data concatenated with all the prefix content before position t in the preset answer labels. The constructed full-sequence common context is input into the health management student network, a complete forward propagation is performed, and the raw full-vocabulary dimension corresponding to each token position t is output. .right Perform a softmax operation with a preset temperature coefficient τ to obtain the probability distribution covering the entire candidate token set V defined by the tokenizer. This distribution is the first probability distribution, which corresponds to the relative probability of the health management student network predicting all candidate tokens at each location.
[0030] Freeze all parameters of the preset teacher network, switch to inference mode, and disable the training-related random dropout module to ensure stable and reproducible output distribution. Reuse the full-sequence common context that is completely identical to the student network. Given a pre-defined teacher network in a frozen state, perform forward propagation synchronously and output the original logits of the full vocabulary dimension for each token position t. .right A softmax operation is performed using a preset temperature coefficient τ to obtain the native probability distribution of teachers covering the entire vocabulary V. This distribution is the second probability distribution, which is the relative probability distribution of all tokens generated by the pre-defined teacher network under the constraints of data and rules in the field of medical and elderly care.
[0031] It is understandable that the teacher network and the health management student network use the same tokenizer and vocabulary. If the original vocabulary of the two networks is different, a token mapping is established before training and normalization is performed on the common vocabulary.
[0032] For example, the process of generating preset answer labels can be as follows: Configure batch-level pattern probabilities for the patterns corresponding to the three types of sequences respectively; each mini-batch selects one pattern based on the pattern probability as the target pattern. Determine the preset answer labels based on the sequence corresponding to the target pattern. The student network obtains a self-sampled sequence based on healthy sample data in inference mode. The teacher network deterministically generates a teacher-generated sequence based on healthy sample data. Read the corresponding manually annotated standard answer sequence from the labeled dataset.
[0033] Step 103: Calculate the second loss based on the first probability distribution and the second probability distribution.
[0034] In this embodiment of the invention, a second loss can be calculated based on a first formula, a first probability distribution, and a second probability distribution. The second loss can be a Generalized Knowledge Distillation (GKD) loss, used to enable the health management student network to fit the relative probabilities of the pre-defined teacher network for all candidate tokens in the full vocabulary. This calculated second loss can align with the teacher's soft distribution within the distribution space generated by the student, specifically correcting potential biases in the student's self-generation process.
[0035] For example, a gradient stopping operation is performed on the teacher branch corresponding to the second probability distribution to block the backward gradient flow on the teacher side, ensuring that subsequent parameter updates only affect the health management student network. For each valid output token position t, the first probability distribution is calculated. and the second probability distribution The divergence loss of all valid output positions is calculated, summed, and then averaged by the total number of valid positions T to obtain the second loss.
[0036] For example, the first formula can be:
[0037] in, The second loss is used to characterize θ, and all trainable parameters of the health management student network are used to characterize θ. T represents the total number of valid output tokens in the preset answer label sequence. Used to characterize the first probability distribution Used to characterize the second probability distribution. Used to characterize the divergence distance between the second probability distribution and the first probability distribution at the t-th token position.
[0038] Step 104: Based on the first loss and the second loss, iteratively update the parameters of the health management student network to generate a health management model.
[0039] In this embodiment of the invention, the first loss and the second loss are weighted and summed according to preset weights to obtain the total loss, and backpropagation is performed on the health management student network. Based on the optimizer, the trainable parameters of the health management student network are updated layer by layer, and the above three steps are iterated until the model's indicators converge on the validation set, finally obtaining a deployable health management model. The health management model can automatically generate a health management plan that includes health goals, medical care recommendations, exercise rehabilitation plans, and nutritional diet plans based on residents' physical examination reports, follow-up records, chronic disease labels, medication status, lifestyle information, and expert consensus. When calculating subsequent tasks (such as diet and exercise), the preceding tasks (such as absolute clinical contraindications and medical medications) must be used as strong constraints as prerequisites to reduce the probability of medical conflicts between modules.
[0040] For example, it can be based on the second formula Calculate the total loss .in, The first loss, The preset weight value corresponding to the first loss. This is the second loss. This is the preset weight value corresponding to the second loss.
[0041] By using dual-loss joint training, the model can simultaneously achieve rapid convergence of basic reasoning capabilities and deep knowledge alignment effects brought about by distillation. Since the deployment phase does not require calling the teacher model, the model's output stability and accuracy in real medical and elderly care scenarios can be improved without increasing the online reasoning cost on the teacher side.
[0042] Understandably, depending on the actual model training requirements, it's also possible to base the training on either the first or second loss, for example... or or The student network for health management is iteratively updated to generate a health management model.
[0043] In summary, in this embodiment of the invention, by directly aligning the standard health reasoning sequence output by the preset teacher network through the first loss, the health management student network learns the entire reasoning process in the health management scenario from the early stages of training, rather than merely memorizing the surface text of the final answer, thus establishing a structured reasoning habit specific to medical and elderly care. Simultaneously, relying on the preset answer labels determined by dynamic label scheduling, the model training process can dynamically consider the correctness of manual annotations, the teacher model's implicit knowledge, and the distribution characteristics generated by the student, avoiding information loss from a single supervisory signal and providing a more comprehensive supervisory foundation for subsequent distillation. Furthermore, by calculating the second loss, the student network fits the relative probability of the teacher network's full vocabulary within its own generated distribution space, correcting potential biases in the autoregressive reasoning process, rather than simply learning one-hot hard labels. Finally, by iteratively updating the model parameters, balancing the convergence of basic reasoning ability and the alignment of deep knowledge, the student network truly masters the expert-level reasoning logic of the medical and elderly care scenario, improving the medical correctness and compliance of the model output after training, thereby enhancing the quality and accuracy of the output plan.
[0044] Furthermore, through GKD generative knowledge distillation, student networks can access their own generated context during the training phase, and the teacher network provides distributional correction within that context, making the training state closer to the actual online inference state. This reduces the risk of amplified prior biases in long-term solution generation and improves the stability of health management solutions.
[0045] Optionally, step 101 may include the following steps: Step 201: Input the health sample data into the preset teacher network and obtain the standard health inference sequence output by the preset teacher network.
[0046] In this embodiment of the invention, health sample data is input separately into a preset teacher network in inference mode, and all training random perturbation modules of the teacher network are turned off to ensure the stability of the output results. The preset teacher network can generate complete end-to-end inference content based on built-in medical and health knowledge and rule constraints, and serialize this content according to a preset JSON structure to obtain the final standard health inference sequence.
[0047] Step 202: Concatenate the health sample data and the standard health inference sequence into a training sequence and input it into the health management student network, and obtain the predicted probability distribution of each word segment output by the health management student network in the training sequence.
[0048] In this embodiment of the invention, the two parts are concatenated into a complete training sequence in a fixed order: health sample data first, followed by the standard health inference sequence. This is then input into the health management student network for autoregressive forward propagation. For each word segmentation position in the training sequence, the health management student network outputs the original prediction score for the full vocabulary dimension at that position, covering the entire candidate token set defined by the tokenizer.
[0049] Optionally, step 202 may include the following steps: Step 301: For the t-th word segment position of the health management student network, take the health sample data and the first t-1 preceding words of the standard health inference sequence as input, and obtain the original prediction score of the corresponding position output by the health management student network.
[0050] In this embodiment of the invention, based on the teacher forcing training mechanism, all valid word segmentation positions of the standard health inference sequence are traversed. For each position t, all word segments of the health sample data are concatenated with the first t-1 word segments in the standard health inference sequence to form the complete context of the current position, which is used as the input of the current position. Based on this context, the health management student network outputs the original logits score of the full vocabulary dimension corresponding to the t-th position, i.e., the original prediction score.
[0051] Here, the t-th segmentation position is the t-th valid segmentation position in the standard health inference sequence portion of the training sequence. The preceding t-1 segments can be all generated segmented content before the t-th segmentation position, used to construct the context of autoregressive inference. The original prediction score is used to reflect the degree of preference of the health management student network for all candidate tokens.
[0052] Step 302: Based on a preset temperature coefficient, normalize the original predicted score to generate the predicted probability distribution of the health management student network at the current location.
[0053] In this embodiment of the invention, the original predicted score at position t is divided by a preset temperature coefficient, and a softmax operation is performed on the processed score to map the scores of the entire vocabulary dimension to a probability distribution with a sum of 1, thus obtaining the predicted probability distribution of the health management student network at the current position. In this way, by controllably adjusting the temperature coefficient, the sharpness of the student network's predicted distribution can be smoothly controlled, adapting to the training needs of different safety levels in medical and elderly care scenarios, while balancing output stability and expressive diversity.
[0054] In this embodiment of the invention, by reusing the health sample data and the preceding t-1 words of the standard health inference sequence at the t-th word segment position as input, the inference logic of "deriving the next token based on the generated prefix" during the actual autoregressive inference of the health management student network after its launch is aligned. This eliminates the distribution offset problem of inconsistency between training and inference states in conventional training, and avoids inference logic gaps in the model under medical and elderly care chronic disease management scenarios. Furthermore, by using a preset temperature coefficient to controllably normalize the original prediction scores, the sharpness of the full vocabulary prediction probability distribution can be smoothly adjusted to adapt to the task requirements of different security levels in medical and elderly care scenarios, thereby improving the inference consistency and output quality of the health management student network in medical and elderly care scenarios.
[0055] Step 203: Calculate the first loss based on the predicted probability distribution of each word segment and the word segmentation label at the corresponding position in the standard health inference sequence.
[0056] In this embodiment of the invention, all valid word segmentation positions are traversed. For each position t, the cross-entropy loss between the predicted probability distribution of the student network and the corresponding word segmentation label is calculated. The first loss is determined based on the arithmetic mean of the losses for all valid positions. Here, the word segmentation label can be the one-hot hard label corresponding to the actual word segmentation at the corresponding position in the standard healthy inference sequence.
[0057] In this embodiment of the invention, a standard health reasoning sequence containing full-link reasoning logic, output by a pre-set teacher network, is used as the supervision carrier, rather than just a single final answer text. This allows the student network to learn the complete reasoning chain of "problem analysis - risk stratification - solution generation - risk review" in the medical and elderly care scenario from the initial training stage, avoiding the lack of reasoning logic caused by conventional SFT only aligning the surface output. Then, health sample data and the standard health reasoning sequence are concatenated into a training sequence for full word segmentation prediction, and the first loss is calculated based on the word segmentation labels at corresponding positions. This allows the student network to quickly establish a basic output paradigm for chronic disease management tasks, improving training convergence efficiency and ensuring the medical compliance and reasoning integrity of the model output.
[0058] Optionally, step 203 may include the following steps: Step 401: For any word segmentation position, based on the predicted probability distribution corresponding to the word segmentation position, index the predicted confidence of the word segmentation tag at the corresponding position, and calculate the loss value corresponding to each word segmentation position.
[0059] In this embodiment of the invention, all word segmentation positions in the training sequence are traversed. For each word segmentation position, the token index of the corresponding word segmentation tag is used as the subscript. The index value is then retrieved from the full vocabulary prediction probability distribution output by the student network to obtain the prediction confidence of the health management student network for that real tag word segmentation. Based on the general calculation logic of cross-entropy loss, the negative logarithm of this prediction confidence is taken to obtain the independent loss value corresponding to the current word segmentation position.
[0060] Step 402: Based on the preset loss mask, set the loss value corresponding to the word segmentation position in the healthy sample data interval to zero, and calculate the first loss based on the loss value corresponding to all word segmentation positions in the standard healthy inference sequence interval.
[0061] In this embodiment of the invention, a preset loss mask is multiplied element-wise with the independent loss values of all words in the entire sequence. The preset loss mask can be a binary label vector of the same length as the training sequence, used to label the interval corresponding to the healthy sample data as 0 and the interval corresponding to the standard healthy inference sequence as 1.
[0062] The loss values corresponding to all word segments within the health sample data interval are set to zero to mask invalid loss gradients from known input content. The valid word segment loss values that are not set to zero and belong to the standard health inference sequence interval are summed, then divided by the total number of valid word segments T within that interval, and the arithmetic mean is taken to obtain the normalized first loss. The health sample data interval is the prefix word segment interval of the training sequence that belongs to the resident health input information. This part of the content is the known condition for model inference, avoiding meaningless autoregressive predictions in the input text, and therefore does not participate in loss supervision. The standard health inference sequence interval is the suffix word segment interval of the training sequence that belongs to the end-link expert inference content output by the teacher, and is the effective supervision interval for the first loss.
[0063] For example, the first loss can be calculated using the following third formula:
[0064] in, The first loss is represented by θ, and all trainable parameters of the health management student network are represented by θ. T represents the total number of valid output segments within the standard health inference sequence interval. Used to characterize the preceding word segmentation sequence of the student network before the t-th effective output word segmentation position, given healthy sample data x. Under the given conditions, output the true tag word segmentation at position t. The predicted probability.
[0065] In this embodiment of the invention, the confidence score of the corresponding word segmentation tag is extracted by index prediction probability distribution to calculate the positional loss, thereby reducing the GPU memory usage for training the large-scale medical and elderly care model and improving training efficiency. Furthermore, a preset loss mask is used to set the loss of the health sample data interval to zero, shielding the invalid supervision gradient of known health information on the input side. This prevents the student network from repeatedly fitting the input sample content, allowing all training computing power to focus on the expert logic alignment of the standard health inference sequence. This avoids training interference caused by invalid gradients and enables the student network to master the structured reasoning paradigm of the medical and elderly care scenario, improving the model's inference accuracy and training convergence speed.
[0066] Optionally, embodiments of the present invention may further include the following steps: Step 501: Obtain the pattern probabilities corresponding to the student self-sampling mode, teacher-generated mode, and manual annotation mode respectively, and perform random sampling based on the category distribution formed by the probabilities of each mode to determine the target mode.
[0067] In this embodiment of the invention, the preset answer labels can be selected from sequences generated by different modes based on mode probabilities. The mode probability can be the sampling weight value corresponding to each mode, which can be dynamically adjusted in each training round according to the training stage, sample quality, and model capability. Correspondingly, the preset answer labels will also change dynamically in each training round. Modes can include student self-sampling mode, teacher-generated mode, and manually labeled mode. Student self-sampling mode can be a sampling mode where the output sequence autonomously generated by the health management student network in the current iteration phase serves as the preset answer label. Teacher-generated mode can be a sampling mode where the output sequence generated by the preset teacher network serves as the preset answer label. Manually labeled mode can be a sampling mode where the preset answer label is based on a manually labeled standard answer sequence.
[0068] For each mini-batch, a pattern is randomly sampled according to the category distribution formed by the probabilities of each pattern, and the sampled pattern is determined as the target pattern. The target pattern is the label generation pattern corresponding to a single healthy sample data point.
[0069] For example, assuming the probabilities of the student self-sampling mode, the teacher-generated mode, and the manually labeled mode are 0.5, 0.3, and 0.2 respectively, it means that the probability of the student self-sampling mode being sampled and determined as the target mode is 0.5, the probability of the teacher-generated mode being sampled and determined as the target mode is 0.3, and the probability of the manually labeled mode being sampled and determined as the target mode is 0.2.
[0070] Step 502: When the target mode is student self-sampling mode, the health sample data is input into the health management student network, and the student self-sampling sequence is generated through self-sampling as the preset answer label.
[0071] In this embodiment of the invention, health sample data is input separately into the health management student network in inference mode, so that the health management student network completes full-sequence autoregressive sampling based on its current parameters and generates student self-sampling sequences.
[0072] Accordingly, after determining the student self-sampling sequence as the preset answer label, the healthy sample data is concatenated before the student self-sampling sequence and input into the preset teacher network to obtain the second probability distribution corresponding to the preset teacher network. The difference between the second probability distribution and the first probability distribution, along with their divergence gradient, constitutes a directional correction signal for the student's own errors. This correction signal is used to provide directional correction for inference biases and rule omissions that actually occur during the student's own generation process.
[0073] It is understandable that the health management student network in this step can be a health management student network that has completed the initialization of basic reasoning ability in the previous SFT stage.
[0074] Step 502: When the target mode is teacher-generated mode, the health sample data is input into the preset teacher network to generate a teacher-generated sequence, which is used as the preset answer label.
[0075] In this embodiment of the invention, health sample data is input into a preset teacher network in inference mode, and autoregressive generation is performed to obtain a teacher-generated sequence, which serves as a preset answer label.
[0076] Accordingly, after determining the teacher-generated sequence as the preset answer label, the soft probability distribution of the full vocabulary output at each word segmentation position of the preset teacher network is obtained, i.e., the second probability distribution. The second probability distribution can be used as a soft probability distribution signal to characterize the implicit knowledge of the preset teacher network and the relative preference information under the constraints of medical and health care rules.
[0077] Step 503: When the target mode is manual annotation mode, obtain the manual annotation standard answer sequence corresponding to the health sample data from the pre-constructed manual annotation dataset, and use it as the preset answer label.
[0078] In this embodiment of the invention, the sample identifier of the healthy sample data is used as an index to retrieve and match the corresponding manually labeled standard answer sequence from the pre-constructed manually labeled dataset, which is then used as a preset answer label.
[0079] Understandably, the probabilities of different modes can be dynamically adjusted according to the progress of iterative training. For example, in the early stages of training, the probability of manually labeled modes can be set to the highest value. In the middle stages of training, the probability of teacher-generated modes can be gradually increased. In the later stages of training, the probability of student-sampled modes can be gradually increased. Furthermore, when testing the generation accuracy of the health management student network after a complete training run on the validation set, if the generation accuracy is lower than a preset accuracy threshold, the probability of the mode corresponding to the currently highest-proportion mode can be temporarily reduced to avoid training oscillations. In this way, increasing the proportion of manually labeled modes in the early stages of training ensures basic compliance of the solution's output. Increasing the proportion of student and teacher modes in the middle and later stages allows the label distribution to closely resemble the model's actual inference distribution, reducing training-to-deployment distribution drift and balancing the high safety requirements of the medical and elderly care scenario with the model's generalization ability at a low labeling cost.
[0080] In this embodiment of the invention, a single complete sequence is selected as the label by dynamic mode probability, without cross-sequence weighted noise. Furthermore, a sequence can be selected as the preset answer label from student self-sampled sequences, teacher-generated sequences, or manually labeled standard answer sequences according to the mode probability. This avoids the defects of losing hidden knowledge due to fixed hard labels and avoids the medical compliance risks that may occur from a single sequence source. It improves the convergence efficiency of knowledge distillation in medical and elderly care scenarios and the inference accuracy of the final model.
[0081] Optionally, embodiments of the present invention may further include the following steps: Step 601: Calculate the intermediate mixed distribution based on the preset adjustable parameters, the first probability distribution, and the second probability distribution.
[0082] In this embodiment of the invention, for each effective word segmentation position t in the training sequence, a preset adjustable parameter β is combined with a second probability distribution. Element-wise multiplication, combining the weight coefficients (1-β) with the first probability distribution. Element-wise multiplication is performed, and the two weighted distributions are summed element-wise to obtain the intermediate mixed distribution at the current position. The preset adjustable parameter can be a hyperparameter β ranging from 0 to 1, and its value can be dynamically adjusted according to the safety level of the medical and elderly care task.
[0083] For example, intermediate hybrid distribution It can be based on formula Sure.
[0084] Step 602: Based on the intermediate mixed distribution, calculate the adjustable divergence loss as the second loss.
[0085] In this embodiment of the invention, for each word segmentation position t, the KL divergence of the first probability distribution with respect to the intermediate mixed distribution is multiplied by (1-β), and the KL divergence of the second probability distribution with respect to the intermediate mixed distribution is multiplied by β. The two products are summed to obtain the adjustable divergence loss for the current position. The arithmetic mean of the adjustable divergence losses for all effective word segmentation positions is taken to obtain the final second loss.
[0086] For example, adjustable divergence loss at any word segmentation position It can be calculated based on the fourth formula:
[0087] In this embodiment of the invention, the continuous and smooth switching of divergence characteristics can be achieved by using a single parameter β. That is, when β approaches 0, the gradient is biased towards forward KL, allowing the student network to cover a variety of reasonable expressions of the teacher network distribution; when β approaches 1, the gradient is biased towards backward KL, allowing the student network to focus on learning the most certain and safest output of the teacher network. Without switching between two independent training processes, it can simultaneously adapt to the differentiated training needs of high-safety tasks in medical and elderly chronic disease management and large expression space tasks such as publicity or follow-up communication.
[0088] Optionally, the preset teacher network and the health management student network are different branches of the same model. To reduce the deployment cost of additional teacher models, the same model can simultaneously serve as both the preset teacher network and the health management student network. The basic structural parameters such as the number of network layers, hidden dimensions, and number of attention heads are the same for both the health management student network branch and the preset teacher network branch.
[0089] Embodiments of the present invention may further include the following steps: Step 701: Run the health management student network branch with health sample data as input and the preset teacher network branch with the health sample data and privileged information as input within the same model to obtain the first probability distribution output by the health management student network branch and the second probability distribution output by the preset teacher network branch.
[0090] In this embodiment of the invention, for any healthy sample data, the healthy sample data is input into the input layer of the student network branch without any privileged information, and forward propagation is completed along the autoregressive inference link of the student network branch, outputting a first probability distribution for the corresponding word segmentation position. After concatenating privileged information, the healthy sample data is input into the input layer of the teacher network branch of the same model, and forward propagation is completed along the autoregressive inference link of the teacher branch, outputting a second probability distribution for the corresponding word segmentation position.
[0091] For example, health sample data x is input into the input layer of the student network branch, and forward propagation is completed along the autoregressive inference link of the student network branch. Candidate sequences y are generated through autonomous sampling. Each word segmentation position t of the candidate sequence y is traversed, based on the student-side context without privileged information z. The first probability distribution of the current position is calculated. Simultaneously, the health sample data x, privilege information z, and student-side prefixes are combined. Concatenation is used to enhance the contextual input of the teacher network branch, which is then used by the teacher branch. The second probability distribution of the current position is calculated. .
[0092] Step 702: Perform gradient stopping operation on the preset teacher network branch, and calculate the self-distillation loss based on the first probability distribution and the second probability distribution, as the second loss.
[0093] In this embodiment of the invention, during the training backpropagation phase, the backflow of the loss gradient to the parameter layer of the teacher network branch is blocked. The parameters of the teacher network branch can be fixed at the initial training checkpoint or a periodically updated frozen snapshot to prevent the output of the teacher network from drifting synchronously with the parameters of the student network. Based on the first probability distribution of the student network branch output and the second probability distribution of the teacher network branch output, the alignment divergence of the two distributions is calculated position by position. The arithmetic mean of the divergence over all effective word segmentation positions is then minimized, for example, minimizing... The first probability distribution that allows students to output network branches. Gradually align the high-quality distribution of teacher network branches and learn the implicit knowledge of healthcare experts carried by privileged information. Calculate the self-distillation loss. As a second loss, the gradient of this loss is backpropagated to the student network branch to complete the parameter update.
[0094] In this embodiment of the invention, the teacher and student network branches share the same native network structure and initial weights of the same basic model, eliminating the need to deploy an independent external teacher model with large parameters, thus reducing the parameter storage and deployment resource requirements of an independent external teacher model. Simultaneously, gradient stopping and teacher network branch freezing mechanisms ensure the long-term stability of the teacher's output. Without introducing additional large model deployment costs, the student network branches can learn the reasoning logic of medical and elderly care experts from privileged information, making it suitable for training scenarios with limited expert-annotated data and constrained computing resources in medical and elderly care chronic disease management.
[0095] Optionally, the health management student network includes at least two expert sub-networks, which are deployed on different devices running in parallel.
[0096] In this embodiment of the invention, the health management student network can be a model supporting a hybrid MoE-expert architecture, including MoE layers, each MoE layer comprising at least two expert sub-networks. The health management student network can be initialized directly from a pre-trained MoE base checkpoint, or initialization can be completed by replacing a specified feedforward layer of a dense base with an expert layer with a routing mechanism. At least two expert sub-networks are deployed on different devices running in parallel. The devices can be independent computing cards, and data exchange between devices is achieved through high-speed communication links.
[0097] For example, based on the hardware resource configuration of the training cluster, the expert parallelism parameter ep can be set, and the E expert sub-networks contained in each MoE layer of the health management student network can be evenly distributed to different computing devices according to the expert parallelism dimension. The expert sub-networks on different devices can independently complete forward and backward computations and complete synchronization during the cross-device communication phase.
[0098] Embodiments of the present invention may further include the following steps: Step 801: For any of the expert subnetworks, determine the auxiliary loss based on the effective allocation ratio and the average routing probability of the expert subnetwork.
[0099] In this embodiment of the invention, for the e-th expert subnetwork among the E expert subnetworks contained in the l-th MoE layer of the health management student network, global batch statistical aggregation is performed within the expert parallel and data parallel group to calculate the effective token allocation ratio corresponding to that expert. Simultaneously, the average route probability assigned to this expert by the router at this layer is calculated. Based on the effective allocation ratio and average routing probability, the global expert load balancing auxiliary loss is determined. The global expert load balancing auxiliary loss is obtained by summing the load balancing losses of all MoE layers and multiplying them by a preset auxiliary loss coefficient α. α can take the value 1e-3, consistent with the original training configuration of the base model.
[0100] The effective allocation ratio can be the proportion of the number of valid tokens allocated to the corresponding expert subnetwork within the current global statistical batch to the total number of tokens. The average routing probability can be the average probability output by the routers at the MoE layer, indicating that all tokens are allocated to the corresponding expert subnetwork.
[0101] For example, the auxiliary loss of any MoE layer can be calculated using the following fifth formula:
[0102] Accordingly, step 104 may include the following steps: Step 802: Based on the first loss, the second loss, and the auxiliary loss, iteratively update the parameters of the health management student network.
[0103] In this embodiment of the invention, an auxiliary loss is added to the total loss calculated based on the first loss (SFT loss in the supervised fine-tuning stage) and the second loss (GKD loss or OPSD self-distillation loss in the knowledge distillation stage) to obtain the target loss. After each computing device completes its local forward and backward computation, it performs gradient reduction and parameter piecewise updates within its corresponding parallel group to complete the iterative optimization of all parameters of the health management student network.
[0104] In this embodiment of the invention, expert parameters are distributed across multiple GPUs through an expert parallel mechanism. At the same time, dynamic load balancing of experts is achieved through joint constraints of token allocation ratio and routing probability. Without introducing additional complex routing modification logic, the computing power utilization of all expert sub-networks can be kept in a balanced range in training scenarios with long medical and elderly care contexts and complex inference chain samples. Without changing the original SFT and distillation task objective functions, load balancing of MoE experts can be achieved by simply adding a lightweight auxiliary loss, thereby improving the training efficiency and final inference quality of the model.
[0105] Optionally, embodiments of the present invention may further include the following steps: Step 901: Input the test data into the iteratively updated health management student network and the preset teacher network respectively, and obtain the first output scheme of the iteratively updated health management student network and the second output scheme of the preset teacher network.
[0106] In this embodiment of the invention, test data is input into the iteratively updated health management student network to obtain the first output scheme corresponding to all test data. Simultaneously, the same test data is input into the preset teacher network in the frozen inference state to obtain the top-k candidate probability information in the preset teacher network generation process, and output the second output scheme with probability summary.
[0107] Step 902: Evaluate the first output scheme, and determine the target test data corresponding to the first output scheme that is unqualified, the second output scheme corresponding to the target test data, and the manual evaluation result corresponding to the target test data as the healthy sample data for the next round of iterative training.
[0108] In this embodiment of the invention, the first output scheme can be initially screened by an automatic evaluation system and an LLM Judge, marking candidate samples with compliance risks and inference biases. These samples are then pushed to medical and elderly care experts for manual sampling and business scenario playback, ultimately marking the first output scheme that fails the evaluation. The original target test data corresponding to the first output scheme that fails the evaluation, the second output scheme generated by the corresponding teacher (which may include the top-k probability summary content of the preset teacher network output), and the structured manual evaluation results filled in by the experts are associated and bound together. A new sample data for the SFT stage or the GKD / OPSD stage is automatically generated by the data construction program. At the same time, the parent sample traceability information and evaluation version identifier of the sample are recorded, and it is included in the health sample dataset for the next round of training.
[0109] The structured human evaluation results may include error fields / types, risk levels, correction content, and the basis for correction.
[0110] In this embodiment of the invention, by constructing a closed-loop iterative mechanism of "training-evaluation-feedback-retraining", the model's error samples are transformed into exclusive optimization materials for the next round of training, which specifically makes up for the shortcomings of the student model's capabilities and continuously iterates to improve the compliance and inference accuracy of the medical and elderly care model.
[0111] For example, for an elderly person with diabetes, hypertension, gout, and osteoporosis, the sample input includes age, gender, BMI, disease diagnosis, current medication, fall risk, dietary preferences, and exercise capacity; the sample output includes blood glucose and blood pressure control targets, care tasks, exercise contraindications, low-purine diet plan, and risk review instructions.
[0112] The standardized training samples were input into the health management student network, and the first loss calculation corresponding to ordinary SFT was performed. The standard health inference sequence output by the pre-set teacher network, expert-reviewed answers, or automatically evaluated candidate solutions served as supervision signals. This allowed the student model to initially grasp the instruction format, output structure, and basic rule calling logic of medical and chronic disease management tasks. After this training phase, the student model can stably output structured chronic disease management plans and accurately grasp basic medical and elderly care rules such as restricting high-purine foods during acute gout attacks, prohibiting high-intensity resistance training for very high-risk elderly individuals with hypertension, and strictly prohibiting alcohol consumption while taking cephalosporin antibiotics. This improves the learning ability of these rules and reduces the risk of common-sense errors.
[0113] After completing the basic SFT (Solution-Based Financial Theory), the student network enters the GKD (Guided Knowledge Digest) training phase. The same health sample of an elderly person with multiple comorbidities, along with pre-defined answer labels, are simultaneously input into both the health management student network and the pre-defined teacher network. This phase no longer requires the student network to simply fit the standard answer; instead, the teacher network provides richer candidate output judgments for each generation step. By learning the teacher network's judgment distribution, the student network understands the differences in rationality, safety, and priority among different candidate solutions. For example, regarding the exercise suggestion generation position, the teacher network might consider "low-intensity aerobic training," "seated balance training," and "walking under the supervision of a rehabilitation therapist" as relatively safe suggestions, while considering "high-intensity weighted squats" and "rapid stair climbing training" as higher-risk. By learning these judgment differences, the student network can understand the safety boundaries in exercise prescriptions, rather than simply mechanically memorizing a standard answer, and thus grasp the safety boundaries for generating exercise prescription solutions.
[0114] During the preset answer label generation process, an On-Policy distillation mode can be enabled. The student network first generates a chronic disease management plan based on the current parameters. If the student network omits "abstaining from alcohol while taking cephalosporins" or incorrectly recommends "high-intensity resistance training" during the generation process, the erroneous prefix generated by the student network is input into the preset teacher network, which then outputs a directional correction signal for the corresponding position. This mode completely simulates the actual autoregressive inference state of the student network after it goes live, avoiding the distribution bias problem caused by the standard answer prefix in ordinary SFT. It allows the student network to directly correct the errors that occur during its actual generation process during the training phase, reducing the risk of continuous inference bias after going live.
[0115] For certain medical and elderly care samples, an OPSD self-distillation variant can be enabled, where the same model simultaneously serves as both the pre-defined teacher network and the health management student network. The health management student network branch inputs health sample data to complete inference, while the pre-defined teacher network branch, within the same base model, additionally inputs privileged information such as expert reference answers, medical and elderly care rule base content, and historical evaluation feedback to generate a higher-quality second probability distribution. Gradient stopping is performed on the second probability distribution of the teacher branch, updating only the parameters of the student branch. Without deploying an additional independent teacher model with large parameters, this allows the student network to align with the expert hidden knowledge in the privileged information, reducing training and deployment costs.
[0116] Furthermore, when the number of training samples is enormous, multi-machine, multi-GPU MoE parallel training can be initiated on the Megatron backend. Based on the cluster hardware resources, parameters for data parallelism (dp), tensor parallelism (tp), pipeline parallelism (pp), and expert parallelism (ep) can be configured. For example, 16 expert sub-networks can be evenly distributed across 16 A100 computing cards on 8 servers. During training, an expert load balancing auxiliary loss can be added to the original task loss to avoid overloading some experts while leaving others idle. As training iterates, different expert sub-networks will naturally develop differentiated capabilities: some experts will specialize in disease risk identification, some in exercise safety constraints, some in nutritional diet generation, and some in health goal and care plan generation. This improves the model's processing efficiency and expressive power for different medical and health sub-tasks without requiring manual pre-binding of business categories.
[0117] After training, a comprehensive evaluation process is initiated, involving four levels of verification: an automated evaluation system, an LLM Judge, random checks by medical and elderly care experts, and playback of real-world business scenarios. The evaluation focuses on checking the accuracy of chronic disease risk identification, the compliance of medical and elderly care recommendations, the ability to identify exercise contraindications, the ability to resolve nutritional conflicts, the stability of the output structure, and the degree of internalization of expert consensus. For the aforementioned sample of elderly individuals with multiple coexisting diseases, the evaluation system specifically verifies whether the model addresses the dual needs of diabetes control and osteoporosis calcium supplementation, whether it correctly identifies the low-purine dietary requirements during acute gout attacks, whether it avoids recommendations for high-intensity resistance exercise, and whether it clearly indicates the abstinence requirement during cephalosporin antibiotic treatment. If the model output contains missing risks, the unqualified sample, the teacher's correction results, and the structured expert feedback are reorganized into new training samples and included in the next round of training dataset, forming a complete closed loop of "business accumulation - training - evaluation - feedback - iteration".
[0118] In this way, a closed loop is achieved, from the accumulation of medical and elderly care business knowledge, construction of training data, general fine-tuning, generative knowledge distillation, self-distillation, multi-machine MoE training to automatic evaluation and feedback. This enables the model to not only output chronic disease management solutions, but also to learn the long-range reasoning methods and risk constraint logic of medical and elderly care experts in complex chronic disease scenarios.
[0119] It should be noted that the training method for the health management model provided in this application embodiment can be executed by a training device for the health management model, or by a control module within the training device for executing the training method for loading the health management model. This application embodiment uses the execution of the training method for loading the health management model by a training device for the health management model as an example to illustrate the training device for the health management model provided in this application embodiment.
[0120] Figure 2 This is a structural diagram of a training device for a health management model provided in an embodiment of this application, with reference to... Figure 2The device may include: The first acquisition module 1001 is used to take health sample data and the standard health inference sequence corresponding to the health sample data output by the preset teacher network as input to the health management student network, and acquire the first loss corresponding to the health management student network. The second acquisition module 1002 is used to acquire a first probability distribution obtained by the health management student network based on the health sample data and preset answer labels, and to acquire a second probability distribution obtained by the preset teacher network based on the health sample data and preset answer labels; the preset answer labels are student self-sampling sequences, teacher-generated sequences or manually labeled standard answer sequences dynamically selected based on preset mode selection rules; The first calculation module 1003 is used to calculate the second loss based on the first probability distribution and the second probability distribution; The first generation module 1004 is used to iteratively update the parameters of the health management student network based on the first loss and the second loss to generate a health management model.
[0121] Optionally, the first acquisition module 1001 includes: The third acquisition module is used to input the health sample data into the preset teacher network and acquire the standard health inference sequence output by the preset teacher network. The fourth acquisition module is used to concatenate the health sample data and the standard health inference sequence into a training sequence and input it into the health management student network, and to acquire the predicted probability distribution of each word segment output by the health management student network in the training sequence. The second calculation module is used to calculate the first loss based on the predicted probability distribution of each word and the word tag at the corresponding position in the standard health inference sequence.
[0122] Optionally, the fourth acquisition module includes: The first acquisition submodule is used to obtain the original predicted score of the corresponding position output by the health management student network for the t-th word segment position of the health management student network, taking the health sample data and the first t-1 preceding words of the standard health inference sequence as input; The first generation submodule is used to normalize the original predicted score based on a preset temperature coefficient to generate the predicted probability distribution of the health management student network at the current location.
[0123] Optionally, the second computing module includes: The first calculation submodule is used to, for any word segmentation position, index the prediction confidence of the corresponding word segmentation tag based on the prediction probability distribution corresponding to the word segmentation position, and calculate the loss value corresponding to each word segmentation position. The second calculation submodule is used to set the loss value corresponding to the word segmentation position in the healthy sample data interval to zero based on a preset loss mask, and to calculate the first loss based on the loss value corresponding to all word segmentation positions in the standard healthy inference sequence interval.
[0124] Optionally, the device further includes: The fifth acquisition module is used to acquire the mode probabilities corresponding to the student self-sampling mode, the teacher-generated mode, and the manual annotation mode, and to perform random sampling based on the category distribution formed by the probabilities of each mode to determine the target mode. The second generation module is used to input the health sample data into the health management student network when the target mode is the student self-sampling mode, and generate the student self-sampling sequence through self-sampling as the preset answer label; The third generation module is used to input the health sample data into the preset teacher network when the target mode is the teacher generation mode, and generate a teacher generation sequence as the preset answer label; The fourth generation module is used to obtain the sequence of manually labeled standard answers corresponding to the health sample data from the pre-constructed manually labeled dataset when the target mode is manually labeled mode, and use it as the preset answer label.
[0125] Optionally, the first computing module 1003 includes: The third calculation submodule is used to calculate the intermediate mixed distribution based on preset adjustable parameters, the first probability distribution and the second probability distribution; The fourth calculation submodule is used to calculate the adjustable divergence loss based on the intermediate mixed distribution, as the second loss.
[0126] Optionally, the preset teacher network and the health management student network are different branch networks in the same model; the device further includes: The first output module is used to run the health management student network branch with health sample data as input and the preset teacher network branch with the health sample data and privilege information as input in the same model, respectively, to obtain the first probability distribution output by the health management student network branch and the second probability distribution output by the preset teacher network branch. The third calculation module is used to perform gradient stopping operation on the preset teacher network branch and calculate the self-distillation loss based on the first probability distribution and the second probability distribution, as the second loss.
[0127] Optionally, the health management student network includes at least two expert sub-networks, which are deployed on different devices operating in parallel; the device further includes: The first determining module is used to determine the auxiliary loss for any of the expert subnetworks based on the effective allocation ratio and the average routing probability of the expert subnetwork. The first generation module 1004 includes: The first iteration module is used to iteratively update the parameters of the health management student network based on the first loss, the second loss, and the auxiliary loss.
[0128] Optionally, the device further includes: The sixth acquisition module is used to input test data into the iteratively updated health management student network and the preset teacher network respectively, and to acquire the first output scheme of the iteratively updated health management student network and the second output scheme of the preset teacher network. The second determining module is used to evaluate the first output scheme and determine the target test data corresponding to the first output scheme with an unqualified evaluation result, the second output scheme corresponding to the target test data, and the manual evaluation result corresponding to the target test data as the healthy sample data for the next round of iterative training.
[0129] The training device for the health management model in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0130] The training device for the health management model in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0131] Optional, such as Figure 3 As shown, this application embodiment also provides an electronic device, including a processor 1110, a memory 1109, and a program or instructions stored in the memory 1109 and executable on the processor 1110. When the program or instructions are executed by the processor 1110, they implement the various processes of the above-described training method embodiment of the health management model and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0132] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0133] Figure 4 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application. The electronic device 1100 includes, but is not limited to, components such as: radio frequency unit 1101, network module 1102, audio output unit 1103, input unit 1104, sensor 1105, display unit 1106, user input unit 1107, interface unit 1108, memory 1109, and processor 1110.
[0134] Those skilled in the art will understand that the electronic device 1100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here. It should be understood that, in this embodiment, the input unit 1104 may include a graphics processing unit (GPU) 11041 and a microphone 11042. The GPU 11041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1106 may include a display panel 11061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 1107 includes at least one of a touch panel 11071 and other input devices 11072. The touch panel 11071 is also called a touch screen. The touch panel 11071 may include a touch detection device and a touch controller. Other input devices 11072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0135] The memory 1109 can be used to store software programs and various data. The memory 1109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1109 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0136] Processor 1110 may include one or more processing units; optionally, processor 1110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 1110.
[0137] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described training method embodiment for the health management model and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0138] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0139] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described training method embodiment of the health management model and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0140] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0141] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the training method embodiment of the health management model described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0142] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0143] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0144] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A training method for a health management model, characterized in that, The method includes: The health sample data and the standard health inference sequence corresponding to the health sample data output by the preset teacher network are used as inputs to the health management student network, and the first loss corresponding to the health management student network is obtained. The system obtains a first probability distribution from the health management student network based on the health sample data and preset answer labels, and a second probability distribution from the preset teacher network based on the health sample data and preset answer labels; the preset answer labels are student self-sampling sequences, teacher-generated sequences, or manually labeled standard answer sequences dynamically selected based on preset mode selection rules. Calculate the second loss based on the first probability distribution and the second probability distribution; Based on the first loss and the second loss, the parameters of the health management student network are iteratively updated to generate a health management model.
2. The method according to claim 1, characterized in that, The step of using health sample data and the standard health inference sequence corresponding to the health sample data output by the preset teacher network as input to the health management student network, and obtaining the first loss corresponding to the health management student network, includes: The health sample data is input into the preset teacher network to obtain the standard health inference sequence output by the preset teacher network. The health sample data and the standard health inference sequence are concatenated into a training sequence and input into the health management student network. The predicted probability distribution of each word segment output by the health management student network in the training sequence is then obtained. The first loss is calculated based on the predicted probability distribution corresponding to each word and the word tag at the corresponding position in the standard health inference sequence.
3. The method according to claim 2, characterized in that, The step of obtaining the predicted probability distribution of the health management student network for each word segmentation output in the training sequence includes: For the t-th word segment position of the health management student network, the original predicted score of the corresponding position output by the health management student network is obtained by taking the health sample data and the first t-1 preceding words of the standard health inference sequence as input. Based on a preset temperature coefficient, the original predicted score is normalized to generate the predicted probability distribution of the health management student network at the current location.
4. The method according to claim 3, characterized in that, The calculation of the first loss based on the predicted probability distribution corresponding to each word segment and the word segmentation label at the corresponding position in the standard health inference sequence includes: For any word segmentation position, based on the predicted probability distribution corresponding to the word segmentation position, the predicted confidence of the corresponding word segmentation tag is indexed, and the loss value corresponding to each word segmentation position is calculated. The loss value corresponding to the word segmentation position within the health sample data interval is set to zero based on the preset loss mask, and the first loss is calculated based on the loss value corresponding to all word segmentation positions within the standard health inference sequence interval.
5. The method according to claim 1, characterized in that, The method further includes: Obtain the pattern probabilities corresponding to the student self-sampling mode, teacher-generated mode, and manually labeled mode respectively, and perform random sampling based on the category distribution formed by the probabilities of each mode to determine the target mode; When the target mode is the student self-sampling mode, the health sample data is input into the health management student network, and the student self-sampling sequence is generated through self-sampling as the preset answer label; When the target mode is teacher-generated mode, the health sample data is input into the preset teacher network to generate a teacher-generated sequence, which is used as the preset answer label; When the target mode is the manual annotation mode, the manual annotation standard answer sequence corresponding to the health sample data is obtained from the pre-constructed manual annotation dataset and used as the preset answer label.
6. The method according to claim 1, characterized in that, The calculation of the second loss based on the first probability distribution and the second probability distribution includes: Based on preset adjustable parameters, the first probability distribution, and the second probability distribution, an intermediate mixed distribution is calculated; Based on the intermediate mixed distribution, the adjustable divergence loss is calculated and used as the second loss.
7. The method according to claim 1, characterized in that, The preset teacher network and the health management student network are different branches of the same model; the method further includes: Within the same model, the health management student network branch, which takes health sample data as input, and the preset teacher network branch, which takes the health sample data and privileged information as input, are run separately to obtain the first probability distribution output by the health management student network branch and the second probability distribution output by the preset teacher network branch. Gradient stopping is performed on the preset teacher network branch, and the self-distillation loss is calculated based on the first probability distribution and the second probability distribution, which is used as the second loss.
8. The method according to claim 1, characterized in that, The health management student network includes at least two expert sub-networks, which are deployed on different devices running in parallel; the method further includes: For any of the expert subnetworks, the auxiliary loss is determined based on the effective allocation ratio and the average routing probability of the expert subnetwork. The iterative update of the parameters of the health management student network based on the first loss and the second loss includes: Based on the first loss, the second loss, and the auxiliary loss, the parameters of the health management student network are iteratively updated.
9. The method according to claim 1, characterized in that, After iteratively updating the parameters of the health management student network based on the first loss and the second loss, the method further includes: The test data is input into the iteratively updated health management student network and the preset teacher network respectively, and the first output scheme of the iteratively updated health management student network and the second output scheme of the preset teacher network are obtained. The first output scheme is evaluated, and the target test data corresponding to the first output scheme that is unqualified, the second output scheme corresponding to the target test data, and the manual evaluation result corresponding to the target test data are determined as the healthy sample data for the next round of iterative training.
10. A training device for a health management model, characterized in that, The device includes: The first acquisition module is used to take health sample data and the standard health inference sequence corresponding to the health sample data output by the preset teacher network as input to the health management student network, and acquire the first loss corresponding to the health management student network. The second acquisition module is used to acquire a first probability distribution obtained by the health management student network based on the health sample data and preset answer labels, and to acquire a second probability distribution obtained by the preset teacher network based on the health sample data and preset answer labels; the preset answer labels are student self-sampling sequences, teacher-generated sequences, or manually labeled standard answer sequences dynamically selected based on preset mode selection rules; The first calculation module is used to calculate the second loss based on the first probability distribution and the second probability distribution; The first generation module is used to iteratively update the parameters of the health management student network based on the first loss and the second loss to generate a health management model.
11. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the training method for the health management model as described in any one of claims 1-9.
12. A readable storage medium, characterized in that, The program or instructions are stored on the readable storage medium, and when the program or instructions are executed by a processor, they implement the steps of the training method for the health management model as described in any one of claims 1-9.