Task offloading agent training method based on differentiable secure projection and related equipment
The DSL-SafePPO algorithm divides the scheduling constraints of large language models into instantaneous physical integrity and task-level service reliability. By using multi-round updates and gradient correction techniques, it solves the problems of memory overflow and conservative exploration in edge server scheduling, realizes an efficient and stable task offloading strategy, and improves the reliability and performance of the system.
Patent Information
- Application Number
- CN202611059239.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies cannot effectively avoid memory overflow crashes and conservative agent exploration in edge server scheduling of large language models. This makes it difficult for agents to achieve a balance between meeting hardware and latency SLA constraints, resulting in low SLA compliance rates for long-term task scheduling and frequent hardware failures at edge nodes.
A task offloading agent training method based on differentiable safe projection is adopted. The scheduling constraints are divided into instantaneous physical integrity and task-level service reliability through the DSL-SafePPO algorithm. Multi-round update operations and gradient correction techniques are used to ensure that the agent's decision vector and gradient conform to the hardware constraints, thereby achieving stable convergence and efficient scheduling.
It improves the reliability of the task offloading strategy determined by the agent, avoids memory overflow and crashes, enhances system stability and performance, reduces energy consumption and latency, and ensures the reliable operation of edge nodes.
Smart Images

Figure CN123177907A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method and related equipment for training a task offloading agent based on differentiable secure projection. Background Technology
[0002] With the advent of Industry 5.0, Large Language Models (LLMs), with their superior natural language understanding, logical reasoning, and context generation capabilities, have become the core engine driving the transformation of the Industrial Internet of Things (IIoT) towards higher-level intelligence. They are widely used in key scenarios such as industrial robot instruction parsing, fault diagnosis, and human-machine interaction. However, modern large language models often have hundreds of billions of parameters, and the video random access memory (VRAM) required for inference far exceeds the hardware limit of a single edge server, making them typical computationally intensive and memory-intensive applications. While traditional centralized cloud deployment solutions can meet computing power requirements, the high network latency and data privacy risks brought by cloud inference in industrial scenarios with extremely stringent millisecond-level real-time requirements make it unsuitable as the sole inference backend for latency-sensitive industrial tasks. To address this, researchers have turned their attention to collaborative edge computing and distributed inference. By sharding large language models and distributing them to multiple edge servers through pipelined parallel mechanisms to collaboratively complete inference, researchers can overcome the resource constraints of single devices while ensuring service availability and data locality. Meanwhile, designing an intelligent scheduling mechanism that balances physical hardware security and task-level service reliability in the dynamic environment of the Industrial Internet of Things, characterized by random task arrivals and channel fluctuations, has become a core challenge in the research of distributed large language model inference.
[0003] Currently, most mainstream dynamic scheduling schemes rely on safe reinforcement learning (Safe RL), such as Proximal Policy Optimization (PPO) or Soft Actor-Critic (SAC) based on Lagrange multiplication tables. These existing technologies generally employ "scalar penaltyization," packaging all types of constraints as a penalty term in the reward function, attempting to guide the agent by optimizing the "expected cumulative penalty." This expectation-based optimization mechanism is effective for long-term SLA (Service Level Agreement) latency control, but it is a fatal logical flaw for instantaneous hard memory constraints. Expectation constraints can only guarantee a "low probability of violation under long-term average conditions," but they cannot prevent the agent from outputting dangerous actions that exceed physical limits at a specific scheduling step. Due to the lack of hard interception and physical authentication mechanisms before execution, these invalid actions are directly issued and executed, instantly triggering OOM (Out of Memory) crashes at edge nodes. This means that existing technology leaves a vulnerability, leaving intelligent manufacturing systems constantly exposed to the risk of downtime.
[0004] Furthermore, to forcibly suppress memory overruns, traditional Safe RL typically assigns extremely high penalties (huge negative rewards) to physical violations. However, this mechanism, which relies on "post-hoc penalties," can lead to serious side effects in the heavily constrained high-dimensional scheduling space of collaborative inference: "exploration paralysis" and "over-conservatism." If an agent incurs a huge penalty for stepping on a physical red line during the early stages of training, its neural network parameter updates will oscillate violently. To avoid these penalties, the policy network will drastically shrink its exploration range, becoming extremely timid and unwilling to try efficient scheduling schemes that approach memory limits but offer extremely high throughput, ultimately causing the model to fall into a low-performance local optimum.
[0005] In summary, existing technologies are prone to issues such as memory overflow crashes, conservative agent exploration, and training oscillations. This makes it difficult for agents to balance exploring feasible scheduling schemes with meeting hardware and latency SLA constraints. Consequently, they cannot stably converge to the optimal offloading strategy that balances low latency, low power consumption, and resource security. Long-term task scheduling SLA compliance rates are low, and edge node hardware failures are frequent. These factors significantly reduce the reliability of the agent's output task offloading strategy. Summary of the Invention
[0006] In view of this, the purpose of this application is to propose a training method and related equipment for task offloading agents based on differentiable secure projection, so as to overcome all or part of the shortcomings of the prior art.
[0007] To achieve the above objectives, this application provides a method for training a task offloading agent based on differentiable secure projection, comprising: acquiring a task sequence corresponding to each historical moment within a predetermined historical time period, wherein the task sequence includes task data corresponding to each task to be offloaded, and state data corresponding to each server used to execute the task; performing multiple rounds of update operations on a pre-constructed initial agent based on the task sequence corresponding to each historical moment, taking the first historical moment within the predetermined historical time period as the target moment, and performing each round of update operations as follows: using the initial agent, determining a task offloading strategy based on the task data and state data corresponding to the target moment, wherein the task offloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be offloaded; and determining the task offloading agent based on the task offloading strategy. The task unloading strategy includes a decision vector and a corrected decision vector. Based on the task unloading strategy, the server state data corresponding to the task unloading strategy, the decision vector, and the corrected decision vector, the initial update gradient of the initial agent is determined, and the initial update gradient is corrected to obtain the target update gradient. Based on the target update gradient, multiple parameters in the initial agent are updated, and it is determined whether the initial agent has converged. In response to determining that the initial agent has not converged, the updated initial agent is used as the initial agent in the next round of update operations, and the next time step adjacent to the target time step is used as the target time step in the next round of update operations, and the next round of update operations is executed. In response to determining that the initial agent has converged, the initial agent is determined as the target agent, and at least one round of update operations is exited.
[0008] Based on the same inventive concept, this application also provides a task offloading agent training device based on differentiable secure projection, comprising: an acquisition module configured to acquire a task sequence corresponding to each historical moment within a predetermined historical time period, the task sequence including task data corresponding to each task to be offloaded, and state data corresponding to each server used to execute the task; performing multiple rounds of update operations on a pre-constructed initial agent based on the task sequence corresponding to each historical moment, taking the first historical moment within the predetermined historical time period as the target moment, and performing each round of update operations as follows: a first determination module configured to determine a task offloading strategy using the initial agent based on the task data and state data corresponding to the target moment, wherein the task offloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be offloaded; and a second determination module configured to determine the task offloading strategy based on the task offloading strategy. The system comprises: a decision vector corresponding to the task unloading strategy and a corrected decision vector; a correction module configured to determine the initial update gradient of the initial agent based on the task unloading strategy, the server status data corresponding to the task unloading strategy, the decision vector, and the corrected decision vector, and to perform gradient correction on the initial update gradient to obtain the target update gradient; an update module configured to update multiple parameters in the initial agent based on the target update gradient and determine whether the initial agent has converged; a third determination module configured to, in response to determining that the initial agent has not converged, use the updated initial agent as the initial agent in the next round of update operations, use the next time moment adjacent to the target time moment as the target time moment in the next round of update operations, and execute the next round of update operations; and a fourth determination module configured to, in response to determining that the initial agent has converged, determine the initial agent as the target agent and exit at least one round of update operations.
[0009] Based on the same inventive concept, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.
[0010] Based on the same inventive concept, this application also provides a non-transitory computer-readable storage medium that stores computer instructions for causing a computer to perform the method described above.
[0011] As can be seen from the above, the task offloading agent training method and related equipment based on differentiable secure projection provided in this application include obtaining a task sequence corresponding to each historical moment within a predetermined historical time period. The task sequence includes task data corresponding to each task to be offloaded, and state data corresponding to each server used to execute the task. Based on the task sequence corresponding to each historical moment, multiple rounds of update operations are performed on the pre-constructed initial agent. Multiple rounds of iterative updates are carried out based on the time-series task sequence with time correlation characteristics, which can realistically restore the dynamic evolution law of on-site tasks and equipment states, allowing the agent to adapt to the actual scheduling scenario through continuous learning and complete capability iterative optimization. The first historical moment within the predetermined historical time period is taken as the target moment. Each round of update operations is performed as follows: using the initial agent, based on the task data and state data corresponding to the target moment, a task offloading strategy is determined. The task offloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be offloaded. The task offloading strategy is obtained based on real historical conditions, completely preserving the exploration distribution information of the agent. Based on the task offloading strategy, the decision vector corresponding to the task offloading strategy and the modified decision vector are determined. On the one hand, the distributed and independent sub-task server allocation probabilities are unified and standardized into standardized computational inputs. On the other hand, the task offloading strategy with the risk of memory violation can be adjusted to a feasible range, ensuring that the modified task offloading strategy meets the server's memory operation requirements, while preserving the scheduling and allocation tendency of the agent output in the original vector to the greatest extent. Based on the task offloading strategy, the server state data corresponding to the task offloading strategy, the decision vector, and the modified decision vector, the initial update gradient of the initial agent is determined, and the initial update gradient is modified to obtain the target update gradient. This allows the gradient value to closely match the real latency, energy consumption, and hardware load conditions, accurately correcting the deviation between the original strategy and feasible constraints. Based on the target update gradient, multiple parameters in the initial agent are updated, ensuring that the parameter iteration direction in each round closely matches the real server latency, energy consumption, and memory hardware constraints. This effectively avoids the training oscillation problem caused by gradient deviation and steadily guides the model towards optimization towards low latency, low energy consumption, load balancing, and policy compliance. It can determine whether the initial agent has converged, accurately identify nodes where model parameters and scheduling performance tend to be stable, and stop iterative training in time when the agent reaches the optimal allocation effect, so as to avoid meaningless continuous iteration that consumes computing power and time resources.In response to the determination that the initial agent has not converged, the updated initial agent is used as the initial agent in the next round of update operations, and the next time step adjacent to the target time step is used as the target time step in the next round of update operations. This iterative approach can progressively optimize the scheduling strategy, continuously adapt to dynamically fluctuating system conditions, and gradually reduce strategy errors until the agent converges. In response to the determination that the initial agent has converged, the initial agent is designated as the target agent, and at least one round of update operations is exited. This convergence determination mechanism can promptly terminate redundant iterations, saving training computing power and time costs. The converged agent's strategy is stable and meets various scheduling constraints, allowing for direct deployment and avoiding strategy oscillations caused by excessive iteration, thus improving the reliability of the task offloading strategy determined by the agent. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart illustrating the task offloading agent training method based on differentiable secure projection according to an embodiment of this application.
[0014] Figure 2 This is a schematic diagram of a system model according to another embodiment of this application; Figure 3 This is a schematic diagram of the DSL-SafePPO algorithm structure according to another embodiment of this application; Figure 4 This is a schematic diagram of the structure of the task offloading agent training device based on differentiable secure projection according to an embodiment of this application. Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0016] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0017] As described in the background section, with the evolution of Industry 5.0, large language models (LLMs) are becoming the "core brain" of smart manufacturing workshops due to their superior generalization reasoning and natural language interaction capabilities. However, large LLMs have extremely high computational complexity and massive memory consumption. In particular, the key-value cache (KVCache) that accumulates continuously during the autoregressive decoding stage causes dynamic memory consumption to explode with the increase in the number of concurrent tasks. A single industrial edge device, limited by cost and physical size, simply cannot independently handle complete LLM inference. To address this, the industry has introduced "collaborative edge computing," which divides large models into multiple shards and distributes them across multiple edge servers for collaborative execution in a pipelined parallel manner. However, in dynamic production environments with hundreds or thousands of heterogeneous industrial devices making high-frequency concurrent requests, how to safely and efficiently schedule and allocate resources for multiple tasks has become an extremely challenging problem.
[0018] The existing technology has the following two problems: 1) Existing technologies confuse hard physical constraints with soft statistical constraints, failing to provide absolute protection against step-level memory overflows, making industrial systems highly susceptible to catastrophic availability failures.
[0019] In the scheduling of industrial collaborative inference, there are two fundamentally different types of reliability constraints with varying time execution granularities: one is task-level service reliability, such as end-to-end latency SLA. Scenarios like industrial control and real-time visual quality inspection have extremely high requirements for response time, which falls under the service level agreement (SLA) category. While occasional timeout violations may not cause the system to crash immediately, a long-term violation rate exceeding the limit can lead to production rhythm disruptions, constituting a "soft constraint" that requires statistical control over a longer operation cycle. The other type is instantaneous physical constraints, namely, hard limits on video memory. In edge servers, video memory is an insurmountable physical red line. Any scheduling decision that inadvertently allocates too many task fragments or excessively long context sequences to the same node, causing the total instantaneous video memory to exceed the hardware's physical limit, will instantly trigger a memory overflow crash. This is a zero-tolerance "hard constraint"; once it occurs, the operating system will directly terminate the process, the current inference task is forcibly interrupted, and cannot be recovered within the scheduling window.
[0020] Existing mainstream secure reinforcement learning methods (such as Lagrange PPO algorithms based on Restricted Markov Decision Processes) typically treat all types of constraints in the system, whether memory capacity limitations or end-to-end latency requirements, as "soft constraints." This means that a scalar penalty term is introduced into the reward function to force the agent to comply with the rules. The essence of this mechanism is to optimize the "long-term expected violation rate." However, the memory of edge servers is a zero-tolerance, instantaneous physical "hard constraint." Any memory overrun in a single scheduling step will instantly trigger an OutOfMemoryError (OOM), causing the inference process to be terminated directly by the operating system, resulting in irreversible availability failure. Existing expected penalty mechanisms cannot hard-intercept actions before they are actually sent to the physical environment, leaving industrial scheduling systems constantly exposed to the risk of downtime.
[0021] 2) Existing technologies are extremely inefficient in strategy exploration under strict physical constraints, and the convergence of multi-objective joint optimization is extremely unstable, making it difficult to maximize the performance of edge computing power.
[0022] To suppress the fatal physical violation rate, existing technologies often set extremely high penalty values. This causes the agent to suffer severe setbacks during training, leading to a "fear" mentality that drastically narrows the exploration scope and ultimately results in an extremely conservative, suboptimal solution that sacrifices significant system throughput and latency performance. Simple scalar penalties can only tell the network that it has "crossed the line," but cannot indicate "where the correct boundary is" at the geometric level. Furthermore, for Long-Term Service Level Agreement (SLA) latency constraints that allow for a certain probability of violation, existing technologies typically use fixed-step Lagrange multipliers for updates. When the system's latency violation rate is near the SLA threshold, the fixed step size causes the multiplier values to fluctuate wildly, resulting in the policy oscillating violently between aggressive and conservative approaches, severely disrupting training stability.
[0023] A deeper reason lies in the fact that scalar penalties merely tell the neural network "the current action is wrong," but fail to provide geometric guidance on "where the correct physical boundary is" or "along which gradient direction to adjust for both safety and efficiency." This "blind men and the elephant" approach of trial and error wastes a significant amount of computational power. In summary, existing technologies are prone to memory overflow crashes, conservative agent exploration, and training oscillations. This makes it difficult for the agent to balance exploring feasible scheduling schemes with meeting hardware and latency SLA constraints, preventing stable convergence to the optimal offloading strategy that balances low latency, low energy consumption, and resource security. Long-term task scheduling SLA compliance rates are low, and edge node hardware failures are frequent. These factors significantly reduce the reliability of the agent's output task offloading strategy. Terminology Explanation: 1) Intelligent Manufacturing: Intelligent manufacturing is a human-machine integrated intelligent system composed of intelligent machines and humans. It aims to achieve supervised intelligent activities in the manufacturing process through analysis, reasoning, judgment, and decision-making. By collaborating with machines, it expands, extends, and partially replaces the physical and mental activities of human experts in the manufacturing process, extending the concept of manufacturing automation to flexibility, integration, and overall intelligence.
[0024] 2) Industrial Internet: It is a new type of infrastructure, application model and industrial ecosystem that deeply integrates the new generation of information and communication technology with the industrial economy. Through the comprehensive connection of people, machines, things and systems, it builds a new manufacturing and service system covering the entire industrial chain and value chain, providing a way to realize the digital, networked and intelligent development of industry and even the entire industrial sector.
[0025] 3) Collaborative Edge Computing: Collaborative edge computing is a computing paradigm designed to address the limitations of single-device computing power and high latency in cloud computing by bringing computing resources closer to end devices (TDs) and distributing computing tasks across multiple edge servers (ESs). It allows large tasks to be broken down and collaboratively completed by geographically dispersed edge infrastructure.
[0026] 4) Task offloading: Task offloading is a key technology in edge computing. In edge computing, computing offloading involves offloading the computing tasks of mobile terminals to the edge cloud environment, which solves the shortcomings of devices in terms of resource storage, computing performance and energy efficiency.
[0027] 5) Model Sharding: Model sharding is a key technique in distributed inference. It refers to dividing a large deep neural network (such as an LLM) into multiple shards by layer or module, which are then stored and run on different computing nodes. Through pipeline parallelism, multiple nodes process the data sequentially, thereby jointly completing a complete inference task.
[0028] 6) Safe Reinforcement Learning: Safe Reinforcement Learning (Safe RL) not only pursues the maximization of cumulative rewards during the reinforcement learning process, but also ensures that the agent's exploration and execution strategies meet specific safety constraints (such as latency requirements and resource limitations).
[0029] In view of this, embodiments of this application propose a method for training a task offloading agent based on differentiable secure projection, referring to... Figure 1 This includes the following steps: Step 101: Obtain the task sequence corresponding to each historical moment within the predetermined historical time period. The task sequence includes task data corresponding to each task to be uninstalled, and status data corresponding to each server used to execute the task.
[0030] In this step, the model is fragmented and distributed to multiple edge servers for collaborative inference using a pipelined parallel mechanism to overcome the resource constraints of a single device. Therefore, accurately determining the server to execute the offloaded task is crucial. Existing technologies are prone to issues such as memory overflow crashes, conservative agent exploration, and training oscillations. Therefore, this application proposes a task offloading agent training method based on differentiable safe projection. This application targets Industry 5.0 scenarios, where the memory requirements of LLM inference often exceed the physical limit of a single edge server, while also meeting stringent end-to-end latency service quality requirements. To address this, this application proposes the DSL-SafePPO (Differentiable Safety Layer-SafeProximal Policy Optimization) framework, which divides the dependency constraints of inference scheduling into two categories—instantaneous physical integrity (VRAM non-overflow) and task-level service reliability (latency SLA compliance), and handles them separately through a layered safe reinforcement learning mechanism.
[0031] First, the hardware and software deployment system and hardware entities at each level of this application are clearly defined, and the device scale is quantified using mathematical sets: The system architecture proposed in this application includes a set of terminal devices (TUs), a set of edge servers (ESs), a remote cloud server (CS), and a centralized task scheduling server (TSS). This represents a collection of N heterogeneous terminal devices, including robotic arms, automated guided vehicles (AGVs), and visual inspection cameras, etc. This represents a collection of M edge servers deployed near the terminal devices to provide low-latency computing services. The CS (Server Controller) has ample computing and storage resources, but is located far from the industrial site, resulting in significant transmission latency. The TSS (Control Plane) acts as the control plane, responsible for global status monitoring, task queue management, and the execution of scheduling algorithms.
[0032] Secondly, considering the actual working conditions of randomly assigned tasks in industrial settings, the arrival patterns of inference tasks are defined, and the core parameters such as load and timeliness of each task to be unloaded are quantified: In a dynamic production environment, terminal devices randomly generate inference requests using a Poisson process, with an arrival rate of... Each scheduling window aggregates... A number of concurrent unloading tasks, represented as Each task Formal definition by the following quadruple: ,in, The computational load of the pre-filling stage is determined by the length of the input prompt words; The number of iterations in the decoding phase is determined by the desired number of output tokens. This represents the maximum tolerable latency. This is the index for the source terminal device.
[0033] Finally, mathematical definitions are provided for the sharding rules, scheduling decision variables, and basic operational constraints of LLM distributed inference: The LLM model is based on the Transformer architecture and contains... Each decoding layer is logically divided into... Each partition is a sequential partition, and each partition is a separate partition. Packaging A series of Transformer layers, satisfying (1). The deployment strategy is determined by a binary decision matrix. It means that, among them, Indicates the first Each shard is deployed on an edge server. superior, Indicates the first One shard was not deployed on the edge server. Up. For tasks to be uninstalled. Scheduling decision variables Indicator fragments Is the computation assigned to the edge server? To ensure effective execution, scheduling decisions must satisfy deployment coupling constraints: (2), where k is the single inference task number, K is the set of all inference tasks, i is the model fragment number, S is the set of all fragments of the entire large model, j is the computing node number, and E is the set of all edge servers. This is the central server in the cloud. Inference computations corresponding to a model shard are only allowed to be allocated to this server for execution if the server has pre-deployed the corresponding model shard, thus preventing invalid scheduling due to lack of inference conditions and ensuring that all offloading decisions are physically executable. Furthermore, each shard must be processed by one and only one edge server. , (3).
[0034] This application takes into account the simultaneous reception of multiple unloading tasks and the different task processing capabilities of different servers. Therefore, it first acquires the task sequence corresponding to each historical moment within a predetermined historical time period. The task sequence includes task data corresponding to each unloading task and status data corresponding to each server used to execute the task. The task data consists of tasks generated by the terminal device based on actual needs, requiring the system to resolve them. For example, terminal devices such as visual inspection equipment, robotic arms, and maintenance terminals in industrial settings will generate large language model inference requests for tasks such as workpiece defect identification, equipment fault diagnosis, and equipment control command parsing, based on actual production and maintenance needs. These inference requests, along with associated input text, sequence length, latency requirements, and other relevant information, constitute the task data in this application. The status data characterizes the real-time operating status of each edge server. For example, the status data includes information such as the server's remaining video memory capacity, current workload, and wireless channel gain between the terminal and the server.
[0035] The task data corresponding to the task to be unloaded in this application also includes multiple subtasks corresponding to the task to be unloaded. The subtasks corresponding to the inference task to be unloaded are determined by the model sharding rules of the large language model. The overall large language model is based on the Transformer architecture and contains several decoding layers. All decoding layers are pre-divided into multiple consecutive layer groups, each layer group corresponding to a model shard. In a distributed collaborative inference scenario, a single inference task to be unloaded will naturally decompose into multiple subtasks along with the model shards. Each model shard, as an independent computing unit, is pre-deployed on one or more edge servers to obtain execution qualifications. Which server executes the subtask corresponding to the task to be unloaded is dynamically determined by the task unloading strategy output by the agent.
[0036] It should be noted that the task sequences within the predetermined historical time period can be based on actual needs, and the data source can be determined accordingly. To improve the adaptability of the agent, the task sequences within the predetermined historical time period can come from a predetermined smart factory.
[0037] Step 102: Based on the task sequence corresponding to each historical moment, perform multiple rounds of update operations on the pre-constructed initial agent, taking the first historical moment within the predetermined historical time period as the target moment. Each round of update operations is performed as follows: Using the initial agent, based on the task data and state data corresponding to the target moment, determine the task unloading strategy, wherein the task unloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be unloaded.
[0038] In this step, multiple rounds of updates are performed on the pre-built initial agent, transforming it from general-purpose capabilities to specific task-specific capabilities, thus compensating for any shortcomings. The task sequences corresponding to each historical moment exhibit temporal correlation, reflecting the dynamic changes in the tasks to be unloaded and the server's processing capabilities. Therefore, by performing multiple rounds of updates on the pre-built initial agent based on the task sequences corresponding to each historical moment, and by relying on the time-correlated task sequences for iterative updates, the dynamic evolution of on-site tasks and equipment states can be realistically reproduced. This allows the agent to adapt to actual scheduling scenarios through continuous learning, completing iterative optimization of its capabilities.
[0039] The first historical moment within a predetermined historical time period is taken as the target moment. Each round of update operations is performed as follows: Using the initial agent, a task unloading strategy is determined based on the task data and state data corresponding to the target moment. The task data and state data corresponding to the target moment are input into the initial agent, which determines the task unloading strategy. The task unloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be unloaded. For example, if a robotic arm instruction parsing task is divided into two subtasks, and there are two servers available for scheduling, the task unloading strategy determined by the agent is: the probability of the first subtask being assigned to one of the two servers is 0.8 and 0.2, and the probability of the second subtask being assigned to one of the two servers is 0.4 and 0.6. This application first generates the task unloading strategy based on the task and state data of the target moment through the initial agent. This not only allows the task unloading strategy to be obtained based on real historical conditions, fully preserving the agent's exploration distribution information, but also allows this original strategy to be used as a basis for subsequent DSL step-level constraint projection verification, filtering out allocation schemes that violate memory, deployment, and latency constraints.
[0040] This application models the model fragmentation, allocation, and scheduling problem of industrial cloud-edge collaborative large-scale inference as a tuple form: The constrained Markov decision process (CMDP) is defined as follows: S represents the state space, which is the set of all observable states of the system; A represents the action space, which is the set of all scheduling decisions that the agent can execute; P represents the state transition probability function, which is the probability distribution of the environment jumping to the next state after executing a scheduling action in the current state; r represents the immediate reward function, which is the optimization benefit obtained after executing the action and is used to guide the agent to learn better scheduling schemes; c represents the immediate cost function, which is the constraint violation cost caused by executing the action and is used to quantify the risk. This represents the discount factor, which is the decay weight of future rewards / costs.
[0041] Among them, the state space Defined as a four-dimensional composite vector: ,in, Encapsulate the metadata of the current batch of tasks (input / output length, deadline, source device index). This represents the real-time remaining VRAM of each server, a key input for the DSL. This indicates the current workload status of each server. This represents the dynamic wireless channel gain between the terminal device and the edge layer. Action Space. For a continuous uninstallation strategy, for each subtask and fragmentation The network outputs the probability vectors of each available server: (4) It should be noted that the original task unloading strategy may violate the VRAM physical integrity constraint (C3), and it needs to be projected to a feasible area by DSL before it can be actually executed.
[0042] Step 103: Based on the task unloading strategy, determine the decision vector corresponding to the task unloading strategy and the corrected decision vector.
[0043] In this step, to standardize the distributed and independent server allocation probabilities of each subtask into a unified computational input for subsequent constraint verification and projection correction calculations, it is necessary to first integrate and concatenate the overall decision vector based on the task unloading strategy. The decision vector is obtained by vectorizing and concatenating the first probability values of each subtask's corresponding server, serving as a standard numerical vector representing the task unloading strategy. This unprocessed original decision vector is merely the result of the agent's tentative output and cannot inherently guarantee compliance with the server's physical memory constraints. Direct execution of this vector could easily lead to memory overflow and crashes at edge nodes. Therefore, the decision vector needs to be corrected to obtain the corrected decision vector. By correcting the decision vector, the task unloading strategy with memory violation risks can be adjusted to a feasible range, ensuring that the corrected task unloading strategy meets the server's memory operating requirements while preserving the scheduling and allocation tendencies output by the agent in the original vector to the greatest extent possible.
[0044] Step 104: Based on the task unloading strategy, the server status data corresponding to the task unloading strategy, the decision vector, and the corrected decision vector, determine the initial update gradient of the initial agent, and perform gradient correction on the initial update gradient to obtain the target update gradient.
[0045] In this step, if the gradient is calculated solely based on the original task offloading strategy, the gradient cannot accurately reflect the task execution overhead and hardware bottlenecks in the actual scenario. This can cause the agent's learning direction to deviate from the real simulation conditions, resulting in a strategy with only theoretical advantages. In actual deployment, this can easily lead to problems such as excessive latency, high energy consumption, and server load imbalance. Therefore, based on the task offloading strategy, the server's state data corresponding to the task offloading strategy, the decision vector, and the corrected decision vector, the initial update gradient of the initial agent is determined, and gradient correction is performed on the initial update gradient to obtain the target update gradient. The initial update gradient is a set of values representing the original adjustment magnitude and direction of the agent's network parameters. The target update gradient is the set of values obtained after gradient correction of the initial update gradient. The gradient correction operation cancels out and suppresses gradient components in the initial update gradient that could cause the scheduling strategy to exceed the server's memory or the safe boundary of the probability distribution. This operation does not freeze the parameters to stop updating; it only weakens gradient directions that could cause constraint overflows, retaining effective gradients for optimizing inference efficiency, ensuring that parameter iteration always falls within a safe and feasible policy space.
[0046] By calculating the initial gradient based on multi-dimensional data and correcting it to obtain the target update gradient, the gradient value can be made to fit the real latency, energy consumption, and hardware load conditions. This accurately corrects the deviation between the original strategy and feasible constraints, and can subsequently guide the agent to iterate in the direction of low latency, low energy consumption, load balance and compliance with the hard constraints of memory. This ensures that the training strategy can be directly implemented and run stably, and improves the overall inference scheduling performance.
[0047] Step 105: Based on the target update gradient, update multiple parameters in the initial agent and determine whether the initial agent has converged.
[0048] In this step, multiple parameters of the initial agent are updated based on the target update gradient. Using the corrected target update gradient to update the parameters of the initial agent ensures that the direction of parameter iteration in each round aligns with the latency, energy consumption, and memory hardware constraints of real servers. This effectively avoids training oscillations caused by gradient bias and steadily guides the model towards optimization towards low latency, low energy consumption, load balancing, and policy compliance. Furthermore, it determines whether the initial agent has converged. Convergence determination of the initial agent accurately identifies nodes where model parameters and scheduling performance tend to stabilize. Iterative training is stopped promptly when the agent reaches the optimal allocation effect, avoiding meaningless continuous iterations that consume computational and time resources.
[0049] Step 1061: In response to determining that the initial agent has not converged, the updated initial agent is used as the initial agent in the next round of update operations, and the next time moment adjacent to the target time moment is used as the target time moment in the next round of update operations, and the next round of update operations is executed.
[0050] In this step, if the initial agent fails to converge, the updated initial agent becomes the initial agent for the next round of updates, the next adjacent time step is set as the new target time step, and a new round of updates is initiated. This iterative approach can progressively optimize the scheduling strategy, continuously adapt to dynamically fluctuating system conditions, gradually reduce the strategy error until the agent converges, and ultimately train a high-performance inference scheduling agent that can stably cope with time-varying tasks and hardware environments while taking into account latency and energy consumption constraints.
[0051] Step 1062: In response to determining that the initial agent has converged, the initial agent is identified as the target agent, and at least one round of update operation is exited.
[0052] In this step, when it is determined that the initial agent has converged, the agent is directly designated as a usable target agent and the iterative update process is terminated. This convergence determination mechanism can terminate redundant iterations in a timely manner, saving training computing power and time costs. The converged agent's policy is stable and meets various scheduling constraints, and can be directly deployed and used, avoiding policy oscillations caused by excessive iteration.
[0053] The reward function of the agent in this application has no penalty term. It adopts a restricted reinforcement learning approach with safe gradient backpropagation, which differs from traditional high-value scalar penalty schemes. During backpropagation, it corrects the original gradient through null space projection, filtering gradient components that are prone to resource overflow. This provides precise geometric boundary guidance for the policy network, breaking the performance bottleneck caused by the traditional huge scalar penalty mechanism, which leads to the agent becoming "more conservative the safer it is." While avoiding ineffective trial and error, it significantly improves the efficiency of policy exploration and the convergence stability of multi-objective joint optimization. This application avoids overly pessimistic allocation of edge computing resources. While strictly guaranteeing the task queuing latency SLA, it releases locked idle computing power, further reducing the overall system latency and energy consumption.
[0054] The above scheme obtains the task sequence corresponding to each historical moment within a predetermined historical time period. The task sequence includes task data for each task to be unloaded and state data for each server executing the task. Based on the task sequence corresponding to each historical moment, multiple rounds of update operations are performed on the pre-constructed initial agent. Multiple rounds of iterative updates are carried out based on the time-series task sequence with temporal correlation characteristics, which can realistically reproduce the dynamic evolution of on-site tasks and equipment states, allowing the agent to adapt to actual scheduling scenarios through continuous learning and complete iterative optimization of capabilities. The first historical moment within the predetermined historical time period is taken as the target moment. Each round of update operations is performed as follows: Using the initial agent, based on the task data and state data corresponding to the target moment, a task unloading strategy is determined. The task unloading strategy includes a first probability value for at least one server corresponding to each subtask within each task to be unloaded. The task unloading strategy is obtained based on real historical conditions, fully preserving the agent's exploration distribution information. Based on the task offloading strategy, the decision vector corresponding to the task offloading strategy and the modified decision vector are determined. On the one hand, the distributed and independent sub-task server allocation probabilities are unified and standardized into standardized computational inputs. On the other hand, the task offloading strategy with the risk of memory violation can be adjusted to a feasible range, ensuring that the modified task offloading strategy meets the server's memory operation requirements, while preserving the scheduling and allocation tendency of the agent output in the original vector to the greatest extent. Based on the task offloading strategy, the server state data corresponding to the task offloading strategy, the decision vector, and the modified decision vector, the initial update gradient of the initial agent is determined, and the initial update gradient is modified to obtain the target update gradient. This allows the gradient value to closely match the real latency, energy consumption, and hardware load conditions, accurately correcting the deviation between the original strategy and feasible constraints. Based on the target update gradient, multiple parameters in the initial agent are updated, ensuring that the parameter iteration direction in each round closely matches the real server latency, energy consumption, and memory hardware constraints. This effectively avoids the training oscillation problem caused by gradient deviation and steadily guides the model towards optimization towards low latency, low energy consumption, load balancing, and policy compliance. The system determines whether the initial agent has converged, accurately identifying nodes where model parameters and scheduling performance are stabilizing. It stops iterative training promptly when the agent reaches optimal allocation, avoiding meaningless continuous iterations that waste computational and time resources. In response to the determination that the initial agent has not converged, the updated initial agent is used as the initial agent in the next round of update operations, and the next time step adjacent to the target time step is used as the target time step in the next round of update operations. This iterative approach gradually optimizes the scheduling strategy, continuously adapts to dynamically fluctuating system conditions, and gradually reduces strategy errors until the agent converges.In response to the determination that the initial agent has converged, the initial agent is identified as the target agent, and at least one round of update operation is exited. This convergence determination mechanism can terminate redundant iterations in a timely manner, saving training computing power and time costs. The converged agent's policy is stable and meets various scheduling constraints, and can be directly deployed and used, avoiding policy oscillations caused by excessive iteration and improving the reliability of the task offloading policy determined by the agent.
[0055] In some embodiments, determining the decision vector and the modified decision vector corresponding to the task unloading strategy based on the task unloading strategy includes: for each subtask within each task to be unloaded, vectorizing and concatenating the first probability values of at least one server corresponding to the subtask to obtain a first concatenated vector; concatenating all the first concatenated vectors corresponding to the task to be unloaded to obtain a second concatenated vector; concatenating all the second concatenated vectors corresponding to the tasks to be unloaded to obtain the decision vector; constructing a modified objective function with the objective of minimizing the Euclidean squared distance between the modified decision vector and the decision vector, and constructing a first constraint condition corresponding to the modified objective function; and solving the modified objective function based on the first constraint condition to obtain the modified decision vector.
[0056] In this embodiment, the task unloading strategy is flattened and concatenated into a decision vector. ,in, Let be the decision vector. Let D be the real vector space. Therefore, for each subtask within each task to be uninstalled, the first probability value of at least one server corresponding to the subtask is vectorized and concatenated to obtain the first concatenated vector corresponding to the subtask; all the first concatenated vectors corresponding to the tasks to be uninstalled are concatenated to obtain the second concatenated vector; and all the second concatenated vectors corresponding to the tasks to be uninstalled are concatenated to obtain the decision vector. It should be noted that, following the predetermined order of the first probability values in the task uninstallation strategy, the first probability values corresponding to all tasks to be uninstalled are sequentially and orderly vectorized and concatenated, preserving the correspondence and arrangement logic of the probability data in the original uninstallation strategy, avoiding data corruption, and simultaneously organizing the scattered probability information into a standard vector format.
[0057] The objective function for modification is constructed with the goal of minimizing the Euclidean squared distance between the modified decision vector and the original decision vector, along with the corresponding first constraint. The goal of the differentiable security layer is to find the physically secure vector closest to the original output within the feasible memory region. The objective function for modification is determined by the following formula: (5), among which, The optimal safety correction decision vector is the final output of formula (5) that satisfies the constraints. To optimize the variables, the safety correction decision vector to be solved is... This represents half the Euclidean squared distance. Adding half serves only to eliminate coefficients through differentiation; it does not change the location of the minimum value. The optimization objective is to make the corrected distance... As close as possible to the original allocation strategy, This indicates traversing all valid [legal] entries. Find the optimal solution that minimizes the distance.
[0058] The first constraint of the correction function includes physical integrity constraints, simplex constraints, and nonnegativity probability constraints. Physical integrity constraints control the upper limits of hardware resources such as memory and computing power on each server, ensuring that the allocated load does not exceed the device's capacity limit and preventing hardware overload and crashes. Physical integrity constraints are determined by the following formula: (6), where the mapping transformation matrix This represents mapping each decision variable to its corresponding memory consumption on the edge server. The mapping transformation matrix has dimensions of M rows and D columns, where M is the total number of edge servers and D is the total dimension of the decision vector. Let be an M×D dimensional real vector space. The mapping transformation matrix is used to optimize variables. The estimated memory usage for each server is calculated, converting scheduling probability into memory usage. Each element in this mapping matrix represents the memory consumption of a subtask on a corresponding edge server when that subtask is scheduled to run. (Vector) This indicates the real-time remaining VRAM of each server (from state at each step). renew), Let be an M-dimensional real vector space. The result of multiplying the mapping transformation matrix with the optimization variables is an M-dimensional column vector. Each element in this M-dimensional column vector corresponds to the total estimated memory usage of a single edge server under the current scheduling probability. Each element in the algorithm represents the current real-time available GPU memory limit of the corresponding server, which is dynamically updated based on the server's operating status. By limiting the GPU memory load of all servers to the real-time available GPU memory limit, it avoids GPU memory overflow and hardware overload crashes on a single server, ensuring that the task scheduling scheme can be implemented at the physical hardware level. Existing technologies ignore the fact that the two-stage GPU memory peaks in large model inference will not occur simultaneously, and directly reserve GPU memory based on the sum of the "pre-fill peak and the decoding peak". This resource allocation is overly conservative and pessimistic, resulting in a large amount of GPU memory being idle and locked for a long time, wasting computing power, and causing high system latency and energy consumption. This application utilizes the mutual exclusion characteristic of the two-stage GPU memory peak timing to dynamically calculate the actual GPU memory limit that the server can support. This provides a more accurate memory threshold for physical integrity constraints, reducing resource waste from the source of resource measurement.
[0059] Each element represents the current real-time remaining available video memory limit of the corresponding server, determined as follows: For each server, all running sub-tasks are counted one by one. The peak value of the dynamic video memory corresponding to each sub-task is obtained, for example, the peak value of dynamic inference video memory or the peak value of transient activation video memory. All peak values corresponding to the server are summed to obtain the total dynamic video memory of the entire machine. Then, the corresponding static video memory of the server is added to obtain the current total video memory usage of the server. The current real-time remaining available video memory limit is obtained by subtracting the current total video memory usage from the actual physical video memory limit of the server.
[0060] This application takes the peak value of dynamic video memory as the video memory requirement for a single task, adds the dynamic usage of all tasks, and then adds the fixed video memory usage to ensure that the total video memory usage does not exceed the physical video memory limit of the server GPU. Based on this calculation logic, the remaining available video memory threshold of each server is obtained in real time, which serves as the hardware constraint boundary of the differentiable safety layer, thus preventing video memory overflow failures from the source.
[0061] The limitation of GPU memory on edge servers is a core source of availability risk for LLM inference. Any scheduling decision that causes VRAM consumption to exceed the hardware limit will immediately trigger a memory overflow process termination—a hard availability failure that cannot be recovered within the current scheduling window. The total physical GPU memory capacity on edge servers is divided into fixed memory and dynamic memory. Static model weight memory and background memory are fixed memory, while dynamic inference memory and transient activation value memory are dynamic memory. Fixed memory is permanently occupied by the GPU after the partitioning is completed and the system boots up. Regardless of whether any inference tasks are running, this memory cannot be released for inference use; it is a fixed hardware overhead. Dynamic memory is occupied only during task execution and is released immediately after the task ends. Large language model inference is divided into two sequential stages: pre-filling and decoding. The peak value of transient activation value in video memory only occurs in the pre-filling stage, while the peak value of dynamic inference video memory only occurs in the decoding stage. The two types of peak values will not occur at the same time. Based on this, this application uses the exclusive characteristic of the timing to reuse video memory. Instead of accumulating the video memory usage of the two types, the maximum value of the two is taken as the dynamic video memory overhead of a single task. This avoids the overly pessimistic resource reservation method of traditional solutions, effectively reduces video memory usage, releases idle computing power, and makes the calculation results of the remaining available video memory of the server more consistent with the actual load.
[0062] server Video memory usage It consists of the following four components: (1) Static model weight memory The proportion of model parameters remains unchanged after fragmented deployment, determined by the deployment decision. Decide: (7) in, Indicates server The static model weights' memory usage =1 indicates fragmentation. Deployed on server , =0 indicates fragmentation. Not deployed on the server , For fragmentation The number of parameters, S represents the number of bytes (precision) for each parameter, and S represents the total number of model slices.
[0063] (2) Dynamic reasoning memory To avoid redundant computation of the attention mechanism during the decoding phase, the key-value matrix of historical tokens is cached in VRAM. This part grows linearly with the sequence length and batch size, and is a major driver of runtime OOM (Out of Memory) failures during concurrent task execution. (8) in, Indicates server Dynamic KV Cache memory usage on the device. The variable is identified by 0-1; task k uses the server. On the fragment The value is set to 1 if the data is active and 0 if it is not used. This is used to determine whether the data segment participates in the KVCache calculation of the current task. For fragmentation The corresponding number of Transformer layers corresponds to the number of multi-head attention heads in the Transformer within the corresponding slice. Indicates the current allocation to the server. The set of concurrent requests to be processed. The hidden layer dimension of the Transformer model is represented by the coefficient 2, which represents the two matrices: Key and Value. The maximum context window required for the task. To input the length of the prompt word, The length of the generated output token.
[0064] (3) Transient activation value memory The intermediate activation tensors generated during forward propagation, especially during the pre-padding stage of long input sequences, consume a significant amount of GPU memory. The peak activation memory is approximately: (9) in, Indicates server The peak transient activation value of the video memory usage.
[0065] (4) Background video memory Represents edge server The above represents background video memory usage reserved by the operating system and other resident processes; this portion is unavailable for LLM inference tasks.
[0066] To ensure system-level physical integrity, and considering that peak active memory occurs during the pre-filling phase while peak KV cache occurs at the end of the generation phase, and that these two events do not occur simultaneously for a single task, a memory reuse mechanism is introduced to allocate memory for tasks. On the server Effective dynamic video memory usage Defined as the maximum demand in two phases: (10) Therefore, the physical integrity boundary is formalized as a zero-tolerance constraint that must be satisfied at every decision step: (11) in, Indicates server The physical VRAM capacity limit.
[0067] The simplex constraint ensures that the sum of probabilities of each subtask being assigned to all servers is strictly equal to 1, which conforms to the mathematical definition of probability distribution and guarantees the logical consistency of task partitioning. The simplex constraint is determined by the following formula: (12), among which, To calculate the coefficient matrix for grouping and summing, To optimize variables, Let b be a constant vector, for example, b = 1. The dimension of the grouped summation coefficient matrix matches the optimization variable a, and its purpose is to extract and sum the probabilities of assigning a single subtask to all servers. Equality constraints. Ensure that the sum of the unloading probabilities for each task-shard pair is 1. The non-negativity probability constraint restricts all allocation probability values to be non-negative, ensuring that probabilities do not have negative values, thus adhering to the mathematical range of probability itself. The non-negativity probability constraint is determined by the following formula: , (13).
[0068] Based on the first constraint, the corrected objective function is solved to obtain the corrected decision vector. Relying on the first constraint, which consists of physical integrity constraints, simplex constraints, and non-negative probability constraints, quadratic programming is performed on the corrected objective function, which focuses on minimizing the Euclidean distance between the decision vectors before and after correction, to output the corrected decision vector. Traditional secure reinforcement learning relies solely on post-hoc scalar penalties, which cannot intercept instantaneous memory overruns in advance, easily leading to server OOM crashes. Furthermore, high penalties can paralyze agent exploration, cause overly conservative scheduling strategies, and result in low throughput. This application, through constrained vector correction, forcibly corrects illegal allocation schemes before the scheduling strategy is issued, eliminating the risk of hardware downtime at the decision level. Simultaneously, without high penalties, the agent can fully explore efficient scheduling schemes close to the memory limit.
[0069] This invention addresses the stringent physical limitations of instantaneous GPU memory in collaborative reasoning of large language models in the Industrial Internet of Things (IIoT). It innovatively embeds a differentiable security layer (DSL) at the output of the reinforcement learning policy network. The DSL is directly embedded in the action pipeline of the policy network, serving as an unavoidable security enforcement layer to ensure that every action distributed to the environment is physically safe before execution. This differentiable security layer is a differentiable convex quadratic programming correction module. It receives the original, uncorrected decision vector output by the policy network and uses dynamic memory reuse to evaluate the real-time remaining GPU memory of each server as a hardware threshold. It integrates physical integrity constraints, simplex constraints, and non-negative probability constraints to construct a convex quadratic programming optimization problem, thereby establishing a physical safety authentication mechanism before execution. This mechanism utilizes forward quadratic programming (QP) projection to solve for the corrected decision vector that is closest to the original output within the memory-safe feasible region, completing the absolute physical safety verification before the action is issued. At the same time, it relies on inverse KKT conditions (Karush-Kuhn-Tucker Conditions, representing the necessary and sufficient conditions that the optimal solution of a convex optimization problem must satisfy) and null gradient projection to filter dangerous gradients, achieving end-to-end differentiable backpropagation of gradients. This guides the policy network to internalize the physical safety boundary from a geometric perspective, completely eliminating the memory overflow (OOM) downtime risk caused by blind exploration and reliance solely on expected penalties in traditional secure reinforcement learning. It achieves 100% hardware-level physical safety, fully meeting the hard requirements of high system availability in industrial IoT scenarios.
[0070] The agent design in this application incorporates a differentiable security layer (DSL). The DSL performs different objectives in the forward and backward propagation phases: during the forward propagation phase, the original policy output is projected onto the feasible set of VRAM using convex quadratic programming (QP), providing a provable zero-fault guarantee for OOM; during the backward propagation phase, the gradient is backpropagated to the Actor network (policy network) using implicit differentiation based on KKT conditions, ensuring end-to-end trainability.
[0071] In some embodiments, determining the initial update gradient of the initial agent based on the task offloading strategy, the state data of the server corresponding to the task offloading strategy, the decision vector, and the corrected decision vector, and performing gradient correction on the initial update gradient to obtain the target update gradient includes: mapping and transforming the corrected decision vector to obtain a corrected task offloading strategy; simulating and executing the corrected task offloading strategy to obtain latency data, energy consumption data, and simulated task execution data and update status data of multiple servers corresponding to the corrected task offloading strategy; determining the initial update gradient based on the latency data and energy consumption data of each server, the simulated task execution data, state data, and update status data of the multiple servers, and the corrected task offloading strategy; and determining the target update gradient based on the decision vector, the corrected decision vector, and the initial update gradient.
[0072] In this embodiment, the modified decision vector is mapped and transformed to obtain the modified task unloading strategy. The mapping and transformation is the inverse operation of flattening and splicing. The DSL (forward propagation phase) projects the decision vector onto the feasible region of the VRAM to obtain the certified safe action, i.e., the modified decision vector. The constraint-aware greedy allocation strategy is mapped to discrete execution actions, i.e., the modified task unloading strategy. The original task unloading strategy arranges the tasks to be unloaded, the subtasks under each task, and the first probability corresponding to multiple edge servers for each subtask in a fixed order. Flattening and integrating in this order yields a one-dimensional original decision vector. After solving the quadratic programming problem to output the modified one-dimensional vector, it is necessary to match the original sorting and reverse restore the strategy structure. The strategy is then decomposed layer by layer to restore all the tasks to be unloaded, all the subtasks within each task to be unloaded, and the second probability corresponding to each edge server for each subtask, finally obtaining the modified task unloading strategy.
[0073] For example, there are two tasks T1 and T2 to be unloaded, each containing a subtask. T1 corresponds to subtask S1, and T2 corresponds to subtask S2. The cluster has two edge servers, Server1 and Server2. The original hierarchical first probabilities are as follows: T1-S1 is assigned to Server1 with a probability of 0.7, T1-S1 is assigned to Server2 with a probability of 0.3, T2-S2 is assigned to Server1 with a probability of 0.8, and T2-S2 is assigned to Server2 with a probability of 0.2. Flattening and integrating them according to the fixed order of "task to be unloaded - subtask - server" yields a one-dimensional original decision vector [0.7, 0.3, 0.8, 0.2]. After obtaining the corrected one-dimensional vector [0.65, 0.35, 0.72, 0.28] through quadratic programming, the vector is split in reverse order using the previously unified arrangement. The first two values are restored to the second probability of the two servers corresponding to subtask S1 of task T1, and the last two values are restored to the second probability of the two servers corresponding to subtask S2 of task T2. The hierarchical probability structure is restored layer by layer, and finally the compliant and corrected task unloading strategy is obtained.
[0074] The revised task offloading strategy is simulated and executed to obtain latency and energy consumption data for each server, as well as simulated task execution data and update status data for multiple servers. After the simulation execution, the trajectory data is stored in the experience replay buffer. The trajectory data is a complete time-series sample unit generated by a single interaction between the intelligent agent and the industrial IoT edge environment. The trajectory data includes at least latency and energy consumption data for each server, as well as simulated task execution data and update status data for multiple servers. Simulating the revised task offloading strategy and collecting latency, energy consumption, task execution, and device status data for each server allows for direct verification of the strategy's effectiveness and accurate understanding of server load and resource utilization.
[0075] Based on latency and energy consumption data for each server, simulation task execution data, status data, and update status data from multiple servers, and the revised task offloading strategy, the initial update gradient is determined. The reward function is constructed based on latency and energy consumption data, while the cost function is obtained by statistically analyzing latency violations based on task execution data. These various data points collectively reflect the operational effectiveness and constraint compliance status of the current offloading strategy in the actual scenario. Calculating the initial update gradient using this data allows for accurate evaluation of the overall strategy performance and the generation of a gradient that closely reflects the actual operational patterns. Then, the target update gradient is solved based on the original decision vector, the revised safety decision vector, and the initial update gradient. The original decision vector is the unconstrained scheduling action directly output by the Actor network, while the revised decision vector is a feasible action that has undergone secondary planning constraint calibration and conforms to hardware and probability rules. By performing null-space projection correction on the initial update gradient based on the constraint mapping relationship of two sets of vectors, the target update gradient can be obtained. This not only preserves the original trend of optimizing latency and energy consumption performance, but also suppresses and cancels harmful gradient components that may drive the strategy to exceed the server memory and probability distribution safety constraints. This allows the final update direction given to the Actor network to take into account both scheduling performance improvement and hardware operation safety, and steadily promotes the network's autonomous learning and compliant offloading strategy.
[0076] In some embodiments, determining the initial update gradient based on latency data and energy consumption data of each server, simulation task execution data, status data, and update status data of the plurality of servers, and the modified task offloading strategy includes: determining the current expected value of security advantage based on latency data and energy consumption data of each server and simulation task execution data, status data, and update status data of the plurality of servers; in response to determining that the current round of update operation is not the first round of update operation, obtaining the modified task offloading strategy corresponding to the previous round of update operation adjacent to the current round of update operation, and using the modified task offloading strategy corresponding to the previous round of update operation as the comparison task offloading strategy; in response to determining that the current round of update operation is the first round of update operation, using the predetermined task offloading strategy as the comparison task offloading strategy; constructing an update objective function based on the current expected value of security advantage, the modified task offloading strategy, and the comparison task offloading strategy, with the goal of maximizing the theoretical expected value of security advantage, and constructing a second constraint condition corresponding to the update objective function; and determining the initial update gradient based on the second constraint condition and the update objective function.
[0077] In this embodiment, based on the latency data, energy consumption data, and simulation task execution data, status data, and update status data of each server, the current expected value of the security advantage is determined. This current expected value characterizes the overall performance level of the current batch task offloading strategy across multiple dimensions, integrating latency, energy consumption scheduling performance, and latency constraint compliance. It quantifies the balance between the optimization benefits of the current strategy and the losses from constraint violations. Calculating the current expected value of the security advantage based on server latency, energy consumption, task execution, and status update data integrates scheduling performance and latency violation levels into a unified quantitative standard, providing a clear and intuitive measurement of the overall effect of the current offloading strategy. This ensures that the agent iteration balances the two objectives of reducing power consumption and latency while adhering to latency constraints.
[0078] If the current update operation is not the first update operation, it indicates that a modified task offloading strategy already exists corresponding to a previous update operation. The previous update operation is the one immediately preceding the current update operation. This modified task offloading strategy is used as the comparison task offloading strategy. It serves as the old strategy benchmark in the PPO optimization framework, used to calculate the ratio of the probability of actions under the new and old strategies, constrain the adjustment range of network parameters in this round, prevent large fluctuations in a single iteration of the strategy, and ensure steady optimization of scheduling performance and smooth convergence during training. If the current update operation is the first update operation, it indicates that no modified task offloading strategy exists corresponding to a previous update operation. A predetermined task offloading strategy is used as the comparison task offloading strategy, serving as the initial old strategy benchmark for PPO optimization. This completes the calculation of the probability ratio of the new and old strategies in the first round, successfully initiating the first round of agent network parameter iteration updates. The predetermined task offloading strategy is determined based on historical experience.
[0079] Based on the current expected value of the security advantage, a revised task unloading strategy and a comparative task unloading strategy are used to construct an update objective function with the goal of maximizing the theoretical expected value of the security advantage. A second constraint condition corresponding to the update objective function is also constructed. Actor parameters. The update objective function is determined by maximizing the PPO-Clip objective function, and is specified by the following formula: (14) in, This represents the pruned PPO policy update loss function with security advantage terms and entropy regularization, used to update the parameters of the policy network (Actor network). It balances scheduling rewards, memory safety constraints, and strategy exploration capabilities. This indicates a batch aggregation operation. First, it calculates the probability ratio weighting and pruning to obtain the minimum value based on the security advantage of each sample. Then, it calculates the mean of the calculation results of all samples to obtain the current expected value of the security advantage. This represents the probability ratio between the old and new strategies. This indicates the revised task unloading strategy, the current strategy to be optimized, network output, and input environment state. Output scheduling action The probability, This indicates the task unloading strategy for comparison. The safety advantage function, unlike the ordinary PPO advantage function, integrates scheduling reward benefits and SLA latency costs to guide strategies to meet long-term service reliability constraints. The hard constraints of memory are not included as penalty terms in the safety advantage function, but are implemented through quadratic programming projection in the differentiable safety layer and KKT null gradient projection in the forward and backward propagation stages of the action, respectively. This indicates a clipping operation, which compares the probability to... Forced to be limited to the range [ [Within], to prevent training oscillations caused by excessively large single policy updates. This represents the core mechanism of PPO pruning, which is to construct a conservative lower bound by taking the smaller of the original probability ratio weighted advantage and the post-pruning probability ratio weighted advantage, thus only slightly optimizing the strategy and avoiding large gradient updates that could disrupt scheduling stability. To trim hyperparameters, Entropy is used to encourage exploration.
[0080] A second constraint is constructed corresponding to the update objective function. This second constraint defines the feasible range of policy optimization. On the one hand, it controls the overall system latency violation rate to ensure task service quality; on the other hand, it limits the value range of the Lagrange multiplier to avoid training oscillations caused by multiplier anomalies. The second constraint is integrated into the safety advantage calculation through the Lagrange relaxation mechanism, indirectly affecting the construction and solution of the update objective function. The policy network parameters must be iteratively updated under the constraints of the second constraint. The second constraint corresponding to the update objective function includes SLA latency violation constraints and Lagrange multiplier value constraints. The SLA latency violation constraint determines the violation level of the current round, and the Lagrange multiplier value constraint locks in a reasonable range of penalty coefficients. Together, they determine the magnitude of the single-step safety advantage. The update objective function is guided by maximizing the theoretical expected value of the safety advantage. The constraint's adjustment of the penalty intensity is transmitted to the policy gradient update through the safety advantage, ultimately achieving policy optimization that simultaneously considers performance gains and SLA compliance requirements. The SLA latency violation constraint is determined by the following formula: (15), among which, For strategy The corresponding expected cost of long-term latency violation represents the current task offloading strategy. Under continuous scheduling, the average cumulative cost of SLA latency exceeding the limit for all inference tasks quantifies the severity of overall system latency violations. A higher value indicates a higher proportion of tasks failing to meet latency standards and a worse level of service compliance. Based on simulation task execution data from multiple servers, the expected cost of the aforementioned long-term latency violations is determined. Set a compliance and violation threshold for the system. SLA latency violation constraints rely on formula (15) to control the proportion of long-term task timeout violations, so as to avoid a large number of tasks exceeding the service quality standard.
[0081] Lagrange multiplier value constraints rely on clipping intervals Limiting the range of penalty coefficients prevents the penalty intensity from expanding without limit or resulting in negative and invalid penalties; penalty multipliers. By employing a PID controller (Proportional-Integral-Derivative controller), dynamic closed-loop adjustment is achieved based on the violation error. The proportional term provides rapid response to real-time violations, the integral term eliminates long-term steady-state deviations, and the derivative term suppresses regulatory oscillations, thus achieving full-range closed-loop SLA compliance control. The violation error is determined using the following formula: (16), among which, This represents the average latency violation cost corresponding to the k-th round of update operations. The expected global average latency violation cost, statistically obtained after the simulation of the corrected task offloading strategy in this round, characterizes the severity of the overall latency exceeding the limit under the current strategy and is the actual feedback observation value of the PID controller.
[0082] The design uses the current expected value of the security advantage obtained from this round of sample statistics as an approximate estimate, and aims to maximize the theoretical expected value of the global security advantage. It introduces the probability ratio of the old and new policies, combined with a pruning interval to limit the magnitude of single parameter updates, avoiding drastic fluctuations and training crashes in single iterations. An additional entropy regularization term is added to maintain the agent's ability to explore multi-server offloading schemes. Here, the current expected value of the security advantage is the result of a single-step sample... Based on the empirical mean of this batch, the theoretical expectation of the security advantage is the true expectation under the long-term trajectory distribution of the strategy; the two represent the estimation relationship between sample approximation and the global optimal objective. SLA delay violation constraints and Lagrange multiplier value constraints are jointly controlled. , , Directly change single step The numerical constraints and the resulting compliance penalties are transmitted to the policy gradient update through security advantages, allowing the policy to automatically meet SLA service compliance restrictions while optimizing latency and energy consumption performance gains. This balances training stability, scenario exploration, and scheduling compliance. The PPO-Clip update objective function uses a pruning mechanism to constrain the fluctuation range of the probability ratio between the old and new policies, preventing scheduling policy collapse caused by a single gradient update. An entropy term preserves the exploration space for task offloading actions, and the current expected value of the security advantage obtained from this round of sampling is used to approximately fit the theoretical expected value of the global security advantage for iterative optimization. The second constraint adjusts the penalty parameters to change the scoring result of the single-step security advantage and indirectly affects the policy update. The entire design can stably improve the overall performance gains in latency and energy consumption under multi-server offloading scenarios, and rely on SLA latency violation constraints and multiplier value constraints to close the loop and control the task timeout ratio, balancing training convergence stability, environment exploration capabilities, and service quality compliance.
[0083] Based on the second constraint and the update objective function, the initial update gradient is determined. Specifically, the current expected value of the security advantage is adjusted using the second constraint, and the adjusted expected value of the security advantage is loaded into the update objective function for differentiation and solution to obtain the initial update gradient. This method only corrects the security advantage input through the second constraint without changing the structure of the PPO objective function, reducing the computational overhead of gradient differentiation, and achieving hierarchical decoupling between the SLA statistical soft constraint and the hardware hard constraint of memory and probability allocation. The two types of constraints can be independently tuned and optimized.
[0084] This invention proposes a hierarchical security reinforcement learning framework—the Differentiable Security Layer Proximal Policy Optimization Algorithm (DSL-SafePPO). This algorithm is deployed on a task scheduling server, acting as an agent to interact with the IIoT environment. The core design concept of the framework is hierarchical decoupling based on the temporal coercive granularity of two types of reliability constraints: for task-level service reliability (latency SLA compliance), a PID-Lagrange closed-loop regulator is used for statistical constraints; for instantaneous physical integrity (VRAM non-overflow), a differentiable security layer (DSL) is embedded in the action pipeline of the policy network, providing a formalized VRAM zero-overflow guarantee for each step through convex quadratic programming (QP) projection.
[0085] In some embodiments, determining the current expected value of the security advantage based on the latency data, energy consumption data, and simulation task execution data, status data, and update status data of each server includes: constructing a reward objective function with the goal of maximizing the negative weighted sum of the total latency and total energy consumption corresponding to all tasks to be unloaded, and using the reward objective function to determine the batch instant reward value of the current update operation; constructing a cost function based on the simulation task execution data of the multiple servers, and using the cost function to determine the batch, i.e., era value, of the current update operation; and inputting the status data and update status data of the multiple servers into a reward evaluation network to obtain the expected value of the security advantage. The system calculates a first reward value corresponding to the current state data and a second reward value corresponding to the updated state data. Based on the batch-instant reward value, the first reward value, and the second reward value, a reward advantage value is determined. The system inputs the state data and updated state data of the multiple servers into a cost evaluation network to obtain a first-generation value corresponding to the current state data and a second-generation value corresponding to the updated state data. Based on the batch-instant value, the first-generation value, and the second-generation value, a cost advantage value is determined. Based on the reward advantage value, the cost advantage value, and the simulation task execution data of the multiple servers, the current expected value of the security advantage is determined.
[0086] In this embodiment, the reward function guides the agent to optimize system efficiency. It should be noted that the reward function of the agent in this application does not include a fixed scalar penalty term. Instead, it introduces a cost function, a dynamic penalty multiplier, a PID-Lagrange multiplier, and the penalty intensity from the safety advantage. The reward function of the agent in this application only represents the positive scheduling gains corresponding to latency and energy consumption, without setting a penalty term. This isolates performance gains from constraint losses and avoids training oscillations caused by fixed penalty weights. The agent in this application no longer relies on the built-in penalty in the reward function. Instead, it uses the Lagrange penalty multiplier updated in real time by the PID controller as a dynamic penalty coefficient. It calculates the latency violation loss by combining the SLA latency compliance error of each iteration and integrates this loss into the safety advantage function. The safety advantage then carries the adaptive penalty effect, replacing the penalty term in the traditional reward function. This dynamically balances scheduling performance and latency compliance constraints during the policy update phase.
[0087] The intelligent agent iteratively updates the policy network with the goal of maximizing the expected value of long-term cumulative rewards. The reward objective function is constructed with the goal of maximizing the negative weighted sum of the total latency and total energy consumption of all tasks to be unloaded. The reward function is constructed by taking the negative weighted sum of the total latency and total energy consumption, and the optimization goal of reducing latency and energy consumption is transformed into the standard form of maximizing rewards through reinforcement learning, which is in line with the actual business scheduling requirements. The total latency and total energy consumption data of all tasks to be unloaded in this round of simulation are collected and substituted into formula (17) to calculate the batch instant reward value. The two different dimensions of latency and energy consumption are converted into evaluation scores of a unified standard, which can be used to compare the advantages and disadvantages of different scheduling schemes horizontally. The numerical calculation rule of the reward objective function is defined as the negative weighted sum of the normalized latency and energy consumption of the current batch of tasks, which is determined by the following formula: (17) in, The batch instant reward value corresponding to the target time t. This is a collection of tasks to be uninstalled. For delay weight hyperparameter, The total execution latency for completing the inference for the k-th task is This is the energy consumption weighting hyperparameter. The total energy consumption of the server corresponding to the execution of the k-th task. It is the weighted sum of latency and energy consumption losses. Adding a negative sign indicates that the smaller the loss, the higher the reward. The larger the value, the more the business objective of "reducing latency and reducing power consumption" is transformed into a standard optimization form for maximizing rewards through reinforcement learning. The immediate reward of a single update operation is solved round by round by formula (17). The cumulative immediate rewards of all batches form the long-term cumulative reward of the reward objective function. The agent iteratively updates the policy network with the expectation of maximizing this cumulative reward as the optimization direction.
[0088] Based on simulation task execution data from multiple servers, a cost function is constructed. The cost function serves as the feedback signal of the latency reliability constraint (C4), quantifying the instantaneous rate of deadline exceedance. The cost function is determined using the following formula: (18) in, For the cost of instantaneous latency, This represents an indicator function (step function). If the condition inside the parentheses is true, then I is 1; if the condition inside the parentheses is false, then I is 0. The total execution latency for completing inference for the k-th task is obtained from simulation task execution data across multiple servers. The maximum allowable latency (SLA cutoff threshold) is specified for the k-th task. The sum of the indication values for all tasks is then divided by the total number of tasks to obtain the instantaneous latency violation rate for this batch, which serves as a quantitative feedback signal for latency compliance constraints.
[0089] This application constructs a cost function based on multi-server simulation task execution data, using it as a quantitative feedback signal for latency reliability constraints. By statistically analyzing the proportion of timeout tasks in the current batch, it intuitively quantifies the instantaneous percentage of task deadlines exceeding the deadline. This not only accurately quantifies the severity of scheduling scheme violations of latency constraints, providing a calculable numerical basis for the second constraint, but also provides real-time feedback on task timeout risks. This facilitates the application of penalty terms in the safety advantage calculation to guide the agent to avoid timeout unloading strategies, thus stably ensuring the system's latency reliability indicators. The cost function is used to determine the batch / era value of the current update operation. Specifically, the actual execution latency of all tasks in this round of multi-server simulation and the maximum allowable deadline latency of each task are collected. An indicator function is used to determine whether a single task has timed out. The total number of timeout tasks in this batch is counted, and then divided by the total number of tasks in the batch to obtain the batch / era value corresponding to the current update operation. This quantifies the task timeout ratio of this round of scheduling scheme. By calculating the batch-time value based on this cost function, the overall proportion of task timeouts within a single scheduling batch can be uniformly quantified, accurately reflecting the degree of violation of latency reliability constraints, providing standardized numerical input for the second constraint, facilitating the application of corresponding penalties within the security advantage, guiding the agent in real time to reduce timeout allocation schemes, continuously managing the risk of exceeding task deadlines, and ensuring the latency reliability of system scheduling.
[0090] The agent in this application, in order to capture the complex value pattern of rewards and costs, adopts a three-branch neural network architecture: a policy network (Actor, ...). Output action distribution; Reward Critic Network (RPN) Estimate expected cumulative discount reward; Cost Critic network (Cost Critic, Estimate the expected cumulative discount cost (i.e., the probability of long-term SLA violation).
[0091] To calculate the reward advantage value by analyzing the difference in benefits between the previous and current states, the server's current state and the updated state are input into a reward evaluation network to obtain two sets of reward values. This accurately measures the performance change brought about by the unloading action, eliminating the interference of the inherent state of the environment on the benefits, and providing a precise evaluation basis for the PPO policy gradient update. This allows the agent to clearly distinguish the merits of actions and optimize the scheduling strategy in the direction of reducing latency and energy consumption. Based on the batch instant reward value, the first reward value, and the second reward value, the reward advantage value is determined. This can accurately quantify the increase or decrease in benefits brought by the current unloading action compared to the base state, eliminate the interference of the inherent state of the environment, and intuitively evaluate the merits of the action.
[0092] The state data and updated state data of multiple servers are input into the cost evaluation network to obtain the first-generation value corresponding to the state data and the second-generation value corresponding to the updated state data. The cost evaluation network is used to fit the long-term timeout cost under different scheduling states, calculating the state cost value before and after the action execution. This comprehensively characterizes the change in latency and timeout risk brought about by a single unloading action, quantifying the inherent timeout risk benchmark of different system states, distinguishing the cost impact of the environment itself and the scheduling action, and providing standardized numerical values for subsequent cost advantage value calculation. Based on the batch-era value, the first-generation value, and the second-generation value, the cost advantage value is determined. Relying on the difference between the immediate cost and the long-term cost value fitted by the network, the degree of increase or decrease in timeout risk brought about by the current unloading action is quantified. This intuitively assesses the degree to which the scheduling action violates latency reliability constraints, and can be incorporated into the safety advantage as a constraint penalty term, accurately guiding the agent to avoid unloading schemes that easily cause task timeouts, and stabilizing the system deadline exceedance rate.
[0093] Based on the reward advantage value, cost advantage value, and simulated task execution data from multiple servers, the current expected value of the security advantage is determined. The reward advantage value reflects the changes in the benefits of the scheduling scheme in terms of latency and energy consumption, while the cost advantage value quantifies the changes in task timeout risk caused by scheduling actions. By combining the two with the simulated execution data to solve for the expected value of the security advantage, it is possible to simultaneously consider system scheduling performance and latency reliability constraints, and to unify business optimization goals and latency constraint control requirements into the policy evaluation system. This expected value can serve as the core evaluation basis for PPO policy updates, guiding the agent to continuously reduce total task latency and total energy consumption, while simultaneously constraining the task timeout ratio, balancing scheduling efficiency and latency reliability, and ensuring that the policy iteration direction takes into account both business benefits and constraint compliance, thereby improving the overall scheduling effect and training stability of multi-server task offloading.
[0094] It should be noted that the reward function in this application involves total latency and total energy consumption. Historical data is also required to calculate total latency and total energy consumption. The total latency and total energy consumption are determined through the following: Complete the reasoning task The total delay is defined as the sum of the four components: , (19) in, Indicates task The total end-to-end latency, Indicates a waiting delay. Indicates transmission delay. Indicates the delay in collaborative processing. This indicates the delay in delivering the result.
[0095] (a) Waiting delay The inference task can only begin after all assigned servers are idle. Let... To handle tasks A set of sharded servers, waiting for latency. From set The maximum remaining busy time for all servers in the region is determined by: (20) in, Indicates server The queue is immediately filled with Previous task index, This represents the time elapsed since the preceding task was executed.
[0096] (ii) Transmission delay Input data first comes from the terminal device The data is transmitted wirelessly to the TSS (Traffic Scheduling Server) via the uplink, and then forwarded to the server hosting the first fragment. Wireless transmission rate to TSS Based on the Shannon-Hartley theorem, the model is as follows: ,(twenty one), in, For the allocated channel bandwidth, For transmission power, For channel gain including path loss and fading, Let be the noise power. The transmission delay is determined using the following formula: ,(twenty two), in, The size of the data in the input token embedding vector. The length of the token sequence is given as input for task k. The hidden layer vector dimension of the Transformer model. For the quantization bit precision of a single floating-point number, It is a binary indicator variable of 0-1. The model shard with 1 representing task k is deployed on the j-th server; A value of 0 indicates that the server is not selected. This indicates the link propagation delay.
[0097] (iii) Processing delay A pipelined parallel strategy is employed to perform distributed processing of tasks. The total number of iterations is (The first iteration is pre-filled; subsequent iterations are decoded token by token). The first fragment in the... The completion time of the next iteration The recursive calculation is as follows: ,(twenty three) The boundary conditions are as follows: and , Let be the absolute moment when all computations and communications for the m-th iteration of segment s are completed. This refers to the completion time of the previous iteration for the same partition s. The time when the current iteration of the previous slice \(s-1\) is completed. The GPU computation time for the m-th iteration of partition s is calculated as follows. This represents the computation time of partition s in the m-th iteration. The transmission delay of activation values between adjacent fragments is defined as follows: ,(twenty four), in, To ensure the transmission rate between servers hosting adjacent shards, The data size of the activation tensor between slices. The pre-padding stage processes the complete input prompts in parallel, including... Fragments of a Transformer layer The calculation time is: (25) in, For the server GPU frequency hosting this shard, The number of GPU cores on the server hosting this shard. The number of instructions per cycle for hosting this slice, For the hidden layer dimension, The original token length is input for the prompt word of the k-th task. The decoding phase processes each token autoregressively, starting with the k-th task. The next iteration ( The effective context length is: (26), among which, The length of the valid context token in the m-th decoding iteration. The length of the original token for the input prompt word of the k-th task. The computation delay of the m-th decoding iteration of segment s is: ,(27) The processing latency of a task is determined by the completion time of the last slice in the last iteration: (28), among which, The absolute completion time is when the last slice completes its last iteration, signifying the end of the entire distributed inference process, and is therefore used as the total processing latency of the task.
[0098] (iv) Delivery delay After inference is complete, the generated result is transmitted from the server hosting the last shard to the TSS, and then sent back to the source terminal device. Let... The delivery delay is based on the output data size: (29), among which, It is a binary indicator variable of 0-1. A value of 1 indicates that the last model shard of task k is deployed on the j-th server; otherwise, a value of 0 indicates that the task is deployed on the j-th server.
[0099] Complete the reasoning task Total energy consumption is defined as the sum of three components: (30), among which, For data transmission energy consumption, To coordinate energy consumption, Energy consumption for result delivery. Total energy consumption covers the energy consumed throughout the entire lifecycle of the inference task, including data transmission, collaborative processing, and result delivery.
[0100] (v) Data transmission energy consumption Transmission energy consumption captures the cost of uploading input prompts from the terminal device to the designated server, involving two hops (terminal → TSS → server): (31) in, This represents the transmit power of the source terminal δ_k. This indicates the transmit power when the TSS forwards input data.
[0101] (vi) Cooperative processing of energy consumption The power consumption of a server is proportional to the cube of its operating frequency. ), and execution time is inversely proportional to frequency, therefore the energy consumption of each operation is directly proportional to the square of the frequency (). Summarize the workload of the pre-filling and decoding phases, and the tasks... The total processing energy consumption is: , (32), in, For fragmentation Processing tasks The total number of floating-point operations, This represents the correlation coefficient of the input sequence size for a single forward propagation during the pre-filling stage. This is a single-round floating-point operation function for the pre-filling stage, with the input being the sequence size. Number of sharding layers , This is a floating-point arithmetic function for iterative decoding of a single token. Each decoding iteration adds only one token, and the context length increases with each round. The effective switching capacitor coefficient.
[0102] (vii) Energy consumption for deliverables After inference is completed, the energy consumption for delivering the generated result back to the source device is: (33) in, The constant transmit power when the server j wired network card sends data.
[0103] In some embodiments, determining the current expected value of the security advantage based on the reward advantage value, the cost advantage value, and the simulation task execution data of the plurality of servers includes: in response to determining that the current round of update operation is not the first round of update operation, obtaining the dynamic penalty multiplier corresponding to the previous round of update operation adjacent to the current round of update operation, and using the dynamic penalty multiplier corresponding to the previous round of update operation as the comparison dynamic penalty multiplier; in response to determining that the current round of update operation is the first round of update operation, using a predetermined dynamic penalty multiplier as the comparison dynamic penalty multiplier; determining the dynamic penalty multiplier corresponding to the current round of update operation based on the simulation task execution data of the plurality of servers, the comparison dynamic penalty multiplier, and a preset violation threshold; and determining the current expected value of the security advantage based on the reward advantage value, the cost advantage value, and the comparison dynamic penalty multiplier.
[0104] In this embodiment, to introduce the dynamic penalty multiplier, the scheduling problem of this application is first formalized as a joint optimization of inference task offloading and computational resource allocation. A scheduling objective function is constructed with the goal of minimizing the weighted sum of the total latency and total energy consumption of all inference tasks in the system. A third constraint corresponding to the scheduling objective function is also constructed to minimize the total weighted cost of the system under two types of reliability constraints. Let... Unload decision variables for binary tasks. and These are the normalized latency and energy consumption, respectively. and Let the weights be time delay and energy consumption, respectively. The formal expression of the scheduling objective function is: (34) The third set of constraints includes the unique deployment constraint for shards (C1), the matching constraint for shard preloading (C2), the hard constraint for server memory capacity (C3), the task latency SLA deadline constraint (C4), and the constraint for binary unloading decision variables (C5).
[0105] The unique deployment constraint C1 for shards restricts each shard to be processed by exactly one server, ensuring pipeline integrity. This constraint is determined using the following formula: , (35).
[0106] Shard preloading matching constraint C2 restricts tasks to only being offloaded to servers that have preloaded the corresponding shards. The shard preloading matching constraint is determined by the following formula: , (36).
[0107] The server's hard constraint C3 on video memory capacity limits the VRAM consumption of any edge server at any given scheduling instant to not exceed its hardware limit (violating this constraint will immediately lead to a hard availability failure). The server's hard constraint on video memory capacity is determined by the following formula: , (37).
[0108] The task delay SLA deadline constraint C4 restricts the end-to-end delay of each task to meet its deadline (relaxed to a probabilistic SLA compliance objective in RL formalization). The task delay SLA deadline constraint is determined by the following formula: , (38).
[0109] The binary unloading decision variable constraint C5 is a binary variable for unloading decisions, and is determined by the following formula: , (39).
[0110] The ultimate goal is to learn strategies. Maximize the expected cumulative discount reward while satisfying probabilistic SLA compliance constraints: (40) (41) in, Representation Strategy The corresponding long-term expected cumulative discount return (the main optimization objective of reinforcement learning). This is a discount factor used to attenuate future returns / costs, avoiding infinite summation and divergence; the weight decreases as time progresses. Let be the batch instant reward value corresponding to the t-th target time. For strategy The corresponding long-term expected cumulative discount cost, Let t represent the instantaneous latency cost at the t-th target time. By calculating the scheduling objective function, the latency and energy consumption rewards at each time step are discounted, accumulated, and the expected value is taken, transforming them into a calculable global value. The higher the value, the lower the average latency and average energy consumption of this fragmentation offloading and resource allocation strategy in the long run. During training, the neural network parameters are automatically adjusted with the goal of maximizing the long-term expected cumulative discounted reward. We continuously iterate to develop better distributed inference scheduling schemes.
[0111] Existing scheduling optimization approaches only evaluate latency and energy consumption independently for a single batch of tasks, failing to accumulate and statistically analyze the instantaneous rewards across multiple rounds of sequential interactions, thus failing to quantify the long-term comprehensive performance of scheduling strategies. To address this, this application constructs a long-term expected cumulative discounted reward as the scheduling objective function. The instantaneous rewards for latency and energy consumption obtained at each scheduling moment are weighted and accumulated using a discount coefficient. The expected value is then calculated for a large number of interaction trajectories, transforming it into a globally comparable evaluation value. A higher value indicates a better long-term average latency and average energy consumption for the corresponding fragmentation offloading and resource allocation strategy. The agent training process is guided by maximizing this long-term expected cumulative discounted reward, automatically updating the network parameters of the scheduling strategy in reverse. Through multiple iterations, the optimal distributed inference scheduling scheme that balances latency and energy consumption is obtained. The primal-dual method is used to solve the scheduling objective function. A dual Lagrangian function is constructed, inequality constraints are eliminated, and the constrained problem is transformed into an unconstrained dual problem through Lagrangian relaxation. (42) in, It represents the original-dual Lagrangian function, which integrates performance rewards and latency compliance penalties, transforming the constrained optimization problem into an unconstrained minimax alternating optimization problem. For scheduling policy network All trainable parameters, For strategy The corresponding long-term expected cumulative discount reward, the higher the value, the lower the long-term average latency and energy consumption. For strategy The corresponding long-term expected cumulative discount delay violation cost represents the severity of the global task timeout. The dynamic penalty multiplier for SLA violations, namely the Lagrange penalty multiplier, is used to punish SLA task timeout violations. Its value is always non-negative and is dynamically and adaptively updated by the closed-loop PID controller. (Inner layer of the unconstrained dual problem) Indicates the parameters for optimizing the uninstallation strategy. This increases overall performance gains; outer layer Indicates optimization penalty multiplier The degree of SLA timeout violation of the suppression strategy.
[0112] If the current update operation is not the first update operation, the dynamic penalty multiplier corresponding to the previous update operation adjacent to the current update operation is obtained, and the dynamic penalty multiplier corresponding to the previous update operation is used as the comparison dynamic penalty multiplier. If the current update operation is the first update operation, the predetermined dynamic penalty multiplier is used as the comparison dynamic penalty multiplier. The dynamic penalty multiplier has a temporal iterative characteristic, and the values of the previous and next rounds are related: if the current round is not the agent's first update, the dynamic penalty multiplier output after the previous round of update is directly read as the comparison benchmark; if it is the first round of training and there is no historical iteration data, the system's preset initial penalty coefficient is used as the comparison dynamic penalty multiplier to provide an initial benchmark value for the multiplier iteration. The multiplier of the previous round is a reliable constraint benchmark obtained by adaptive convergence based on historical multi-round violation data. It can stably control the SLA timeout penalty intensity during the current training round, and at the same time, it serves as the base of the PID iteration formula. The violation deviation of the current round is superimposed to correct a new penalty coefficient that is suitable for subsequent loads, forming a temporal closed-loop adaptive adjustment logic.
[0113] In addition, a dynamic penalty multiplier needs to be calculated for the next round of update operations. This involves comparing the dynamic penalty multiplier with a preset violation threshold based on simulation task execution data from multiple servers to determine the dynamic penalty multiplier for the current round of update operations. Specifically, based on simulation task execution data from multiple servers, the violation rate of the current round of update operations is obtained. The violation rate of all completed update operations is then acquired. Based on the violation rate of the current round of update operations, the dynamic penalty multiplier is compared with the dynamic penalty multiplier, the violation rate of all completed update operations, and the preset violation threshold to determine the dynamic penalty multiplier for the current round of update operations. The dynamic penalty multiplier is determined using the following formula: (43) in, For comparison of the dynamic penalty multiplier in the next round of update operations, For the comparison dynamic penalty multiplier of the current round of update operations, To update the learning rate for the multiplier, scale the overall PID correction amplitude to control each round. Adjust the range of each step to ensure training stability; This is a proportional adjustment coefficient that controls the correction magnitude of the current round of violation deviations; the more the violation rate exceeds the threshold in this round, the greater the correction magnitude of the proportional term, thus quickly reducing the current compliance deviation. For the violation deviation in the k-th round of update operation; The integral adjustment coefficient is used to accumulate violation deviations from all historical rounds, eliminate long-term steady-state violation offsets, and prevent the system from experiencing continuous small timeouts. Let be the integral sum of violation deviations for all historical update operations from round 1 to round k, and let be the statistic corresponding to the violation rate of all completed update operations. To improve efficiency, the integral sum of violation deviations for all completed update operations can also be obtained directly. The differential adjustment coefficient represents the change in the deviation of the violation rate between the current round and the previous round, suppressing violent fluctuations in the violation rate and preventing large jumps in the penalty multiplier; For the violation deviation of the k-th round update operation, This represents the difference in violation deviation between the current round and the previous round, reflecting the changing trend of the violation severity.
[0114] By combining the actual timeout data of this round, the timeout records of each previous round, the baseline penalty coefficient used in this round, and the allowed timeout standard, the penalty coefficient is updated. This can tighten or loosen the constraints in a timely manner based on the current actual timeout situation, and can also avoid the continuous occurrence of small timeouts after training by combining historical long-term timeout data. Relying on stable baseline coefficients for iterative calculation, it automatically adapts to changes in server task load. Unlike fixed penalty coefficients, it will not have problems such as overly strict constraints leading to poor performance or overly loose constraints leading to frequent timeouts. It continuously balances task scheduling efficiency and latency compliance requirements throughout the process.
[0115] Based on the reward advantage value, cost advantage value, and contrast dynamic penalty multiplier, the current expected value of the security advantage is determined. To incorporate reliability awareness, the advantage function is calculated for both the reward and cost using generalized advantage estimation (GAE), and a normalized security advantage is synthesized. The current expected value of the security advantage is determined using the following formula: (44) in, This represents the expected value of the strategy update advantage at target time t, considering both reward benefits and constraint costs; in other words, the current value of the security advantage. Let be the reward advantage function, representing the reward advantage of the current action relative to the average policy in terms of system performance; To compare with the dynamic penalty multiplier, used to measure the penalty strength of SLA violation cost in policy optimization; Let $\mathbf{a}$ be the cost advantage function, representing the cost advantage of the current action relative to the average policy in terms of constraint cost. The average violation rate for the current round. This is the fast correction coefficient that is activated only when the violation exceeds the threshold.
[0116] This approach relies on a combination of reward advantage and cost advantage values, along with a dynamic penalty multiplier adapted to the current constraint strength, to solve for the current expected value of the safety advantage. It simultaneously considers the performance gains of the scheduling system and the cost of latency compliance constraints. By flexibly adjusting the penalty weights for violations using dynamic penalty multipliers, it avoids the problems of frequent timeouts or excessive conservatism at the expense of throughput that occur with fixed weights. This allows the agent to iteratively optimize the scheduling strategy, ensuring the system fully performs while meeting SLA latency requirements. This application considers long-term service latency (SLA) reliability requirements in multi-task concurrent scenarios and proposes a hierarchical, differentiated, multi-objective reliability scheduling architecture. It uses a PID-Lagrange closed-loop regulator instead of the traditional fixed-step update, dynamically and smoothly adjusting the penalty multiplier to eliminate policy oscillations near constraint boundaries, achieving globally optimal scheduling for overall system latency and energy consumption while strictly ensuring physical safety.
[0117] In some embodiments, determining the target update gradient based on the decision vector, the modified decision vector, and the initial update gradient includes: determining a first dual variable of the memory inequality constraint and a second dual variable of the probability equality constraint based on the decision vector, the modified decision vector, a predetermined memory constraint mapping matrix, and a predetermined probability equality constraint matrix; determining an action constraint boundary based on the first dual variable and the second dual variable; and performing a null space projection operation based on the action constraint boundary and the initial update gradient to generate the target update gradient.
[0118] In this embodiment, the KKT implicit differentiation and safety gradient propagation mechanism are used to solve the compliant target update gradient. First, the implicit function theorem is applied to the quadratic programming problem to obtain the accurate policy gradient. Then, a system of equations is constructed based on the KKT stationarity condition, and the first and second type dual variables are solved using least squares. Based on the decision vector, the corrected decision vector, the predetermined memory constraint mapping matrix, and the predetermined probability equality constraint matrix, the first dual variable of the memory inequality constraint and the second dual variable of the probability equality constraint are determined. The dual variables are then recovered using the following formula: (45) in, This is the corrected decision vector. Let be the decision vector. This is the transpose of the memory inequality constraint mapping matrix G, used to associate inequality constraints with the action space. Let A be the transpose of the probability equality constraint matrix A, used to associate the equality constraints with the action space. , being the first dual variable, corresponds to the explicit inequality constraint, and characterizes the constraint strength of the inequality constraint. The second dual variable corresponds to the probability equality constraint, representing the constraint strength of the equality constraint. This formula establishes a linear relationship between action deviation, the dual variable of the inequality constraint, and the dual variable of the equality constraint based on the KKT stationarity condition. After solving the system simultaneously, the two types of dual variables can be solved simultaneously using least squares, fully restoring the dual information corresponding to the constraint boundary.
[0119] Based on the first and second dual variables, the action constraint boundaries are determined. Specifically, the first and second dual variables are obtained by solving the system of equations using least squares and then projecting them onto the dual feasible system. The active constraint set is identified based on the first dual variable and a preset error threshold. This active constraint set represents the currently effective action constraint boundaries. The constraint sub-matrices corresponding to the active constraints are extracted and assembled to obtain the active constraint matrix, which represents the complete action constraint boundaries. This approach first solves for two types of dual variables simultaneously using least squares and completes dual feasibility projection, ensuring the compliance of dual variable values. Then, based on the first dual variable and an error threshold, it accurately selects the set of active constraints that truly limit the action range, eliminating redundant constraints that are ineffective. Finally, it extracts the corresponding sub-matrices and assembles them into an active constraint matrix to fully represent the action constraint boundary. This approach can accurately lock the constraint boundary that takes effect in real time, reduce the unnecessary computational overhead caused by invalid constraints, and completely distinguish the limiting effects of two types of constraints—visual inequalities and probabilistic equality—on the action space. It provides an accurate and reliable constraint benchmark for subsequent gradient null space projection, effectively avoiding violations caused by actions breaking through constraint boundaries during policy updates, and improving the overall algorithm's solution efficiency and action feasibility assurance effect.
[0120] Feasibility of performing duality via projection: (46) The least squares optimization formula (formula (46)) is used to solve the first dual variable and the second dual variable simultaneously. By minimizing the L2 norm error of the action deviation and the constraint dual term, the initial value of the dual variable that satisfies the KKT stationarity condition is obtained. Then, the range of values of the constraint variable is combined with the projection operation to ensure that the two types of dual variables solved satisfy the dual feasibility, and to provide compliant and accurate dual parameters for subsequent identification of active constraints and delineation of action constraint boundaries.
[0121] Subsequently, in order to form a conditionally well-conditioned gradient system that reflects only the active boundaries of the constraints, the set of active constraints is identified: (47) in, Let j be the set of active constraints at time t, which stores the indices j of all currently effective explicit memory inequality constraints. Let be the row vector corresponding to the j-th memory inequality constraint. Let be the constraint threshold constant for the j-th memory inequality constraint. A pre-defined uniform error tolerance threshold is used as a critical criterion for determining whether a constraint is active.
[0122] Assemble and merge active constraint matrix: (48) in, The merged active constraint matrix integrates equality constraints and current active memory inequality constraints, and is the core matrix representing the constraint boundaries of all effective actions. This is the complete probability equality constraint matrix; To define the active memory inequality constraint submatrix, extract the active constraint set from the complete memory constraint matrix G. The corresponding rows retain only the currently active memory inequality constraints; To illustrate that matrix C belongs to the real number field, the number of rows is the sum of the number of equality constraints and the number of active memory constraints, and the number of columns is equal to the action dimension.
[0123] Null-space projection is performed based on the action constraint boundaries and the initial update gradient to generate the target update gradient. The initial update gradient is projected onto the null space of the active constraint matrix, and gradient components that violate the action constraint boundaries are filtered out to obtain the feasible target update gradient constrained by the action constraint boundaries. The upstream gradient... Projected to The null space is removed, and gradient components that would push the policy in a direction that violates the active constraint are removed, ensuring that policy updates proceed in a direction that maintains physical integrity. ,(49) in, To update the gradient for the target, I is the identity matrix with the same dimensions as the action space. For regularization hyperparameters, A regularization constant used to maintain numerical stability. For initial gradient updates, The objective loss function for policy optimization is centered on the scheduling objective function and constructed by adding a third constraint, transforming the problem of maximizing scheduling gains into minimizing losses. If the Cholesky decomposition fails, the SVD pseudo-inverse is used as an alternative. This null projection has a precise reliability interpretation: the Actor is updated along the direction on the tangent plane of the physical integrity boundary, ensuring that the policy gradient always guides towards better feasible actions, rather than OOM (Out of Memory) fault regions.
[0124] By quantifying the tightness of various constraints using dual variables, the constraint boundaries that truly limit the range of actions are accurately screened, and redundant constraints that do not play a role are eliminated to reduce subsequent computational overhead. Furthermore, null space projection is used to filter out gradient components that would drive actions to break through the constraint boundaries. At the same time, the dual constraint requirements of probability equality and memory inequality are fully taken into account. This ensures that the actions are compliant throughout the policy update process, avoids memory overruns and probability imbalance faults, and continuously optimizes scheduling performance within the actionable domain. Combined with the constraint screening mechanism, the scale of matrix operations is effectively reduced, and the numerical stability of gradient solution and the overall running efficiency of the algorithm are improved.
[0125] In another embodiment, the DSL-SafePPO algorithm is divided into two stages: online training and real-time inference.
[0126] Safe trajectory acquisition: In each training round, TSS follows the current Actor network strategy. Sampling original action Subsequently, the DSL (forward propagation phase) projects it onto the VRAM feasible region to obtain certified safe actions. The constraint-aware greedy allocation strategy is mapped to discrete execution actions. After the actions are executed, the trajectory data is stored in the experience replay buffer.
[0127] Optimization Phase: Generalized advantage is calculated and security advantage is synthesized, driving stochastic gradient descent updates of the Actor and Critic networks. During backpropagation, gradients flow back to the Actor through null space projection of the active set based on KKT, progressively training the Actor to internalize the physical boundaries.
[0128] PID reliability tuning: At the end of each round, the dual variable is updated through the PID controller. Establish a closed-loop feedback mechanism to enforce long-term SLA compliance.
[0129] Real-time scheduling: After training, the optimal Actor network parameters are saved. In actual industrial production, TSS only needs to report the real-time system state. By inputting the Actor network, the optimal offloading and sharding deployment scheme can be obtained in milliseconds, enabling global dynamic scheduling of high-concurrency multi-inference tasks, while ensuring zero VRAM overflow through real-time projection of DSL.
[0130] In another embodiment, such as Figure 2 As shown, Figure 2This is a schematic diagram of a system model according to another embodiment of this application. The overall architecture covers a Device Layer, an Edge Layer, and a Cloud Layer. In this system, each device unit in the Device Layer actively initiates a large model inference request and uploads it to the task scheduling service. The task scheduling service sequentially completes the fragmentation and orchestration, and distributes the request to multiple edge servers in the Edge Layer or cloud servers in the Cloud Layer, and performs inference operations on the large language model. After the operation is completed, the inference result is sent back to the device unit to complete the response delivery. A complete constraint control link is formed by building a security reinforcement learning and differentiable security layer. After the policy network outputs the original action, it is sent to the differentiable security layer. Combined with constraints such as system topology and memory limitations, secondary planning and KKT active set projection are carried out to generate compliant and secure actions and distribute them to the scheduling service. At the same time, the system performance and constraint violation rate are comprehensively evaluated by the reward evaluator and cost evaluator. The policy gradient is corrected by Lagrange projection and the policy network is updated by backpropagation. Throughout the process, dual variables, active constraint identification, and null projection are used to eliminate illegal update directions. While ensuring that the constraints of video memory and probability equation are not breached, we continuously optimize the cloud-edge-device collaborative sharding scheduling strategy, taking into account multiple scheduling objectives such as inference latency, device power consumption, and memory usage, to achieve multi-objective collaborative optimization under security constraints.
[0131] In another embodiment, such as Figure 3 As shown, Figure 3This is a schematic diagram of the DSL-SafePPO algorithm structure according to an embodiment of this application. The DSL-SafePPO algorithm proposed in this embodiment is composed of a policy network, a differentiable safety layer, a PID Lagrange controller, a reward evaluator, a cost evaluator, and an environment and buffer module. During system runtime, the environment collects interactive samples including state, action, immediate reward, constraint cost, memory usage, and remaining memory, and stores them in the buffer. The samples are input to the reward evaluator and the cost evaluator, which fit the value function through multi-layer linear, activation, and normalization structures, respectively, and output the value advantage and cost advantage. The two together participate in constructing a policy loss that integrates the PPO pruning loss, the safety constraint penalty term, and the policy entropy regularization term. The policy network internally relies on an MLP encoder and policy head to output the original action probabilities, which are then fed into a differentiable safety layer. In the forward phase, a quadratic programming solver, combined with memory constraints and residual memory constraints, projects the original probabilities into safe probabilities that satisfy the constraints. In the backward phase, KKT implicit differentiation corrects the gradient direction by projecting the null space gradient. Simultaneously, a PID Lagrange controller dynamically adjusts the Lagrange multipliers based on historical average constraint costs, adaptively controlling the penalty strength for violations. The corrected gradient is then fed back to update the policy network, and actions are sampled based on the updated policy and sent to the environment to complete the iterative loop. This architecture achieves full-process differentiability in both forward and backward directions through the differentiable safety layer. KKT implicit differentiation precisely eliminates gradient update components that trigger memory overruns or constraint violations, while the PID controller dynamically and adaptively adjusts the penalty weights. It not only solves the shortcomings of traditional secure reinforcement learning, such as gradient non-differentiability and easy constraint violation, but also stabilizes the constraint violation rate while optimizing scheduling reward benefits. It achieves multi-objective balanced optimization by relying on dual evaluators to fit the benefits and constraint costs respectively. The entropy regularization term ensures the diversity of strategy exploration. The overall algorithm has stronger numerical stability and faster iteration convergence speed. In the scenario of large model fragmentation scheduling in cloud, edge and terminal, it can continuously ensure the compliance of memory resource constraints and simultaneously reduce inference latency and device power consumption.
[0132] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the method described.
[0133] It should be noted that some embodiments of this application have been described above. In some cases, the actions or steps described in the above embodiments can be performed in a different order than that shown in the above embodiments and the desired result can still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0134] Based on the same inventive concept, and corresponding to any of the above embodiments, this application also provides a task offloading intelligent agent training device based on differentiable secure projection.
[0135] refer to Figure 4 The task offloading agent training device based on differentiable secure projection includes: The acquisition module 10 is configured to acquire the task sequence corresponding to each historical moment within a predetermined historical time period. The task sequence includes task data corresponding to each task to be uninstalled, and status data corresponding to each server used to execute the task.
[0136] Based on the task sequence corresponding to each historical moment, multiple rounds of update operations are performed on the pre-built initial agent, with the first historical moment within the predetermined historical time period being taken as the target moment. Each round of update operations is executed as follows: The first determining module 20 is configured to use the initial agent to determine a task unloading strategy based on the task data and state data corresponding to the target time, wherein the task unloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be unloaded.
[0137] The second determining module 30 is configured to determine the decision vector and the corrected decision vector corresponding to the task unloading strategy based on the task unloading strategy.
[0138] The correction module 40 is configured to determine the initial update gradient of the initial agent based on the task unloading strategy, the state data of the server corresponding to the task unloading strategy, the decision vector, and the corrected decision vector, and to perform gradient correction on the initial update gradient to obtain the target update gradient.
[0139] The update module 50 is configured to update multiple parameters in the initial agent based on the target update gradient, and determine whether the initial agent has converged.
[0140] The third determining module 601 is configured to, in response to determining that the initial agent has not converged, use the updated initial agent as the initial agent in the next round of update operations, use the next time moment adjacent to the target time moment as the target time moment in the next round of update operations, and execute the next round of update operations.
[0141] The fourth determining module 602 is configured to, in response to determining that the initial agent has converged, determine the initial agent as the target agent and exit at least one round of update operations.
[0142] Using the aforementioned device, a task sequence corresponding to each historical moment within a predetermined historical time period is obtained. This task sequence includes task data for each task to be unloaded and status data for each server executing the task. Based on the task sequence corresponding to each historical moment, multiple rounds of update operations are performed on the pre-constructed initial agent. Relying on the time-series task sequence with temporal correlation characteristics, multiple rounds of iterative updates can realistically reproduce the dynamic evolution of on-site tasks and equipment states, allowing the agent to adapt to actual scheduling scenarios through continuous learning and complete iterative optimization of capabilities. The first historical moment within the predetermined historical time period is taken as the target moment. Each round of update operations is performed as follows: Using the initial agent, based on the task data and status data corresponding to the target moment, a task unloading strategy is determined. This task unloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be unloaded. The task unloading strategy is obtained based on real historical conditions, fully preserving the agent's exploration distribution information. Based on the task offloading strategy, the decision vector corresponding to the task offloading strategy and the modified decision vector are determined. On the one hand, the distributed and independent sub-task server allocation probabilities are unified and standardized into standardized computational inputs. On the other hand, the task offloading strategy with the risk of memory violation can be adjusted to a feasible range, ensuring that the modified task offloading strategy meets the server's memory operation requirements, while preserving the scheduling and allocation tendency of the agent output in the original vector to the greatest extent. Based on the task offloading strategy, the server state data corresponding to the task offloading strategy, the decision vector, and the modified decision vector, the initial update gradient of the initial agent is determined, and the initial update gradient is modified to obtain the target update gradient. This allows the gradient value to closely match the real latency, energy consumption, and hardware load conditions, accurately correcting the deviation between the original strategy and feasible constraints. Based on the target update gradient, multiple parameters in the initial agent are updated, ensuring that the parameter iteration direction in each round closely matches the real server latency, energy consumption, and memory hardware constraints. This effectively avoids the training oscillation problem caused by gradient deviation and steadily guides the model towards optimization towards low latency, low energy consumption, load balancing, and policy compliance. The system determines whether the initial agent has converged, accurately identifying nodes where model parameters and scheduling performance are stabilizing. It stops iterative training promptly when the agent reaches optimal allocation, avoiding meaningless continuous iterations that waste computational and time resources. In response to the determination that the initial agent has not converged, the updated initial agent is used as the initial agent in the next round of update operations, and the next time step adjacent to the target time step is used as the target time step in the next round of update operations. This iterative approach gradually optimizes the scheduling strategy, continuously adapts to dynamically fluctuating system conditions, and gradually reduces strategy errors until the agent converges.In response to the determination that the initial agent has converged, the initial agent is identified as the target agent, and at least one round of update operation is exited. This convergence determination mechanism can terminate redundant iterations in a timely manner, saving training computing power and time costs. The converged agent's policy is stable and meets various scheduling constraints, and can be directly deployed and used, avoiding policy oscillations caused by excessive iteration and improving the reliability of the task offloading policy determined by the agent.
[0143] In some embodiments, the second determining module 30 is further configured to, for each subtask within each task to be uninstalled, vectorize and concatenate the first probability values of at least one server corresponding to the subtask to obtain a first concatenated vector; concatenate all the first concatenated vectors corresponding to the task to be uninstalled to obtain a second concatenated vector; concatenate all the second concatenated vectors corresponding to the tasks to be uninstalled to obtain the decision vector; construct a modified objective function with the objective of minimizing the Euclidean squared distance between the modified decision vector and the decision vector, and construct a first constraint condition corresponding to the modified objective function; and solve the modified objective function based on the first constraint condition to obtain the modified decision vector.
[0144] In some embodiments, the correction module 40 is further configured to: map and transform the corrected decision vector to obtain a corrected task offloading strategy; simulate and execute the corrected task offloading strategy to obtain latency data, energy consumption data, and simulated task execution data and update status data of multiple servers corresponding to the corrected task offloading strategy; determine the initial update gradient based on the latency data and energy consumption data of each server, the simulated task execution data, status data, and update status data of the multiple servers, and the corrected task offloading strategy; and determine the target update gradient based on the decision vector, the corrected decision vector, and the initial update gradient.
[0145] In some embodiments, the correction module 40 is further configured to: determine the current expected value of security advantage based on latency data, energy consumption data, and simulation task execution data, status data, and update status data of each server; in response to determining that the current round of update operation is not the first round of update operation, obtain the corrected task unloading strategy corresponding to the previous round of update operation adjacent to the current round of update operation, and use the corrected task unloading strategy corresponding to the previous round of update operation as the comparison task unloading strategy; in response to determining that the current round of update operation is the first round of update operation, use the predetermined task unloading strategy as the comparison task unloading strategy; based on the current expected value of security advantage, the corrected task unloading strategy, and the comparison task unloading strategy, construct an update objective function with the goal of maximizing the theoretical expected value of security advantage, and construct a second constraint condition corresponding to the update objective function; and determine the initial update gradient based on the second constraint condition and the update objective function.
[0146] In some embodiments, the correction module 40 is further configured to: construct a reward objective function with the goal of maximizing the negative weighted sum of the total latency and total energy consumption corresponding to all tasks to be unloaded; determine the batch instant reward value of the current update operation using the reward objective function; construct a cost function based on the simulated task execution data of the plurality of servers; determine the batch-era value of the current update operation using the cost function; input the state data and update state data of the plurality of servers into a reward evaluation network to obtain a first reward value corresponding to the state data and a second reward value corresponding to the update state data; determine a reward advantage value based on the batch instant reward value, the first reward value, and the second reward value; input the state data and update state data of the plurality of servers into a cost evaluation network to obtain a first-generation value corresponding to the state data and a second-generation value corresponding to the update state data; determine a cost advantage value based on the batch-era value, the first-generation value, and the second-generation value; and determine the current expected value of the security advantage based on the reward advantage value, the cost advantage value, and the simulated task execution data of the plurality of servers.
[0147] In some embodiments, the correction module 40 is further configured to: in response to determining that the current round of update operation is not the first round of update operation, obtain the dynamic penalty multiplier corresponding to the previous round of update operation adjacent to the current round of update operation, and use the dynamic penalty multiplier corresponding to the previous round of update operation as the comparison dynamic penalty multiplier; in response to determining that the current round of update operation is the first round of update operation, use a predetermined dynamic penalty multiplier as the comparison dynamic penalty multiplier; determine the dynamic penalty multiplier corresponding to the current round of update operation based on the simulation task execution data of the plurality of servers, the comparison dynamic penalty multiplier and the preset violation threshold; and determine the current expected value of the security advantage based on the reward advantage value, the cost advantage value and the comparison dynamic penalty multiplier.
[0148] In some embodiments, the correction module 40 is further configured to: determine a first dual variable of the memory inequality constraint and a second dual variable of the probability equality constraint based on the decision vector, the corrected decision vector, a predetermined memory constraint mapping matrix, and a predetermined probability equality constraint matrix; determine an action constraint boundary based on the first dual variable and the second dual variable; and perform a null space projection operation based on the action constraint boundary and the initial update gradient to generate the target update gradient.
[0149] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0150] The apparatus of the above embodiments is used to implement the corresponding task offloading agent training method based on differentiable secure projection in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0151] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the task offloading agent training method based on differentiable secure projection as described in any of the above embodiments.
[0152] Figure 5 This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.
[0153] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0154] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0155] The input / output interface 1030 is used to connect input / output modules to realize information input and output. The input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.
[0156] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0157] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0158] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0159] The electronic device described above is used to implement the corresponding task offloading agent training method based on differentiable secure projection in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0160] Based on the same inventive concept, corresponding to any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the task offloading agent training method based on differentiable secure projection as described in any of the above embodiments.
[0161] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0162] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the task offloading agent training method based on differentiable secure projection as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0163] Based on the same concept, corresponding to the methods of any of the above embodiments, this application also provides a computer program product, including computer program instructions, which, when run on a computer, cause the computer to execute the task unloading agent training method based on differentiable secure projection as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0164] It is understood that before using the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner, and user authorization will be obtained.
[0165] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations of this disclosed technical solution.
[0166] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0167] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0168] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application is limited to these examples; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in detail for the sake of brevity.
[0169] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0170] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0171] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of this application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.
Claims
1. A method for training a task offloading agent based on differentiable secure projection, characterized in that, include: Obtain the task sequence corresponding to each historical moment within a predetermined historical time period. The task sequence includes task data corresponding to each task to be uninstalled, and status data corresponding to each server used to execute the task. Based on the task sequence corresponding to each historical moment, multiple rounds of update operations are performed on the pre-built initial agent, with the first historical moment within the predetermined historical time period being taken as the target moment. Each round of update operations is executed as follows: Using the initial agent, a task unloading strategy is determined based on the task data and state data corresponding to the target time. The task unloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be unloaded. Based on the task unloading strategy, determine the decision vector corresponding to the task unloading strategy and the corrected decision vector; Based on the task unloading strategy, the state data of the server corresponding to the task unloading strategy, the decision vector and the corrected decision vector, the initial update gradient of the initial agent is determined, and the initial update gradient is corrected to obtain the target update gradient. Based on the target update gradient, multiple parameters in the initial agent are updated, and it is determined whether the initial agent has converged. In response to the determination that the initial agent has not converged, the updated initial agent is used as the initial agent in the next round of update operations, and the next time moment adjacent to the target time moment is used as the target time moment in the next round of update operations, and the next round of update operations is executed. In response to determining that the initial agent has converged, the initial agent is identified as the target agent, and at least one round of update operations is exited.
2. The method according to claim 1, characterized in that, The step of determining the decision vector and the modified decision vector corresponding to the task unloading strategy based on the task unloading strategy includes: For each subtask within each task to be uninstalled, the first probability values of at least one server corresponding to the subtask are vectorized and concatenated to obtain a first concatenated vector. Concatenate all the first concatenation vectors corresponding to the task to be uninstalled to obtain the second concatenation vector; The decision vector is obtained by concatenating the second concatenation vectors corresponding to all tasks to be uninstalled. A modified objective function is constructed with the goal of minimizing the Euclidean square distance between the modified decision vector and the decision vector, and a first constraint condition corresponding to the modified objective function is constructed. Based on the first constraint, the modified objective function is solved to obtain the modified decision vector.
3. The method according to claim 1, characterized in that, Based on the task offloading strategy, the server status data corresponding to the task offloading strategy, the decision vector, and the corrected decision vector, the initial update gradient of the initial agent is determined, and the initial update gradient is corrected to obtain the target update gradient, including: The modified decision vector is mapped and transformed to obtain the modified task unloading strategy. The modified task offloading strategy is simulated and executed to obtain the latency data, energy consumption data, simulation task execution data and update status data of each server corresponding to the modified task offloading strategy. Based on the latency data and energy consumption data of each server, the simulation task execution data, status data and update status data of the multiple servers, and the corrected task unloading strategy, the initial update gradient is determined. Based on the decision vector, the corrected decision vector, and the initial update gradient, the target update gradient is determined.
4. The method according to claim 3, characterized in that, The determination of the initial update gradient based on the latency data and energy consumption data of each server, the simulation task execution data, status data, and update status data of the multiple servers, and the corrected task unloading strategy includes: Based on the latency data, energy consumption data, and simulation task execution data, status data, and update status data of each server, the current expected value of the security advantage is determined. In response to determining that the current round of update operation is not the first round of update operation, the corrected task unloading strategy corresponding to the previous round of update operation adjacent to the current round of update operation is obtained, and the corrected task unloading strategy corresponding to the previous round of update operation is used as the comparison task unloading strategy. In response to determining that the current round of update operation is the first round of update operation, the pre-defined task unloading strategy is used as the comparison task unloading strategy; Based on the current expected value of the security advantage, the modified task unloading strategy and the comparative task unloading strategy are used to construct an update objective function with the goal of maximizing the theoretical expected value of the security advantage, and to construct the second constraint condition corresponding to the update objective function. The initial update gradient is determined based on the second constraint and the update objective function.
5. The method according to claim 4, characterized in that, The determination of the current expected value of the security advantage based on the latency data, energy consumption data, and simulation task execution data, status data, and update status data of each server, including: A reward objective function is constructed with the goal of maximizing the negative weighted sum of the total latency and total energy consumption of all tasks to be uninstalled, and the batch instant reward value of the current update operation is determined using the reward objective function. Based on the simulation task execution data of the multiple servers, a cost function is constructed, and the batch value of the current update operation, i.e., the era value, is determined using the cost function. The status data and updated status data of the multiple servers are input into the reward review network to obtain a first reward value corresponding to the status data and a second reward value corresponding to the updated status data. Based on the batch instant reward value, the first reward value, and the second reward value, a reward advantage value is determined; The state data and updated state data of the multiple servers are input into the cost evaluation network to obtain the first-generation value corresponding to the state data and the second-generation value corresponding to the updated state data. Based on the batch value (i.e., the era value), the first generation value, and the second generation value, determine the cost advantage value; Based on the reward advantage value, the cost advantage value, and the simulation task execution data of the multiple servers, the current expected value of the security advantage is determined.
6. The method according to claim 5, characterized in that, The process of determining the current expected value of the security advantage based on the reward advantage value, the cost advantage value, and the simulation task execution data of the multiple servers includes: In response to determining that the current round of update operation is not the first round of update operation, the dynamic penalty multiplier corresponding to the previous round of update operation adjacent to the current round of update operation is obtained, and the dynamic penalty multiplier corresponding to the previous round of update operation is used as the comparison dynamic penalty multiplier; In response to determining that the current round of update operation is the first round of update operation, the predetermined dynamic penalty multiplier is used as the comparison dynamic penalty multiplier; Based on the simulation task execution data of the multiple servers, the dynamic penalty multiplier is determined by comparing the dynamic penalty multiplier with the preset violation threshold. Based on the reward advantage value, the cost advantage value, and the comparative dynamic penalty multiplier, the current expected value of the security advantage is determined.
7. The method according to claim 3, characterized in that, Determining the target update gradient based on the decision vector, the corrected decision vector, and the initial update gradient includes: Based on the decision vector, the modified decision vector, the predetermined memory constraint mapping matrix and the predetermined probability equality constraint matrix, the first dual variable of the memory inequality constraint and the second dual variable of the probability equality constraint are determined. Based on the first dual variable and the second dual variable, determine the action constraint boundary; The target update gradient is generated by performing null space projection operation based on the action constraint boundary and the initial update gradient.
8. A training device for a task offloading intelligent agent based on differentiable secure projection, characterized in that, include: The acquisition module is configured to acquire the task sequence corresponding to each historical moment within a predetermined historical time period. The task sequence includes task data corresponding to each task to be uninstalled, and status data corresponding to each server used to execute the task. Based on the task sequence corresponding to each historical moment, multiple rounds of update operations are performed on the pre-built initial agent, with the first historical moment within the predetermined historical time period being taken as the target moment. Each round of update operations is executed as follows: The first determining module is configured to use the initial agent to determine a task unloading strategy based on the task data and state data corresponding to the target time, wherein the task unloading strategy includes a first probability value for executing at least one server corresponding to each subtask within each task to be unloaded. The second determining module is configured to determine the decision vector and the modified decision vector corresponding to the task unloading strategy based on the task unloading strategy. The correction module is configured to determine the initial update gradient of the initial agent based on the task unloading strategy, the state data of the server corresponding to the task unloading strategy, the decision vector and the corrected decision vector, and perform gradient correction on the initial update gradient to obtain the target update gradient. The update module is configured to update multiple parameters in the initial agent based on the target update gradient, and determine whether the initial agent has converged. The third determining module is configured to, in response to determining that the initial agent has not converged, use the updated initial agent as the initial agent in the next round of update operations, use the next time moment adjacent to the target time moment as the target time moment in the next round of update operations, and execute the next round of update operations. The fourth determination module is configured to, in response to determining that the initial agent has converged, identify the initial agent as the target agent and exit at least one round of update operations.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method described in any one of claims 1 to 7.
