Distributed hybrid expert model reasoning method and system for multi-edge device

By implementing expert-level distributed deployment and phased routing scheduling across multiple edge devices, the memory and energy limitations of hybrid expert models are resolved, achieving efficient first-word response and continuous service capabilities.

CN123185074APending Publication Date: 2026-11-27UNIV OF SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611641172.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-22
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively address the memory and energy limitations of hybrid expert models in multi-edge device scenarios, resulting in insufficient initial response time and cluster continuous service capabilities.

Method used

It adopts expert-level distributed deployment, heat-aware expert replica configuration, and differentiated routing scheduling in the pre-filling and decoding stages. The expert replica deployment matrix is ​​generated in the offline stage, and the replica worker nodes are selected in the online stage based on the computing latency and remaining energy, thereby optimizing the first word response time and continuous service capability.

Benefits of technology

Efficient execution of hybrid expert models was achieved in memory- and power-constrained multi-edge devices, reducing first-word response time and extending cluster service life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123185074A_ABST
    Figure CN123185074A_ABST
Patent Text Reader

Abstract

This invention discloses a distributed hybrid expert model inference method and system for multiple edge devices, belonging to the field of multi-edge device collaborative computing technology. The invention deploys the non-expert layer and gated network of the hybrid expert model on the master node, while expert replicas are split and deployed on multiple worker nodes. In the offline phase, an expert replica deployment matrix is ​​generated based on the historical activation probability of experts and the memory capacity of worker nodes, determining the candidate replica worker node set for each expert. During online inference, the current inference stage is identified. In the pre-filling stage, replica worker nodes are selected based on the computation latency, communication latency, and marginal latency of each candidate replica worker node. In the decoding stage, replica worker nodes are selected based on the remaining energy and marginal energy consumption of the candidate replica worker nodes. Expert calculations are performed, and node states are updated. This invention enables efficient execution of hybrid expert model inference in resource-constrained multi-edge devices, balancing first-word response time and cluster continuous service capabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of collaborative computing technology for multiple edge devices, and specifically to a distributed hybrid expert model reasoning method and system for multiple edge devices. Background Technology

[0002] Edge devices have been widely used in industrial manufacturing, automotive intelligence, and edge device inspection. As task complexity increases, edge devices are increasingly facing demands for multi-source information fusion, multi-step reasoning, dynamic collaborative decision-making, and adaptive task replanning. Traditional machine learning and reinforcement learning methods can provide edge devices with certain perception, control, and planning capabilities, but they still struggle to fully meet the needs of collaborative reasoning tasks involving multiple edge devices in complex and open environments. Large Language Models (LLMs) possess strong contextual understanding, reasoning generation, and task planning capabilities and have begun to be used in scenarios such as embodied agents, aerial agents, and multi-agent collaborative decision-making. In existing LLM structures, Hybrid Expert (MoE) models use gating networks to route input tokens to at least a few experts for computation, reducing the computational cost of actual token activation while maintaining a large model capacity, thus making them suitable for large-scale model reasoning in resource-constrained environments. Because the expert modules in a MoE model are relatively independent, with each token only calling a portion of the expert set, MoE models have structural advantages in terms of expert-level splitting and distributed deployment.

[0003] However, the total number of parameters in a hybrid expert model is typically much larger than the number of parameters actually activated in a single inference iteration. Even if a single term only activates a small number of experts, the complete model still needs to store the non-expert layer, the gating network, and all expert parameters, and its total memory requirements usually exceed the onboard memory capacity of a single edge device. Therefore, when performing hybrid expert large model inference across multiple edge devices, a single-node deployment approach is insufficient to meet the storage and computational needs of the complete model, necessitating a distributed deployment that utilizes the memory and computing power resources of multiple edge devices.

[0004] In expert-level distributed deployment, the master node can host the non-expert layer, gating network, and result aggregation module, while multiple worker nodes host different experts. Once the gating network determines the active expert corresponding to the input term, the master node sends the hidden state to the worker node hosting the corresponding expert. The worker node then completes the expert computation and returns the result to the master node. This method can utilize multiple nodes to jointly host a hybrid expert model. However, existing methods typically ignore the limited energy in edge devices. Their optimization goals focus on communication overhead, load balancing, or computational throughput, assuming that edge nodes have a relatively sufficient and stable energy supply. These assumptions are difficult to directly apply to multi-edge device scenarios. On one hand, each worker node relies on battery power, and its remaining energy is limited and uneven. The cluster's continuous service capability is often constrained by the worker node that runs out of power first. On the other hand, conventional parallel expert deployment usually places each expert on only one worker node. For an expert activated by the gating network, the input term can only be sent to the unique node hosting that expert. Even if the node has low remaining energy, the system still needs to send the corresponding expert computation task to that node, lacking scheduling space. If a low-energy node exits prematurely, the experts it supports may be unable to continue providing services, thus affecting the executability of the entire hybrid expert model.

[0005] Replicating experts within a hybrid expert pool provides multiple optional host nodes for the same expert, thus introducing flexibility to online routing. However, with limited onboard GPU memory on edge nodes, the system cannot uniformly configure redundant replicas for all experts; moreover, experts within a hybrid pool have varying activation frequencies, resulting in differences between "hot" and "cold" experts. If the replica configuration is not aware of expert activation frequencies, limited GPU memory may be occupied by low-frequency experts, making it difficult to alleviate queuing and synchronization bottlenecks caused by "hot" experts. On the other hand, existing expert replica scheduling strategies often aim to reduce communication costs, improve locality, or balance computational load, typically failing to consider the heterogeneity of remaining energy on edge device nodes. Consequently, low-energy nodes may continue to be scheduled, accelerating their failure and shortening the cluster's service life.

[0006] Even with expert replicas providing candidate replica worker nodes for online scheduling, the requirements for replica selection still differ across inference stages. Large language model inference typically includes a prefill stage and a decoding stage, each with different computational characteristics and optimization objectives. The prefill stage requires processing the complete input, handling a large number of tokens, and the computation results from multiple expert nodes need to be synchronized at a hybrid expert layer. Therefore, this stage is primarily affected by cross-node synchronization waiting and the completion time of the slowest computation node, directly impacting the time-to-first-to-toe (TTFT). The decoding stage, on the other hand, generates tokens step-by-step according to the autoregressive approach of the Transformer. While the computational scale per step is smaller, the duration is longer, resulting in significant cumulative energy consumption and a more pronounced impact on the continuous inference capability across multiple edge devices.

[0007] Under the energy constraints of multiple edge devices, the pre-filling and decoding phases present conflicting and coupled routing and scheduling requirements. To reduce the first-word response time in the pre-filling phase, the scheduling strategy tends to allocate workload to nodes with strong computing power, short queuing times, or low communication latency. To extend the service life of the decoding phase, the scheduling strategy needs to avoid low-energy nodes from continuing to bear too much load and make full use of the remaining energy differences between different nodes. If a unified routing strategy is adopted for the two phases, it is difficult to simultaneously balance response latency and continuous service capability.

[0008] In summary, existing technologies such as edge-side large language model deployment, expert-level distributed hybrid expert inference, expert replica configuration, and unified online routing scheduling are still insufficient to simultaneously meet the inference requirements of limited GPU memory, energy differences, and stage-specific differences in multi-edge device scenarios. Therefore, there is an urgent need for a distributed hybrid expert inference method and system for energy-constrained multi-edge devices. This method and system should be able to generate an expert replica deployment scheme by combining expert popularity and GPU memory constraints in the offline phase, and perform latency-oriented and energy lifetime-oriented expert replica routing scheduling in the online phase, respectively, to balance first-word response time and cluster continuous service capabilities. Summary of the Invention

[0009] To address the aforementioned technical problems, this invention provides a distributed hybrid expert model inference method and system for multiple edge devices.

[0010] This invention enables hybrid expert models to run on memory- and energy-constrained multi-edge devices through expert-level distributed deployment, heat-aware expert replica configuration, and differentiated routing scheduling in the pre-filling and decoding stages, while taking into account first-word response time and the continuous service capability of multi-edge device clusters.

[0011] This invention divides the hybrid expert model into a non-expert part and an expert part. The non-expert part and the gating network are deployed on the master node, while the expert part and its corresponding replicas are split and deployed on multiple worker nodes. In the offline phase, an expert replica deployment matrix is ​​generated based on the historical activation probability of the experts and the memory capacity of the worker nodes, and the candidate worker node set for each expert is determined by the deployment matrix. In the online phase, the optimization objective is decoupled, the current inference stage is identified, and latency-oriented replica selection or energy lifetime-oriented replica selection is performed respectively in the candidate replica worker node set of the corresponding expert.

[0012] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: In a first aspect, the present invention provides a distributed hybrid expert model inference method for multiple edge devices, comprising: The non-expert layer and gated network of the hybrid expert model are deployed on the master node, while expert replicas are split and deployed on multiple worker nodes. During the offline phase, an expert replica deployment matrix is ​​generated based on the expert's historical activation probability and the memory capacity of the working nodes to determine the candidate replica working node set for each expert. During online inference, the current inference stage is identified. When in the pre-filling stage, a replica worker node is selected based on the computation latency, communication latency, and marginal latency of each candidate replica worker node. When in the decoding stage, a replica worker node is selected based on the remaining energy and marginal energy consumption of the candidate replica worker nodes. Perform expert calculations and update node status.

[0013] In one embodiment, the offline phase, generating an expert replica deployment matrix based on the expert's historical activation probability and the worker node's memory capacity, specifically includes: First, deploy a copy for each expert to ensure model integrity; then calculate the marginal benefit of adding new copies. ,in, For experts Historical activation probability, For experts The number of currently deployed replicas; priority is given to The expert with the highest value is assigned a redundant copy, and this copy is placed on a working node with remaining video memory not less than the expert's parameter value and which has not yet hosted a copy of the expert; the above process is repeated until all working nodes have no remaining video memory to accommodate a new copy or the preset copy number limit is reached.

[0014] In one embodiment, the step of selecting replica worker nodes based on the computation latency, communication latency, and marginal latency of each candidate replica worker node during the pre-filling phase specifically includes: Set the current routing event Work nodes allocated to candidate replicas The number of lexical units is The computational cost of word meta-experts is Candidate replica worker nodes The computational throughput during the pre-filling phase is The calculation delay is Let the size of the hidden state be... The wireless link rate is The communication delay is System latency of the current routing event The maximum completion time among the participating candidate replica worker nodes is determined by the maximum completion time. ,in This includes the overhead incurred by master node gating computation, route distribution, and result aggregation; for experts... candidate replica worker nodes Calculate the first route score ,in For candidate replica working nodes Current cumulative estimated execution time, To send candidate replica working nodes New allocation experts The marginal delay introduced by the word block is used to select the first route score. The minimum set number of candidate replica worker nodes performs expert calculations.

[0015] In one embodiment, the step of selecting a replica worker node based on the remaining energy and marginal energy consumption of the candidate replica worker node during the decoding phase specifically includes: Candidate replica worker node The power consumption for word-based computation during the decoding phase is The calculation delay is Then the current routing event The energy consumption in The remaining energy after the current routing event ends. for: ; For candidate replica working nodes In the current route event Remaining energy before starting; Set risk penalty function The risk penalty function varies with the remaining energy. The value decreases and monotonically increases; for experts candidate replica worker nodes Calculate the second route score ,in Add new word blocks in the node The marginal energy consumption caused by the above, select the second route for scoring. The minimum set number of candidate replica worker nodes performs expert calculations.

[0016] In one embodiment, the risk penalty function Adopt the following form: ,in This is used to prevent positive numbers with a denominator of zero.

[0017] In one embodiment, the execution of expert calculation and updating of node status specifically includes: The master node sends the corresponding hidden state to the selected replica worker node according to the expert identifier and the term correspondence. The selected replica worker node calls the corresponding local expert replica to perform forward computation and returns the computation result carrying the expert identifier, term index and expert output to the master node. The master node performs weighted aggregation on the expert output according to the gating weight and term index, restores the hybrid expert layer output at the corresponding term position, and continues to execute the subsequent network layers. After the routing event ends, the master node updates the remaining energy, cumulative estimated execution time, link status and availability status of each replica worker node according to the computation time, energy consumption estimate, link quality and reachability feedback of this routing event.

[0018] In one embodiment, the method further includes a node state dynamic maintenance step: updating the candidate replica worker node set based on the remaining energy, link quality, and reachability of the worker node; when the remaining energy of a replica worker node is lower than a preset threshold or the communication conditions are not met, removing the replica worker node from the candidate replica worker node set of the corresponding expert, or reducing the routing priority of the replica worker node.

[0019] In one embodiment, the expert's historical activation probability is obtained statistically based on historical task data, calibration data, or existing inference logs: the number of times each expert is selected in the gating output is counted, and the probability is normalized based on the total number of activations to obtain the expert's historical activation probability. Historical activation probability .

[0020] In one embodiment, identifying the current inference stage specifically includes: determining whether there are still unprocessed words in the input sequence during the current generation step; if there are unprocessed words, it is a pre-filling stage; if all input words have been processed and the current process is word-by-word autoregressive generation, it is a decoding stage; and automatically switching to the decoding stage after the pre-filling stage ends within the same request.

[0021] In a second aspect, the present invention provides a distributed hybrid expert model inference system for multiple edge devices, used to implement the method of any embodiment of the first aspect, comprising: The system consists of a master node and multiple worker nodes. The master node deploys the non-expert layer of the hybrid expert model, a gated network, a routing scheduler, and an output aggregation module. The worker nodes are used to host and execute the computation of expert replicas. The offline deployment module is used to generate an expert replica deployment matrix based on the expert's historical activation probability and the memory capacity of the working nodes during the offline phase, and to determine the candidate replica working node set for each expert. The phase-aware routing module is used to identify the current inference phase during online inference. When it is in the pre-filling phase, it selects a replica worker node based on the computation latency, communication latency, and marginal latency of each candidate replica worker node. When it is in the decoding phase, it selects a replica worker node based on the remaining energy and marginal energy consumption of the candidate replica worker nodes. The state maintenance module is used to update the node state after performing expert calculations.

[0022] The system and method in this invention correspond to each other; the specific technical solutions applicable to the method are also applicable to the system.

[0023] Compared with the prior art, the beneficial technical effects of the present invention are: This invention utilizes heat-aware replica deployment to prioritize providing redundant replicas for high-frequency experts within a limited memory budget, thereby increasing the online scheduling space for hot experts. By decoupling the stages, it distinguishes between the pre-filling stage and the decoding stage, optimizing the first-word response time and continuous service capabilities respectively, avoiding performance trade-offs caused by a single scheduling objective. Furthermore, through a residual energy risk penalty mechanism, it reduces the additional load borne by low-energy nodes during the decoding stage, mitigating the impact of premature node failure on the cluster inference service. Attached Figure Description

[0024] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a system architecture diagram of the present invention; Figure 3 This is a schematic diagram illustrating the deployment of expert copies of the present invention; Figure 4 This is a schematic diagram of the phase-aware routing of the present invention; Figure 5 This is a schematic diagram of the update process of the present invention. Detailed Implementation

[0025] A preferred embodiment of the present invention will now be described in detail with reference to the accompanying drawings.

[0026] like Figure 1 As shown, this invention provides a distributed hybrid expert model inference method for multiple edge devices, including: S1 deploys the non-expert layer and gated network of the hybrid expert model on the master node, and splits and deploys the expert replicas on multiple worker nodes. S2, offline phase: Generate expert replica deployment matrix based on the expert's historical activation probability and the memory capacity of the working nodes, and determine the candidate replica working node set for each expert. S3, during online inference, identifies the current inference stage. When in the pre-filling stage, it selects a replica worker node based on the computation latency, communication latency, and marginal latency of each candidate replica worker node. When in the decoding stage, it selects a replica worker node based on the remaining energy and marginal energy consumption of the candidate replica worker nodes. S4 performs expert calculations and updates the node status.

[0027] 1. Master node and worker nodes.

[0028] like Figure 2 As shown, a multi-edge device consists of one master node and multiple worker nodes. The master node can be an edge device node with strong computing power, large memory, or optimal communication location in the cluster, or it can be a control node dynamically elected during task execution. Worker nodes are edge device nodes that carry expert replicas and perform expert forward computation.

[0029] The master node deploys the non-expert layer, gated network, routing scheduler, and output aggregation module in the Transformer architecture. Multiple worker nodes form an expert computing resource pool, used to host corresponding expert replicas according to the expert replica deployment results, and to execute corresponding expert computations based on the routing tasks issued by the master node. For any hybrid expert layer, the expert set is denoted as […]. The set of working nodes is denoted as Deployment matrix elements in Used to represent experts Is the copy placed on the worker node? Above; when When, it indicates a working node. Carrier experts A copy. Experts Optional set of replica worker nodes Recorded as: ; During system initialization, the master node or external control terminal collects the status of each working node, including the video memory capacity. Remaining video memory, initial remaining energy Calculate throughput during the pre-filling stage Decoding stage calculation throughput Power consumption during the pre-filling stage Power consumption during decoding stage and wireless link rate .

[0030] 2. Candidate replica worker nodes.

[0031] like Figure 3 As shown, the offline phase first obtains expert activation statistics based on historical task data or calibration data. For experts... The system counts the number of times a value is selected in the gating output and normalizes the historical activation probability based on the total number of activations. This historical activation probability is used to represent expert popularity.

[0032] During the basic coverage deployment phase, the system deploys each expert at least once, while satisfying the memory capacity constraints of each working node. Basic coverage is implemented according to standard expert parallelism (EP) (i.e., experts are placed into nodes in order of their index). After basic coverage is completed, the deployment matrix ensures that each expert has at least one available host node.

[0033] During the redundant replica deployment phase, the system calculates the marginal benefit of adding a replica for each expert. For experts... If its historical activation probability is The current number of copies is The marginal benefit of adding a new instance is: ; The system selects the expert with the highest current marginal benefit as the expert to be replicated, and selects a working node that meets the memory constraints and has not yet hosted the expert.

[0034] In one implementation, the system selects the candidate replica worker node with the largest remaining video memory as the placement node. After one placement is completed, the system updates the deployment matrix. The remaining video memory of the node and the number of expert replicas. This process is repeated until no worker node can accommodate more expert replicas, or the pre-set maximum number of replicas is reached. After offline deployment is complete, the deployment matrix... The set of candidate replica working nodes used to determine each expert during the online inference service process.

[0035] 3. Identification and Reasoning Stage After the expert replica is deployed, the master node begins the inference process.

[0036] During the online inference phase, the master node receives input requests and performs non-expert computations. When the hybrid expert layer is reached, the gating network generates expert selection results for each input lexical, and the master node aggregates these results to obtain the lexical demand for each expert. ,in This indicates the current routed event. The system determines the stage identifier based on the current request processing position. ,in Indicates the pre-filling stage. This indicates the decoding stage.

[0037] like Figure 4 As shown, when At that time, the system performs latency-oriented routing scheduling. For worker nodes... If the number of tokens assigned to this node in the current event is The computational cost of word meta-experts is The calculation delay is as follows: ; If the size of the hidden state is Then the communication delay is: .

[0038] Since the current hybrid expert layer needs to wait for the relevant expert outputs to return before proceeding to subsequent calculations, the system latency of the current routing event is determined by the maximum completion time among the participating nodes, which can be expressed as follows: ; in, This represents the overhead incurred by master node gating computation, route distribution, and result aggregation.

[0039] For the candidate replica worker node n of expert e, the pre-filled routing scheduling module calculates: ; in For nodes Current cumulative estimated execution time, To the node New allocation experts The marginal latency introduced by the word blocks. The system allocates word blocks to Smaller candidate replica worker nodes are selected, and the estimated execution time of each node is updated. In this way, the terminology load of hotspot experts can be distributed across multiple replica worker nodes, thereby reducing synchronization wait caused by the slowest node.

[0040] like Figure 4 As shown, when At that time, the system performs energy lifetime-oriented routing scheduling. For working nodes... Its energy consumption in the current event can be expressed as The remaining energy after the event ends is updated as follows: ; ; Remaining energy after this routing event ends This refers to the remaining energy before the next routing event begins.

[0041] To reduce the risk of premature failure of low-energy nodes, the system sets a risk penalty function. In one implementation, ,in It is a positive number; when When smaller, A larger energy level increases the scheduling cost of continuing to allocate tasks to low-energy nodes. The risk penalty function can also be a piecewise function, an exponential function, or a function related to the return-to-home safety threshold, as long as it satisfies the constraint that the lower the remaining energy, the higher the scheduling cost.

[0042] For experts candidate replica worker nodes The decoding routing scheduling module calculates: ; in Add new word blocks in the node The marginal energy consumption caused by this. System selection. Smaller nodes perform expert calculations, thus prioritizing the use of replica worker nodes with lower energy risk and reducing the additional burden on low-energy nodes.

[0043] 4. Perform expert calculations and update node status.

[0044] like Figure 5 As shown, after the master node determines the worker nodes to which each activated expert will be hosted, it sends the corresponding hidden state to the selected worker nodes according to the expert identifier and term mapping. The worker nodes then call their local corresponding expert replicas to perform forward computation and return the expert identifier, term index, and expert output to the master node. The master node performs weighted aggregation of the expert output based on the gating weights and term indexes, restoring the hybrid expert layer output at the corresponding term position, and continues executing subsequent network layers or the next generation step. Simultaneously, the node state maintenance module updates the remaining energy, estimated execution time, link quality, and availability status of each worker node based on the computation time, energy consumption estimate, link quality, and reachability feedback of this routing event.

[0045] In a complete request, the pre-population phase may include routing events from multiple hybrid expert layers, while the decoding phase repeatedly performs gating computation, expert replica selection, expert computation, and state updates in each generation step. Through this process, the system prioritizes reducing the initial response time at the beginning of the request phase and prioritizing extending the cluster service time during the continuous generation phase.

[0046] This invention is applicable to hybrid expert models where each lexical term activates one or more experts. When the gating network employs Top-k expert selection, this invention does not change the set of activated experts, but instead performs routing selection among multiple feasible replica worker nodes of the same expert. Therefore, this invention can be used as a deployment and inference scheduling layer for existing hybrid expert models without relying on retraining model parameters.

[0047] This embodiment uses offline collection of expert activation frequencies to implement different scheduling strategies for the two-stage differences in large language model inference. It aims to optimize the reduction in cluster inference times caused by early device dropout in energy-constrained edge device clusters, and to address the goal conflict between the two inference stages. The following effects are achieved: 1) By distributing the experts of the hybrid expert model across multiple working nodes, the adaptation to the single-node memory capacity limitation is achieved, so that the hybrid expert model with a total number of parameters exceeding the single-node memory capacity can still be executed in multiple edge devices.

[0048] 2) Based on the historical activation probability of experts, a replica deployment matrix is ​​generated, which enables high-frequency experts to obtain redundant replicas first. Under the limited memory budget, the number of optional carrying nodes for hot experts is increased, which alleviates local queuing and synchronization waiting.

[0049] 3) By decoupling the pre-filling stage and the decoding stage, routing strategies oriented towards latency and energy lifetime are adopted respectively. In the request initiation stage, priority is given to reducing the first word response time, and in the decoding stage, priority is given to extending the cluster service time.

[0050] 4) By dynamically maintaining the remaining energy, link status, and availability of nodes, the first word response time reduction caused by hotspot congestion during the pre-filling phase is reduced, and the energy consumption of low-energy nodes during the decoding phase is reduced, thereby increasing the continuous service capability of the cluster.

[0051] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0052] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple steps or stages, which are not necessarily completed at the same time, but may be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but may be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0053] This invention also provides a system. The system can be a system that uses software (applications), modules, components, servers, clients, etc., employing the methods described in the embodiments of this specification, combined with necessary hardware implementation. Since the implementation schemes and methods for solving the problem are similar, the specific system implementations in the embodiments of this specification can be found in the implementations of the foregoing methods, and repeated details will not be elaborated upon. Although the system is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0054] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0055] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention, and no reference numerals in the claims should be construed as limiting the scope of the claims.

[0056] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A distributed hybrid expert model inference method for multiple edge devices, characterized in that, include: The non-expert layer and gated network of the hybrid expert model are deployed on the master node, while expert replicas are split and deployed on multiple worker nodes. During the offline phase, an expert replica deployment matrix is ​​generated based on the expert's historical activation probability and the memory capacity of the working nodes to determine the candidate replica working node set for each expert. During online inference, the current inference stage is identified. When in the pre-filling stage, a replica worker node is selected based on the computation latency, communication latency, and marginal latency of each candidate replica worker node. During the decoding phase, a replica worker node is selected based on the remaining energy and marginal energy consumption of the candidate replica worker nodes. Perform expert calculations and update node status.

2. The distributed hybrid expert model inference method for multiple edge devices according to claim 1, characterized in that, During the offline phase, an expert replica deployment matrix is ​​generated based on the expert's historical activation probability and the worker node's memory capacity, specifically including: First, deploy a copy for each expert to ensure model integrity; then calculate the marginal benefit of adding new copies. ,in, For experts Historical activation probability, For experts The number of currently deployed replicas; priority is given to The expert with the highest value is assigned a redundant copy, and this copy is placed on a working node with remaining video memory not less than the expert's parameter value and which has not yet hosted a copy of the expert; the above process is repeated until all working nodes have no remaining video memory to accommodate a new copy or the preset copy number limit is reached.

3. The distributed hybrid expert model inference method for multiple edge devices according to claim 1, characterized in that, When in the pre-filling stage, the selection of replica worker nodes based on the computation latency, communication latency, and marginal latency of each candidate replica worker node specifically includes: Set the current routing event Work nodes allocated to candidate replicas The number of lexical units is The computational cost of word meta-experts is Candidate replica worker nodes The computational throughput during the pre-filling phase is The calculation delay is Let the size of the hidden state be... The wireless link rate is The communication delay is System latency of the current routing event The maximum completion time among the participating candidate replica worker nodes is determined by the maximum completion time. ,in This includes the overhead incurred by master node gating computation, route distribution, and result aggregation; for experts... candidate replica worker nodes Calculate the first route score ,in For candidate replica working nodes Current cumulative estimated execution time, To send candidate replica working nodes New allocation experts The marginal delay introduced by the word block is used to select the first route score. The minimum set number of candidate replica worker nodes performs expert calculations.

4. The distributed hybrid expert model inference method for multiple edge devices according to claim 1, characterized in that, When in the decoding phase, the selection of replica worker nodes based on the remaining energy and marginal energy consumption of candidate replica worker nodes specifically includes: Candidate replica worker node The power consumption for word-based computation during the decoding phase is The calculation delay is Then the current routing event The energy consumption in The remaining energy after the current routing event ends. for: ; For candidate replica working nodes In the current route event Remaining energy before starting; Set risk penalty function The risk penalty function varies with the remaining energy. The value decreases and monotonically increases; for experts candidate replica worker nodes Calculate the second route score ,in Add new word blocks in the node The marginal energy consumption caused by the above, select the second route for scoring. The minimum set number of candidate replica worker nodes performs expert calculations.

5. The distributed hybrid expert model inference method for multiple edge devices according to claim 4, characterized in that, The risk penalty function Adopt the following form: ,in This is used to prevent positive numbers with a denominator of zero.

6. The distributed hybrid expert model inference method for multiple edge devices according to claim 1, characterized in that, The execution expert calculates and updates the node status, specifically including: The master node sends the corresponding hidden state to the selected replica worker node according to the expert identifier and the term correspondence. The selected replica worker node calls the corresponding local expert replica to perform forward computation and returns the computation result carrying the expert identifier, term index and expert output to the master node. The master node performs weighted aggregation on the expert output according to the gating weight and term index, restores the hybrid expert layer output at the corresponding term position, and continues to execute the subsequent network layers. After the routing event ends, the master node updates the remaining energy, cumulative estimated execution time, link status and availability status of each replica worker node according to the computation time, energy consumption estimate, link quality and reachability feedback of this routing event.

7. The distributed hybrid expert model inference method for multiple edge devices according to claim 1, characterized in that, It also includes a dynamic node status maintenance step: updating the candidate replica worker node set based on the remaining energy, link quality, and reachability of the worker node; when the remaining energy of a replica worker node is lower than a preset threshold or does not meet the communication conditions, removing the replica worker node from the candidate replica worker node set of the corresponding expert, or reducing the routing priority of the replica worker node.

8. The distributed hybrid expert model inference method for multiple edge devices according to claim 1, characterized in that, The expert's historical activation probability is obtained statistically based on historical task data, calibration data, or existing inference logs: the number of times each expert is selected in the gating output is counted, and the probability is normalized according to the total number of activations to obtain the expert's historical activation probability. Historical activation probability .

9. The distributed hybrid expert model reasoning method for multiple edge devices according to claim 1, characterized in that, The identification of the current inference stage specifically includes: depending on whether there are still unprocessed words in the input sequence in the current generation step, if there are unprocessed words, it is the pre-filling stage; if all input words have been processed and the current process is word-by-word autoregressive generation, it is the decoding stage; and automatically switching to the decoding stage after the pre-filling stage ends within the same request.

10. A distributed hybrid expert model inference system for multiple edge devices, used to implement the method as described in any one of claims 1 to 9, characterized in that, include: The system consists of a master node and multiple worker nodes. The master node deploys the non-expert layer of the hybrid expert model, a gated network, a routing scheduler, and an output aggregation module. The worker nodes are used to host and execute the computation of expert replicas. The offline deployment module is used to generate an expert replica deployment matrix based on the expert's historical activation probability and the memory capacity of the working nodes during the offline phase, and to determine the candidate replica working node set for each expert. The phase-aware routing module is used to identify the current inference phase during online inference. When it is in the pre-filling phase, it selects the replica worker node based on the computation latency, communication latency, and marginal latency of each candidate replica worker node. During the decoding phase, a replica worker node is selected based on the remaining energy and marginal energy consumption of the candidate replica worker nodes. The state maintenance module is used to update the node state after performing expert calculations.