Large model fine-tuning method, device, and electronic equipment based on hybrid experts

By introducing a hybrid expert network structure into the large model and fine-tuning it by combining task-level and character-level gating networks, the problems of resource utilization and accuracy improvement of large models in multi-task scenarios in the field of network management are solved, and more efficient model inference and resource sharing are achieved.

CN122088587APending Publication Date: 2026-05-26CHINA MOBILE GROUP ZHEJIANG +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511989847.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-26
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Current large model technology is difficult to meet the application needs of multi-task scenarios in the field of network management. It suffers from problems such as computing power pressure, repeated consumption of resources, and limited improvement of model accuracy. In particular, when making routing decisions, relying on only a single-dimensional feature leads to insufficient utilization of global information and local features.

Method used

A two-layer network structure based on hybrid experts is adopted, including a task-level gating network and multiple task-level expert groups. Each expert group contains a character-level gating network and multiple character-level experts. By embedding specific layers of a pre-trained large model into the hybrid expert network, and fine-tuning using training data and prompt words, a network management model suitable for multi-task scenarios is formed.

Benefits of technology

It improves the model's generalization ability in multi-task scenarios, reduces training computational pressure, avoids knowledge fragmentation and redundant resource consumption, improves resource utilization, and achieves efficient model inference processing in multi-task scenarios in the field of network management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122088587A_ABST
    Figure CN122088587A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, and electronic device for fine-tuning a large model based on hybrid experts, belonging to the field of artificial intelligence technology. It addresses the problem that current large model technologies struggle to meet the application needs of multi-task scenarios in network management. The method includes: initializing a hybrid expert network for a pre-trained large model, the hybrid expert network comprising a task-level gating network and multiple task-level expert groups (each group containing a character-level gating network and multiple character-level experts), the hybrid expert network being embedded in specific layers of the pre-trained large model; inputting training data and a first prompt word into the pre-trained large model, guiding the pre-trained large model to output sample prediction results through the first prompt word; determining the loss result of the pre-trained large model based on the true label results corresponding to the training data, the sample prediction results, and the target loss function; and fine-tuning the network parameters of specific layers of the pre-trained large model based on the loss result to obtain a network management model for multi-task scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of artificial intelligence technology, specifically relating to a method, apparatus, and electronic device for fine-tuning large models based on hybrid experts. Background Technology

[0002] As digital transformation enters its more complex phase, network management faces the challenges of rapidly increasing data volume and increasingly complex business scenarios. Simultaneously, the ever-growing demands for real-time performance and accuracy are exposing the inefficiencies and limited analytical depth of current network management technologies when processing massive and complex data. The rise of general artificial intelligence technologies, exemplified by big data models, has brought new solutions to the network management field. Through learning and understanding massive amounts of data, big data models possess powerful pattern recognition, semantic understanding, and decision support capabilities, effectively handling complex tasks in network management and improving management efficiency and decision accuracy. In various business scenarios such as signaling analysis, home maintenance, and security assessment, big data model technology has demonstrated enormous application potential, driving network management towards intelligence and automation.

[0003] However, the application of large-scale model technology in vertical fields such as network management still faces several constraints. On the one hand, different task scenarios within a vertical field typically employ independent data-driven fine-tuning models, leading to difficulties in knowledge sharing and redundant consumption of computing resources. This approach of deploying multiple large models separately not only exacerbates computational pressure but also limits the improvement of model accuracy and the efficient utilization of resources. On the other hand, current solutions often select appropriate experts based on single-dimensional features (such as character-level features) during routing decisions. This makes it difficult for the model to fully utilize the global information and local features of the input data, limiting the model's adaptability and accuracy in multi-task scenarios. Therefore, providing a better solution to facilitate the rapid deployment of large-scale models in vertical fields, enabling trained large-scale models to meet the application needs of multi-task scenarios within those fields, is particularly necessary. Summary of the Invention

[0004] This application provides a method, apparatus, and electronic device for fine-tuning large models based on hybrid experts, which can solve the problem that current large model technology is difficult to meet the application needs of multi-task scenarios in the field of network management.

[0005] In a first aspect, embodiments of this application provide a method for fine-tuning a large model based on hybrid experts, comprising: initializing a hybrid expert network of a pre-trained large model; the hybrid expert network includes a task-level gating network and multiple task-level expert groups, each task-level expert group including a character-level gating network and multiple character-level experts; the hybrid expert network is used to embed specific layers of the pre-trained large model; inputting training data and a first prompt word into the pre-trained large model, and guiding the pre-trained large model to output sample prediction results through the first prompt word; determining the loss result of the pre-trained large model based on the true label results corresponding to the training data, the sample prediction results, and the target loss function; and fine-tuning the network parameters of specific layers of the pre-trained large model based on the loss result to obtain a trained large model; the trained large model is a network management model applied in multi-task scenarios. Secondly, embodiments of this application provide a large model fine-tuning device based on hybrid experts, comprising: an initialization module for initializing a hybrid expert network of a pre-trained large model; the hybrid expert network includes a task-level gating network and multiple task-level expert groups, each task-level expert group including a character-level gating network and multiple character-level experts; the hybrid expert network is used to embed specific layers of the pre-trained large model; a model processing module for inputting training data and a first prompt word into the pre-trained large model, and guiding the pre-trained large model to output sample prediction results through the first prompt word; a determination module for determining the loss result of the pre-trained large model based on the true label results corresponding to the training data, the sample prediction results, and the target loss function; and a model fine-tuning module for fine-tuning the network parameters of specific layers of the pre-trained large model based on the loss result to obtain a trained large model; the trained large model is a network management model applied in multi-task scenarios.

[0006] Thirdly, embodiments of this application provide an electronic device including a processor; and a memory arranged to store computer-executable instructions configured to be executed by the processor to implement the steps of the large model fine-tuning method based on hybrid experts as described in the first aspect.

[0007] Fourthly, embodiments of this application provide a computer-readable storage medium for storing computer-executable instructions, which, when executed by a processor, implement the steps of the large model fine-tuning method based on hybrid experts as described in the first aspect.

[0008] Fifthly, embodiments of this application provide a computer program product comprising a computer program that, when executed by a processor, implements the steps of the large model fine-tuning method based on hybrid experts as described in the first aspect.

[0009] In a sixth aspect, 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 executable instructions to implement the steps of the large model fine-tuning method based on hybrid experts as described in the first aspect.

[0010] In this embodiment, a hybrid expert network is initialized within a pre-trained large model. This hybrid expert network comprises a task-level gating network and multiple task-level expert groups. Each task-level expert group contains a character-level gating network and multiple character-level experts. The hybrid expert network is embedded into specific layers of the pre-trained large model, forming a two-layer hybrid expert network structure. This allows the pre-trained large model to simultaneously capture both global task features and local character features of the input data. The task-level gating network selects the corresponding expert group for the input data, ensuring that the model can perform targeted processing for different network management tasks. The character-level gating network further refines character-level feature processing within the expert group, adapting to local semantic differences in the input data. This two-layer hybrid expert network structure overcomes the shortcomings of current solutions that rely solely on single-dimensional features (such as only character-level features), leading to a lack of global information and enhancing the model's generalization ability in multi-task scenarios. This hybrid expert network is used in the pre-trained large model to process input data, achieving fine-grained capture and dynamic allocation of multi-task information. Specifically, training data and a first prompt word are input into a pre-trained large model. The first prompt word guides the pre-trained large model to output sample prediction results. Based on the true label results corresponding to the training data, the sample prediction results, and the target loss function, the loss result of the pre-trained large model is determined. Then, based on the loss result, the network parameters of specific layers of the pre-trained large model are fine-tuned to obtain the trained large model. The trained large model is a network management model applicable to multi-task scenarios. It is evident that this technical solution only fine-tunes the parameters of specific layers of the pre-trained large model (i.e., the layers embedded in the hybrid expert network), rather than updating all parameters, reducing the computational burden of model training and facilitating the rapid deployment of the large model in vertical fields. Furthermore, by sharing the pre-trained large model base through the hybrid expert network, different network management tasks can reuse common features. Compared to the solution of deploying a large model separately for each task scenario, this avoids knowledge fragmentation and redundant resource consumption, improving resource utilization. Therefore, the trained large model can support more targeted model inference processing of input data in multi-task scenarios in the network management field, meeting the application needs of multi-task scenarios in network management. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating a large model fine-tuning method based on hybrid experts provided in an embodiment of this application; Figure 2 This is a schematic diagram of a process for initializing a hybrid expert network provided in an embodiment of this application; Figure 3 This is a schematic diagram of a hybrid expert network structure provided in an embodiment of this application; Figure 4 This is a schematic diagram of a network structure for a task-level expert group provided in an embodiment of this application; Figure 5 This is a schematic diagram of a model quantization storage process provided in an embodiment of this application; Figure 6 This is a schematic diagram of a model scheduling process provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a large model fine-tuning device based on hybrid experts provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. 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, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. 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] In recent years, general artificial intelligence technologies, represented by large models, have shown significant potential in diverse network management scenarios due to their powerful pattern recognition and semantic understanding capabilities, driving the development of network management towards intelligence and automation.

[0015] However, several constraints still exist in the application of large-scale model technology in vertical fields. First, the pre-training stage of large-scale models focuses on learning general knowledge and lacks in-depth adaptation to specific vertical domain expertise. Therefore, fine-tuning is needed to meet the high-precision requirements of practical applications. Second, actual business often involves complex requirements across multiple tasks and scenarios, rather than single-task scenarios. Effectively integrating knowledge from multiple tasks to improve model training performance remains a significant challenge.

[0016] In response to this, current training in large-scale vertical model domains generally employs efficient fine-tuning schemes rather than full fine-tuning, considering computational costs. Efficient fine-tuning methods involve introducing a small number of trainable parameters to adapt to new tasks without freezing the backbone parameters of the pre-trained large model. Low-Rank Adaptation (LoRA) is a common method, which significantly reduces training parameters by inserting low-rank matrices into the weight matrix of the pre-trained large model. To better handle multi-task scenarios, some research attempts to combine the Mixture of Experts (MoE) framework with LoRA fine-tuning. This involves introducing multiple expert models (including a routing module and multiple LoRA modules), each focusing on learning knowledge from different domains. This allows each expert model to dynamically select the LoRA module for computation based on the input data. Specifically, one implementation scheme involves introducing multiple experts into the LoRA weight matrix and using the routing module to dynamically select an expert for the currently processed character. In this scheme, character-level features are used as input to the routing module, assigning different experts to different characters to better handle the knowledge hidden within them. Another implementation scheme involves dividing the self-programming task into five categories, with each category corresponding to a LoRA expert model. Multiple LoRA expert models share a single base multilingual model for inference on the self-programming task. In this scheme, a separate LoRA expert is trained for each task.

[0017] Therefore, current multi-expert large model fine-tuning schemes often select appropriate experts based on only one of character-level or task-level features during dynamic routing, failing to consider both simultaneously. This results in the model's inability to fully utilize the global information and local features of the input data, limiting its adaptability and accuracy in multi-task scenarios. Furthermore, different task scenarios in network management typically employ their own independent data fine-tuning models, leading to difficulties in knowledge sharing and redundant consumption of computing resources. Deploying multiple large models separately not only exacerbates computing pressure but also limits the improvement of model accuracy and the efficient utilization of resources.

[0018] Furthermore, current dynamic routing mechanisms often employ softmax normalization or a fixed Top-K strategy, which may introduce unnecessary noise or lose important expert information, affecting inference accuracy. Specifically, when selecting experts, some schemes use softmax normalization to assign weights to different experts. This normalization method may cause unimportant information to be assigned smaller weights, thus participating in the subsequent inference process and causing interference. Other schemes use a Top-K approach to filter experts with lower scores, but selecting a fixed number of experts for each input may also result in low-scoring experts being selected or some high-scoring experts being filtered out, leading to inaccurate subsequent inference.

[0019] Besides limitations in fine-tuning schemes, insufficient computing power and resources can also exist during inference deployment. The inability of trained models to perform inference services due to insufficient computing resources is a major challenge for large-scale business applications.

[0020] Therefore, how to enable multiple task scenarios to share a single model base while effectively alleviating computational pressure while ensuring model performance has become a pressing technical challenge. Furthermore, insufficient computational resources during the inference deployment phase also restrict the widespread application of large models, necessitating the design of flexible scheduling strategies to meet the accuracy and response requirements of different business scenarios.

[0021] In summary, the field of network management faces key technical challenges when applying large models for multi-task fine-tuning training and inference deployment. These challenges include how to rationally configure expert network parameters, how to integrate task-level and character-level features to improve model specificity, how to implement dynamic and adaptive routing mechanisms, and how to flexibly schedule models based on computing power and business needs. Solving these problems is crucial for improving the training efficiency and inference performance of large models in complex multi-task scenarios.

[0022] Therefore, this application provides a large model fine-tuning method based on hybrid experts. The following, in conjunction with the accompanying drawings, describes in detail the large model fine-tuning method, apparatus, and electronic equipment based on hybrid experts provided in this application through specific embodiments and application scenarios.

[0023] Figure 1 This application illustrates a method for fine-tuning a large model based on hybrid experts, provided in one embodiment. This method can be executed by an electronic device, which may include a server and / or a terminal device, such as an in-vehicle terminal or a mobile terminal. In other words, the method can be executed by software or hardware installed on the electronic device, and includes the following steps: Step 102: Initialize the hybrid expert network of the pre-trained large model; the hybrid expert network includes a task-level gating network and multiple task-level expert groups, and each task-level expert group includes a character-level gating network and multiple character-level experts.

[0024] In this context, the hybrid expert network is used to embed specific layers of a pre-trained large model. These specific layers may be, for example, the FFN (Feedforward Neural Network) layer or the attention layer of a Transformer (a deep learning model based on an attention mechanism).

[0025] Task-level gating networks can be used to select corresponding task-level expert groups based on the task feature vectors of the input data, ensuring that the model can perform targeted processing for different network management tasks (such as fault detection and traffic prediction). Character-level gating networks can be used to further refine character-level feature processing within groups, adapting to local semantic differences in the input data. This two-layer hybrid expert network structure overcomes the shortcomings of current MoE models that rely solely on single-dimensional features (such as character-level features), leading to a lack of global information, and enhances the model's generalization ability in multi-task scenarios.

[0026] In practical implementation, the hybrid expert network can be a hierarchical hybrid expert model MoE framework based on low-rank matrix factorization (LoRA) modules. LoRA is an efficient large model fine-tuning technique that adjusts a pre-trained large model by training only a small number of low-rank matrices, significantly reducing computational resource requirements while maintaining model performance. This model, based on the LoRA and MOE architecture, treats different LoRA modules as multiple "experts" and embeds them into specific layers of the pre-trained large model (such as the FFN layer or attention layer of a Transformer). Character-level experts can be LoRA experts, each containing a pair of low-rank matrices A and B, used to fine-tune the weights of the pre-trained large model.

[0027] Step 104: Input the training data and the first prompt word into the pre-trained large model, and guide the pre-trained large model to output the sample prediction results through the first prompt word.

[0028] The training data consists of sample data from vertical domains that require large-scale model deployment. In this embodiment, the training data is sample data from the network management domain.

[0029] By jointly inputting training data and a first prompt word into a pre-trained large model, the task objective can be clearly defined through the prompt word, guiding the model to output prediction results that meet business requirements. This approach leverages the prompt learning capability of the large model, reduces the model's dependence on large amounts of labeled data, and improves the matching degree between prediction results and task scenarios.

[0030] In practice, all training data can be fed into the pre-trained large model after initializing the hybrid expert network in batches for training. The model input data can be processed into text pairs of input prompts and expected outputs. Specifically, the question is used as input, and the answer is used as the true label. Cross-entropy loss is used to minimize the difference between the predicted result and the true label, enabling the model to learn language patterns that meet the task requirements.

[0031] Step 106: Determine the loss result of the pre-trained large model based on the true label results, sample prediction results, and target loss function corresponding to the training data.

[0032] In practice, the target loss function can be the cross-entropy loss function, and the loss result can be the cross-entropy loss between the true label result and the sample prediction result.

[0033] Step 108: Based on the loss results, fine-tune the network parameters of specific layers of the pre-trained large model to obtain the trained large model.

[0034] The trained large model serves as a network management model for multi-task scenarios. In practice, based on the loss results, after training until the iteration termination condition is met, the network parameters of specific layers of the pre-trained large model are fixed to obtain the trained large model. The iteration termination condition can be that the cross-entropy loss between the sample prediction result and the true label result is less than a preset threshold.

[0035] Optionally, during the fine-tuning of the pre-trained large model, training data can be input into a hybrid expert network, and a contrastive learning function can be used to train a task-level gating network and a character-level gating network to optimize the gating weights and obtain the trained large model, thereby improving the accuracy of expert selection and training precision in multi-task scenarios.

[0036] In this embodiment, a hybrid expert network is initialized within a pre-trained large model. This hybrid expert network comprises a task-level gating network and multiple task-level expert groups. Each task-level expert group contains a character-level gating network and multiple character-level experts. The hybrid expert network is embedded into specific layers of the pre-trained large model, forming a two-layer hybrid expert network structure. This allows the pre-trained large model to simultaneously capture both global task features and local character features of the input data. The task-level gating network selects the corresponding expert group for the input data, ensuring that the model can perform targeted processing for different network management tasks. The character-level gating network further refines character-level feature processing within the expert group, adapting to local semantic differences in the input data. This two-layer hybrid expert network structure overcomes the shortcomings of current solutions that rely solely on single-dimensional features (such as only character-level features), leading to a lack of global information and enhancing the model's generalization ability in multi-task scenarios. This hybrid expert network is used in the pre-trained large model to process input data, achieving fine-grained capture and dynamic allocation of multi-task information. Specifically, training data and a first prompt word are input into a pre-trained large model. The first prompt word guides the pre-trained large model to output sample prediction results. Based on the true label results corresponding to the training data, the sample prediction results, and the target loss function, the loss result of the pre-trained large model is determined. Then, based on the loss result, the network parameters of specific layers of the pre-trained large model are fine-tuned to obtain the trained large model. The trained large model is a network management model applicable to multi-task scenarios. It is evident that this technical solution only fine-tunes the parameters of specific layers of the pre-trained large model (i.e., the layers embedded in the hybrid expert network), rather than updating all parameters, reducing the computational burden of model training and facilitating the rapid deployment of the large model in vertical fields. Furthermore, by sharing the pre-trained large model base through the hybrid expert network, different network management tasks can reuse common features. Compared to the solution of deploying a large model separately for each task scenario, this avoids knowledge fragmentation and redundant resource consumption, improving resource utilization. Therefore, the trained large model can support more targeted model inference processing of input data in multi-task scenarios in the network management field, meeting the application needs of multi-task scenarios in network management.

[0037] In one implementation, data can be clustered and grouped based on the task feature vector and character feature vector to determine a first number of task-level expert groups and a second number of character-level experts within each task-level expert group. Based on these determined first and second numbers, a hierarchical hybrid expert network is constructed. This hierarchical hybrid expert network includes a task-level gating network, a character-level gating network, and multiple LoRA experts embedded in specific layers of a pre-trained large model. Figure 2 As shown, initializing the hybrid expert network of the pre-trained large model (i.e., step 102) can be performed as follows: steps 1021-1026: Step 1021: Obtain training data, which includes sample data from multi-task scenarios.

[0038] In this embodiment, the training data is sample data from multi-task scenarios in the field of network management. For example, the training data may include sample data for fault detection, sample data for traffic prediction, sample data for signaling analysis, etc.

[0039] In practical implementation, the distribution of sample data in different task scenarios can be analyzed based on sample data from multi-task scenarios in the network management field to select an appropriate number of experts. This ensures model performance while minimizing unnecessary computational overhead. Since the hybrid expert network in this embodiment adopts a hierarchical routing design, namely task-level and character-level, the number of experts to be determined includes the number of task-level expert groups and the number of character-level experts within each task-level expert group.

[0040] Step 1022: For each task scenario, determine the first task feature vector of each task in the task scenario based on the sample data in that task scenario.

[0041] In practical implementation, sample data from the task scenario can be randomly sampled to select a target number (e.g., 5, 10, etc.) of sample data to calculate the first task feature vector for a task in the task scenario. Specifically, the Term Frequency–Inverse Document Frequency (TF-IDF) algorithm can be used to extract key features for each sample data, and the text information can be converted into a numerical feature vector. Then, for each task, the mean of the numerical feature vectors corresponding to the target number of sample data for that task can be calculated to obtain the first task feature vector for that task.

[0042] Term frequency-inverse document frequency (TF-IV) is a text feature representation method that reflects the importance of a word by calculating the weighted ratio of the frequency of a word in a document to its rarity in the entire corpus. It is widely used in text retrieval and classification tasks.

[0043] To reduce dimensionality redundancy and noise, the feature vectors of the first task can be standardized. If the TF-IDF dimension is high (e.g., >1000 dimensions), Principal Component Analysis (PCA) or Truncated Singular Value Decomposition (TruncatedSVD) can be used for dimensionality reduction, such as reducing it to 50-100 dimensions, while retaining the main information and accelerating clustering efficiency.

[0044] Step 1023: Based on the first task feature vector of all tasks in all task scenarios, determine the first number of task-level expert groups using the K-means clustering method combined with the elbow method.

[0045] In practical implementation, the optimal number of cluster centers can be determined based on the K-means clustering method combined with the elbow method, thus obtaining the initial number K of task-level expert groups. Specifically, the candidate range of K can be limited by considering the expected number and diversity of task scenarios to avoid K being too large or too small, causing the clustering results to deviate from business requirements and ensuring that the number of clusters conforms to the task distribution characteristics of the actual scenario. Assuming the total number of task scenarios is M, the candidate range of K can be preset as [ Then, for each candidate K value, K-means clustering is performed.

[0046] Based on this, step 1023 can be executed as follows: steps A1-A5: Step A1: For each candidate K value, randomly initialize the corresponding K initial cluster centers.

[0047] Specifically, K cluster centers can be randomly selected from the first task feature vectors of all tasks in all task scenarios as initial cluster centers.

[0048] Step A2: Based on the first task feature vector of each task, assign each task to the nearest initial cluster center, resulting in K initial clusters. Recalculate the center of each initial cluster, and perform task clustering again based on the calculated centers, resulting in K first clusters. Recalculate the center of each first cluster, and perform task clustering again based on the calculated centers, resulting in K second clusters, and so on, until the cluster centers no longer change significantly, resulting in K target clusters.

[0049] Here, the distance is the distance between the first task feature vector of the task to be assigned and the initial cluster center. The reference index for when the cluster center no longer changes significantly can be that the number of iterations reaches a preset upper limit (such as 500 times), or the change in the center is less than 1e-6 (at this time, the algorithm can be considered to have converged to a stable solution).

[0050] Step A3: Record the sum of squared errors (SSE) within the target cluster corresponding to each K value.

[0051] In this embodiment, the sum of squared errors refers to the sum of squared distances between each task and the center of its target cluster. Optionally, the sum of squared errors... It can be calculated using the following formula (1).

[0052] (1) in, For the first k Target clusters, For the first k The center of each target cluster, , x SSE represents the first task feature vector within the target cluster. The smaller the SSE, the more concentrated the distribution of tasks within the cluster, and the better the clustering effect.

[0053] Step A4: Plot the "SSE-K value" curve. Plot the K value on the horizontal axis and the corresponding SSE value on the vertical axis to generate a line graph.

[0054] Step A5: Identify the "elbow point". Observe the trend of the curve. When the K value is small, the SSE will decrease rapidly as K increases (because increasing the number of clusters can significantly reduce intra-cluster variability). When the K value exceeds a certain critical point, the rate of decrease of SSE will slow down significantly (at this point, increasing the number of clusters has limited effect on improving the clustering effect). This critical point is the "elbow point", and the corresponding K value is the optimal number of cluster centers.

[0055] Step 1024: For each task-level expert group, determine the first character feature vector of each task contained in that task-level expert group.

[0056] Step 1025: Based on the first character feature vectors of all tasks within the task-level expert group, determine the second number of character-level experts using the K-means clustering method combined with the elbow method.

[0057] Among them, the second number of character-level experts N The method for determining this can be found in steps A1-A5 above, and will not be repeated here.

[0058] Step 1026: Based on the determined first number of task-level expert groups and the second number of character-level experts within each task-level expert group, and in conjunction with the pre-configured task-level gating network and character-level gating network, initialize the hybrid expert network.

[0059] In this embodiment, during the initialization of the hybrid expert network, based on the training data in a multi-task scenario, the task feature vectors of each task are first extracted, and the number of task-level expert groups is determined using a clustering method. Then, for each task within a task-level expert group, character-level feature vectors are extracted, and the number of character-level experts is determined using a clustering method. Combining the pre-configured task-level gating network and character-level gating network, the parameters of the hybrid expert network are initialized. This hierarchical clustering and grouping strategy based on task features and character features can automatically determine the expert parameters according to the data distribution in the network management domain, thereby more rationally setting the entire hybrid expert network, achieving targeted training and knowledge specialization of experts, and making model training more accurate.

[0060] In one implementation, the gating threshold corresponding to the task-level gating network is the first dynamic gating threshold, and the gating threshold corresponding to the character-level gating network is the second dynamic gating threshold.

[0061] In this embodiment, the first dynamic gating threshold is related to the network layer number and the task-level expert group. Specifically, different task-level expert groups in the same network layer have different first dynamic gating thresholds, and the same task-level expert group in different network layers has different first dynamic gating thresholds.

[0062] In this embodiment, the second dynamic gating threshold is related to the network layer number of the character-level expert and the character-level expert itself. Specifically, different character-level experts in the same network layer have different second dynamic gating thresholds, and the same character-level expert in different network layers has different second dynamic gating thresholds.

[0063] In this embodiment, by designing task-level and character-level gating networks and combining them with a dynamic threshold mechanism, the system can adapt to different network layers and expert variations, achieving multi-level filtering based on task and character features to select suitable experts. This technical solution effectively avoids the interference caused by the indiscriminate inclusion of low-weight expert information due to current softmax normalization, while overcoming the problem of missing important expert information caused by fixed Top-K filtering, thus achieving a more accurate expert filtering and information fusion effect.

[0064] Previously, LoRA-based hybrid expert models often only considered character-level feature gating networks and single-group multi-expert mechanisms. Their goal was to select a corresponding expert for each character to generate character features. However, this method ignored the global features of the sequence samples, which might contain crucial information useful for prediction accuracy, such as task information and target information. Therefore, this application's embodiment groups experts, with different groups responsible for different types of task objectives. A multi-level dynamic threshold routing network is set up. First, the corresponding expert group is selected based on the task-level gating network, and then the corresponding expert within the group is selected through the character-level gating network to process the current character.

[0065] The parameter learning process of hybrid expert networks is described in detail below, specifically including the following steps B1-B3: Step B1: Configure the task-level gating network.

[0066] In practical implementation, compared to the current network structure, this embodiment adds a task-level gating network before the task-level expert group in the hybrid expert network. As an example, the network structure of the hybrid expert network is as follows: Figure 3 As shown, it includes a task-level gated network S-Router and three task-level expert groups. Each task-level expert group includes a character-level gated network T-Router and four character-level experts.

[0067] The task-level gating network is used to select an appropriate expert group based on the task feature vector corresponding to the input data and in conjunction with a first dynamic gating threshold. The input data is either the training data or the output data of the previous network layer of the hybrid expert network in a pre-trained large model.

[0068] In practical implementation, to reduce the difficulty of task identification and improve the ability to distinguish between different task expert groups, a series of vectors can be initialized based on different task IDs (numerical or string codes used to uniquely identify a task) to obtain task feature vectors, such as... The ID vector is continuously updated during training. For an entire input sequence, assuming its length is T, the sequence's features are represented as: Its task ID is m Then the vector representation of its task can be... .

[0069] Next, the task feature vector and the sequence feature representation can be fed into a task-level gating network to select a suitable expert group. Assuming there are K expert groups in total, the task feature vectors fed into the training data... Subsequently, task-level gating network The weight of each expert group can be obtained using the following formula (2). : (2) in, These are parameters of the task-level gating network. It is the score predicted by the expert group from the task-level gating network. Indicates the first The scores of the expert panel .

[0070] Then, the expert groups are selected based on their weights and a first dynamic gating threshold. Specifically, a separate first dynamic gating threshold can be set for each expert group at each specific level. To train the first dynamic gating threshold, two vectors can be introduced for calculation, namely... and Among them, vector It is related to the number of network layers The relevant vector controls how the threshold changes with the number of network layers. It is a vector related to the expert group. This is the subscript corresponding to the expert panel. Layer Threshold for each expert group for: As can be seen, this technical solution calculates the dynamic threshold of gating networks at different levels using two learnable vectors. These two vectors are related to the number of network layers and different expert groups, respectively, thus enabling the dynamic threshold to adaptively change with different expert groups and the number of network layers. Specifically, the number of network layers... This has no impact on the subsequent reasoning process; to simplify the formula, the network layer number symbol can be omitted in later formulas. , represented as .

[0071] After obtaining the first dynamic gating threshold for each expert group, the following formula (3) can be used to first filter based on the first dynamic gating threshold, and then normalize the scores to obtain the weights of the filtered expert groups. : (3) in, For task-level gating networks, the current input is the first... The weights assigned to each expert group, It is a conditional function; when the condition is met... If true, =1; when the condition is 1 x It is fake. The threshold is set to 0, thus filtering out expert groups that do not meet the threshold.

[0072] Therefore, according to After selecting a suitable expert group, the system enters the corresponding character-level gating network, where appropriate experts are selected based on the characteristics of different characters.

[0073] Step B2: Configure the character-level gating network.

[0074] In practical implementation, based on the aforementioned task-level gating network, an expert group filtered by the first dynamic gating threshold can be obtained. For each expert group, compared to the current network structure, this embodiment adds a character-level gating network before the character-level experts in the expert group. As an example, the network structure of the expert group is as follows: Figure 4 As shown, it includes the character-level gated network T-Router, and LoRA experts (i.e., character-level experts) T-Expert 1, T-Expert 2, T-Expert 3 and T-Expert 4.

[0075] Among them, the character-level gating network is used to select a suitable LoRA expert based on the character feature vector corresponding to the input data and in combination with the second dynamic gating threshold.

[0076] In practice, each LoRA expert All are updated by the matrix and The LoRA system is composed of several LoRA experts, each responsible for learning features from different character sets. A character-level gating network dynamically selects the most suitable LoRA expert based on the input characters. The gating network assigns a weight to each expert, representing the expert's importance to the current input. Weights are typically calculated using a softmax function to ensure the sum of all expert weights equals 1. For the input characters... Character-level gating network The output distribution can be determined using the following formula (4). : (4) in, These are the parameters of a character-level gating network. It is the expert score predicted by the character-level gating network. It is the first The scores of the experts, .

[0077] Then, experts are selected based on their weight and a second dynamic gating threshold. Specifically, a separate second dynamic gating threshold can be set for each expert at each specific tier. To train the second dynamic gating threshold, two vectors can be introduced for calculation, namely... and , where vector It is related to the number of network layers The relevant vector controls how the threshold changes with the number of network layers. It is a vector related to experts. This is the subscript corresponding to the expert. Layer n Threshold for an expert for: As can be seen, this technical solution calculates the dynamic threshold of gating networks at different levels using two learnable vectors. These two vectors are related to the number of network layers and different experts, respectively, thus enabling the dynamic threshold to adaptively change with different experts and the number of network layers. Specifically, the number of network layers... This has no impact on the subsequent reasoning process; to simplify the formula, the network layer number symbol can be omitted in later formulas. , represented as .

[0078] After obtaining the second dynamic gating threshold for each expert, the following formula (5) can be used to first filter based on the second dynamic gating threshold, and then normalize the scores to obtain the filtered expert weights. : (5) in, For character-level gating networks targeting the first t The character is the first n The weights assigned to each expert It is a conditional function; when the condition is met... x If true, =1; when the condition is 1 x It is fake. The threshold is set to 0, thus filtering out experts who do not meet the threshold.

[0079] Therefore, according to After selecting a suitable expert, the corresponding LoRA expert is fed into the system. Then, the output of the LoRA expert is weighted according to the weight distribution of the task-level gating network and the character-level gating network.

[0080] Step B3, the final feature representation of the current hybrid expert network.

[0081] In practice, for each input data point, each LoRA expert independently computes its output. Specifically, the LoRA expert adjusts the weights of the pre-trained large model using its low-rank matrix, generating a fine-tuned result for the current input. The final fine-tuned result is obtained by multiplying the weights assigned by the gating network with the output of each LoRA expert, and then summing the weighted outputs of all experts. That is, for each character, assuming its embedding representation from the previous layer is... Then, after passing through the LoRA expert, the output feature representation is as follows: By adding two weights, the feature representation of this character is as follows: .get Then, this feature representation is added to the output of the pre-trained large model to obtain the final feature representation of this layer: Then, the result is fed into the next layer as input, and after traversing all network layers, the final output is obtained.

[0082] In one implementation, the process of processing input data by the hybrid expert network may include the following steps C1-C5: Step C1: Using a task-level gating network, determine the first prediction weight corresponding to each task-level expert group based on the second task feature vector corresponding to the input data.

[0083] The input data consists of training data or the output data of the previous layer of the hybrid expert network in a pre-trained large model. The first prediction weight for each task-level expert group can be... In practice, It can be calculated using the above formula (2), which will not be repeated here.

[0084] Step C2: Determine the target task-level expert group for processing the input data based on the first prediction weight and the first dynamic gating threshold corresponding to each task-level expert group.

[0085] In practical implementation, the above formula (3) can be used to determine the first prediction weight corresponding to each task-level expert group. and the first dynamic gating threshold The weights of the selected expert groups were calculated. Therefore, based on Select an appropriate expert group, namely, a target task-level expert group for processing the input data.

[0086] Step C3: Using the character-level gating network in the target task-level expert group, determine the second prediction weight corresponding to each character-level expert based on the second character feature vector corresponding to the input data.

[0087] The second prediction weight for each character-level expert can be: In practice, It can be calculated using the above formula (4), which will not be repeated here.

[0088] Step C4: Determine the target character-level expert for processing the input data based on the second prediction weight and the second dynamic gating threshold corresponding to each character-level expert.

[0089] In practical implementation, the above formula (5) can be used to determine the second prediction weight corresponding to each character-level expert. Second dynamic gating threshold The expert weights after screening are calculated. Therefore, based on Choose the appropriate expert, that is, the target character-level expert to process the input data.

[0090] Step C5: Process the input data using a target character-level expert.

[0091] In this embodiment, during the specific data processing, the hybrid expert network utilizes a task-level gating network to calculate the prediction weights of each task-level expert group based on the task feature vector of the input data. This weighting, combined with a first dynamic gating threshold, filters out the target task-level expert group, achieving the effect of narrowing the expert search range using global task-level information. Subsequently, the character-level gating network within the target task-level expert group calculates the prediction weights of character-level experts based on the character feature vector of the input data. This weighting, combined with a second dynamic gating threshold, determines the target character-level expert for processing the input data. This achieves precise expert selection using fine-grained character-level information. Finally, the selected character-level expert is used to process the input data, improving the model's efficiency and accuracy in handling complex multi-task inputs. Each dynamic gating threshold is related to the network layer number of the expert and the expert's own characteristics. Different network layers and different experts correspond to different thresholds, achieving more precise and dynamic expert selection. This avoids noise interference and loss of important expert information caused by the current fixed normalization strategy, improving the accuracy and efficiency of model inference.

[0092] In one implementation, a large trained model can be quantized using multiple precision versions, and these quantized versions can be stored. For example... Figure 5 As shown, it may include the following steps 110-114: Step 110: Perform quantization processing of the trained large model with different precision to obtain multiple quantized versions of the model.

[0093] In practice, after obtaining the trained large model, the large model can be quantized with various precisions, including INT8 and INT4, according to the requirements, and the different quantized versions of the model can be stored.

[0094] Step 112: For each model quantization version, test the model of the quantization version using test data to obtain the model accuracy corresponding to the model quantization version.

[0095] Step 114: Record the model accuracy and the memory usage corresponding to the model quantization version.

[0096] In practice, a small batch of test data can be used to test different quantization versions of the model to statistically analyze their accuracy. By recording the model accuracy and the corresponding memory usage for each quantization version, a correlation between model performance and resource consumption can be established, facilitating the subsequent use of different quantization versions based on computing power and accuracy requirements.

[0097] In one implementation, a suitable model quantization version can be dynamically selected for inference services based on current computing resources and business accuracy requirements. For example... Figure 6 As shown, it may include the following steps 116-118: Step 116: Based on the remaining computing power resources of the nodes to be deployed, the maximum accuracy loss rate and maximum inference latency allowed by the business, as well as the memory usage, accuracy loss rate and inference latency of each model quantization version, select the model quantization version that meets the target conditions.

[0098] In practice, two levels of conditional coefficients for judging the model's memory can be set to screen feasible model quantization versions.

[0099] Then, firstly, a quantized version of the model that meets all resource and performance metrics is selected using a certain conditional coefficient; if the selection result is empty, the conditional coefficient is reduced, and selection is based solely on memory usage; finally, the version with the highest accuracy is selected from the candidate models for inference service. This adaptive model scheduling strategy effectively alleviates the problem of scarce computing resources while meeting the requirements of different business scenarios for inference accuracy and latency.

[0100] The target conditions may include several of the following: the product of the condition coefficient for model memory determination and the model size of the current quantized version is less than or equal to the remaining memory / video memory of the node to be deployed; the accuracy loss rate of the current quantized version is less than or equal to the maximum accuracy loss rate allowed by the business; and the inference latency of the current quantized version is less than or equal to the maximum inference latency allowed by the business.

[0101] For example, suppose the set of quantized versions of the model is The remaining computing resources (GPU / CPU availability percentage) of the nodes to be deployed are: The remaining memory / GPU memory of the node to be deployed is Model quantization version q The model size is The accuracy loss rate is Inference delay is For a given input business data, the maximum allowable precision loss rate is... The maximum inference delay is .

[0102] If two levels of coefficients are set for the conditional coefficients used to determine the model's memory usage: Therefore, the scheme for selecting the quantized version of the model that meets the target conditions is as follows: First step, select =1.2 (to prevent memory overflow risk). Based on computing resources, inference latency, and accuracy requirements, select feasible model quantization versions. .for Any model quantization version , The following conditions must be met simultaneously: , and ,Right now .

[0103] The second step is to find all feasible quantization versions of the model. Then, make a judgment Is it empty? If not empty, proceed to step 118. If empty, reduce the condition coefficient for model memory judgment. =1.0, only considering video memory usage to select feasible models, that is Then proceed to step 118.

[0104] Step 118: Select the target model quantization version with the highest accuracy from the filtered model quantization versions for inference.

[0105] Inference, in particular, involves using the quantized version of the target model deployed on the node to be deployed to process the input data.

[0106] In this embodiment, multiple quantized versions of the trained large model are generated by performing multi-precision quantization. For each quantized version, its accuracy is evaluated using test data, and the corresponding memory usage is recorded. Therefore, during the inference deployment phase, based on the remaining computing resources of the nodes to be deployed, the maximum allowable precision loss rate for the business, and the inference latency requirements, combined with the memory usage, precision loss rate, and inference latency of each quantized version, the quantized model version that meets the target conditions is selected, and the version with the highest precision is chosen for inference. This flexible scheduling strategy based on resource and performance constraints effectively alleviates the limitations of insufficient computing power on large model inference applications, improving the applicability and response speed of model deployment.

[0107] By adopting the technical solution provided in this application, the pre-trained large model, through embedding a hierarchical hybrid expert network and combining a dynamic gating mechanism of task-level and character-level features, can more comprehensively capture the complex feature distribution under multiple tasks and scenarios, significantly improving the model's fine-tuning effect and inference accuracy. The design of the dynamic gating threshold makes expert selection more refined and adaptive, reducing unnecessary computational redundancy and avoiding the omission of important expert information, thereby improving the model's inference efficiency and stability. The multi-precision quantization and scheduling method provides a flexible solution for model deployment in resource-constrained environments, balancing accuracy and computational resources, and meeting the multi-dimensional requirements for real-time performance and accuracy in network management services. Overall, this technical solution effectively overcomes the shortcomings of current single-dimensional expert routing selection and wasted computing resources, achieving efficient, accurate, and scalable multi-task large model fine-tuning and deployment, and promoting the improvement of network management intelligence.

[0108] It should be noted that the large model fine-tuning method based on hybrid experts provided in this application can be executed by a large model fine-tuning device based on hybrid experts, or by a control module within that device for executing the large model fine-tuning method based on hybrid experts. This application uses the execution of the large model fine-tuning method based on hybrid experts by the large model fine-tuning device based on hybrid experts as an example to illustrate the large model fine-tuning device based on hybrid experts provided in this application.

[0109] Figure 7 This is a schematic diagram of a large model fine-tuning device based on hybrid experts provided in an embodiment of this application. Figure 7 As shown, the large model fine-tuning device based on hybrid experts includes: an initialization module 710, a model processing module 720, a determination module 730, and a model fine-tuning module 740.

[0110] Initialization module 710 is used to initialize the hybrid expert network of the pre-trained large model; the hybrid expert network includes a task-level gating network and multiple task-level expert groups, each task-level expert group includes a character-level gating network and multiple character-level experts; the hybrid expert network is used to embed specific layers of the pre-trained large model; model processing module 720 is used to input training data and a first prompt word into the pre-trained large model, and guide the pre-trained large model to output sample prediction results through the first prompt word; determination module 730 is used to determine the loss result of the pre-trained large model based on the true label results corresponding to the training data, the sample prediction results, and the target loss function; model fine-tuning module 740 is used to fine-tune the network parameters of specific layers of the pre-trained large model based on the loss result to obtain the trained large model; the trained large model is a network management model applied to multi-task scenarios.

[0111] In one implementation, the initialization module 710 includes: an acquisition unit, a first determination unit, a second determination unit, a third determination unit, a fourth determination unit, and an initialization unit.

[0112] The system comprises the following components: an acquisition unit for acquiring training data, including sample data from multi-task scenarios; a first determination unit for determining the first task feature vector of each task in each task scenario based on the sample data; a second determination unit for determining the first number of task-level expert groups based on the first task feature vectors of all tasks in all task scenarios using K-means clustering combined with the elbow method; a third determination unit for determining the first character feature vector of each task within each task-level expert group; a fourth determination unit for determining the second number of character-level experts based on the first character feature vectors of all tasks within each task-level expert group using K-means clustering combined with the elbow method; and an initialization unit for initializing the hybrid expert network based on the determined first number of task-level expert groups and the second number of character-level experts within each task-level expert group, combined with a pre-configured task-level gating network and a character-level gating network.

[0113] In one implementation, the process of the hybrid expert network processing the input data includes: using a task-level gating network, determining the first prediction weight corresponding to each task-level expert group based on the second task feature vector corresponding to the input data; the input data is training data or the output data of the previous network layer of the hybrid expert network in a pre-trained large model; determining the target task-level expert group for processing the input data based on the first prediction weight and the first dynamic gating threshold corresponding to each task-level expert group; using the character-level gating network in the target task-level expert group, determining the second prediction weight corresponding to each character-level expert based on the second character feature vector corresponding to the input data; determining the target character-level expert for processing the input data based on the second prediction weight and the second dynamic gating threshold corresponding to each character-level expert; and processing the input data using the target character-level expert.

[0114] In one implementation, the first dynamic gating threshold is related to the network layer number of the task-level expert group and the task-level expert group itself; wherein, the first dynamic gating thresholds corresponding to different task-level expert groups in the same network layer are different, and the first dynamic gating thresholds corresponding to the same task-level expert group in different network layers are different; the second dynamic gating threshold is related to the network layer number of the character-level expert and the character-level expert itself; wherein, the second dynamic gating thresholds corresponding to different character-level experts in the same network layer are different, and the second dynamic gating thresholds corresponding to the same character-level expert in different network layers are different.

[0115] In one implementation, the large model fine-tuning device based on hybrid experts also includes: a quantization processing module, a test processing module, and a recording module.

[0116] The quantization module is used to quantize the trained large model with different precisions to obtain multiple quantized versions of the model; the testing module is used to test each quantized version of the model using test data to obtain the model accuracy corresponding to the quantized version; the recording module is used to record the model accuracy and the memory usage of the quantized version of the model.

[0117] In one implementation, the large model fine-tuning device based on hybrid experts also includes a screening module and a model inference module.

[0118] The filtering module is used to filter model quantization versions that meet the target conditions based on the remaining computing power resources of the node to be deployed, the maximum accuracy loss rate and maximum inference latency allowed by the business, as well as the memory usage, accuracy loss rate and inference latency of each model quantization version; the model inference module is used to select the target model quantization version with the highest accuracy from the filtered model quantization versions for inference.

[0119] In this embodiment, a hybrid expert network is initialized within a pre-trained large model. This hybrid expert network comprises a task-level gating network and multiple task-level expert groups. Each task-level expert group contains a character-level gating network and multiple character-level experts. The hybrid expert network is embedded into specific layers of the pre-trained large model, forming a two-layer hybrid expert network structure. This allows the pre-trained large model to simultaneously capture both global task features and local character features of the input data. The task-level gating network selects the corresponding expert group for the input data, ensuring that the model can perform targeted processing for different network management tasks. The character-level gating network further refines character-level feature processing within the expert group, adapting to local semantic differences in the input data. This two-layer hybrid expert network structure overcomes the shortcomings of current solutions that rely solely on single-dimensional features (such as only character-level features), leading to a lack of global information and enhancing the model's generalization ability in multi-task scenarios. This hybrid expert network is used in the pre-trained large model to process input data, achieving fine-grained capture and dynamic allocation of multi-task information. Specifically, training data and a first prompt word are input into a pre-trained large model. The first prompt word guides the pre-trained large model to output sample prediction results. Based on the true label results corresponding to the training data, the sample prediction results, and the target loss function, the loss result of the pre-trained large model is determined. Then, based on the loss result, the network parameters of specific layers of the pre-trained large model are fine-tuned to obtain the trained large model. The trained large model is a network management model applicable to multi-task scenarios. It is evident that this technical solution only fine-tunes the parameters of specific layers of the pre-trained large model (i.e., the layers embedded in the hybrid expert network), rather than updating all parameters, reducing the computational burden of model training and facilitating the rapid deployment of the large model in vertical fields. Furthermore, by sharing the pre-trained large model base through the hybrid expert network, different network management tasks can reuse common features. Compared to the solution of deploying a large model separately for each task scenario, this avoids knowledge fragmentation and redundant resource consumption, improving resource utilization. Therefore, the trained large model can support more targeted model inference processing of input data in multi-task scenarios in the network management field, meeting the application needs of multi-task scenarios in network management.

[0120] The large model fine-tuning device based on hybrid experts 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.

[0121] The large model fine-tuning device based on hybrid experts 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 it.

[0122] The large model fine-tuning device based on hybrid experts provided in this application embodiment can achieve… Figures 1 to 6 The various processes implemented in the method embodiments are not described in detail here to avoid repetition.

[0123] Based on the same technical concept, embodiments of this application also provide an electronic device for executing the above-described large model fine-tuning method based on hybrid experts. Figure 8 This is a schematic diagram of the structure of an electronic device to implement various embodiments of this application. The electronic device can vary significantly due to differences in configuration or performance, and may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840. The processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can call a computer program stored in the memory 830 and executable on the processor 810 to perform the following steps: Initialize the hybrid expert network of the pre-trained large model; the hybrid expert network includes a task-level gating network and multiple task-level expert groups, each task-level expert group includes a character-level gating network and multiple character-level experts; the hybrid expert network is used to embed specific layers of the pre-trained large model; input the training data and the first prompt word into the pre-trained large model, and guide the pre-trained large model to output sample prediction results through the first prompt word; determine the loss result of the pre-trained large model based on the true label results corresponding to the training data, the sample prediction results, and the target loss function; fine-tune the network parameters of specific layers of the pre-trained large model based on the loss result to obtain the trained large model; the trained large model is a network management model applied to multi-task scenarios.

[0124] In this embodiment, a hybrid expert network is initialized within a pre-trained large model. This hybrid expert network comprises a task-level gating network and multiple task-level expert groups. Each task-level expert group contains a character-level gating network and multiple character-level experts. The hybrid expert network is embedded into specific layers of the pre-trained large model, forming a two-layer hybrid expert network structure. This allows the pre-trained large model to simultaneously capture both global task features and local character features of the input data. The task-level gating network selects the corresponding expert group for the input data, ensuring that the model can perform targeted processing for different network management tasks. The character-level gating network further refines character-level feature processing within the expert group, adapting to local semantic differences in the input data. This two-layer hybrid expert network structure overcomes the shortcomings of current solutions that rely solely on single-dimensional features (such as only character-level features), leading to a lack of global information and enhancing the model's generalization ability in multi-task scenarios. This hybrid expert network is used in the pre-trained large model to process input data, achieving fine-grained capture and dynamic allocation of multi-task information. Specifically, training data and a first prompt word are input into a pre-trained large model. The first prompt word guides the pre-trained large model to output sample prediction results. Based on the true label results corresponding to the training data, the sample prediction results, and the target loss function, the loss result of the pre-trained large model is determined. Then, based on the loss result, the network parameters of specific layers of the pre-trained large model are fine-tuned to obtain the trained large model. The trained large model is a network management model applicable to multi-task scenarios. It is evident that this technical solution only fine-tunes the parameters of specific layers of the pre-trained large model (i.e., the layers embedded in the hybrid expert network), rather than updating all parameters, reducing the computational burden of model training and facilitating the rapid deployment of the large model in vertical fields. Furthermore, by sharing the pre-trained large model base through the hybrid expert network, different network management tasks can reuse common features. Compared to the solution of deploying a large model separately for each task scenario, this avoids knowledge fragmentation and redundant resource consumption, improving resource utilization. Therefore, the trained large model can support more targeted model inference processing of input data in multi-task scenarios in the network management field, meeting the application needs of multi-task scenarios in network management.

[0125] The specific execution steps can be found in the various steps of the above-described embodiment of the large model fine-tuning method based on hybrid experts, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.

[0126] It should be noted that the electronic devices in the embodiments of this application include: servers, terminals, or other devices besides terminals.

[0127] The above electronic device structure does not constitute a limitation on the electronic device. An electronic device may include more or fewer components than illustrated, or combine certain components, or arrange them differently. For example, an input unit may include a Graphics Processing Unit (GPU) and a microphone, and a display unit may use a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar display panels. User input units include at least one of a touch panel and other input devices. A touch panel is also called a touchscreen. Other input devices 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 elaborated further here.

[0128] Memory can be used to store software programs and various data. Memory can primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area can store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, memory can include volatile memory or non-volatile memory, or both. Non-volatile memory can 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 linked dynamic random access memory (Synchlink DRAM, SLDRAM), and direct memory bus RAM (DRRAM).

[0129] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly handles operations related to the operating system, user interface, and applications, while 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 the processor.

[0130] This application also provides a computer-readable storage medium for storing computer-executable instructions. When these computer-executable instructions are executed by a processor, they implement the various processes of the above-described embodiments of the large model fine-tuning method based on hybrid experts, and achieve the same technical effect. To avoid repetition, these will not be described again here.

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

[0132] This application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described embodiments of the large model fine-tuning method based on hybrid experts, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0133] 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 embodiment of the large model fine-tuning method based on hybrid experts, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

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

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

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

[0137] 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 method for fine-tuning large models based on hybrid experts, characterized in that, include: A hybrid expert network is initialized for a pre-trained large model; the hybrid expert network comprises a task-level gating network and multiple task-level expert groups, each task-level expert group comprising a character-level gating network and multiple character-level experts; the hybrid expert network is used to embed specific layers of the pre-trained large model; The training data and the first prompt word are input into the pre-trained large model, and the pre-trained large model is guided to output the sample prediction result by the first prompt word. Based on the true label results corresponding to the training data, the sample prediction results, and the target loss function, the loss result of the pre-trained large model is determined; Based on the loss result, the network parameters of a specific layer of the pre-trained large model are fine-tuned to obtain the trained large model; the trained large model is a network management model applied to multi-task scenarios.

2. The method according to claim 1, characterized in that, The initialization of the pre-trained large model's hybrid expert network includes: The training data is obtained, including sample data from multi-task scenarios; For each task scenario, a first task feature vector is determined for each task in the task scenario based on the sample data in the task scenario. Based on the first task feature vector of all tasks in all task scenarios, the first number of task-level expert groups is determined by K-means clustering combined with the elbow method. For each task-level expert group, determine the first character feature vector of each task contained within the task-level expert group; Based on the first character feature vector of all tasks within the task-level expert group, the second number of character-level experts is determined by K-means clustering combined with the elbow method. The hybrid expert network is initialized based on the determined first number of task-level expert groups and the second number of character-level experts within each task-level expert group, combined with the pre-configured task-level gating network and character-level gating network.

3. The method according to claim 1, characterized in that, The process by which the hybrid expert network processes the input data includes: Using the task-level gating network, the first prediction weight corresponding to each task-level expert group is determined based on the second task feature vector corresponding to the input data; the input data is the training data or the output data of the previous network layer of the hybrid expert network in the pre-trained large model. Based on the first prediction weight and the first dynamic gating threshold corresponding to each task-level expert group, the target task-level expert group for processing the input data is determined. Using the character-level gating network in the target task-level expert group, the second prediction weight corresponding to each character-level expert is determined based on the second character feature vector corresponding to the input data; Based on the second prediction weight and the second dynamic gating threshold corresponding to each character-level expert, a target character-level expert for processing the input data is determined; The input data is processed using the target character-level expert.

4. The method according to claim 3, characterized in that, The first dynamic gating threshold is related to the network layer number of the task-level expert group and the task-level expert group itself; wherein, the first dynamic gating thresholds corresponding to different task-level expert groups in the same network layer are different, and the first dynamic gating thresholds corresponding to the same task-level expert group in different network layers are different. The second dynamic gating threshold is related to the network layer number of the character-level expert and the character-level expert; wherein, the second dynamic gating thresholds corresponding to different character-level experts in the same network layer are different, and the second dynamic gating thresholds corresponding to the same character-level expert in different network layers are different.

5. The method according to claim 1, characterized in that, The method further includes: The trained large model is quantized with different precision to obtain multiple quantized versions of the model; For each quantized version of the model, the model of the quantized version is tested using test data to obtain the model accuracy corresponding to the quantized version of the model. Record the model accuracy and the memory usage corresponding to the quantized version of the model.

6. The method according to claim 5, characterized in that, The method further includes: Based on the remaining computing power resources of the nodes to be deployed, the maximum precision loss rate and maximum inference latency allowed by the business, as well as the memory usage, precision loss rate and inference latency corresponding to each model quantization version, the model quantization version that meets the target conditions is selected. Select the target model quantization version with the highest accuracy from the selected model quantization versions for inference.

7. A large model fine-tuning device based on hybrid experts, characterized in that, include: An initialization module is used to initialize the hybrid expert network of a pre-trained large model; the hybrid expert network includes a task-level gating network and multiple task-level expert groups, each task-level expert group includes a character-level gating network and multiple character-level experts; the hybrid expert network is used to embed specific layers of the pre-trained large model; The model processing module is used to input training data and the first prompt word into the pre-trained large model, and guide the pre-trained large model to output sample prediction results through the first prompt word; The determination module is used to determine the loss result of the pre-trained large model based on the true label results corresponding to the training data, the sample prediction results, and the target loss function; The model fine-tuning module is used to fine-tune the network parameters of a specific layer of the pre-trained large model based on the loss result, so as to obtain the trained large model; the trained large model is a network management model applied to multi-task scenarios.

8. An electronic device, characterized in that, include: processor; as well as A memory is configured to store computer-executable instructions configured to be executed by the processor to implement the large model fine-tuning method based on hybrid experts as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store computer-executable instructions, which, when executed by a processor, implement the large model fine-tuning method based on hybrid experts as described in any one of claims 1-6.

10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the large model fine-tuning method based on any one of claims 1-6.