Progressive domain adaptation method, system and product for MoE large model

By employing a two-stage pruning and directional fine-tuning approach, the low adaptation efficiency and stability issues of the MoE model under limited computing resources and data conditions were addressed, achieving efficient and stable domain adaptation and performance recovery under low-resource conditions.

CN123140131APending Publication Date: 2026-11-20BEIJING BIG DATA ADVANCED TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611303086.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-26
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Under the constraints of limited computing resources and limited domain data, the sparse activation architecture of the MoE model suffers from problems such as low adaptation efficiency and unstable training during the vertical domain adaptation process, and its performance degrades after pruning.

Method used

A two-stage pruning strategy is adopted. First, the MoE model is pruned according to the target device parameters. Then, targeted pruning is performed using data from the target business domain to select expert modules with high activation frequency and fine-tune them using the LoRA method. Combined with hierarchical structure splicing and routing network fine-tuning, the model performance is restored.

Benefits of technology

Achieving efficient and stable domain adaptation and performance recovery under low-resource conditions improves model training stability and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123140131A_ABST
    Figure CN123140131A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, and discloses a progressive field adaptation method, system and product for a MoE large model. The method comprises the following steps: pruning an original mixed expert model based on device parameters of a target device and general training data to obtain a first expert model; pruning the first expert model based on training data of a target business field to obtain a second expert model; performing LoRA fine-tuning on a plurality of target expert modules selected from the second expert model based on the training data of the target business field; splicing the expert modules pruned from the first expert model and the fine-tuned second expert model in a feature dimension according to a hierarchical structure of the original mixed expert model; and fine-tuning routing network parameters of a fusion model using general calibration data to obtain a target field model. The method can efficiently and stably realize field adaptation and performance recovery of the MoE under the dual constraints of limited computing resources and field data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, specifically to a progressive domain adaptation method, system, and product for large MoE models. Background Technology

[0002] As the scale of large language model parameters exceeds hundreds of billions or trillions, sparse activation architectures, represented by MoE (Mixture of Experts), have become the mainstream technical approach due to their dynamic routing and expert selection mechanism, which greatly improves model capacity while keeping inference overhead controllable.

[0003] However, the sparse architecture of the MoE model also presents new challenges for downstream adaptation. Under the dual constraints of limited computational resources and limited domain data, sparsely activated hybrid expert models suffer from low adaptation efficiency and unstable training during adaptation to vertical domains (e.g., finance, healthcare, military, scientific research). Furthermore, pruning to reduce resource consumption in models with large parameters leads to a certain degree of performance degradation in the MoE model. Traditional model transfer solutions suffer from low resource utilization and poor training results during the domain adaptation or model performance recovery phases.

[0004] Therefore, how to efficiently and stably achieve vertical domain adaptation and performance recovery of hybrid expert models under the dual constraints of limited computing resources and limited domain data is a problem that needs to be solved. Summary of the Invention

[0005] The purpose of this application is to provide a progressive domain adaptation method, system, and product for large MoE models, so as to efficiently and stably complete the vertical domain adaptation and performance recovery of hybrid expert models under the dual constraints of limited computing resources and limited domain data.

[0006] To achieve the above objectives, the technical solution of this application is as follows: In a first aspect, embodiments of this application provide a progressive domain adaptation method for large MoE models, the method comprising: Based on the device parameters of the target device for the target domain model to be deployed, a first number of expert modules to be retained in the original hybrid expert model is determined, and the original hybrid expert model is pruned based on the first number and general training data to obtain a first expert model; the device parameters include: the number of graphics processors and the video memory capacity; The first expert model is pruned based on training data from the target business domain to retain a second number of expert modules related to the target business domain, resulting in a second expert model; the first number is twice the second number. Based on the training data of the target business domain, the target expert modules with the highest route activation frequency are selected from the second expert model, and the parameters of each target expert module are fine-tuned using the LoRA method to obtain the fine-tuned second expert model. According to the hierarchical structure of the original hybrid expert model, the expert modules removed from the first expert model and the fine-tuned second expert model are spliced ​​together from the feature dimension to obtain the fusion domain model; The target domain model is obtained by fine-tuning the routing network parameters of the fusion domain model based on general calibration data.

[0007] Secondly, embodiments of this application provide a progressive domain adaptation system for large MoE models, used to implement the steps in the method provided in the first aspect of this application. The system includes: A pruning module is configured to determine a first number of expert modules to be retained in the original hybrid expert model based on the device parameters of the target device of the target domain model to be deployed, and prune the original hybrid expert model based on the first number and general training data to obtain a first expert model; the device parameters include: the number of graphics processors and the video memory capacity; the first expert model is pruned based on the training data of the target business domain to retain a second number of expert modules related to the target business domain to obtain a second expert model; the first number is twice the second number; The first fine-tuning module is configured to select multiple target expert modules with the highest route activation frequency from the second expert model based on the training data of the target business domain, and fine-tune the parameters of each target expert module using the LoRA method to obtain the fine-tuned second expert model. The fusion module is configured to, according to the hierarchical structure of the original hybrid expert model, splice together the expert modules removed from the first expert model and the fine-tuned second expert model from the feature dimension to obtain a fused domain model; The second fine-tuning module is configured to fine-tune the routing network parameters of the fusion domain model based on general calibration data to obtain the target domain model.

[0008] 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 in the method provided in the first aspect of embodiments of this application.

[0009] This application employs a progressive domain adaptation method for large MoE models. During vertical domain adaptation, a two-stage pruning operation is used. The first stage prunes the original hybrid expert model based on the device parameters of the lightweight hardware device where the target domain model will be deployed, adapting it to low-resource hardware. The second stage performs targeted pruning using training data from the target business domain, resulting in a second expert model focused on the target business domain within the vertical domain. Based on this second expert model, a targeted fine-tuning approach is used to further select the most relevant subset of experts to the target business domain. The second expert model is then efficiently optimized using low-rank adaptation parameters, avoiding full-parameter training. This enhances the model's domain performance while reducing computational overhead, improving training stability, resource utilization, and domain adaptation efficiency.

[0010] Subsequently, the second expert model, fine-tuned through hierarchical feature dimension concatenation, is combined with the pruned expert modules from the second stage, preserving the information transmission path and representational capabilities of the original model to the greatest extent possible. Then, a small amount of general calibration data is used to fine-tune the routing network parameters of the fused domain model to restore its general capabilities, achieving rapid performance recovery after domain pruning while also saving computational overhead for performance recovery. Thus, under constraints of limited computational resources and limited domain data, this approach improves the efficiency of vertical domain adaptation and performance recovery of hybrid expert models, as well as training stability. Attached Figure Description

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

[0012] Figure 1 This is a flowchart of a progressive domain adaptation method for a large MoE model proposed in one embodiment of this application; Figure 2 This is a flowchart of model migration for a target business domain in one embodiment of this application; Figure 3 This is a flowchart of a target business domain adaptation and fine-tuning of a second expert model in one embodiment of this application; Figure 4 This is a schematic diagram of a progressive domain adaptation system for the MoE large model proposed in an embodiment of this application; Figure 5 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0013] 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.

[0014] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0015] In the various embodiments of this application, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0016] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects as detailed in this application.

[0017] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other.

[0018] Traditional large-scale model transfer programming schemes mainly fall into two categories. One category consists of parameter-efficient fine-tuning methods based on LoRA (Low-Rank Adaptation) (such as LoRA and Adapter Tuning). These methods reduce training costs by adding low-rank adaptation matrices to the side loops of linear layers and updating only a small number of parameters. These methods employ a strategy of updating all parameters indiscriminately, resulting in extremely high computational costs and a high risk of catastrophic forgetting. Furthermore, LoRA-based fine-tuning schemes lack awareness of the sparse structure of experts in the Model of Earth's Edge (MoE), failing to specifically strengthen expert knowledge relevant to the target domain, leading to wasted computational resources and insufficient domain adaptation efficiency and expert specialization capabilities. Moreover, due to the scarcity and uneven distribution of data in vertical domains, the model is prone to overfitting, loss oscillations, and slow convergence during fine-tuning. Furthermore, interference between multiple subtasks within the domain can disrupt expert functional differentiation, hindering the learning and convergence of domain-specific knowledge, leading to training instability. The other category is a compression scheme combining model pruning and knowledge distillation. This involves removing unimportant experts and using distillation to allow the compressed model to learn the output of the original model. These approaches rely on a complete original large model as the teacher model. The deployment of the teacher model and the training of the distillation process both require extremely high computing and storage resources, resulting in huge resource overhead.

[0019] Based on this, this application proposes a progressive domain adaptation scheme that balances domain adaptation, performance recovery, and computational overhead. The application will now be described in detail with reference to the accompanying drawings and embodiments.

[0020] Figure 1 This is a flowchart of a progressive domain adaptation method for large MoE models proposed in one embodiment of this application. Figure 1 As shown, the method includes: S1: Based on the device parameters of the target device for the target domain model to be deployed, determine the first number of expert modules to be retained in the original hybrid expert model, and prune the original hybrid expert model based on the first number and general training data to obtain the first expert model; the device parameters include: the number of graphics processors and the video memory capacity; S2: Prune the first expert model based on the training data of the target business domain to retain a second number of expert modules related to the target business domain, thereby obtaining a second expert model; the first number is twice the second number. S3: Based on the training data of the target business domain, select the multiple target expert modules with the highest route activation frequency from the second expert model, and fine-tune the parameters of each target expert module using the LoRA method to obtain the fine-tuned second expert model; S4: According to the hierarchical structure of the original hybrid expert model, the expert modules removed from the first expert model and the fine-tuned second expert model are spliced ​​together from the feature dimension to obtain the fusion domain model; S5: Fine-tune the routing network parameters of the fusion domain model based on the general calibration data to obtain the target domain model.

[0021] In this embodiment, a two-stage pruning strategy is adopted. In the first stage, the device parameters of the lightweight device (i.e., the target device) to which the target domain model is to be deployed are obtained, including the number of graphics processors and video memory capacity. In practical applications, models deployed on multiple devices also need to consider factors such as communication bandwidth between devices. Then, based on the target device's device parameters, the first number of expert modules to be retained in the original MoE large model is determined. Based on this first number and training data from the general domain, the original hybrid expert model is pruned to reduce the resource overhead of the migrated model, resulting in a first expert model adapted to the hardware resources. In the second stage, training data from the target business domain (e.g., vertical domains such as finance, healthcare, military, and scientific research) is further used to perform targeted pruning on the first expert model, retaining half of the expert modules highly relevant to the target business domain, resulting in a second expert model for domain adaptation, avoiding interference from irrelevant expert modules. After the two-stage pruning operation, multiple expert modules related to the target business domain are retained in the second expert model.

[0022] To adapt the pruned model to the target business domain, this embodiment uses a small amount of training data from that domain to fine-tune the second expert model. Specifically, using training data from the target business domain, several expert modules with the highest route activation frequency are selectively identified as the target expert modules whose parameters need to be updated during the fine-tuning process. An expert subset is then constructed based on all target expert modules. Then, using training data from the target business domain, the second expert model is trained with a small number of samples to fine-tune the parameters of each expert module in the expert subset, thereby improving the inference performance of the second expert model for the target business domain, completing the vertical domain adaptation of the model, and obtaining the fine-tuned second expert model.

[0023] In this embodiment, the functional differentiation and composability of the MoE architecture are fully utilized. Through phased pruning and gradual fine-tuning to restore model performance, the complex domain adaptation problem is decomposed into controllable sub-tasks. During the fine-tuning phase, targeted LoRA updates are performed on experts with high routing activation frequencies to specifically strengthen expert knowledge relevant to the target domain. Since only the selected target expert modules undergo lightweight parameter updates, the perturbation amplitude of gradient updates is significantly reduced. This effectively avoids overfitting or oscillation problems caused by training with few samples on all parameters, improving training stability and enabling the model to converge smoothly even in scenarios with limited data. This achieves efficient and stable domain adaptation under low-resource conditions, effectively addressing the dual constraints of limited computing resources and domain sample data.

[0024] Furthermore, to restore the general capabilities of the migrated model, following the hierarchical structure of the original hybrid expert model, multiple expert modules pruned from the first expert model in the second stage are concatenated with the fine-tuned second expert model along the feature dimension to obtain a fused domain model. By concatenating the expert modules according to the original hierarchical structure, the structural information of the pruned experts is preserved, reducing the number of parameters that need to be fine-tuned for subsequent general performance restoration. Based on this, the parameters of each expert module in the fused domain model are frozen, and the routing network parameters of the fused domain model are fine-tuned using general calibration data to obtain a target domain model that can be deployed on the target device.

[0025] In the general performance recovery phase, this scheme only utilizes a small-scale general calibration data to fine-tune the routing network parameters. Through lightweight routing fine-tuning, semantic alignment and collaborative work between new and old experts are achieved, completing the final optimization of domain adaptation while restoring pruning performance. Thus, while significantly reducing training resource consumption, the scheme effectively maintains the model's general capabilities and achieves rapid performance recovery after pruning, balancing multiple objectives such as model transfer efficiency and effectiveness, performance, and resource control.

[0026] Figure 2 This is a flowchart illustrating model migration for a target business domain in one embodiment of this application. For example... Figure 2As shown, in this embodiment, the devices to be deployed for the target domain model are two independent devices (such as servers) with identical configurations and interconnected networks. To balance the requirements of dual-machine deployment with low-resource training conditions, the pre-trained original MoE model (containing 256 routing experts) is first pruned into a dual-machine deployable model containing 160 expert modules (i.e., the first expert model) to retain general capabilities. Subsequently, to further compress the scale of fine-tuning parameters and to fine-tune the target domain capabilities without compromising general capabilities, this embodiment uses a small amount of training data from the target business domain to perform targeted pruning on the first expert model, removing 80 expert modules with low relevance to the target business domain, resulting in a second expert model with 80 experts highly relevant to the target business domain, used for subsequent domain fine-tuning adaptation. Then, based on the second expert model, the routing activation frequency of each expert module is filtered based on a small batch of target business domain data to obtain multiple target expert modules most relevant to the target domain, and an expert subset is constructed. For the expert subset, a low-rank adaptation (LoRA) fine-tuning method is introduced. The original weights of the expert subset are frozen, and only the lightweight low-rank matrix is ​​updated to complete domain-oriented fine-tuning, enhancing the domain task capability of the pruned model. Next, a hierarchical structure fusion is performed. The 80 expert modules pruned from the first expert model in the second stage are reconnected to the fine-tuned second expert model according to the hierarchical structure of the original hybrid expert model, and concatenated along the feature dimension to form a fused 160 expert model (i.e., the fused domain model). Subsequently, the routing weight parameters of the fused domain model are fine-tuned using general calibration data. A learnable projection matrix maps the outputs of the old and new experts to a unified semantic space, enabling collaborative work between the old and new experts and quickly restoring the general reasoning capability of the pruned model. The trained fused domain model is then obtained and can be deployed to the target domain model on a dual-machine system.

[0027] As one implementation of this application, the first expert model is pruned based on training data from the target business domain to retain a second number of expert modules related to the target business domain, resulting in a second expert model, including: Based on the training data from the target business domain, construct the first dataset; Each training data point in the first dataset is input into the first expert model to obtain the original scores of each expert module in the first expert model for the training data. The raw scores of each expert module are normalized to obtain the activation probability of each expert module in response to the training data. Based on the activation probability of each expert module for all training data in the first dataset, calculate the expert importance score of each expert module. The experts were ranked from highest to lowest according to their importance scores, resulting in the expert ranking results. The second number of expert modules ranked first in the expert ranking results are selected and retained, and the remaining expert modules are removed to obtain the second expert model.

[0028] In one embodiment, a second expert model is obtained by performing domain-specific pruning on the first expert model using training data from the target business domain, thereby removing expert modules with low relevance to the target business domain. Specifically, a first dataset is first constructed based on a small amount of training data from the target business domain. Each training data point in the first dataset is then input into the first expert model to obtain the raw scores of each expert module in the first expert model for the input data.

[0029] Suppose that a certain layer of the first expert model has N expert modules. Training data x is input into the first expert model, and the routing network outputs the corresponding raw scores for each expert module. The raw scores of each expert module are normalized to obtain the activation probability of each expert module for the input data x. For the i-th expert module... Its activation probability is expressed as: ; in, For the i-th expert module The original score for the input data x; N is the number of expert modules in the corresponding network layer.

[0030] Since the sum of the activation probabilities of each expert after normalization is 1, the activation probability of each expert module for the input data x is taken as the expert importance distribution corresponding to the input data.

[0031] Next, the average activation probability of each expert module for all input data in the first dataset is calculated, and this average value is determined as the expert importance score. Specifically, the expert module... Expert Importance Score Represented as: ; in, The total number of samples in the first dataset; This is the m-th input data in the first dataset; For expert module For input data The activation probability.

[0032] Based on expert importance scores Sort the expert modules in the first expert model from highest to lowest quality, and let the sorted expert modules be as follows: ,satisfy: .

[0033] Based on the ranking results, the second-highest number of expert modules are selected as those with high relevance to the target business domain and retained. The remaining expert modules are identified as those with low relevance to the target business domain and removed from the first expert model. That is, the set of expert modules retained in the second expert model... for: ; Where k is the second quantity, and .

[0034] As one implementation of this application, based on the training data of the target business domain, multiple target expert modules with the highest route activation frequency are selected from the second expert model, and the parameters of each target expert module are fine-tuned using the LoRA method to obtain the fine-tuned second expert model, including: Based on the training data from the target business domain, a second dataset is constructed; Input each training data point in the second dataset into the second expert model to obtain the routing activation frequency of each expert module in the second expert model; All expert modules are sorted from high to low according to their route activation frequency to obtain the sorting results; Based on the sorting results, multiple target expert modules are selected and the following conditions are met: the sum of the routing activation frequencies of all target expert modules is greater than or equal to the first threshold, and the number of target expert modules is less than or equal to the second number. Based on the task types in the target business domain, construct task losses; Based on the difference between the current weights and the initial weights of each target expert module, an expert parameter regularization loss is constructed. Based on the activation probability of each target expert module, the first load balancing loss is constructed; The task loss, the expert parameter regularization loss, and the first load balancing loss are weighted and summed to construct a comprehensive loss function; Based on the comprehensive loss function, the parameters of each objective expert module are fine-tuned using the LoRA method to obtain the fine-tuned second expert model.

[0035] In one embodiment, a second dataset is constructed based on a small amount of training data from the target business domain. To reduce the computational overhead of domain fine-tuning and avoid training instability caused by full-parameter fine-tuning, after pruning to obtain the second expert model, some target expert modules are selected using the second dataset for domain-adaptive fine-tuning. Specifically, the training data from the second dataset is input into the second expert model to obtain the expert selection results of the routing network for each input token. For the i-th expert module... Its routing activation frequency for: ; Where T is the total number of tokens in the second dataset; K is the number of expert modules selected by the routing network for each token; For the t-th token; The set of expert modules selected by the routing network for the t-th token; This is an indicator function; it takes the value 1 when the expert module is selected and 0 when it is not selected.

[0036] The routing activation frequencies of each expert module are sorted from high to low to obtain the corresponding ranking results. Based on the ranking results, the top 'a' expert modules are selected as trainable target expert modules, and an expert subset is constructed. The selected 'a' target expert modules must simultaneously satisfy the following constraints: Condition 1: a is less than or equal to the second quantity k; Condition 2: The sum of the routing activation frequencies of the a target expert modules is greater than or equal to the preset expert screening threshold (i.e., the first threshold, with a value range of 0.6-0.8).

[0037] In this embodiment, to further improve parameter optimization efficiency and reduce computational overhead, low-rank adaptation (LoRA) is used as an auxiliary optimization technique for the selected trainable expert subset. This LoRA structure is deeply integrated with the expert selection architecture, forming a dual advantage of "expert-oriented selection and lightweight parameter optimization." When fine-tuning the expert subset, a comprehensive loss function is constructed based on multi-dimensional loss as follows: ; in, To mitigate task losses, focus on improving task performance in the target domain; The expert parameter regularization loss is used to prevent expert overfitting and preserve their general knowledge. The first load balancing loss ensures balanced activation of trainable experts; , These are the weighting coefficients. , The weighting coefficient can be dynamically adjusted according to the target business domain tasks, taking into account both load balancing and training stability.

[0038] Expert parameter regularization loss Using L2 regularization, the calculation is as follows: ; in, Let be the current weight of the i-th trainable expert module; Let be the initial weights of the i-th trainable expert module.

[0039] First load balancing loss The calculation is as follows: ; in, To express summation; A subset of experts consisting of trainable target expert modules; For the target expert module The activation probability for input data x.

[0040] When fine-tuning the second expert model, for any linear layer weight matrix within each target expert module... Introduce two low-rank matrices and (where d is the output feature dimension of the linear layer, k is the input feature dimension of the linear layer, and r is the rank of the low-rank matrix, The forward propagation process of the parameters of each target expert module is as follows: ;in This is the original weight matrix of the linear layer; The input feature vector of the linear layer; This is the output feature vector of the linear layer.

[0041] As one implementation of this application, a task loss is constructed based on the task type of the target business domain, including: For the question-answering task, a semantic alignment loss is calculated based on the cosine similarity between the semantic vector of the answer and the semantic vector of the question-answer pair; and a cross-entropy loss is constructed based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the answer; the question-answering loss is constructed by weighted summation of the semantic alignment loss and the cross-entropy loss. For the solution generation task, the edit distance between the output text of the second expert model and the reference text is calculated and normalized to obtain the edit distance loss; and, based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the reference text, the cross-entropy loss is constructed; the edit distance loss and the cross-entropy loss are weighted and summed to construct the solution generation loss. Based on the task type of the target business domain, determine the weights corresponding to the question-answering loss and the solution generation loss, respectively; the task type includes at least one of the following: question-answering task and solution generation task. The task loss is constructed based on the question-answering loss, the solution generation loss, and their respective weights.

[0042] In one embodiment, to address multi-task scenarios within a domain, the task loss of the second expert model is fine-tuned based on the type of task corresponding to the target business domain. In practical applications, tasks in the target business domain can be question-answering tasks or solution generation tasks. For example, in a law-related business domain, it may include question-answering tasks related to legal regulations, as well as solution generation tasks such as report generation and document summarization. In this embodiment, corresponding loss functions are involved for different task types, and the contribution of the loss function for each task type is adjusted using weights to construct the task loss.

[0043] Construct question-answering loss for question-answering tasks The details are as follows: (1) Based on the cosine similarity between the semantic vector of the answer and the semantic vector of the question-answer pair, calculate the semantic alignment loss to constrain the consistency between the model output and the question in the semantic space: ; in, The semantic vector of the answer; The semantic vector of the problem; (2) Based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the answer, construct the cross-entropy loss. This is used to ensure the accuracy of model output predictions at the token level. ; Where T is the total number of tokens contained in the answer text; This refers to the t-th real token in the answer text. Let q be the sequence of tokens preceding the t-th token; q is the question text. For the second expert model, given the problem text q and the preceding token sequence Under the given conditions, predict the t-th real token. The probability of "".

[0044] (3) Construct the question-answering loss by fusing semantic alignment loss and cross-entropy loss through weighted summation: ;in, The weighting coefficient (ranging from 0.1 to 0.3) is used to balance the contributions of the two losses.

[0045] Construct a solution generation loss for the solution generation task. The details are as follows: (1) Calculate the edit distance between the output text of the second expert model and the reference text, and normalize it to construct the edit distance loss. This is used to constrain the model's output text to more closely resemble the reference text in terms of structural regularity and logical coherence. ; in, This is the output text of the second expert model; The reference text is used as the edit distance between the output text and the reference text. Calculated using dynamic programming algorithm; This indicates the length of the corresponding text sequence.

[0046] (2) Based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the answer, construct the cross-entropy loss. This is used to ensure the accuracy of the model's output predictions at the token level. The calculation method for cross-entropy loss in the solution generation loss is the same as that in the question-answering loss described above, and will not be repeated here.

[0047] (3) The scheme generation loss is constructed by merging the editing distance loss and cross-entropy loss through a weighted summation method: ;in This is the weighting coefficient (with a value range of 0.05 to 0.15).

[0048] In this embodiment, based on question-answering loss and solution generation loss The task loss is constructed by weighted summation. as follows: ; in, The loss weight coefficients corresponding to the question-and-answer task; Generate loss weight coefficients for the tasks corresponding to the solution; .

[0049] In practical applications, weight coefficients can be assigned to question-answering tasks and solution generation tasks based on the types of tasks involved in the target business domain.

[0050] Optionally, if the target business domain includes both types of tasks, then... , Both are set to 0.5, or the corresponding loss weight coefficients can be allocated according to the proportion of the two types of tasks. If the target business domain contains only one type of task, set the loss weight coefficient for that type of task to 1, and set the weight coefficient for the other type of task to 0. For example, if the target business domain only involves question-answering tasks, then... Set to 1, Set to 0.

[0051] Based on the construction of a composite task loss, this solution can flexibly adapt to the optimization needs of different task scenarios, ensuring the quality of token-level generation while taking into account the task-specific semantic consistency and structural normative constraints.

[0052] As one embodiment of this application, before fine-tuning the parameters of each target expert module using the LoRA method based on the comprehensive loss function, the method further includes: Based on the network layer position of each target expert module in the second expert model, each target expert module is divided into a basic layer target expert module and a task layer target expert module. Assign a first update weight to the base layer target expert module, and assign a second update weight to the task layer target expert module; the second update weight is greater than the first update weight. Based on the comprehensive loss function, the parameters of each target expert module are fine-tuned using the LoRA method, including: during backpropagation based on the comprehensive loss function, the gradients of the LoRA parameters of each target expert module are weighted according to the update weights corresponding to each target expert module, and the LoRA parameters of each target expert module are updated based on the weighted gradients.

[0053] In one embodiment, each target expert module is divided into a base layer target expert module and a task layer target expert module based on its position in the network layer of the second expert model. The base layer target expert module is located in the bottom Transformer layer, and the task layer target expert module is located in the top Transformer layer.

[0054] When fine-tuning each target expert module using the LoRA method, a first update weight is assigned to the base-layer target expert modules, and a second update weight is assigned to the task-layer target expert modules, where the second update weight is greater than the first update weight. For example, the first update weight is 0.3, and the second update weight is 1. During backpropagation, the gradients of the LoRA parameters of each target expert module are weighted according to their corresponding update weights, and the LoRA parameters of the corresponding target expert module are updated based on the weighted gradients.

[0055] Specifically, for the i-th target expert module, the update process of its LoRA parameters is expressed as follows: ; in, , These are the LoRA parameters of the i-th target expert module at the t-th and t+1-th iterations, respectively; The learning rate; Represents the comprehensive loss function ; Let be the updated weight corresponding to the i-th target expert module. When the i-th target expert module belongs to the base layer target expert module... Take the first update weight; when the i-th target expert module belongs to the task layer target expert module... Take the second updated weight.

[0056] By allowing the task-layer target expert module to have a larger parameter update range and limiting the parameter update range of the base-layer target expert module, the high-level target expert module can focus more on the specific representation learning of the target business domain while protecting the general knowledge at the lower level.

[0057] As one implementation of this application, the parameters of each target expert module are fine-tuned using the LoRA method, including: Based on the full training data of the target business domain, construct multiple training datasets with increasing data volume; The second expert model is iteratively trained for one training cycle by sequentially using each of the multiple training datasets, from smallest to largest, based on the amount of data in the training dataset. Furthermore, as the training cycle increases, the batch size of the training data used in each training cycle decreases.

[0058] In one embodiment, to further improve training stability and ensure the generalization ability of the second expert model, an incremental fine-tuning strategy is adopted. First, based on the full training data of the target business domain, multiple training datasets containing batch data are constructed. The data volume of each training dataset increases according to a preset ratio. For example, three training datasets are constructed, each containing 20%, 40%, and 60% of the full training data, respectively. Following the order of increasing data volume, each dataset is used sequentially to iteratively train the second expert model for one training cycle. Furthermore, as the training cycle increases, the batch size used within the cycle (i.e., the number of samples fed into the model to update parameters in a single training iteration) gradually decreases. For example, the batch size used in the first training cycle is 64, in the second training cycle it is 32, and in the third training cycle it is 16.

[0059] In the first training cycle, the training dataset with the smallest amount of data is used to allow the model to initially adapt to the task distribution. Subsequently, the amount of data is gradually increased in each training cycle, enabling the model to progressively learn complex data distributions. This effectively avoids the problem of loss oscillation caused by data noise or excessive data volume in the early stages, and further improves training stability.

[0060] As one implementation of this application, the parameters of each target expert module are fine-tuned using the LoRA method, including: Based on the full training data of the target business domain, the second expert model is iteratively trained for multiple training cycles. During the first training cycle, the parameters of each target expert module are updated using the target learning rate; and at the end of each training cycle, the learning rate for the next training cycle is reduced according to the target decay ratio.

[0061] In one embodiment, a dynamic learning rate scheduling strategy of fast-then-slow is employed during the fine-tuning of the second expert model, dividing the training process into iterative training cycles. Specifically, multiple batches of training data are constructed based on the full training data of the target business domain, and all batches of training data are divided into multiple training cycles. In the first training cycle, the parameters of the target expert module are fine-tuned using a preset default learning rate (i.e., the target learning rate), enabling the model to quickly learn the general features of the target business domain. Subsequently, after each training cycle, the learning rate of the next training cycle is reduced according to the target decay ratio, and then the model is fine-tuned in the next training cycle, gradually reducing the learning rate and introducing gradient accumulation to refine the feature representation. In later training cycles, the learning rate becomes extremely small, which helps the model focus on consolidating complex dependencies and suppressing overfitting.

[0062] For example, a large learning rate of 5e-4 and a batch size of 64 are used in the initial stage of training (e.g., the first 30% of steps), the learning rate is gradually decayed and gradient accumulation is introduced in the middle stage of training (e.g., 30%-70% of steps) using a batch size of 32, and a very small learning rate of 1e-6 and a batch size of 16 are used in the later stage of training (e.g., after 70% of steps).

[0063] Figure 3 This is a flowchart illustrating the target business domain adaptation and fine-tuning of a second expert model in one embodiment of this application. For example... Figure 3 As shown, after performing domain-specific pruning on the first expert model to obtain the second expert model, the routing activation frequency of each expert module is obtained based on a small amount of training data from the target business domain. This allows for the selection of a subset of experts from the second expert model that requires fine-tuning. When performing domain-specific fine-tuning on the second expert model, a low-rank matrix is ​​introduced for the selected expert subset. The original weights are frozen using LoRA fine-tuning, and the lightweight low-rank matrix is ​​updated based on a combined loss model. Simultaneously, during iterative fine-tuning, an incremental training strategy combined with dynamic learning rate adjustment is employed. As the training cycle increases, the amount of training data is gradually increased, while the batch size and learning rate are decreased. This allows the model to progressively learn the general features, refined features, and complex dependencies of the target business domain, completing the domain-specific fine-tuning and enhancing the model's domain capabilities.

[0064] In the above embodiment, according to the hierarchical structure of each module in the original hybrid expert model, multiple expert modules pruned from the first expert model are concatenated with the fine-tuned second expert model in terms of feature dimensions. Specifically, firstly, the position of each of the pruned second number of expert modules in the original hybrid expert model is analyzed. Then, according to the hierarchical structure of the original model, the pruned expert modules are added back to the fine-tuned second expert model as "new expert modules." At each layer, the output of the pruned expert modules (i.e., the expert modules in the second expert model) is... Output of the newly returned expert module The features are concatenated to form the fused output. : This splicing method can restore the information transmission path of the original MoE model to the greatest extent, ensuring the structural integrity and rationality of the fused domain model.

[0065] As one embodiment of this application, the target domain model is obtained by fine-tuning the routing network parameters of the fusion domain model based on general calibration data, including: Freeze the weights of all expert modules in the fusion domain model and set the routing network parameters as trainable parameters; A fusion training dataset with multiple batches was constructed based on general calibration data; Based on the activation probability of each expert module in the fusion domain model, a second load balancing loss is constructed; The fusion domain model is trained using the multiple batches of fused training datasets, and the routing network parameters are updated with a preset number of gradient steps based on the second load balancing loss.

[0066] In one embodiment, considering that the inconsistency in the spatial semantics of the new and old expert feature representations in the spliced ​​fusion domain model leads to their inability to work collaboratively, this embodiment further employs general calibration data to fine-tune the fusion domain model to achieve semantic alignment and restore the general performance of the pruned model. This embodiment uses a lightweight fine-tuning process to achieve semantic alignment. During fine-tuning, the original weights of all expert modules are first frozen, and only the routing network parameters are set as trainable parameters. Then, a small amount of unlabeled or minimally labeled general calibration data (approximately 5000-10000 samples) is used to perform gradient updates on the routing network parameters for a preset number of steps, gradually adapting it to the fused expert combination structure. Optionally, the preset number of steps can be set to 5%-10% of the total training steps.

[0067] A multi-batch fused training dataset containing general calibration data is constructed to iteratively train the model. During the route weight update process, a second load balancing loss is constructed based on the activation probabilities of each expert module in the fused domain model. The details are as follows: ; in, It is the set of all expert modules in the fusion domain model; To express summation; For expert module The activation probability for input data x.

[0068] During training, the routing network parameters of the model are updated with gradients in a limited number of preset steps based on the second load balancing loss. In practical applications, users can customize the preset number of steps according to their needs; this embodiment does not impose any restrictions on this. By fine-tuning the routing network parameters based on the second load balancing loss, the activation frequency of each expert module is constrained to remain relatively balanced. This avoids the routing weights from becoming excessively concentrated in a few old expert modules (i.e., the expert modules in the fine-tuned second expert model) in the initial stage due to the difference in the distribution of outputs from new and old experts, which would prevent newly connected expert modules from being effectively activated.

[0069] Optionally, when fine-tuning the fusion domain model, training data from the target business domain can be added to the training dataset. This means the training dataset contains both general calibration data and training data from the target business domain. Training the fusion domain model with mixed data allows the model to maintain alignment in the general semantic space and preserve its original general capabilities before pruning. It also enhances the collaborative processing capabilities of both new and experienced experts regarding the specific knowledge and logical patterns of the target business domain. This avoids regression in domain adaptation accuracy due to relying solely on general calibration data for fine-tuning, achieving a balanced optimization of general and domain capabilities.

[0070] Through the aforementioned lightweight fine-tuning operations, the routing network can dynamically redirect some of the input traffic to newly connected expert modules while preserving the original division of labor among experts. This allows the old and new experts to gradually form a collaborative and complementary division of labor, thereby effectively compensating for the performance loss caused by pruning and achieving rapid recovery of general performance.

[0071] In this embodiment, the target domain model obtained by the above domain adaptation method and the base MoE model were compared and tested on the datasets of the target business domain and the general domain to evaluate the domain transfer effect. The results are shown in Table 1 and Table 2 below.

[0072] Table 1: Test results for the target business domain dataset

[0073] As shown in Table 1, for tasks within the target business domain, the target domain model obtained using this solution achieved accuracies of 87.33%, 93.75%, and 88.50% in knowledge question answering, content understanding, and logical reasoning tasks, respectively, representing improvements of 13.66, 10.75, and 8.00 percentage points compared to the original base model. The macro-average accuracy for the three domain tasks increased from 79.06% to 89.86%, an improvement of 10.80 percentage points.

[0074] Table 2: Test results for general domain datasets

[0075] As shown in Table 2, the capability retention rates of this solution on the public datasets MMLU-Pro, HumanEval, MATH, and IFEval are 96.53%, 97.40%, 108.67%, and 95.18%, respectively, with an average capability retention rate of 99.45%. The capability retention rate of the target domain model in this solution is calculated as follows: .

[0076] Using the target domain model of this scheme, the simple average score (i.e., the average score) for the four tasks decreased to 86.01 compared to 86.46 for the original base model. Specifically, MMLU-Pro, HumanEval, and IFEval decreased by 2.86, 2.44, and 4.00 respectively, while MATH increased from 86.50 to 94.00, an increase of 7.50. This indicates that the overall general performance of the model after domain adaptation is still close to that of the original base model, but there is a certain degree of capability transfer between different general tasks.

[0077] It is worth noting that the improvement in MATH performance is related to the composition of the training data. On the one hand, in the training data used to prune the original MoE model to generate the first expert model, general mathematical data accounts for 40% of the general data, which helps to retain experts who undertake general knowledge and reasoning functions when compressing the expert scale. On the other hand, in the final fusion stage, mathematical data accounts for 30% of the general data, which further strengthens the expert representation and reasoning patterns related to mathematical reasoning.

[0078] Based on the same inventive concept, one embodiment of this application provides a progressive domain adaptation system for large MoE models. Figure 4 This is a schematic diagram of a progressive domain adaptation system 100 for a large MoE model proposed in one embodiment of this application. Figure 4 As shown, the system includes: The pruning module 101 is configured to determine a first number of expert modules to be retained in the original hybrid expert model based on the device parameters of the target device of the target domain model to be deployed, and prune the original hybrid expert model based on the first number and general training data to obtain a first expert model; the device parameters include: the number of graphics processors and the video memory capacity; the first expert model is pruned based on the training data of the target business domain to retain a second number of expert modules related to the target business domain to obtain a second expert model; the first number is twice the second number; The first fine-tuning module 102 is configured to select multiple target expert modules with the highest route activation frequency from the second expert model based on the training data of the target business domain, and fine-tune the parameters of each target expert module using the LoRA method to obtain the fine-tuned second expert model. The fusion module 103 is configured to splice together the expert modules removed from the first expert model and the fine-tuned second expert model from the feature dimension according to the hierarchical structure of the original hybrid expert model to obtain a fused domain model. The second fine-tuning module 104 is configured to fine-tune the routing network parameters of the fusion domain model based on general calibration data to obtain the target domain model.

[0079] In one embodiment of this application, the pruning module 101 is configured to prune the first expert model based on training data from a target business domain, retaining a second number of expert modules related to the target business domain to obtain a second expert model, including: Based on the training data from the target business domain, construct the first dataset; Each training data point in the first dataset is input into the first expert model to obtain the original scores of each expert module in the first expert model for the training data. The raw scores of each expert module are normalized to obtain the activation probability of each expert module in response to the training data. Based on the activation probability of each expert module for all training data in the first dataset, calculate the expert importance score of each expert module. The experts were ranked from highest to lowest according to their importance scores, resulting in the expert ranking results. The second number of expert modules ranked first in the expert ranking results are selected and retained, and the remaining expert modules are removed to obtain the second expert model.

[0080] In one embodiment of this application, the first fine-tuning module 102 is configured to, based on training data from the target business domain, select multiple target expert modules with the highest route activation frequency from the second expert model, and fine-tune the parameters of each target expert module using the LoRA method to obtain the fine-tuned second expert model, including: Based on the training data from the target business domain, a second dataset is constructed; Input each training data point in the second dataset into the second expert model to obtain the routing activation frequency of each expert module in the second expert model; All expert modules are sorted from high to low according to their route activation frequency to obtain the sorting results; Based on the sorting results, multiple target expert modules are selected and the following conditions are met: the sum of the routing activation frequencies of all target expert modules is greater than or equal to the first threshold, and the number of target expert modules is less than or equal to the second number. Based on the task types in the target business domain, construct task losses; Based on the difference between the current weights and the initial weights of each target expert module, an expert parameter regularization loss is constructed. Based on the activation probability of each target expert module, the first load balancing loss is constructed; The task loss, the expert parameter regularization loss, and the first load balancing loss are weighted and summed to construct a comprehensive loss function; Based on the comprehensive loss function, the parameters of each objective expert module are fine-tuned using the LoRA method to obtain the fine-tuned second expert model.

[0081] As one embodiment of this application, the first fine-tuning module 102 is configured to construct a task loss based on the task type of the target business domain, including: For the question-answering task, a semantic alignment loss is calculated based on the cosine similarity between the semantic vector of the answer and the semantic vector of the question-answer pair; and a cross-entropy loss is constructed based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the answer; the question-answering loss is constructed by weighted summation of the semantic alignment loss and the cross-entropy loss. For the solution generation task, the edit distance between the output text of the second expert model and the reference text is calculated and normalized to obtain the edit distance loss; and, based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the reference text, the cross-entropy loss is constructed; the edit distance loss and the cross-entropy loss are weighted and summed to construct the solution generation loss. Based on the task type of the target business domain, determine the weights corresponding to the question-answering loss and the solution generation loss, respectively; the task type includes at least one of the following: question-answering task and solution generation task. The task loss is constructed based on the question-answering loss, the solution generation loss, and their respective weights.

[0082] In one embodiment of this application, the first fine-tuning module 102 is further configured to perform the following steps: Based on the network layer position of each target expert module in the second expert model, each target expert module is divided into a basic layer target expert module and a task layer target expert module. Assign a first update weight to the base layer target expert module, and assign a second update weight to the task layer target expert module; the second update weight is greater than the first update weight. Based on the comprehensive loss function, the parameters of each target expert module are fine-tuned using the LoRA method, including: during backpropagation based on the comprehensive loss function, the gradients of the LoRA parameters of each target expert module are weighted according to the update weights corresponding to each target expert module, and the LoRA parameters of each target expert module are updated based on the weighted gradients.

[0083] As one embodiment of this application, the first fine-tuning module 102 is configured to fine-tune the parameters of each target expert module using the LoRA method, including: Based on the full training data of the target business domain, construct multiple training datasets with increasing data volume; The second expert model is iteratively trained for one training cycle by sequentially using each of the multiple training datasets, from smallest to largest, based on the amount of data in the training dataset. Furthermore, as the training cycle increases, the batch size of the training data used in each training cycle decreases.

[0084] As one embodiment of this application, the first fine-tuning module 102 is configured to fine-tune the parameters of each target expert module using the LoRA method, including: Based on the full training data of the target business domain, the second expert model is iteratively trained for multiple training cycles. During the first training cycle, the parameters of each target expert module are updated using the target learning rate; and at the end of each training cycle, the learning rate for the next training cycle is reduced according to the target decay ratio.

[0085] As one embodiment of this application, the second fine-tuning module 104 is specifically configured to perform the following steps: Freeze the weights of all expert modules in the fusion domain model and set the routing network parameters as trainable parameters; A fusion training dataset with multiple batches was constructed based on general calibration data; Based on the activation probability of each expert module in the fusion domain model, a second load balancing loss is constructed; The fusion domain model is trained using the multiple batches of fused training datasets, and the routing network parameters are updated with a preset number of gradient steps based on the second load balancing loss.

[0086] Based on the same inventive concept, one embodiment of this application provides an electronic device. Figure 5 This is a schematic diagram of an electronic device according to an embodiment of this application. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the computer program implements the steps in the progressive domain adaptation method for MoE large models as described in any of the above embodiments of this application.

[0087] Regarding the systems in the above embodiments, the specific methods by which each module performs its operations have been described in detail in the embodiments related to the method, and will not be elaborated upon here. The above descriptions are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

[0088] For the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and components involved are not necessarily essential to this application.

[0089] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0090] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0091] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0093] Although preferred embodiments of the embodiments of this application have been described, those skilled in the art, once they understand the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, this application is to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of this application.

[0094] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device 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 terminal device. 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 terminal device that includes said element.

[0095] The foregoing has provided a detailed description of the progressive domain adaptation method, system, and product for the MoE large model provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A progressive domain adaptation method for large MoE models, characterized in that, include: Based on the device parameters of the target device for the target domain model to be deployed, a first number of expert modules to be retained in the original hybrid expert model is determined, and the original hybrid expert model is pruned based on the first number and general training data to obtain a first expert model; the device parameters include: the number of graphics processors and the video memory capacity; The first expert model is pruned based on training data from the target business domain to retain a second number of expert modules related to the target business domain, resulting in a second expert model; the first number is twice the second number. Based on the training data of the target business domain, the target expert modules with the highest route activation frequency are selected from the second expert model, and the parameters of each target expert module are fine-tuned using the LoRA method to obtain the fine-tuned second expert model. According to the hierarchical structure of the original hybrid expert model, the expert modules removed from the first expert model and the fine-tuned second expert model are spliced ​​together from the feature dimension to obtain the fusion domain model; The target domain model is obtained by fine-tuning the routing network parameters of the fusion domain model based on general calibration data.

2. The progressive domain adaptation method for large MoE models according to claim 1, characterized in that, The first expert model is pruned based on training data from the target business domain to retain a second number of expert modules relevant to the target business domain, resulting in a second expert model, including: Based on the training data from the target business domain, construct the first dataset; Each training data point in the first dataset is input into the first expert model to obtain the original scores of each expert module in the first expert model for the training data. The raw scores of each expert module are normalized to obtain the activation probability of each expert module in response to the training data. Based on the activation probability of each expert module for all training data in the first dataset, calculate the expert importance score of each expert module. The experts were ranked from highest to lowest according to their importance scores, resulting in the expert ranking results. The second number of expert modules ranked first in the expert ranking results are selected and retained, and the remaining expert modules are removed to obtain the second expert model.

3. The progressive domain adaptation method for large MoE models according to claim 1, characterized in that, Based on the training data of the target business domain, several target expert modules with the highest route activation frequency are selected from the second expert model, and the parameters of each target expert module are fine-tuned using the LoRA method to obtain the fine-tuned second expert model, including: Based on the training data from the target business domain, a second dataset is constructed; Input each training data point in the second dataset into the second expert model to obtain the routing activation frequency of each expert module in the second expert model; All expert modules are sorted from high to low according to their route activation frequency to obtain the sorting results; Based on the sorting results, multiple target expert modules are selected and the following conditions are met: the sum of the routing activation frequencies of all target expert modules is greater than or equal to the first threshold, and the number of target expert modules is less than or equal to the second number. Based on the task types in the target business domain, construct task losses; Based on the difference between the current weights and the initial weights of each target expert module, an expert parameter regularization loss is constructed. Based on the activation probability of each target expert module, the first load balancing loss is constructed; The task loss, the expert parameter regularization loss, and the first load balancing loss are weighted and summed to construct a comprehensive loss function; Based on the comprehensive loss function, the parameters of each objective expert module are fine-tuned using the LoRA method to obtain the fine-tuned second expert model.

4. The progressive domain adaptation method for large MoE models according to claim 3, characterized in that, Based on the task types in the target business domain, a task loss is constructed, including: For the question-answering task, a semantic alignment loss is calculated based on the cosine similarity between the semantic vector of the answer and the semantic vector of the question-answer pair; and a cross-entropy loss is constructed based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the answer; the question-answering loss is constructed by weighted summation of the semantic alignment loss and the cross-entropy loss. For the solution generation task, the edit distance between the output text of the second expert model and the reference text is calculated and normalized to obtain the edit distance loss; and, based on the log-likelihood between the vocabulary prediction distribution output by the second expert model and the reference text, the cross-entropy loss is constructed; the edit distance loss and the cross-entropy loss are weighted and summed to construct the solution generation loss. Based on the task type of the target business domain, determine the weights corresponding to the question-answering loss and the solution generation loss, respectively; the task type includes at least one of the following: question-answering task and solution generation task. The task loss is constructed based on the question-answering loss, the solution generation loss, and their respective weights.

5. The progressive domain adaptation method for large MoE models according to claim 3, characterized in that, Before fine-tuning the parameters of each target expert module using the LoRA method based on the comprehensive loss function, the following steps are also included: Based on the network layer position of each target expert module in the second expert model, each target expert module is divided into a basic layer target expert module and a task layer target expert module. Assign a first update weight to the base layer target expert module, and assign a second update weight to the task layer target expert module; the second update weight is greater than the first update weight. Based on the comprehensive loss function, the parameters of each target expert module are fine-tuned using the LoRA method, including: during backpropagation based on the comprehensive loss function, the gradients of the LoRA parameters of each target expert module are weighted according to the update weights corresponding to each target expert module, and the LoRA parameters of each target expert module are updated based on the weighted gradients.

6. The progressive domain adaptation method for large MoE models according to claim 1 or 3, characterized in that, The parameters of each target expert module are fine-tuned using the LoRA method, including: Based on the full training data of the target business domain, construct multiple training datasets with increasing data volume; The second expert model is iteratively trained for one training cycle by sequentially using each of the multiple training datasets, from smallest to largest, based on the amount of data in the training dataset. Furthermore, as the training cycle increases, the batch size of the training data used in each training cycle decreases.

7. The progressive domain adaptation method for large MoE models according to claim 1 or 3, characterized in that, The parameters of each target expert module are fine-tuned using the LoRA method, including: Based on the full training data of the target business domain, the second expert model is iteratively trained for multiple training cycles. During the first training cycle, the parameters of each target expert module are updated using the target learning rate; and at the end of each training cycle, the learning rate for the next training cycle is reduced according to the target decay ratio.

8. The progressive domain adaptation method for large MoE models according to claim 1, characterized in that, The target domain model is obtained by fine-tuning the routing network parameters of the fusion domain model based on general calibration data, including: Freeze the weights of all expert modules in the fusion domain model and set the routing network parameters as trainable parameters; A fusion training dataset with multiple batches was constructed based on general calibration data; Based on the activation probability of each expert module in the fusion domain model, a second load balancing loss is constructed; The fusion domain model is trained using the multiple batches of fused training datasets, and the routing network parameters are updated with a preset number of gradient steps based on the second load balancing loss.

9. A progressive domain adaptation system for large MoE models, characterized in that, For performing the method as described in any one of claims 1-8, comprising: A pruning module is configured to determine a first number of expert modules to be retained in the original hybrid expert model based on the device parameters of the target device of the target domain model to be deployed, and prune the original hybrid expert model based on the first number and general training data to obtain a first expert model; the device parameters include: the number of graphics processors and the video memory capacity; the first expert model is pruned based on the training data of the target business domain to retain a second number of expert modules related to the target business domain to obtain a second expert model; the first number is twice the second number; The first fine-tuning module is configured to select multiple target expert modules with the highest route activation frequency from the second expert model based on the training data of the target business domain, and fine-tune the parameters of each target expert module using the LoRA method to obtain the fine-tuned second expert model. The fusion module is configured to, according to the hierarchical structure of the original hybrid expert model, splice together the expert modules removed from the first expert model and the fine-tuned second expert model from the feature dimension to obtain a fused domain model; The second fine-tuning module is configured to fine-tune the routing network parameters of the fusion domain model based on general calibration data to obtain the target domain model.

10. 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 method as described in any one of claims 1-8.