A data processing method, apparatus and computing device

By executing parameter exchange and computation tasks in parallel within the MOE model, the problem of iterative computation latency caused by uneven resource utilization of the expert group is solved, achieving more efficient resource balancing and computational efficiency.

CN123140264APending Publication Date: 2026-11-20HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511373543.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-05-20
Filing Date
2025-09-23
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In the MOE model, uneven resource allocation among expert groups leads to increased iteration computation latency, and existing parameter exchange schemes further increase overall computation latency.

Method used

Parameter exchange and computation tasks are executed in parallel between different expert layers. Iterative computation latency is reduced by pipeline masking, and the differences in resource consumption are used to exchange expert module parameters to balance resource consumption.

Benefits of technology

It reduces the latency of overall iterative computation, improves computational efficiency and resource utilization balance, and avoids the impact of parameter exchange on computational tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123140264A_ABST
    Figure CN123140264A_ABST
Patent Text Reader

Abstract

The application relates to a data processing method and device and a computing device, the method comprising: performing multiple iteration calculations on input data through a mixed expert model, wherein one iteration calculation comprises: performing a first calculation task through a first expert layer of the mixed expert model. After the first calculation task is performed, a second calculation task is performed through a second expert layer of the mixed expert model. And in the process of performing the second calculation task through the second expert layer, the parameters of multiple expert modules in the first expert layer are exchanged. Since the expert modules in the first expert layer have performed the first calculation task when the parameters are exchanged, the parameter exchange does not affect the execution of the first calculation task. And the parameter exchange of the first expert layer is performed in parallel in the process of the second calculation task, so that the parameter exchange can also perform the calculation task at the same time, and the overall iteration calculation time delay can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese Patent Application No. 202510653391.5, filed on May 20, 2025, entitled "A Dynamic Expert Layout Algorithm and Device for Multi-Layer Flow Covering", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of artificial intelligence technology, and in particular to a data processing method, apparatus and computing device. Background Technology

[0003] A mixture of experts (MOE) model comprises multiple expert layers for performing computational tasks. The input of one expert layer is the output of the previous expert layer, and the output of that expert layer is the input of the next expert layer. Each expert layer consists of multiple expert modules, and these expert modules can be further divided into multiple expert groups (e.g., four expert modules form one expert group). Different expert groups are responsible for processing a portion of the input data or a specific type of computational task.

[0004] In the MOE model, each expert layer, when processing input data, selects and activates certain expert modules from some expert groups to perform corresponding computational tasks based on the input data. This can lead to some expert modules in certain expert groups being used frequently, while expert modules in other expert groups are used less frequently.

[0005] Currently, after all expert layers have completed one iteration of computation, the expert modules in each layer are grouped together based on their resource consumption. The groups with higher resource consumption exchange their module parameters, thus adjusting the arrangement of the expert modules and creating a rearranged expert layer for the next iteration. However, this parameter exchange takes time, which increases the overall latency of the iteration computation.

[0006] Therefore, reducing the latency of MOE model iterative calculations has become an urgent technical problem to be solved. Summary of the Invention

[0007] This application relates to a data processing method, apparatus, and device for reducing the latency of MOE model iterative calculation and improving the efficiency of MOE model iterative calculation.

[0008] Firstly, embodiments of this application provide a data processing method applicable to a data processing device. The data processing device deploys a hybrid expert model to perform computational tasks, enabling multiple iterative calculations to obtain the final computational result. The data processing device can be a user device, such as a smartphone, camera, tablet, or other terminal device. Alternatively, the data processing device can be a cloud server, application server, etc., for example, deploying an MOE model on a cloud server to process computational tasks. Furthermore, the method can also be executed by a component of the data processing device, such as a chip. Specifically, the method includes:

[0009] After acquiring input data, the data processing device performs multiple iterative calculations on the input data using a hybrid expert model to obtain the corresponding output data. One iteration of the multiple iterative calculations includes: the data processing device executing a first calculation task through the first expert layer of the hybrid expert model. After the first calculation task is completed, the data processing device then executes a second calculation task through the second expert layer of the hybrid expert model. Furthermore, during the execution of the second calculation task in the second expert layer, the data processing device exchanges parameters between multiple expert modules in the first expert layer.

[0010] In this implementation, since the first expert layer has already completed its first computation task when the expert modules exchange parameters, the parameter exchange does not affect the execution of the first computation task. Furthermore, the first and second expert layers are different, so the parameter exchange of the first expert layer also does not affect the computation task of the second expert layer. Therefore, the parameter exchange of the first expert layer is executed in parallel during the second computation task. Through pipeline masking between different expert layers, computation tasks can be executed simultaneously with parameter exchange, thus reducing the overall latency of iterative computation.

[0011] In one possible implementation, when the data processing device exchanges parameters among multiple expert modules in the first expert layer, it first determines the expert modules whose parameters need to be exchanged. That is, when the first expert layer executes the first computational task, if the resources occupied by the first expert group are greater than those occupied by the second expert group, and the resources occupied by the first expert module are greater than those occupied by the second expert module, then the data processing device exchanges the parameters of the first expert module of the first expert group and the second expert module of the second expert group to obtain a third expert group and a fourth expert group, thereby balancing the resource usage between the first and second expert groups. Specifically, the third expert group is obtained after exchanging parameters with the first expert group, and the fourth expert group is obtained after exchanging parameters with the second expert group. The first expert layer includes the first and second expert groups, and the third expert layer includes the third and fourth expert groups.

[0012] In this implementation, the expert modules that need parameter swapping are determined by comparing the resource consumption of different expert groups. By swapping the parameters of the first expert module with high resource consumption and the second expert module with low resource consumption, the resulting third and fourth expert groups will have more evenly distributed resource consumption in the next iteration, avoiding excessive differences in resource consumption. This improves the resource balance of expert groups in the first expert layer, thereby increasing computational efficiency.

[0013] In one possible implementation, after the data processing device completes the second computational task through the second expert layer, the current iterative computation further includes: during the parameter exchange between the first and second expert modules, the data processing device can also execute a third computational task through a fourth expert layer of a hybrid expert model. This fourth expert layer differs from both the second and first expert layers.

[0014] In this implementation, during the parameter exchange between the first and second expert modules, both the second and third computational tasks can be executed. In other words, the time period for parameter exchange between the first and second expert modules can overlap with the execution time periods of multiple computational tasks. Thus, if the execution of the second computational task is insufficient to mask the time required for parameter exchange when it takes a long time, the execution of the third computational task can compensate for this, further reducing the latency of iterative computation caused by parameter exchange.

[0015] In one possible implementation, when the data processing device performs the next iteration calculation using the MOE model, the third expert layer obtained after parameter exchange executes the fourth calculation task. Furthermore, after the fourth calculation task is completed, if the resources occupied by the third expert group meet the set conditions, the data processing device needs to exchange parameters between the expert modules of the third expert group. That is, when the third expert group executes the fourth calculation task, if the resources occupied by the third expert group are greater than those occupied by the fifth expert group within the third expert layer, and the resources occupied by the third expert module are greater than those occupied by the fourth expert module, then the data processing device will exchange parameters between the third expert module of the third expert group and the fourth expert module of the fifth expert group.

[0016] In this implementation, the third expert layer is obtained after parameter exchange, and the third expert group within the third expert layer is also obtained after parameter exchange. However, since the resource usage of expert modules changes dynamically based on the computational task, the expert module arrangement obtained after the previous parameter exchange (i.e., the expert module arrangement of the third expert layer) may not achieve the best balance in the next iteration. In other words, exchanging parameters between the first and second expert modules may not be the best solution. Therefore, in the next iteration, it can be determined whether to exchange parameters again for the expert modules of the third expert group based on whether the resources used by the third expert group meet the set conditions. This further improves the resource usage balance of each expert group in the third expert layer.

[0017] In one possible implementation, when the data processing device determines whether parameter exchange is needed again for the expert modules of the third expert group based on whether the resources occupied by the third expert group meet the set conditions, the specific conditions for the resources occupied by the third expert group to meet the set conditions include: when the third expert layer executes the fourth calculation task, the resources occupied by the third expert group are greater than a first threshold. The first threshold includes: the average value of the resources occupied by multiple expert groups in the third expert layer when the third expert layer executes the fourth calculation task.

[0018] In this implementation, the average resource usage of multiple expert groups within the third expert layer when performing the fourth computational task is used as a boundary to determine whether the third expert group obtained after parameter exchange has reached an ideal equilibrium state. Clarifying the specific conditions for this judgment improves the feasibility of this solution.

[0019] In one possible implementation, before exchanging parameters among multiple expert modules in the first expert layer, the data processing first determines n expert modules in the first expert layer that need parameter exchange based on the resources occupied by the first expert layer when executing the first computation task. These n expert modules include the first expert module and the second expert module. If the value of n is less than a set threshold, indicating that the time required for the data processing device to exchange parameters among the n expert modules is less than the set time length, then the parameters of the n expert modules are exchanged to obtain the third expert layer. The set time length includes the time from the first moment to the second moment, where the first moment includes the moment when the first expert layer completes the first computation task, and the second moment includes the moment before the third expert layer executes the fourth computation task.

[0020] In this implementation, the parameter exchange of the n expert modules in the first expert layer needs to be completed within a set time period. That is, the parameter exchange of the n expert modules in the first expert layer must be completed before the next iteration calculation of the third expert layer obtained from the parameter exchange in the first expert layer. Since the MOE model requires multiple iteration calculations, completing the parameter exchange of the first expert layer before the third expert layer obtained from the parameter exchange in the first expert layer avoids the situation where the parameter exchange of the first expert layer is not yet completed, thus preventing additional computational delays in the next iteration calculation.

[0021] In one possible implementation, before exchanging parameters between the first expert module and the second expert module, the data processing device determines the expert group requiring parameter exchange based on a second threshold and the expert module requiring parameter exchange based on a third threshold. Specifically, when the first expert layer executes the first computational task, the resources occupied by the first expert group are greater than the second threshold, while the resources occupied by the second expert group are less than the second threshold; the resources occupied by the first expert module are greater than the resources occupied by the second expert module. The second threshold includes the average resource usage of multiple expert groups within the first expert layer when the first expert layer executes the first computational task. Therefore, a third threshold indicates a significant difference in resource usage between the first and second expert groups, and a significant difference in resource usage between the first and second expert modules.

[0022] In this implementation, the purpose of parameter exchange among multiple expert modules in the first expert layer is to balance the resource consumption of each expert group within the first expert layer. Therefore, by using the average resource consumption of the multiple expert groups in the first expert layer when executing the first computation task as a boundary, it is possible to clearly determine which expert groups have excessively high resource consumption and which have relatively low resource consumption. Thus, for those expert groups whose resource consumption has already reached the average level, parameter exchange can be avoided, further reducing the time required for parameter exchange within the first expert layer.

[0023] In one possible implementation, when the first expert layer executes the first computational task, the resources occupied by the first expert module are positively correlated with the activation frequency of the first expert module, and the resources occupied by the second expert module are positively correlated with the activation frequency of the second expert module.

[0024] In this implementation, since the expert modules in the MOE model are selectively activated, frequent activation of an expert module indicates that it is always performing computational tasks, meaning that it will consume more resources. This clarifies the method for determining the resources consumed by the expert modules, thereby improving the feasibility of this solution.

[0025] Secondly, embodiments of this application provide a data processing apparatus, comprising: an acquisition module for acquiring input data; and a calculation module for performing multiple iterative calculations on the input data using a hybrid expert model to obtain output data corresponding to the input data. The calculation module further includes a first calculation module and a second calculation module. The first calculation module executes a first calculation task through a first expert layer of the hybrid expert model. The second calculation module executes a second calculation task through a second expert layer of the hybrid expert model after the first calculation task is completed. The first expert layer and the second expert layer are different. A parameter exchange module exchanges parameters of multiple expert modules in the first expert layer during the execution of the second calculation task in the second expert layer to obtain a third expert layer, which is used to execute the calculation task for the next iteration.

[0026] In one possible implementation, the parameter exchange module is specifically used for:

[0027] The parameters of the first expert module of the first expert group and the second expert module of the second expert group are exchanged to obtain the third expert group and the fourth expert group. The third expert group is obtained after exchanging parameters with the first expert group, and the fourth expert group is obtained after exchanging parameters with the second expert group. The first expert layer includes the first expert group and the second expert group, and the third expert layer includes the third expert group and the fourth expert group. When the first expert layer executes the first computing task, the resources used by the first expert group are greater than those used by the second expert group, and the resources used by the first expert module are greater than those used by the second expert module.

[0028] In one possible implementation, the computation module further includes a third computation module, which performs a third computation task through a fourth expert layer of a hybrid expert model during the parameter exchange process between the first expert module and the second expert module. The fourth expert layer is different from the second expert layer and different from the first expert layer.

[0029] In one possible implementation, the first calculation module is further configured to: execute the fourth calculation task through the third expert layer. The parameter exchange module is further configured to: after the fourth calculation task is completed, if the resources occupied by the third expert group meet the set conditions, exchange parameters between the third expert module of the third expert group and the fourth expert module of the fifth expert group, where the third expert layer includes the fifth expert group. Specifically, when the third expert layer executes the fourth calculation task, the resources occupied by the third expert group are greater than those occupied by the fifth expert group, and the resources occupied by the third expert module are greater than those occupied by the fourth expert module.

[0030] In one possible implementation, the resources used by the third expert group satisfy a set condition: when the third expert layer executes the fourth computational task, the resources used by the third expert group exceed a first threshold. The first threshold includes the average value of the resources used by multiple expert groups in the third expert layer when the third expert layer executes the fourth computational task.

[0031] In one possible implementation, the data processing device further includes: a determining module, configured to determine n expert modules in the first expert layer that require parameter exchange based on the resources occupied by the first expert layer when performing the first computation task, wherein the n expert modules include the first expert module and the second expert module. The parameter exchange module is further configured to: if the value of n is less than a set threshold, indicating that the time required for the n expert modules to exchange parameters is less than a set time length, then perform parameter exchange on the n expert modules to obtain a third expert layer. The set time length includes the time from a first moment to a second moment, where the first moment includes the moment when the first expert layer completes the first computation task, and the second moment includes the moment before the third expert layer performs the fourth computation task.

[0032] In one possible implementation, when the first expert layer executes the first computational task, the resources occupied by the first expert group are greater than a second threshold, while the resources occupied by the second expert group are less than the second threshold; the resources occupied by the first expert module are greater than the resources occupied by the second expert module. The second threshold includes the average resource occupied by multiple expert groups within the first expert layer when the first expert layer executes the first computational task.

[0033] In one possible implementation, when the first expert layer executes the first computational task, the resources occupied by the first expert module are positively correlated with the activation frequency of the first expert module, and the resources occupied by the second expert module are positively correlated with the activation frequency of the second expert module.

[0034] Thirdly, embodiments of this application also provide a data processing apparatus, which includes a memory and a processor. The memory stores code, and the processor is configured to execute the code. When the code is executed, the data processing apparatus performs the method as described in the first aspect or any implementation thereof.

[0035] Fourthly, embodiments of this application also provide a circuit system including a processing circuit configured to perform the method as described in the first aspect or any implementation thereof.

[0036] Fifthly, embodiments of this application also provide a computer storage medium storing one or more instructions, which, when executed by one or more computers, cause the one or more computers to perform the method described in the first aspect or any implementation thereof.

[0037] Sixthly, embodiments of this application also provide a computer program product that stores instructions that, when executed by a computer, cause the computer to perform the method described in the first aspect or any implementation thereof.

[0038] Understandably, the beneficial effects of the second, third, fourth, fifth, and sixth aspects mentioned above can all be referred to with reference to the beneficial effects corresponding to the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0039] Figure 1 A structural diagram illustrating the main framework of the artificial intelligence provided in this application;

[0040] Figure 2a A schematic diagram of the data processing system provided in this application;

[0041] Figure 2b Another schematic diagram of the data processing system provided in this application;

[0042] Figure 3 A schematic flowchart of a data processing method provided in an embodiment of this application;

[0043] Figure 4 A schematic diagram of a single iterative calculation provided in an embodiment of this application;

[0044] Figure 5 A schematic diagram illustrating the exchange of expert module parameters provided in an embodiment of this application;

[0045] Figure 6a A schematic diagram of programming logic provided for an embodiment of this application;

[0046] Figure 6b A schematic diagram of multiple iterative calculations provided in an embodiment of this application;

[0047] Figure 7 A schematic diagram of the structure of a data processing apparatus provided in an embodiment of this application;

[0048] Figure 8 A schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0049] Figure 9 This is a schematic diagram of a computing device cluster provided in an embodiment of this application;

[0050] Figure 10 This is a schematic diagram of another structure of the computing device cluster provided in an embodiment of this application. Detailed Implementation

[0051] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such terms are interchangeable where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0052] It should be understood that, in addition, the character " / " in this document generally indicates that the preceding and following objects are in an "or" relationship. The phrase "at least one of the following" or similar expressions in this document are used to indicate any combination of the listed items; for example, at least one of A, B, and / or C can represent the following six situations: A exists alone, B exists alone, C exists alone, A and B exist simultaneously, B and C exist simultaneously, A and C exist simultaneously, and A, B, and C exist simultaneously, where A, B, and C can be single or multiple. In the embodiments of this application, "instruction" can mean control, that is, one object controls another object to perform an action, and the controlled object must perform the action. Furthermore, "instruction" can also mean notification, that is, one object informs another object to perform an action, and the object informed to perform the action can choose to perform the action or not. In addition, "instruction" can be a direct instruction, such as one object directly issuing the instruction to another object; or it can be an indirect instruction, that is, one object issuing the instruction to another object through one or more intermediate objects. Furthermore, the meaning of "instruction" can also be interpreted based on the meaning expressed in the embodiments of this application, and is not limited here. The term "one or more" in the embodiments of this application can be understood as one or more, and vice versa. "One or more" can also mean "at least one".

[0053] First, the embodiments of this application involve some terms. In order to better understand the solutions of the embodiments of this application, the relevant terms and concepts that may be involved in the embodiments of this application will be introduced below.

[0054] The MOE (Modular Oriented Equation) model is a neural network architecture whose core idea is to decompose complex computational tasks into multiple sub-tasks, which are then processed separately by multiple expert sub-models. The outputs of these experts are then dynamically combined to obtain the final result. Based on a single inference request, the MOE model can perform multiple iterative calculations to obtain the corresponding output data. One iterative calculation of the MOE model can be understood as an input data set (e.g., a text sequence, an image sequence, etc.) undergoing a corresponding computational task, followed by the output data corresponding to that input data (e.g., new words corresponding to the text sequence).

[0055] However, in a single iteration of computation, each expert layer in the MOE model handles different computational tasks. Specifically, the input of one expert layer is the output of the previous expert layer, and the output of that expert layer becomes the input of the next expert layer. This hierarchical computation yields the output of one iteration of the MOE model. For example, the MOE model includes 58 expert layers, each with 256 expert modules. These 256 expert modules can be divided into 64 expert groups, and each expert group includes 4 expert modules.

[0056] For example, when expert layer 1 performs computation task 1 on the input data, it selectively activates a subset of expert modules within the expert group. That is, each activated expert module in expert layer 1 executes a different subtask of computation task 1. Each activated expert module is used to implement its specific subtask, or in other words, to process a specific type of data in the input data of expert layer 1. After each activated expert module completes its subtask, it outputs the result to the next expert layer, until all 58 expert layers have completed their computation tasks, obtaining the output data for the current iteration.

[0057] Understandably, each expert module in the MOE model is distinct, and all expert modules across all expert layers constitute a complete expert. An expert module can be understood as a sub-expert model (or a small neural network), each specializing in processing different parts or features of the input data. For example, when the input data is text, some expert modules are always activated to process the text data, while others remain inactive. Similarly, when the input data is image data, some expert modules are always activated to process the image data, while others remain inactive.

[0058] For example, the expert module can be any structure such as a feedforward neural network (FFN), a convolutional layer (CNN), or an attention mechanism (Transformer), depending on the task requirements. For instance, in a large language model, the expert might use a Transformer encoder to handle long-range dependencies. In a recommender system, the expert might use matrix factorization (MF) or a graph neural network (GNN) to handle user-item interactions.

[0059] In addition, the MOE model can also include gate units (or gated networks, gated network models, etc.). Gate units are used to segment the input data, selectively activate highly relevant expert modules according to a probability distribution, and distribute the segmented data to the activated expert modules for processing. For example, in one iteration of the MOE model, expert modules 1 and 2 in expert layer 1 are selectively activated according to a probability distribution. In expert layer 1, the parameters of expert module 1 and expert module 2 participate in the computational task of expert layer 1, while other expert modules are not activated and do not participate in the computational task.

[0060] For example, a gating unit is typically a lightweight neural network (such as a single-layer MLP), and the output of the gating unit is the activation probability (Softmax normalized) of each expert module. Based on the activation probabilities, the gating unit selects one or more expert modules with higher activation probabilities to activate in order to perform the corresponding computational task.

[0061] The preceding section described the architecture of the MOE model. To better illustrate the embodiments of this application, the background of the solution in this application will be explained in detail below based on the architecture of the MOE model:

[0062] Based on the architecture of the MOE model described above, each expert module excels at processing different parts or features of the input data. When processing data, each expert module in the MOE model selectively activates some expert modules to execute corresponding computational tasks based on a probability distribution. In other words, each expert layer in the MOE model, when processing input data, selects some expert groups from multiple expert groups deployed at that layer to execute the corresponding computational tasks. This can lead to a situation where expert modules in some expert groups are frequently used, while expert modules in other expert groups have lower utilization rates.

[0063] For example, when the MOE model processes a single inference request, it performs multiple iterative calculations. Alternatively, during these multiple iterations of inference requests, the expert module of expert group 1 in expert layer 1 is always activated. That is, when processing input data, expert layer 1 allocates more data to the expert modules in expert group 1, resulting in a higher activation frequency for expert group 1. Consequently, the expert module of expert group 2 in expert layer 1 is always inactive, meaning it receives less or no data. In this case, the activation frequency of expert group 1 will be much higher than that of expert group 2. A higher activation frequency means that expert group 1 consumes more resources, resulting in a higher load on the device node where expert group 1 resides. This leads to an imbalance in resource consumption between expert group 1 and expert group 2 in expert layer 1, and consequently, an imbalance in load among device nodes.

[0064] Furthermore, because expert group 1 needs to process more data, the processing time for expert group 1 will be significantly longer than that for expert group 2. The output data of expert layer 1 is obtained by weighted summation of the outputs from expert groups 1 and 2 through a gating unit. In other words, when the resources used by expert groups 1 and 2 in expert layer 1 are unbalanced, expert group 2 will finish processing first, while expert group 1 must wait for it to finish. This increases the processing time of expert layer 1, thereby increasing the latency of iterative calculations and affecting overall computational efficiency.

[0065] To address the aforementioned issue of uneven resource allocation, the existing solution, after each iteration of the MOE model, swaps the parameters of expert modules in expert layer 1 with those of expert groups that have high resource consumption, based on the activation frequency of each expert module in that iteration. For example, it swaps the parameters of expert module 1 (high resource consumption) in expert group 1 with expert module 2 (low resource consumption) in expert group 2. This adjusts the arrangement of expert modules, resulting in a rearranged expert layer, before executing the next iteration. This rearranged expert layer ensures a more balanced distribution of resources among the expert groups during the next iteration.

[0066] In the existing scheme described above, a separate time window is reserved after each iteration of the MOE model to adjust the arrangement of expert modules within the MOE model. Furthermore, to avoid the impact of expert module parameter exchanges on computational task execution, no other computational tasks are performed within this time window. Only after the expert module parameter exchanges are complete will the next iteration be performed based on the rearranged MOE model. However, the MOE model contains numerous expert modules, and the parameter exchanges of these modules require a certain amount of time. Reserving a separate time window significantly increases the overall latency of the iterative computation.

[0067] To address the technical problems of the aforementioned solutions, this application provides a data processing method to reduce the latency of overall iterative computation. This method can be applied to a data processing device that deploys a hybrid expert model. After acquiring input data, the data processing device performs multiple iterative computations on the input data using the hybrid expert model to obtain the corresponding output data. One iteration of the multiple iterative computations includes: the data processing device executing a first computation task through a first expert layer of the hybrid expert model. After the first computation task is completed, the data processing device executes a second computation task through a second expert layer of the hybrid expert model, where the first and second expert layers are different. Furthermore, during the execution of the second computation task in the second expert layer, the data processing device exchanges the parameters of multiple expert modules in the first expert layer to obtain a third expert layer, which is used to execute the computation task of the next iteration.

[0068] Since the first expert layer has already completed its first computation task when the first expert module and the second expert module exchange parameters, the parameter exchange does not affect the execution of the first computation task. Furthermore, the first and second expert layers are different, so the parameter exchange of the first expert layer does not affect the computation task of the second expert layer. Therefore, the parameter exchange of the first expert layer is executed in parallel during the second computation task. Through pipeline masking between different expert layers, computation tasks can be executed simultaneously with parameter exchange, reducing the overall latency of iterative computation. In other words, based on pipeline masking between different expert layers, it is not necessary to wait for all expert layers to complete their computation tasks before parameter exchange can occur, thereby reducing the overall latency of iterative computation.

[0069] Based on the above scheme, this application relates to the use of the MOE model, which can be applied to the main framework of artificial intelligence. Please see [link / reference]. Figure 1 , Figure 1 This is a structural diagram illustrating the main framework of artificial intelligence provided in this application. The framework is explained below from two dimensions: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it could be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. In this process, data undergoes a condensation process of "data—information—knowledge—wisdom." The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry, from the underlying infrastructure of human intelligence and information (provided and processed by technology) to the industrial ecosystem of the system.

[0070] (1) Infrastructure

[0071] Infrastructure provides computing power to support artificial intelligence systems, enabling communication with the external world and providing support through a basic platform. This communication occurs through sensors; computing power is provided by intelligent chips (hardware acceleration chips such as CPUs, NPUs, GPUs, ASICs, and FPGAs); and the basic platform includes distributed computing frameworks and related platform guarantees and support, which may include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to acquire data, and this data is provided to intelligent chips in the distributed computing system provided by the basic platform for computation.

[0072] (2) Data

[0073] The data at the next layer of infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data from traditional devices, including business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.

[0074] (3) Data processing

[0075] Data processing typically includes methods such as data training, machine learning, deep learning, search, reasoning, and decision-making. Among these, machine learning and deep learning can perform intelligent information modeling, extraction, preprocessing, and training on data, including symbolic and formalized data.

[0076] Reasoning refers to the process in which, in a computer or intelligent system, the machine thinks and solves problems by simulating human intelligent reasoning, based on reasoning control strategies and using formalized information. Typical functions include search and matching.

[0077] Decision-making refers to the process of making decisions based on intelligent information after reasoning, and it typically provides functions such as classification, sorting, and prediction.

[0078] (4) General ability

[0079] After the data processing mentioned above, the results of the data processing can be used to form some general capabilities, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0080] (5) Smart Products and Industry Applications

[0081] Intelligent products and industry applications refer to products and applications of artificial intelligence systems in various fields. They are the encapsulation of overall artificial intelligence solutions, productizing intelligent information decision-making and realizing practical applications. Their application areas mainly include: intelligent terminals, intelligent transportation, intelligent healthcare, autonomous driving, smart cities, etc.

[0082] Based on the above explanations of terminology and application background, the data processing method provided in this application can be applied to various scenarios, as illustrated below with several examples:

[0083] For example, the MOE model can be applied to the vLLM framework, a high-performance LLM inference framework applicable to scenarios requiring rapid response to a large number of inference requests, such as real-time content generation and API services. The MOE model can also be applied to the SGLang framework, a structured generative language framework based on large language models (LLMs) and visual language models (VLMs). It can be used in applications requiring the reuse of historical context, such as multi-turn dialogue systems.

[0084] For example, in dialogue systems or intelligent customer service applications, the data processing device can be a user device. Users input their queries (e.g., query text) into the dialogue system or intelligent customer service on the user device. These queries may involve multiple areas (such as product inquiries, technical faults, etc.). The MOE model in the user device can activate relevant expert modules to process query tasks based on user queries from different areas, outputting query results to the user. Specifically, by implementing the data processing method provided in this application embodiment, the user device performs multiple iterative calculations on the user query through the MOE model. After the first expert layer completes the first calculation task (e.g., a portion of the query task), during the parameter exchange process among multiple expert modules in the first expert layer, a second calculation task (e.g., another portion of the query task) is executed through the second expert layer. This reduces the latency of the iterative calculations, thereby reducing the output latency of the query results and improving the user experience.

[0085] For example, in autonomous driving applications, images captured by cameras in autonomous driving devices typically include multiple targets such as roads, pedestrians, and traffic signs. When processing these images, the MOE model can activate relevant expert modules based on different target categories to handle target recognition tasks, outputting recognition results to the user or to the autonomous driving device for further processing. Specifically, by implementing the data processing method provided in this application, the user equipment performs multiple iterative calculations on the images captured by the cameras of the autonomous driving device using the MOE model. After the first expert layer completes the first calculation task (e.g., a portion of the recognition task), during the parameter exchange process among multiple expert modules in the first expert layer, a second calculation task (e.g., another portion of the recognition task) is executed through the second expert layer. This reduces the latency of the iterative calculations, thereby reducing the output latency of the recognition results and improving the user experience.

[0086] It should be noted that the method provided in this application can also be applied to other application scenarios. The examples of various application scenarios of this application mentioned above are only for the convenience of understanding this solution and are not intended to limit this solution.

[0087] Figure 2a This is a schematic diagram of a data processing system provided in an embodiment of this application. The data processing system 20 includes a user device 201 and a data processing device 202. The user device 201 includes smart terminals such as a mobile phone used by the user and an onboard computer in a vehicle driven by the user. The user device 201 is the initiator of data processing requests. As the initiator of data processing requests, requests are typically initiated by the user through the user device 201 (e.g., the aforementioned user query request, target identification request, etc.).

[0088] The aforementioned data processing device 202 can be a cloud server, network server, application server, management server, or other device or server with data processing capabilities. The data processing device 202 receives data processing requests from smart terminals through an interactive interface, and then performs data processing through a storage device for storing the data and a processor for data processing, employing methods such as machine learning, deep learning, search, reasoning, and decision-making.

[0089] Understandably, the term "memory" in a data processing device can be a general term, including local storage and a database that stores historical data. The database can be located on the data processing device or on other network servers.

[0090] exist Figure 2a In the data processing system 20 shown, user equipment 201 can acquire relevant input data such as text or images input by the user, and then send a data processing request to data processing device 202, so that data processing device 202 executes the data processing request for the input data from user equipment 201, thereby obtaining output data for the input data (e.g., query results for user queries, or recognition results for input images).

[0091] In one example, in Figure 2a In this process, the data processing device 202 can execute the data processing method of the embodiments of this application.

[0092] In another example, user equipment 201 directly functions as a data processing device; that is, user equipment 201 itself can execute the data processing method of this application embodiment. This user equipment 201 can directly acquire input data from the user and process it directly by its own hardware to obtain output data for the input data and provide it to the user.

[0093] When a user triggers user device 201, user device 201 can acquire the user's input data. Then, user device 201 can perform a series of iterative calculations on the input data to obtain the corresponding output data (e.g., query results for the user's query, or recognition results for the input image). The specific process is similar to that of data processing device 202, and can be referred to the description above, so it will not be repeated here.

[0094] refer to Figure 2b , Figure 2b This is another schematic diagram of the data processing system provided in an embodiment of this application. For example... Figure 2b As shown, the data processing system 200 includes a training device 210, a database 220, an execution device 230, and a data storage system 240. The execution device 230 includes a computing module 231, and the computing module 231 can also deploy a machine learning model 232, such as an MOE model.

[0095] Optionally, the above Figure 2a When the user equipment 201 or data processing equipment 202 in the system is equipped with an MOE model, specifically it can be Figure 2b The execution device 230 is located within the execution device 230. The data storage system 240 can store the data to be processed by the execution device 230, such as user-input queries. The data storage system 240 can be integrated into the execution device 230 or located in the cloud or on other network servers.

[0096] Training device 210 can be used to train machine learning models (e.g., the aforementioned MOE model). Furthermore, the trained machine learning model 232 or the trained model parameter matrix can be sent to execution device 230, where a machine learning model is constructed to perform the corresponding computational tasks.

[0097] The execution device 230 is equipped with an I / O interface for data interaction with external devices (e.g., user devices, input / output devices, etc.). For example, the execution device 230 can process user-input queries and output the corresponding query results to a display device, enabling the display device to present the query results to the user. The execution device 230 can be located in a cloud server or in a user client.

[0098] The execution device 230 can access data, code, etc., in the data storage system 240, and can also store output data into the data storage system 240. The data storage system 240 can be located within the execution device 230, can be set up independently, or can be located in other network entities; there can be one or multiple such systems.

[0099] It is worth noting that Figure 2b This is merely an example of the data processing system provided in this application, and the positional relationships between the devices, components, modules, etc., shown in the figures do not constitute any limitation. For example, in Figure 2b In this context, the data storage system 240 is an external memory relative to the execution device 230. In other cases, the data storage system 240 may also be placed within the execution device 230.

[0100] The above describes the system architecture and application scenarios used in the embodiments of this application. The following will use data processing equipment (as described above) as an example. Figure 2a Taking the data processing device or user equipment in the document as the executing entity, this application provides a more detailed description of the specific implementation process of the data processing method provided in the embodiments. (See references.) Figure 3 , Figure 3 This is a schematic flowchart of a data processing method provided in an embodiment of this application.

[0101] like Figure 3 As shown, the data processing method provided in this application embodiment includes:

[0102] Step 301: Obtain input data.

[0103] For example, the data processing device acquires input data from the MOE model so that it can process the input data using the MOE model. The input data to the MOE model can be structured or unstructured data such as text data, voice data, or image data input by the user. For instance, when the data processing device is a user device, the user can directly input a query text on the user device, and the user device can use that query text as input data to the MOE model. Alternatively, the input data to the MOE model can also be data sent to the data processing device by other devices (e.g., external devices communicatively connected to the data processing device).

[0104] Understandably, the input data for the MOE model can also be data from other sources. For example, the input data for the MOE model can also include the output data of other neural network models deployed in the data processing device. This application does not limit the specific content or source of the input data; the above is merely an example for illustrative purposes.

[0105] Step 302: Perform multiple iterative calculations on the input data using the MOE model to obtain the output data corresponding to the input data.

[0106] For example, one iteration of the MOE model can be understood as an input data (e.g., a text sequence, an image sequence, etc.) undergoing a corresponding computational task through the MOE model, and then outputting partial output data (e.g., new words corresponding to the text sequence). Typically, for input data that requires data processing (or a data processing request), the data processing device performs multiple iterative computations on the input data using the MOE model to obtain the complete output data corresponding to the input data.

[0107] For example, let's take the input data of the MOE model as text sequence 1. (Reference) Figure 4 , Figure 4 This is a schematic diagram illustrating a single iterative calculation provided in an embodiment of this application. For example... Figure 4 The MOE model shown includes k expert layers, each containing different expert modules, forming a complete expert. Layer 1 is the first expert layer, layer 2 is the second, layer 3 is the third, and so on, with layer k being the kth expert layer. After layer 1 completes its computational task, its output data serves as the input for layer 2, and so on.

[0108] In the i-th iteration of the MOE model for text sequence 1, when i is 1, text sequence 1 is first processed by layer 1. Layer 1 performs computation task 1 on text sequence 1 (or its feature representation, vector representation, etc.) and outputs data (e.g., the output feature representation, output vector representation, etc. corresponding to text sequence 1) to layer 2. This continues until all k expert layers have completed their calculations, outputting the result of one iteration, i.e., a new token 1 corresponding to text sequence 1. Text sequence 1 and token 1 then serve as the input data for the next iteration (the (i+1)-th iteration), continuing the iterative calculation until the number of iterations reaches j, at which point text sequence 2 corresponding to text sequence 1 is output.

[0109] Understandably, input data can also be called input sequence, input feature representation, input vector representation, etc., and correspondingly, output data can also be called output sequence, output feature representation, output vector representation, etc. This application does not limit this.

[0110] Based on this, the specific process of one iteration of the MOE model's calculation of the input data is as follows:

[0111] Step 3021: Perform the first computational task through the first expert layer of the hybrid expert model.

[0112] For example, in one iteration of the hybrid expert model computation, the input data of the first expert layer (e.g., the aforementioned) Figure 4 The input data of layer 2 in the first expert layer is the output data of the expert layer preceding the first expert layer, or the input data of the first expert layer (e.g., the aforementioned...) Figure 4 The input data of layer 1 in the hybrid expert model is the output data of other neural network layers. The first computational task is performed by the first expert layer of the hybrid expert model. The first computational task can be understood as the computational task corresponding to the input data of the first expert layer (that is, the first computational task is used to process the input data of the first expert layer).

[0113] The first expert layer of the hybrid expert model comprises multiple different expert modules, which can be divided into different expert groups. In other words, the first expert layer includes multiple expert groups, and each expert group includes multiple expert modules.

[0114] Optionally, the first computation task includes multiple subtasks (e.g., one subtask processes a portion of the input data). In this way, the gating unit can calculate the probability distribution of each expert module in the first expert layer based on the input data, and selectively activate the expert modules with higher probabilities in the first expert layer to execute these subtasks respectively.

[0115] It's important to note that, from a hardware perspective, an expert group can be understood as an inference card. An inference card is the hardware execution unit when a MoE model is deployed on hardware, typically corresponding to a physical GPU or TPU accelerator card. Each inference card is responsible for running its assigned expert modules (e.g., one inference card deploys four expert modules), processing the portion of input data routed to these expert modules.

[0116] Understandably, the calculation content of the first calculation task performed by the first expert layer will be different based on different input data. This application does not limit the specific content of the first calculation task or input data.

[0117] Step 3022: Based on the resource size occupied by each expert module in the first expert layer, determine the n expert modules in the first expert layer that need to exchange parameters.

[0118] For example, when the data processing device exchanges parameters between multiple expert modules in the first expert layer, it first determines the n expert modules (including the aforementioned multiple expert modules) that need parameter exchange. Since the first expert layer performs computational tasks (e.g., the first computational task, or a computational task executed before the first computational task), the gating unit selectively activates some expert modules to perform computational tasks for each expert module in the first expert layer. Therefore, the expert groups in the first expert layer that need parameter exchange can be determined based on the resource size occupied by each expert group. For the expert groups that need parameter exchange, the n expert modules that need parameter exchange are determined based on the resource size occupied by each expert module.

[0119] The expert groups requiring parameter exchange include those with resource consumption exceeding a second threshold (hereinafter referred to as high-resource expert groups) and those with resource consumption below the second threshold (hereinafter referred to as low-resource expert groups). The second threshold is the average resource consumption of multiple expert groups (e.g., activated expert groups, or all expert groups) within the first expert layer when executing the first computational task. Therefore, for expert modules in the high-resource expert group, those with higher resource consumption require parameter exchange; similarly, for expert modules in the low-resource expert group, those with lower resource consumption require parameter exchange.

[0120] For example, taking one inference card corresponding to one expert group as an example, when the first expert layer executes the first computation task, if expert group 1 consumes more resources, the load on inference card 1 corresponding to expert group 1 will also be relatively high. Therefore, based on the load of each inference card corresponding to the first expert layer, inference cards with high load and low load are determined (this can be compared with the average load of each inference card corresponding to the first expert layer; a load greater than the average load is considered high, and a load less than the average load is considered low). Thus, inference cards with high load and inference cards with low load can be considered as inference cards that require parameter exchange; that is, inference cards with high load correspond to high-resource expert groups, and inference cards with low load correspond to low-resource expert groups.

[0121] Optionally, the resource consumption of each expert module in the first expert layer is represented by the activation frequency of each expert module. When the first expert layer executes computational tasks, a higher activation frequency of an expert module indicates that the module consumes more resources. In other words, the resources consumed by an expert module are positively correlated with its activation frequency. The activation frequency of an expert module can be understood as the number of times it is activated within a certain time period. In other words, the ratio of the number of times an expert module is activated within a certain time length to that time length is the activation frequency of the expert module.

[0122] Optionally, the resource size occupied by each expert module in the first expert layer is represented by the size of the data stream (or data volume) processed by each expert module. The data stream size of an expert module is positively correlated with the resource size occupied by the expert module. That is, when the first expert layer executes the first computation task, the larger the data stream allocated to the expert module, the more resources the expert module occupies. The data stream of each expert module in the first expert layer can be understood as the data stream allocated to each expert module when the gating unit segments and distributes the input data during the first expert layer's processing of input data.

[0123] Understandably, the resource size occupied by each expert module in the first expert layer can also be directly represented by the actual amount of computing resources used, such as the CPU or GPU computing resources consumed by the expert module when performing computing tasks. This application does not limit this.

[0124] It should be noted that the aforementioned example described how the expert modules requiring parameter exchange can be determined based on their activation frequency or data flow in the first expert layer. Therefore, when each expert layer in the MOE model performs its corresponding computational task, the data processing device can collect activation data and system resource usage in real time through profiling to identify the expert modules requiring parameter exchange. Profiling data collection can run in an independent computational flow, avoiding interference with the execution of computational tasks and thus maintaining overall system efficiency.

[0125] Step 3023: Exchange the parameters of the n expert modules in the first expert layer.

[0126] In step 3022 above, n expert modules in the first expert layer that need parameter exchange were identified. Therefore, the data processing device can exchange the parameters of these n expert modules (n is a natural number greater than or equal to 1). The following example illustrates this by showing parameter exchange between the first and second expert modules out of the n expert modules:

[0127] In one possible implementation, when the first expert layer executes the first computational task, if the resources occupied by the first expert group are greater than those occupied by the second expert group, and the resources occupied by the first expert module are greater than those occupied by the second expert module, then the data processing device exchanges parameters between the first expert module of the first expert group and the second expert module of the second expert group. Furthermore, after the parameter exchange, the first expert layer (which includes the first and second expert groups) is transformed into a third expert layer. This third expert layer includes a third expert group and a fourth expert group, where the third expert group is obtained after the parameter exchange with the first expert group, and the fourth expert group is obtained after the parameter exchange with the second expert group.

[0128] Therefore, since the purpose of exchanging parameters among multiple expert modules in the first expert layer is to balance the resource consumption of each expert group in the first expert layer, the average resource consumption of all expert groups in the first expert layer when the first expert layer executes the first computation task can be used as a boundary to clearly determine which expert groups have excessive resource consumption and which expert groups have low resource consumption.

[0129] In other words, in another possible implementation, when the first expert layer executes the first computational task, the resources occupied by the first expert group are greater than a second threshold, while the resources occupied by the second expert group are less than the second threshold (in this case, the resources occupied by the first expert group must be greater than the resources occupied by the second expert group). However, if the resources occupied by the first expert module are greater than the resources occupied by the second expert module, the data processing device will exchange parameters between the first expert module in the first expert group and the second expert module in the second expert group. The second threshold includes the average resource occupied by multiple expert groups within the first expert layer when the first expert layer executes the first computational task.

[0130] refer to Figure 5 , Figure 5 This is a schematic diagram illustrating the parameter exchange of the expert module provided in an embodiment of this application. For example... Figure 5 As shown, when layer 1 performs computational tasks, rank 1 before parameter swapping includes four expert modules: (ep0, ep1, ep2, ep3), and rank 2 before parameter swapping includes four expert modules: (ep4, ep5, ep6, ep7). Among these, ep2 and ep3 in rank 1 consume relatively high resources, and the resource consumption of rank 1 exceeds the second threshold (i.e., the resource consumption of rank 1 is higher than the average resource consumption of multiple ranks in the first expert layer). Therefore, rank 1 is considered a high-load expert group. Rank 2, on the other hand, consumes less resources than the second threshold, with each expert module in rank 2 consuming relatively low resources.

[0131] Therefore, we can swap the parameters of the expert modules in rank1 and rank2. Specifically, we swap the parameters of ep3 in rank1 and ep4 in rank2 to obtain the parameter-swapped layer1. Furthermore, the parameter-swapped layer1 includes the parameter-swapped rank1 (including ep4) and the parameter-swapped rank2 (including ep3). At this point, the parameter-swapped rank1 is (ep0, ep1, ep2, ep4), and the parameter-swapped rank2 is (ep3, ep5, ep6, ep7).

[0132] The preceding section described the implementation method for identifying the expert groups and modules that require parameter exchange. Once these groups and modules are determined, the rearrangement budget of the expert modules can be used to further determine whether parameter exchange is feasible to avoid impacting the computational task. The following section continues this explanation:

[0133] In one example, based on the n expert modules that need to exchange parameters in the first expert layer, if the value of n is less than a set threshold, it means that the time required for the data processing device to exchange parameters among the n expert modules is less than the set time. Therefore, the parameters of the n expert modules can be exchanged to obtain the third expert layer, which is used to execute the computation task of the next iteration.

[0134] If the value of n is greater than a set threshold, it means that the time required for the data processing device to exchange parameters among the n expert modules exceeds the set time. Therefore, to avoid a situation where the first expert layer needs to perform its calculation task in the next iteration before its parameter exchange is complete, the parameter exchange among the n expert modules is not performed initially, but waited until the next iteration. This reduces the peak pressure of parameter exchange among a large number of expert modules in a single iteration to a gradual optimization process over multiple iterations, preventing severe system instability.

[0135] The set time length includes the time length from the first moment to the second moment. The first moment includes the moment when the first expert layer finishes executing the first calculation task, and the second moment includes the moment before the third expert layer executes the fourth calculation task.

[0136] In other words, the parameter exchange for the n expert modules in the first expert layer needs to be completed within a set time period (i.e., the time period between the first and second time points). That is, the parameter exchange for the n expert modules in the first expert layer needs to be completed before the next iteration of the calculation in the third expert layer obtained from the parameter exchange in the first expert layer. Since the MOE model requires multiple iterations, completing the parameter exchange of the first expert layer before the third expert layer is obtained avoids the situation where the parameter exchange of the first expert layer is not yet complete, thus preventing additional computational delays in the next iteration.

[0137] Specifically, the parameter exchange for the n expert modules in the first expert layer needs to be completed within a set time period. This can be understood as the time period for exchanging parameters for the n expert modules in the first expert layer coinciding with any time period within the set time period.

[0138] Optionally, the threshold setting refers to the maximum number of expert modules in the current expert layer that can perform parameter exchange. The threshold setting can be determined based on the difference between the total number of expert modules and the number of expert modules that have already performed parameter exchange. Here, the total number refers to the number of expert modules capable of performing parameter exchange across all expert layers in the current iteration, and the number of expert modules that have already performed parameter exchange refers to the number of expert modules that have performed parameter exchange in the expert layers preceding the current expert layer.

[0139] For example, refer to Figure 6a , Figure 6a This is a schematic diagram of programming logic provided for an embodiment of this application. It takes an example where one expert group corresponds to one rank.

[0140] In each iteration, the total number of expert modules that need to exchange parameters across all expert layers is N (i.e., the change budget). Input: Expert activation count D t Currently, experts have placed P t-1 And change the budget N. The output is the placement of the new expert P. t The expert activation count represents the number of expert modules activated in the current expert layer l while performing computational tasks. The current expert placement P... t This refers to the deployment of expert modules in the current expert layer l. New experts are placed in P. t This refers to the new deployment of expert modules after the current expert layer l performs parameter exchanges among n expert modules. The constraints include the current expert placement P. t-1 Perform parameter exchange to obtain the new expert placement P t The number of expert modules requiring modification (e.g., the aforementioned n expert modules). The objective goal includes minimizing the rank (i.e., D) of the maximum load in each expert layer. t (Highest rank).

[0141] In an MOE model comprising L expert layers, the l-th expert layer contains experts whose values ​​are greater than or equal to 1 and less than or equal to L. If N remain If the value is greater than 0 and the expert layer l is optimizable, then based on the Goal, generate a new expert placement P for expert layer l. new (with P) t Similarly), where N remain This refers to the remaining change budget (i.e., the aforementioned threshold). Then, predict the placement of new experts (P). new The load of each rank in the expert layer l is used to determine the placement of a new expert in P. new Can the load balancing be improved in the next iteration? If the load can be reduced in the next iteration, then the expert layer l is considered optimizable and the new expert P is placed. newThe optimization scheme is feasible. Place the current expert in expert layer l into P. t Updated to new expert placement P new And, N remain Updated to N remain The difference between the number of expert modules changed and the number of expert modules changed in expert layer l.

[0142] Understandably, the load of a rank can be predicted using a load prediction model (i.e., ...). Figure 2b The machine learning model shown may also include a load prediction model (which can be trained by a training device) for prediction, and this application does not limit this.

[0143] refer to Figure 6b , Figure 6b This is a schematic diagram of multiple iterative calculations provided in an embodiment of this application.

[0144] For example, such as Figure 6b As shown, when the first expert level is as follows Figure 6b In layer 1, parameter exchange for the n expert modules in layer 1 needs to be completed within T1. That is, the first time step includes the moment when layer 1 finishes the first calculation task in the i-th iteration calculation, and the second time step includes the moment before layer 1 (i.e., the third expert layer) after parameter exchange in the (i+1)-th iteration calculation starts to execute the fourth calculation task.

[0145] When the first expert level is as follows Figure 6b In layer 2, parameter exchange for the n expert modules within layer 2 needs to be completed within T2. ​​That is, the first time step includes the moment when layer 2 finishes the first computation task in the i-th iteration, and the second time step includes the moment before layer 2 (i.e., the third expert layer) after parameter exchange in the (i+1)-th iteration executes the fourth computation task.

[0146] Step 3024: Perform the second computational task through the second expert layer of the hybrid expert model.

[0147] For example, during the execution of step 3023 described above, the second computational task is performed through the second expert layer of the hybrid expert model. Alternatively, during the execution of the second computational task in the second expert layer, parameters of multiple expert modules in the first expert layer are exchanged. The second computational task can be understood as the computational task corresponding to the input data of the second expert layer (i.e., the second computational task is used to process the input data of the second expert layer).

[0148] Since the first expert layer has already completed its first computational task when parameters are exchanged among multiple expert modules (e.g., the first expert module and the second expert module), the parameter exchange does not affect the execution of the first computational task. However, the first and second expert layers are different, so parameter exchange in the first expert layer does not affect the computational task of the second expert layer. Therefore, by executing parameter exchange in the first expert layer in parallel during the second computational task, pipeline masking between different expert layers allows computational tasks to be executed simultaneously with parameter exchange, reducing the overall latency of iterative computation.

[0149] Optionally, in the current iterative computation, the second expert layer can be an expert layer following the first expert layer. That is, the first expert layer is the i-th expert layer among the K expert layers of the MOE model, and the second expert layer is the j-th expert layer among the K expert layers of the MOE model, where j is greater than i and less than or equal to K. In the current iterative computation, after the first expert layer completes the first computation task, the second expert layer continues to execute the second computation task to obtain the output result of the current iterative computation, which serves as the input for the next iterative computation.

[0150] For example, such as Figure 6b As shown, when the first expert level is as follows Figure 6b If layer 1 is defined in the first layer, then the second expert layer can be defined as follows: Figure 6b This refers to any expert layer in layer 2, layer 3...layerk. In other words, any expert layer in layer 2, layer 3...layerk can perform parameter exchange of the expert modules in layer 1 when executing computational tasks. When the first expert layer is... Figure 6b In layer 2, the second expert layer can be as follows: Figure 6b This refers to any expert layer in layer 3 through layer k. In other words, any expert layer in layer 3 through layer k can perform parameter exchanges with the expert modules in layer 2 when executing computational tasks.

[0151] Optionally, in the next iteration, the second expert layer can be an expert layer preceding the first expert layer. That is, the first expert layer is the i-th expert layer among the K expert layers of the MOE model, and the second expert layer is the j-th expert layer among the K expert layers of the MOE model, where j is greater than 0 and less than i. In the current iteration, after the first expert layer completes its first computational task, the other expert layers following it continue to perform computational tasks to obtain the output of the current iteration, which serves as the input for the next iteration. In the next iteration, the second expert layer performs a second computational task, and after the second computational task is completed, the third expert layer (i.e., the first expert layer after parameter swapping) continues to perform other computational tasks different from the first computational task.

[0152] For example, such as Figure 6b As shown, when the first expert level is as follows Figure 6b If layer 1 is calculated in the i-th iteration, then the second expert layer can be as follows: Figure 6b In the (i+1)th iteration, any expert layer among layer2, layer3...layerk is calculated. When the first expert layer is... Figure 6b In the i-th iteration calculation of layer 2, the second expert layer can be as follows: Figure 6b In the (i+1)th iteration, any expert layer in layer3...layerk is calculated.

[0153] In other words, such as Figure 6b As shown, in the i-th iteration calculation, when layer2 (i.e., the first expert layer) performs parameter exchange, it can execute the calculation tasks of (layer3... to layerk) in parallel, or in the i+1-th iteration calculation, it can execute the calculation tasks of layer1 (or layer1 after parameter exchange) in parallel.

[0154] In one possible implementation, after the data processing device completes the second computational task through the second expert layer, the current iterative computation further includes: during the parameter exchange process between the first and second expert modules, the data processing device can also execute a third computational task through a fourth expert layer of a hybrid expert model. The fourth expert layer differs from both the second and first expert layers.

[0155] In other words, during the parameter exchange between the first and second expert modules, both the second and third computational tasks can be executed. The time period for parameter exchange between the first and second expert modules can overlap with the execution time periods of multiple computational tasks. Thus, if the execution of the second computational task is insufficient to mask the time required for parameter exchange when it takes a long time, the execution of the third computational task can compensate for this, further reducing the latency of iterative computation caused by parameter exchange.

[0156] Understandably, in the current iteration, the fourth expert layer can be the expert layer following the first expert layer; in the next iteration, the fourth expert layer can be the expert layer preceding the third expert layer obtained after parameter swapping. For example, ... Figure 6b As shown, in the i-th iteration, when layer2 performs parameter swapping, the fourth expert layer can be layer3...up to layerk. In the (i+1)-th iteration, the fourth expert layer can also be layer1. Refer to the description of the second expert layer above for details; it will not be repeated here.

[0157] It should be noted that steps 3023 and 3024 are executed in parallel. "Parallel processing" or "parallel execution" means that data processing is performed in batches or stages at independent and asynchronous speeds. These batches or stages of data processing can completely or partially overlap in time. For example, the execution of parameter exchange in the expert module of expert layer 1 may not have finished while the execution of the computation task in expert layer 2 has already begun. Thus, the parameter exchange in the expert module of expert layer 1 and the computation task in expert layer 2 are executed in parallel. It should be understood that parallel processing is not limited to what is listed herein; any data processing of a neural network model that can be understood by those skilled in the art is within the scope of parallel processing defined in the embodiments of this disclosure.

[0158] Understandably, the relevant description of the second computation task can refer to the detailed description of the first computation task in step 301 above, and the specific process of parameter exchange of the second expert layer can also refer to the detailed description of parameter exchange of the first expert layer in steps 302 and 303 above, which will not be repeated here.

[0159] Step 3025: In the next iteration of the calculation, the fourth calculation task is executed through the third expert layer.

[0160] For example, when the data processing device performs the next iteration calculation using the MOE model, the data processing device performs the fourth calculation task using the third expert layer obtained after parameter exchange. The third expert layer is obtained after parameter exchange, and the third expert group within the third expert layer is also obtained after parameter exchange.

[0161] However, since the resource consumption of expert modules changes dynamically based on the computational tasks, the expert modules that need parameter exchange are determined based on the resource consumption during previous computational tasks. That is, the new expert module arrangement obtained after parameter exchange (i.e., the arrangement of expert modules in the third expert layer) may not achieve the best balance in the next iteration. Therefore, in the next iteration, the parameters of the third expert layer can be exchanged again based on the resources consumed by the third expert layer when executing the fourth computational task.

[0162] In one possible implementation, if the resources used by the third expert group meet a set condition when the third expert group performs the fourth calculation task, the data processing device needs to exchange parameters between the expert modules of the third expert group. If, when the third expert group performs the fourth calculation task, the resources used by the third expert group are greater than those used by the fifth expert group within the third expert group, and the resources used by the third expert module are greater than those used by the fourth expert module, then the data processing device will exchange parameters between the third expert module of the third expert group and the fourth expert module of the fifth expert group.

[0163] Optionally, the resource usage of the third expert group meeting the set conditions specifically includes: when the third expert layer performs the fourth calculation task, the resources used by the third expert group are greater than a first threshold. The first threshold includes: the average value of the resources used by multiple expert groups in the third expert layer when the third expert layer performs the fourth calculation task. The fifth expert group's resources are less than the first threshold.

[0164] In other words, when the resources used by the third expert group exceed the first threshold, it indicates that the resources used by the third expert group are still relatively high (compared to the average) when performing the fourth computation task. Correspondingly, the resources used by the fifth expert group can be less than the first threshold. That is, after the third expert group performs the fourth computation task, the parameters of the expert modules of the third expert group in the third expert layer can be exchanged with those of the fifth expert group with lower resource usage to obtain a new expert layer (i.e., the expert layer obtained after the parameter exchange of the third expert layer).

[0165] For example, the third expert layer, taking layer 1 after parameter swapping, is as follows: Figure 6bAs shown, layer1 undergoes parameter swapping in the i-th iteration to obtain the parameter-swapped layer1. The parameter-swapped layer1 then executes the fourth computation task in the (i+1)-th iteration. If, when the parameter-swapped layer1 executes the fourth computation task, the resources occupied by the parameter-swapped rank1 are still greater than the first threshold, it indicates that the parameter-swapped rank1 has not yet reached an ideal resource balance. In this case, in the (i+1)-th iteration, parameter swapping can continue to be performed on the expert modules within the parameter-swapped rank1.

[0166] Understandably, the parameter exchange of the expert modules in the third expert layer is similar to steps 3022 and 3023 mentioned above. For details on the parameter exchange of the expert modules in the first expert layer in steps 3022 and 3023, please refer to the specific explanations in steps 3022 and 3023. These details will not be repeated here.

[0167] It should be noted that in the i-th iteration, parameters are exchanged for the l-th expert layer. In the (i+1)-th iteration, the same parameter exchange is performed on the l-th expert layer, and so on. Therefore, if in the j-th iteration (where j is greater than i), the resource allocation among the expert groups in the l-th expert layer is relatively balanced (e.g., the resources used by each expert group are very similar), then the deployment of the expert modules in the l-th expert layer is converged to a relatively balanced expert deployment mode. That is, in the j-th iteration, no further parameter exchange is performed on the l-th expert layer.

[0168] Based on steps 301 to 302 above, it should be noted that steps 3022, 3023, 3024, or 3025 in step 302 are all optional steps. For example, in one instance, step 3022 or 3023 is not executed for a certain expert layer during one iteration of the calculation. For example, step 3025 is not executed during the final iteration of the calculation, meaning that the next iteration will not be performed.

[0169] The preceding steps 301 to 302 describe the data processing method provided in the embodiments of this application. The following describes the apparatus and device that can be used to perform the data processing method.

[0170] Please see Figure 7 , Figure 7 This is a schematic diagram of a data processing apparatus provided in an embodiment of this application. Figure 7 As shown, the data processing device 700 includes an acquisition module 701, a calculation module 702, and a parameter exchange module 703. The calculation module 702 further includes a first calculation module 7021 and a second calculation module 7022.

[0171] The acquisition module 701 is used to acquire input data. The calculation module 702 is used to perform multiple iterative calculations on the input data using a hybrid expert model to obtain the output data corresponding to the input data.

[0172] The first computation module 7021 is used to perform a first computation task through a first expert layer of a hybrid expert model.

[0173] The second calculation module 7022 is used to execute the second calculation task through the second expert layer of the hybrid expert model after the first calculation task is completed. The first expert layer is different from the second expert layer.

[0174] The parameter exchange module 703 is used to exchange the parameters of multiple expert modules in the first expert layer during the execution of the second calculation task in the second expert layer, so as to obtain the third expert layer. The third expert layer is used to execute the calculation task of the next iteration.

[0175] Optionally, the calculation module 702 further includes a third calculation module 7023, which is used to perform a third calculation task through a fourth expert layer of a hybrid expert model during the parameter exchange process between the first expert module and the second expert module. The fourth expert layer is different from the second expert layer and different from the first expert layer.

[0176] The acquisition module 701, calculation module 702, and parameter exchange module 703 can all be implemented in software or hardware. For example, the implementation of the calculation module 702 will be described below. Similarly, the implementation of the acquisition module 701 and the parameter exchange module 703 can be referenced from the implementation of the calculation module 702.

[0177] As an example of a software functional unit, computing module 702 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the aforementioned computing instance may be one or more. For example, computing module 702 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0178] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0179] As an example of a hardware functional unit, the computing module 702 may include at least one computing device, such as a terminal. Alternatively, the computing module 702 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.

[0180] The computing module 702 includes multiple computing devices that can be distributed within the same region or in different regions. Similarly, the computing devices in the computing module 702 can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, the computing devices in the computing module 702 can be distributed within the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0181] Please see Figure 8 , Figure 8 This is a schematic diagram of a computing device provided in an embodiment of this application. The computing device 800 includes a processor 801, a communication interface 802, a bus 803, and a memory 804. The processor 801, the communication interface 802, and the memory 804 communicate with each other via the bus 803. In practical applications, communication can also be achieved through other means such as wireless transmission; the specific method is not limited here.

[0182] The computing device 800 can be a server or a terminal device; for example, the computing device 800 can be one of the aforementioned... Figure 2b The execution device in the process can also be the aforementioned Figure 2aThe user equipment or data processing equipment in the computing device 800. It should be understood that this application does not limit the number of processors and memories in the computing device 800.

[0183] Processor 801 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0184] The communication interface 802 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 800 and other devices or communication networks.

[0185] The 803 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 8 The bus 803 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 803 may include a path for transmitting information between various components of the computing device 800 (e.g., memory 804, processor 801, communication interface 802).

[0186] Memory 804 may include volatile memory, such as random access memory (RAM). Memory 804 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0187] The memory 804 stores executable program code, which the processor 801 executes to implement the functions of the aforementioned acquisition module 701, calculation module 702, and parameter exchange module 703, thereby realizing the data processing method. In other words, the memory 804 stores instructions for executing the data processing method.

[0188] This application also provides a computing device cluster, which includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some optional embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0189] Please see Figure 9 and Figure 10 , Figure 9 and Figure 10 These are all schematic diagrams of the computing device clusters provided in the embodiments of this application.

[0190] like Figure 9 As shown, the computing device cluster includes at least one computing device 800. The memory 804 of one or more computing devices 800 in the computing device cluster may store the same instructions for executing the data processing method provided in the embodiments of this application.

[0191] In some possible implementations, the memories 804 of one or more computing devices 800 in the computing device cluster may also each store a portion of the instructions for executing the data processing method. In other words, the combination of the memories 804 of one or more computing devices can jointly execute the instructions for executing the data processing method.

[0192] It should be noted that the memory 804 in different computing devices 800 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the data processing device. That is, the instructions stored in the memory 804 of different computing devices 800 can implement the functions of one or more units in the acquisition module 701, the computing module 702, and the parameter exchange module 703.

[0193] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 10 One possible implementation is shown. For example... Figure 10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this possible implementation, the memory 804 in computing device 800A stores instructions for executing the functions of the acquisition module 701 and the computing module 702. Simultaneously, the memory 804 in computing device 800B stores instructions for executing the functions of the parameter exchange module 703.

[0194] It should be understood that Figure 10The functions of the computing device 800A shown can also be performed by multiple computing devices 800. Similarly, the functions of the computing device 800B can also be performed by multiple computing devices 800.

[0195] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computer device, it causes the at least one computer device to perform the above-described data processing method.

[0196] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform the aforementioned data processing method.

[0197] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0198] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A data processing method, characterized in that, The method includes: Get the input data; The input data is iteratively calculated multiple times using a hybrid expert model to obtain the output data corresponding to the input data. Wherein, one iteration of the multiple iterations includes: The first computational task is performed through the first expert layer of the hybrid expert model; After the first computation task is completed, the second computation task is executed through the second expert layer of the hybrid expert model, wherein the first expert layer is different from the second expert layer. During the execution of the second computation task in the second expert layer, the parameters of multiple expert modules in the first expert layer are exchanged to obtain a third expert layer, which is used to execute the computation task of the next iteration.

2. The method according to claim 1, characterized in that, The step of exchanging parameters among multiple expert modules in the first expert layer to obtain the third expert layer includes: The parameters of the first expert module of the first expert group and the second expert module of the second expert group are exchanged to obtain the third expert group and the fourth expert group. The third expert group is obtained after exchanging the parameters of the first expert group, and the fourth expert group is obtained after exchanging the parameters of the second expert group. The first expert layer includes the first expert group and the second expert group, and the third expert layer includes the third expert group and the fourth expert group. When the first expert layer executes the first computing task, the resources occupied by the first expert group are greater than those occupied by the second expert group, and the resources occupied by the first expert module are greater than those occupied by the second expert module.

3. The method according to claim 1 or 2, characterized in that, After the second computation task is completed, the current iteration computation also includes: During the parameter exchange process between the first expert module and the second expert module, the third computation task is performed through the fourth expert layer of the hybrid expert model. The fourth expert layer is different from the second expert layer and different from the first expert layer.

4. The method according to claim 2, characterized in that, The next iteration includes: The fourth computational task is performed through the third expert layer; After the fourth calculation task is completed, if the resources occupied by the third expert group meet the set conditions, the parameters of the third expert module of the third expert group and the fourth expert module of the fifth expert group will be exchanged. The third expert layer includes the fifth expert group. When the third expert layer executes the fourth computing task, the resources occupied by the third expert group are greater than those occupied by the fifth expert group, and the resources occupied by the third expert module are greater than those occupied by the fourth expert module.

5. The method according to claim 4, characterized in that, The resources occupied by the third expert group meet the set conditions, including: when the third expert layer executes the fourth computing task, the resources occupied by the third expert group are greater than the first threshold. The first threshold includes: the average value of the resources occupied by multiple expert groups in the third expert layer when the third expert layer performs the fourth computing task.

6. The method according to any one of claims 1 to 5, characterized in that, Before exchanging the parameters of the multiple expert modules in the first expert layer, the method further includes: Based on the resources occupied by the first expert layer when executing the first computing task, n expert modules in the first expert layer that need to exchange parameters are determined, and the n expert modules include the first expert module and the second expert module; The exchange of parameters among multiple expert modules in the first expert layer includes: If the value of n is less than a set threshold, it means that the time required for the n expert modules to exchange parameters is less than the set time. Then, the parameters of the n expert modules are exchanged to obtain the third expert layer. The set time length includes the time length of the time period between the first moment and the second moment. The first moment includes the moment when the first expert layer finishes executing the first calculation task, and the second moment includes the moment before the third expert layer executes the fourth calculation task.

7. The method according to any one of claims 1 to 6, characterized in that, When the first expert layer executes the first calculation task, the resources occupied by the first expert group are greater than the second threshold, and the resources occupied by the second expert group are less than the second threshold. The resources used by the first expert module are greater than those used by the second expert module; The second threshold includes the average value of the resources occupied by multiple expert groups in the first expert layer when the first expert layer performs the first calculation task.

8. The method according to any one of claims 1 to 7, characterized in that, When the first expert layer executes the first computation task, the resources occupied by the first expert module are positively correlated with the activation frequency of the first expert module, and the resources occupied by the second expert module are positively correlated with the activation frequency of the second expert module.

9. A data processing apparatus, characterized in that, The device includes: The acquisition module is used to acquire input data; The calculation module is used to perform multiple iterative calculations on the input data using a hybrid expert model to obtain the output data corresponding to the input data. The computing module further includes a first computing module and a second computing module, wherein the first computing module is used to perform a first computing task through the first expert layer of the hybrid expert model; The second computing module is used to execute a second computing task through the second expert layer of the hybrid expert model after the first computing task is completed. The first expert layer is different from the second expert layer. The parameter exchange module is used to exchange the parameters of multiple expert modules in the first expert layer during the execution of the second calculation task in the second expert layer, so as to obtain a third expert layer. The third expert layer is used to execute the calculation task of the next iteration.

10. The apparatus according to claim 9, characterized in that, The parameter exchange module is specifically used for: The parameters of the first expert module of the first expert group and the second expert module of the second expert group are exchanged to obtain the third expert group and the fourth expert group. The third expert group is obtained after exchanging the parameters of the first expert group, and the fourth expert group is obtained after exchanging the parameters of the second expert group. The first expert layer includes the first expert group and the second expert group, and the third expert layer includes the third expert group and the fourth expert group. When the first expert layer executes the first computing task, the resources occupied by the first expert group are greater than those occupied by the second expert group, and the resources occupied by the first expert module are greater than those occupied by the second expert module.

11. The apparatus according to claim 9 or 10, characterized in that, The computing module also includes: The third calculation module is used to perform a third calculation task through the fourth expert layer of the hybrid expert model during the parameter exchange process between the first expert module and the second expert module. The fourth expert layer is different from the second expert layer and different from the first expert layer.

12. The apparatus according to claim 10, characterized in that, The first computing module is further configured to: perform a fourth computing task through the third expert layer; The parameter exchange module is further configured to: after the fourth calculation task is completed, if the resources occupied by the third expert group meet the set conditions, exchange parameters between the third expert module of the third expert group and the fourth expert module of the fifth expert group, wherein the third expert layer includes the fifth expert group; When the third expert layer executes the fourth computing task, the resources occupied by the third expert group are greater than those occupied by the fifth expert group, and the resources occupied by the third expert module are greater than those occupied by the fourth expert module.

13. The apparatus according to claim 12, characterized in that, The resources occupied by the third expert group meet the set conditions, including: when the third expert layer executes the fourth computing task, the resources occupied by the third expert group are greater than the first threshold. The first threshold includes: the average value of the resources occupied by multiple expert groups in the third expert layer when the third expert layer performs the fourth computing task.

14. The apparatus according to any one of claims 9 to 13, characterized in that, The device further includes: The determination module is used to determine n expert modules in the first expert layer that need to exchange parameters based on the resources occupied when the first expert layer executes the first calculation task. The n expert modules include the first expert module and the second expert module. The parameter exchange module is further configured to: if the value of n is less than a set threshold, indicating that the time required for the n expert modules to exchange parameters is less than the set time, then perform parameter exchange on the n expert modules to obtain the third expert layer; The set time length includes the time length from the first moment to the second moment. The first moment includes the moment when the first expert layer finishes executing the first calculation task, and the second moment includes the moment before the third expert layer executes the fourth calculation task.

15. The apparatus according to any one of claims 9 to 14, characterized in that, When the first expert layer executes the first calculation task, the resources occupied by the first expert group are greater than the second threshold, and the resources occupied by the second expert group are less than the second threshold. The resources used by the first expert module are greater than those used by the second expert module; The second threshold includes the average value of the resources occupied by multiple expert groups in the first expert layer when the first expert layer performs the first calculation task.

16. The apparatus according to claim 15, characterized in that, When the first expert layer executes the first computation task, the resources occupied by the first expert module are positively correlated with the activation frequency of the first expert module, and the resources occupied by the second expert module are positively correlated with the activation frequency of the second expert module.

17. A data processing device, characterized in that, include: Memory and processor; The memory stores code, and the processor is configured to execute the code. When the code is executed, the data processing device performs the method as described in any one of claims 1 to 8.

18. A computer storage medium, characterized in that, The computer storage medium stores one or more instructions, which, when executed by one or more computers, cause the one or more computers to perform the method according to any one of claims 1 to 8.

19. A computer program product, characterized in that, The computer program product stores instructions that, when executed by a computer, cause the computer to perform the method described in any one of claims 1 to 8.