Geological safety monitoring and resource scheduling method and system based on large language model
Patent Information
- Application Number
- CN202610625084.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-08
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2046-05-08
AI Technical Summary
传统的经验回放机制采用单一经验池进行统一存储与均匀采样,无法保证高价值边界决策经验在训练过程中被充分学习利用,导致强化学习智能体对极端工况的应对能力不足,收敛速度慢且最终策略的全局最优性难以保障
[0022] Regarding the underlying communication model, this invention establishes a first communication link model between the mobile terminal device and the edge communication base station, and a second communication link model between the edge communication base station and the cloud layer. The first communication link model establishes the uplink and downlink communication links as time-varying Rayleigh fading channels, and calculates the average data transmission rate within a preset time window based on continuous integration using Shannon's theorem, fully considering the dynamic changes in channel state during the movement of the mobile terminal device. The second communication link model uses a time-division multiple access mechanism to evenly allocate bandwidth resources. The two link models together constitute a dynamic data transmission rate, providing a reliable communication rate metric for subsequent accurate calculations of latency and energy consumption. Compared with existing methods that use a fixed transmission rate assumption, the communication model of this invention can reflect the real-time fluctuation of transmission rate with device displacement in mobile scenarios, significantly improving the accuracy of latency prediction.
Smart Images

Figure CN122152483B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of geological safety monitoring technology, specifically relating to a geological safety monitoring and resource scheduling method and system based on a large language model. Background Technology
[0002] In the field of urban geological safety monitoring and early warning, with the acceleration of urbanization, the frequent occurrence of abnormal weather events, and the continuous expansion of the monitoring scope, how to achieve intelligent fusion of multi-source geological sensor data, adaptive scheduling of edge cloud computing resources, and efficient prediction and real-time response to geological risks has become a key technical bottleneck restricting the improvement of smart city safety management.
[0003] Existing geological monitoring systems mostly adopt a centralized cloud computing architecture. All heterogeneous data collected by sensors, such as surface deformation, rainfall, groundwater level, and ground strain, must be transmitted to a remote cloud server for unified processing and analysis. This centralized model presents significant communication bottlenecks and single-point-of-failure risks in complex terrain and multi-node environments: if the cloud server experiences delays, crashes, or network interruptions, the entire early warning process will be disrupted, leading to delays in disaster information processing and missed opportunities for optimal emergency response. Furthermore, this model is highly dependent on communication bandwidth, and in scenarios with dense sensor nodes and massive data volumes, it is prone to network congestion and increased energy consumption, hindering the system's continuous operation and scalability.
[0004] In terms of task scheduling and resource allocation, traditional monitoring systems typically employ static task allocation strategies, which cannot adaptively adjust the allocation of computing and communication resources between edge devices and the cloud based on real-time environmental changes. Specifically, edge mobile devices have limited computing power, while cloud resources are relatively concentrated. When edge nodes are overloaded or communication links are limited, static strategies still force all data to be uploaded to the cloud, leading to a significant increase in system latency and even data loss. Furthermore, existing resource allocation mechanisms fail to fully consider the multi-objective balance between latency, energy consumption, and early warning service quality, and also fail to incorporate the dynamic displacement trajectory of edge mobile devices into the decision-making model. This makes it difficult to effectively schedule inference tasks before the edge device leaves the communication coverage area, thus failing to achieve optimal global resource allocation under an edge-cloud collaborative architecture.
[0005] In terms of model reasoning and intelligent analysis, geological safety monitoring data is characterized by multi-source heterogeneity and strong temporal dependence. Most existing early warning algorithms rely on fixed thresholds or static feature models for risk assessment, lacking the ability to dynamically model the evolution trend of disasters. For example, during continuous rainfall and surface micro-deformation, traditional models cannot fully utilize prior information for autoregressive reasoning to capture spatiotemporal correlation features, easily leading to delayed warnings or false alarms. Although large language models possess cross-modal understanding, knowledge reasoning, and temporal generation capabilities, their large parameter scale and computational complexity make them difficult to deploy directly on edge nodes. Furthermore, the reasoning process of large language models in an edge-cloud collaborative architecture involves two computationally distinct stages: a pre-filling stage and an autoregressive decoding stage. Existing technologies lack fine-grained computational demand modeling methods for the autoregressive reasoning process of large language models, making it impossible to accurately assess the floating-point computational requirements of different reasoning stages, resulting in a lack of quantitative basis for task offloading decisions.
[0006] In solving resource allocation optimization problems using reinforcement learning, existing task offloading methods based on deep reinforcement learning, while capable of handling resource allocation decisions in continuous action spaces, face the challenge of sparse high-value experience samples in geological safety monitoring scenarios. The critical experience samples generated by mobile devices making correct decisions near communication coverage boundaries (such as timely switching to local inference to avoid task failure due to communication interruptions) are extremely scarce and easily overwhelmed by the large number of ordinary experience samples generated under normal communication conditions. Traditional experience replay mechanisms, employing a single experience pool for unified storage and uniform sampling, cannot guarantee that high-value boundary decision experiences are fully learned and utilized during training. This results in insufficient ability of the reinforcement learning agent to cope with extreme conditions, slow convergence speed, and difficulty in guaranteeing the global optimality of the final strategy. Summary of the Invention
[0007] The purpose of this invention is to address the shortcomings of the aforementioned background technology and provide a geological safety monitoring and resource scheduling method and system based on a large language model. This method integrates and optimizes large language model reasoning with edge-cloud collaborative resource scheduling to achieve low latency, low energy consumption, high reliability, and high intelligence in the execution of geological safety monitoring tasks.
[0008] The technical solution adopted in this invention is: a geological safety monitoring and resource scheduling method based on a large language model, comprising the following steps: S1. Construct an edge-cloud collaborative system model, which includes an edge layer, an edge layer, and a cloud layer. The edge layer deploys multi-source sensing nodes and mobile devices, which are mobile devices deployed at geological safety monitoring sites and equipped with an edge-side large language model. The edge layer deploys edge communication base stations. The cloud layer deploys a global resource collaborative orchestration center and a cloud server, with the cloud server deploying a cloud-based large language model. The mobile devices are used to collect data from the multi-source sensing nodes, and the data is converted into an input prompt word sequence for an autoregressive temporal reasoning task. S2. Construct a computational power requirement model for the autoregressive temporal reasoning task based on the input prompt word sequence, and construct an underlying communication model; use the computational power requirement model to evaluate the amount of floating-point computation required to complete the autoregressive temporal reasoning task, and use the underlying communication model to evaluate the dynamic data transmission rate; S3. Combining the floating-point computational complexity and the dynamic data transmission rate, calculate the expected total latency and expected total energy consumption of the autoregressive temporal inference task flowing between the mobile terminal device and the cloud layer; construct a dynamic monitoring trajectory model of the mobile terminal device, and construct a system utility function based on this model, together with the expected total latency and the expected total energy consumption. S4. The process of determining the task unloading location, communication bandwidth allocation ratio, and cloud computing power allocation quota between the mobile terminal device and the cloud layer is abstracted into a Markov decision process. The task prompt word size, maximum tolerable latency limit, mobile terminal device location information, remaining computing resources of the mobile terminal device and the cloud server, distance matrix between nodes, and channel state information are defined as the state space. The system utility function, which includes a penalty mechanism subject to the maximum tolerable latency limit, is defined as the reward function. S5. Start the reinforcement learning scheduling engine deployed in the global resource collaborative orchestration center, and use the TD3 algorithm with an empirical buffer partitioning mechanism to solve the Markov decision process, and output the optimal resource allocation and unloading strategy. S6. In response to the optimal resource allocation and unloading strategy, the device locally calls the terminal-side large language model, or sends it back to the cloud layer to call the cloud-side large language model to perform collaborative reasoning of the autoregressive temporal reasoning task, and outputs geological safety temporal prediction and response instructions.
[0009] In the above technical solution, the multi-source sensing node includes at least two of the following: surface deformation sensor, rainfall sensor, groundwater level sensor, and ground strain sensor; the geological safety time-series prediction and response command includes the geological risk level assessment result and the corresponding early warning response command.
[0010] In the above technical solution, the underlying communication model includes a first communication link model between the mobile terminal device and the edge communication base station, and a second communication link model between the edge communication base station and the cloud layer; The first communication link model establishes the uplink and downlink communication links as time-varying Rayleigh fading channels, and calculates the average data uplink and downlink transmission rates within a preset time window based on Shannon's theorem continuous integration. The second communication link model uses a time-division multiple access mechanism to allocate bandwidth resources on an average basis and calculates the uplink and downlink data transmission rates between the edge communication base station and the cloud layer. The dynamic data transmission rate is jointly calculated by the transmission rates obtained from the first communication link model and the second communication link model.
[0011] In the above technical solution, the computing power requirement model deconstructs the execution process of the large language model of the autoregressive temporal reasoning task into a parallel pre-filling stage and a serial iterative autoregressive decoding stage. The floating-point computation cost of the pre-filling stage is calculated based on the quadratic polynomial equation constructed from the length of the input prompt word sequence, the dimension of the model hidden layer, and the dimension of the feedforward network. The floating-point computation amount of the autoregressive decoding stage is calculated based on the total number of predicted output tokens and the gradual accumulation of key-value cache reused in each generation operation. The sum of the floating-point computation amount in the pre-filling stage and the floating-point computation amount in the autoregressive decoding stage is taken as the floating-point computation amount, and the floating-point computation amount is used as the basis for the decision-making process in the Markov decision-making process to evaluate whether the local computing resources of the mobile terminal device can support the autoregressive temporal inference task and to determine the amount of data to be unloaded to the cloud layer.
[0012] In the above technical solution, the step of constructing the dynamic monitoring trajectory model of the mobile terminal device includes: By obtaining the location coordinates of the mobile terminal device, the location coordinates of the edge communication base station and their effective communication coverage, the remaining communicable distance from the current location of the mobile terminal device to the boundary of the effective communication coverage is calculated simultaneously. Divide the remaining communication distance by the uniform speed of the mobile device to derive the absolute time window constraint boundary for leaving the communication range. The absolute time window constraint boundary is set as the threshold for determining the failure of the autoregressive temporal reasoning task and triggering the penalty mechanism in the reward function.
[0013] In the above technical solution, the calculation logic for the expected total latency and expected total energy consumption is as follows: The expected total latency is the local inference latency of the mobile terminal device, or the sum of the communication latency of the task data being uploaded to the cloud layer via the edge communication base station, the latency of the cloud layer allocating preset computing resources for inference, and the downlink communication latency of the instruction result being transmitted back from the cloud layer to the mobile terminal device via the edge communication base station. The expected total energy consumption is the inference energy consumption of the mobile terminal device, or the sum of the inference energy consumption of the cloud layer and the communication energy consumption during the task data upload and result return process. The system utility function is formed by a weighted combination of the expected total latency, the expected total energy consumption, and the service quality score for each task. The service quality score is in the form of a step function. When the total latency of the task does not exceed the maximum tolerable latency limit, different fixed scores are assigned according to the processing on the edge and the processing on the cloud. When the total latency of the task exceeds the maximum tolerable latency limit, the service quality score is reset to zero.
[0014] In the above technical solution, the step in S5 of using the TD3 algorithm with an empirical buffer partitioning mechanism to solve the Markov decision process includes: Initialize the Actor network, dual Critic network, and their respective target network parameters of the TD3 algorithm agent, and initialize the experience pool; The TD3 algorithm agent is driven to interact with the Markov decision process in the environment, and the action experience data, which includes state, action, immediate reward and next state, is collected into the experience pool. Based on the aforementioned experience buffer partitioning mechanism, the action experience data within the experience pool is distributed and stored separately. During the triggering of neural network iterative training phase, the action experience data is extracted across the buffer by a scaling factor and grouped into a training mini-batch matrix. Calculate the importance sampling weights for the sampled data in different buffers; The loss function is calculated based on the target Q-value deviation equation containing the importance sampling weights, and the dual Critic network and the Actor network are updated to obtain the converged scheduling model parameters.
[0015] The step of dividing and storing the action experience data in the experience pool based on the experience buffer partitioning mechanism is as follows: In the memory system, separate ordinary memory buffers and reward buffers are created; At the end of the time slot for the agent's interaction with the environment, a determination is made based on whether the instant reward value exceeds a preset reward threshold. Action experience data that does not exceed the reward threshold is written into the ordinary memory buffer, while action experience data that exceeds the reward threshold is written into the reward buffer.
[0016] In the above technical solution, the step of extracting the action experience data across the buffer according to the scaling factor and grouping it into a mini-batch matrix for training is as follows: Set a scaling factor to balance the exploration depth and utilization intensity of the strategy; Based on the scaling factor, a first-sized subset of empirical data is randomly extracted from the ordinary memory buffer each time, and a second-sized subset of empirical data is randomly extracted from the reward buffer simultaneously. The first-sized subset of empirical data and the second-sized subset of empirical data are then concatenated to form the training mini-batch matrix.
[0017] In the above technical solution, the step of calculating the importance sampling weights of the sampled data in different buffers respectively: If the action experience data is extracted from the ordinary memory buffer, the initial probability of its sampling and the current total amount of data in the ordinary memory buffer are combined with the annealing coefficient to generate the numerator of the sampling weight. This numerator is then normalized by dividing the numerator by the maximum sampling weight among all samples in the ordinary memory buffer to obtain the gradient correction weight for the ordinary region. If the action experience data is extracted from the reward buffer, the initial probability of its sampling is multiplied by the current total amount of data in the reward buffer, combined with the annealing coefficient, and then normalized by the maximum sampling weight among all samples in the reward buffer, and the gradient correction weight of the reward area is output.
[0018] This invention provides a geological safety monitoring and resource scheduling system based on a large language model, used to implement the method described above. The system includes: The edge-cloud collaborative topology module includes an edge layer with multi-source sensing nodes and mobile devices deployed, an edge layer with edge communication base stations deployed, and a cloud layer with a global resource collaborative orchestration center and cloud servers deployed; wherein, the mobile devices are equipped with an edge-side large language model, and the cloud servers are equipped with a cloud-side large language model. The micro-computing power and kinematic modeling unit is used to evaluate the floating-point computation volume of the two-stage autoregressive process of the large language model using the computing power demand model, and to integrate the dynamic monitoring trajectory model of the mobile terminal device leaving the effective communication coverage area of the base station. The state composite orchestration center is responsible for coordinating the collection of dynamic data transmission rates, available bandwidth, and remaining computing resources of the network, and encapsulating the above parameters into the state space of the Markov decision process. A reinforcement learning decision processor, equipped with an experience buffer partitioning mechanism, is used to train a scheduling model according to the steps described in the above technical solution and output the optimal resource allocation and unloading strategy. The collaborative reasoning and instruction output module is used to respond to the optimal resource allocation and unloading strategy by calling the edge-side large language model locally at the edge layer, or by sending it back to the cloud layer to call the cloud-side large language model to perform collaborative reasoning and output geological safety time series prediction and response instructions.
[0019] The beneficial effects of this invention are as follows: This invention provides a geological safety monitoring and resource scheduling method and system based on a large language model. Compared with the prior art, the overall technical solution of this invention, by constructing an edge-cloud collaborative system model, organically combines the autoregressive temporal reasoning capability of the large language model with the resource scheduling optimization driven by reinforcement learning. It establishes a complete technical closed loop from multi-source geological data acquisition, computing power and communication modeling, multi-objective utility optimization, Markov decision solving to edge-cloud collaborative reasoning execution, realizing edge-cloud integrated intelligent processing of geological safety monitoring tasks, and significantly improving the comprehensive performance of the system in multiple dimensions such as latency, energy consumption, service quality and task completion rate.
[0020] Regarding the edge-cloud collaborative system model, this invention constructs a three-layer edge-cloud collaborative architecture comprising an edge layer, a cloud layer, and a terminal layer. The edge layer deploys multi-source sensing nodes and mobile devices equipped with edge-side large language models. The cloud layer deploys cloud-based large language models and a global resource coordination and orchestration center. The edge layer connects the two ends through edge communication base stations. The technical advantages of this layered architecture are as follows: the edge-side large language model can independently complete inference tasks with high real-time requirements and moderate computational load on mobile devices, avoiding the communication bottlenecks and single-point failure risks caused by the need to upload all data to the cloud in traditional centralized architectures; the cloud-based large language model undertakes deep inference tasks with complex semantics and high computational load, fully leveraging the advantages of the powerful computing power of the cloud; the two are uniformly scheduled through the global resource coordination and orchestration center, achieving complementarity and synergy between edge and cloud computing power, fundamentally solving the problems of response latency and insufficient disaster recovery capabilities caused by centralized allocation of computing resources in traditional systems. At the same time, the mobile devices convert the data from multi-source sensing nodes into input prompt word sequences for autoregressive time-series inference tasks, enabling geological monitoring data to be processed by the large language model in a unified tokenized format, achieving semantic-level fusion of multi-source heterogeneous data. In particular, by integrating multi-dimensional physical quantities such as surface deformation, rainfall, groundwater level and ground strain, the large language model can overcome the limitations of traditional single-sensor static threshold alarms, effectively identify artifact disturbances in complex geological environments, and significantly reduce the system's false alarm rate.
[0021] Regarding the computational demand model, this invention deconstructs the autoregressive inference process of a large language model into a parallel pre-filling stage and a serial iterative autoregressive decoding stage, establishing mathematical models for the floating-point computational load of each stage. The floating-point computational load of the pre-filling stage is calculated based on a quadratic polynomial equation constructed from the length of the input prompt word sequence, the dimension of the model's hidden layer, and the dimension of the feedforward network. The floating-point computational load of the autoregressive decoding stage is calculated based on the total number of predicted output tokens and the gradual accumulation of key-value cache reused in each generation operation. The technical effect of this phased fine-grained modeling is that the computational load of the pre-filling stage increases quadratically with the length of the input prompt word, while the computational load of the decoding stage increases approximately linearly with the total number of output tokens. The distinct growth patterns of the two stages allow the state evaluation in the subsequent Markov decision process to accurately perceive the computational load characteristics of different inference stages. For example, when the input prompt word is long, the quadratic growth characteristic makes the edge device prone to computational overload, and the system tends to offload the task to the cloud accordingly; while when the output sequence is short, the edge device can complete the inference efficiently. This refined modeling provides a quantitative basis for precise matching of computing power between edge and cloud, overcoming the shortcomings of existing technologies that only roughly estimate computing needs based on the total amount of data.
[0022] Regarding the underlying communication model, this invention establishes a first communication link model between the mobile terminal device and the edge communication base station, and a second communication link model between the edge communication base station and the cloud layer. The first communication link model establishes the uplink and downlink communication links as time-varying Rayleigh fading channels, and calculates the average data transmission rate within a preset time window based on continuous integration using Shannon's theorem, fully considering the dynamic changes in channel state during the movement of the mobile terminal device. The second communication link model uses a time-division multiple access mechanism to evenly allocate bandwidth resources. The two link models together constitute a dynamic data transmission rate, providing a reliable communication rate metric for subsequent accurate calculations of latency and energy consumption. Compared with existing methods that use a fixed transmission rate assumption, the communication model of this invention can reflect the real-time fluctuation of transmission rate with device displacement in mobile scenarios, significantly improving the accuracy of latency prediction.
[0023] Regarding the dynamic monitoring trajectory model, this invention obtains the location coordinates of the mobile device, the location coordinates of the edge communication base station, and their effective communication coverage range. It then simultaneously calculates the remaining communicable distance from the mobile device's current location to the boundary of the effective communication coverage range. Dividing this distance by the constant speed of travel, it derives the absolute time window constraint boundary for leaving the communication range. This boundary is then set as the threshold for determining task failure and triggering the penalty mechanism in the reward function. The technical effect of this mechanism is that when the mobile device travels near the communication coverage boundary at the geological safety monitoring site, the reinforcement learning scheduling engine can perceive the impending risk of communication interruption. In its strategy decision-making, it proactively avoids the high-latency cloud offloading scheme and switches to local inference on the device side, thereby preventing task failure due to network disconnection. This allows the resource scheduling strategy to not only optimize latency and energy consumption when communication conditions are good, but also ensure reliable task completion when communication conditions deteriorate, significantly improving the system's robustness in highly dynamic mobile scenarios.
[0024] Regarding the system utility function, this invention weights and combines the expected total latency, expected total energy consumption, and service quality score to form the system utility function. The service quality score is presented as a step function, assigning different fixed scores based on edge processing and cloud processing respectively when the total task latency does not exceed the maximum tolerable latency limit; otherwise, the score is reset to zero. This design integrates the three mutually constraining optimization dimensions of latency, energy consumption, and service quality into a single objective function. It also incorporates a penalty mechanism constrained by the maximum tolerable latency limit, enabling the reinforcement learning agent to automatically identify and avoid undesirable strategies that lead to task timeouts during the exploration process. This achieves multi-objective joint optimization of minimizing latency, minimizing energy consumption, and maximizing service quality under latency constraints.
[0025] In Markov decision process modeling, this invention abstracts the process of determining the task offloading location, communication bandwidth allocation ratio, and cloud computing power allocation quota between the mobile device and the cloud layer into a Markov decision process. The task prompt size, maximum tolerable latency limit, mobile device location information, remaining computing resources of the mobile device and cloud server, inter-node distance matrix, and channel state information are defined as the state space. The technical advantage of this modeling approach is that it unifies discrete offloading decisions and continuous resource allocation decisions into a single decision framework. Through rich state space design, the agent can comprehensively perceive current task characteristics, network status, device location, and computing power reserves, thereby making a globally optimal joint decision. This overcomes the limitations of existing technologies where offloading decisions and resource allocation are separated and cannot be optimized collaboratively.
[0026] In terms of reinforcement learning solutions, this invention activates a reinforcement learning scheduling engine deployed in a global resource collaborative orchestration center. It employs the TD3 algorithm, which incorporates an experience buffer partitioning mechanism, to solve the aforementioned Markov decision process, obtaining a joint optimization strategy for task unloading location, communication bandwidth allocation ratio, and cloud computing power allocation. This mechanism establishes independent ordinary memory buffers and reward buffers within the memory system. Action experience data is distributed and stored based on whether the immediate reward value exceeds a preset reward threshold. During the training phase, experience data is extracted across buffers using a proportional factor and grouped into a mini-batch matrix for training. The technical effect of this design is that it physically isolates high-value experience samples (such as key experiences generated by mobile devices making correct decisions near communication coverage boundaries) from massive amounts of ordinary samples, and ensures that the proportion of high-value samples remains constant in each training iteration, unaffected by the training process, using a fixed proportional factor. Compared to traditional priority experience replay methods, the fixed-proportion guaranteed sampling mechanism of this invention ensures that even when the strategy approaches convergence in the later stages of training, the agent can still continuously access key decision experiences near the communication coverage boundary, maintaining sensitivity and coping ability to extreme conditions. Experiments show that after introducing the experience buffer partitioning mechanism, the convergence speed of the improved TD3 algorithm is increased by about 43% compared with the original TD3 algorithm, and the convergence reward value is also significantly increased.
[0027] Furthermore, this invention designs independent importance sampling weight calculation formulas for the ordinary memory buffer and the reward buffer, respectively, and each is independently normalized using the current total data volume and maximum sampling weight of its corresponding buffer. The advantage of using heterogeneous formulas instead of a unified formula is that the data sizes of the two buffers often differ significantly. If a unified weight formula is used for correction, the gradient contribution of samples in the smaller reward buffer will be excessively amplified or suppressed, making the network training process unstable. Independent normalization ensures a reasonable gradient correction ratio within each buffer, avoiding interference from non-independent identically distributed bias caused by cross-buffer sampling, and guaranteeing the unbiasedness and stability of parameter updates in the dual Critic and Actor networks. Simultaneously, the annealing coefficient introduced in the weight calculation formula can dynamically smooth the sampling weights as the training progresses, further mitigating network oscillations caused by abrupt changes in sample distribution and accelerating the smooth convergence of the scheduling strategy to the global optimum.
[0028] In terms of collaborative reasoning and command output, this invention responds to optimal resource allocation and offloading strategies, locally calling the edge-side large language model on the mobile device or transmitting back to the cloud layer to call the cloud-side large language model to perform collaborative reasoning tasks for autoregressive temporal reasoning. The final output includes geological risk level assessment results and corresponding early warning response commands for geological safety temporal prediction. The edge-side reasoning path ensures reliable task execution even when communication conditions deteriorate, while the cloud-side reasoning path utilizes the deep semantic understanding capabilities of the complete model to achieve high-precision risk reasoning. The two complement each other under the unified scheduling of the optimal strategy. The output geological risk level assessment results, combined with the graded early warning response commands, constitute a complete intelligent closed loop from data acquisition to decision output. This enables the system to automatically generate differentiated emergency response measures for different risk levels, greatly improving the automation level and response efficiency of geological safety monitoring. Attached Figure Description
[0029] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a system architecture diagram of the present invention; Figure 3 This describes the inference process of the transformer model in the embodiment; Figure 4 This is a diagram of the algorithm network structure of this invention; Figure 5 This is the training convergence graph of the resource allocation algorithm based on the improved TD3 algorithm of this invention; Figure 6 This is a schematic diagram illustrating the impact of the number of tasks on the average latency in the resource allocation algorithm based on the improved TD3 algorithm of this invention; Figure 7 This is a schematic diagram illustrating the impact of the number of tasks on average energy consumption in the resource allocation algorithm based on the improved TD3 algorithm of this invention; Figure 8 This is a schematic diagram illustrating the impact of the number of tasks in the resource allocation algorithm based on the improved TD3 algorithm of this invention on the average service quality score; Figure 9 This is a schematic diagram illustrating the impact of the number of tasks on the task completion rate in the resource allocation algorithm based on the improved TD3 algorithm of this invention; Figure 10 This is a schematic diagram illustrating the impact of the prompt size of the resource allocation algorithm based on the improved TD3 algorithm of this invention on the average latency; Figure 11 This is a schematic diagram illustrating the impact of the prompt size of the resource allocation algorithm based on the improved TD3 algorithm of this invention on the average energy consumption; Figure 12 This is a schematic diagram illustrating the impact of the prompt size of the resource allocation algorithm based on the improved TD3 algorithm of this invention on the average service quality score; Figure 13 This is a schematic diagram illustrating the impact of the prompt size of the resource allocation algorithm based on the improved TD3 algorithm of this invention on the task completion rate; Figure 14 This is a schematic diagram illustrating the impact of the maximum tolerable delay on the average delay of the resource allocation algorithm based on the improved TD3 algorithm of this invention; Figure 15 This is a schematic diagram illustrating the impact of the maximum tolerable delay on average energy consumption of the resource allocation algorithm based on the improved TD3 algorithm of this invention; Figure 16 This is a schematic diagram illustrating the impact of the maximum tolerable latency of the resource allocation algorithm based on the improved TD3 algorithm of this invention on the average service quality score; Figure 17 This is a schematic diagram illustrating the impact of the maximum tolerable latency of the resource allocation algorithm based on the improved TD3 algorithm of this invention on the task completion rate. Detailed Implementation
[0030] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments to facilitate a clear understanding of the present invention, but these descriptions do not constitute a limitation on the present invention.
[0031] It should be noted that in the following specific implementations, "autoregressive temporal reasoning task" and "autoregressive generation task" are equivalent expressions, both referring to the temporal reasoning process of a large language model predicting the next token based on historical tokens. The geological safety monitoring involved in this invention covers, but is not limited to, urban geological anomaly monitoring and early warning, geological environmental risk assessment, mine safety monitoring, and other application scenarios requiring real-time analysis and intelligent decision-making of multi-source geological sensor data. The following embodiments use urban geological sudden anomaly monitoring and early warning as a specific scenario for illustration; however, those skilled in the art should understand that the method described in this invention is also applicable to other geological safety monitoring scenarios, simply by replacing the multi-source sensing nodes with sensor combinations corresponding to the scenario, and replacing the geological safety temporal prediction and response commands with prediction and decision outputs corresponding to the scenario.
[0032] Example 1 This embodiment provides a geological safety monitoring and resource scheduling method based on a large language model, such as... Figure 1As shown, it includes the following steps S1 to S6. S1 constructs the basic architecture of the edge-cloud collaborative system model; S2 constructs the computing power requirement model and the underlying communication model on this architecture; S3 uses the output of S2 to calculate latency and energy consumption and combines them with trajectory constraints to construct the system utility function; S4 embeds the utility function of S3 into a Markov decision process as the reward function; S5 solves the decision process using an improved TD3 algorithm and outputs the optimal policy; S6 executes collaborative inference on the edge or cloud according to the optimal policy and outputs the final instruction. The specific implementation flow of each step is as follows.
[0033] S1. Construct a cloud-edge collaborative system model.
[0034] like Figure 2 As shown, a cloud-edge collaborative system model for geological safety monitoring is constructed. This system model consists of a three-layer structure: the edge layer, the cloud layer, and the terminal layer.
[0035] A complete cloud-based large language model is deployed on the cloud layer, consisting of multiple cloud servers (i.e., computing nodes) and a global resource orchestration center. The cloud servers provide powerful computing performance, responsible for handling semantically complex autoregressive temporal inference tasks. The global resource orchestration center performs overall task offloading decisions and bandwidth and computing resource allocation decisions.
[0036] The edge layer deploys edge communication base stations, connecting the terminal layer and the cloud layer, serving as a relay communication bridge between them. Communication between the edge communication base stations and mobile devices, as well as between the edge communication base stations and the cloud server, is conducted via 5G; communication between the global resource coordination and orchestration center and the cloud server is conducted via wired fiber optic cable.
[0037] The edge layer deploys multi-source sensing nodes and mobile edge devices. The multi-source sensing nodes include at least two of the following: surface deformation sensors, rainfall sensors, groundwater level sensors, and ground strain sensors. The mobile edge devices are mobile devices deployed at geological safety monitoring sites, equipped with a lightweight edge-side large language model, capable of performing real-time, low-computational autoregressive temporal inference tasks locally. In specific urban geological disaster monitoring scenarios, the implementation forms of mobile edge devices include, but are not limited to, geological monitoring drones, geological survey vehicles, and other mobile platforms equipped with edge computing capabilities. The multi-source sensing nodes may also include environmental parameter acquisition devices such as temperature and humidity sensors.
[0038] like Figure 2As shown on the right, based on the aforementioned edge-cloud collaborative system model, this invention constructs an edge-cloud collaborative resource allocation model for geological safety monitoring tasks. This model consists of four core sub-models: a geological safety temporal inference task generation model (corresponding to the computing power requirement model in S2, which transforms multi-source sensing data into an autoregressive temporal inference task and quantifies its floating-point computation), a data transmission model (corresponding to the underlying communication model in S2, which quantifies the transmission rate of each communication link), a monitoring trajectory model (corresponding to the dynamic monitoring trajectory model in S3, which quantifies the communication time constraints of mobile devices), and a system utility model (corresponding to the system utility function in S3, which integrates latency, energy consumption, and service quality into optimization objectives). The outputs of the above four sub-models are collectively incorporated into the Markov decision process and reinforcement learning solution framework in S4 and S5.
[0039] In this embodiment, the overall process of edge-cloud collaborative resource scheduling for geological safety monitoring tasks is as follows: ① Multi-source sensing nodes continuously collect geological environmental parameters. Mobile devices aggregate and preliminarily process the data, tokenizing it into an input prompt word sequence for an autoregressive time-series inference task. ② The global resource collaborative orchestration center, based on the current global environmental information (including network status, device location, available computing power, etc.), uses the improved TD3 algorithm proposed in this invention to formulate task offloading strategies and bandwidth and computing resource allocation strategies. ③ For tasks decided to be offloaded to the cloud layer for inference, their input prompt word sequences are uploaded to the cloud layer via edge communication base stations according to the allocated bandwidth resources. ④ According to the computing resource allocation strategy, the cloud server calls the cloud-based large language model to perform inference on tasks offloaded to the cloud layer; simultaneously, tasks decided to be executed locally are inferred by the mobile devices calling the edge-side large language model. ⑤ The cloud layer sends the inference results to the mobile devices via edge communication base stations according to the allocated bandwidth resources. Finally, the mobile devices integrate the inference results from the edge and cloud sides to generate geological safety time-series prediction and response instructions.
[0040] In the above process, the generation of the optimal decision involved in step ② is the core technical problem of this invention. To achieve this optimal decision, it is necessary to first quantify the computing power requirements and communication transmission capabilities of the inference task in S2, then establish a mathematical model of latency, energy consumption, and trajectory constraints in S3, and finally solve the globally optimal policy through a reinforcement learning framework in S4 and S5. The following steps are carried out in the order of S2 to S6.
[0041] S2. Construct a computing power demand model and an underlying communication model.
[0042] This step addresses two parallel modeling problems: first, quantifying the floating-point computation required for autoregressive temporal inference tasks to execute on a large language model (i.e., the computational power requirement model), to determine whether the edge device is capable of completing the inference locally; second, quantifying the data transmission rate between the edge layer, the terminal layer, and the cloud layer (i.e., the underlying communication model), to assess the communication latency incurred when the task is offloaded to the cloud. The outputs of both models will be used together in S3 as inputs to calculate the expected total latency and expected total energy consumption. Specifically, the process includes the following: S2.1: Construct a computing power demand model.
[0043] Geological monitoring data (such as surface deformation, rainfall, groundwater level, and ground strain) collected by multi-source sensing nodes are tokenized by mobile devices and used as input for inference in a large language model based on the Transformer architecture. The inference process requires the model to predict the next token based on historical tokens; therefore, the geological safety monitoring task is an autoregressive temporal inference task (i.e., an autoregressive generation task). Unlike traditional DNN tasks, autoregressive inference tasks involve repeated forward passes, relying on previously generated tokens when generating each token.
[0044] Autoregressive inference consists of a pre-filling stage and an autoregressive decoding stage. In the pre-filling stage, the model first receives an input prompt, breaks down the inference task into smaller tokens using a tokenizer, converts them into vector representations through an embedding layer, outputs the first token after one inference iteration, and stores the key-value cache for each token. The model then enters the autoregressive decoding stage, combining the output token with the key-value cache as the next input to continue inference until it is complete. The pre-filling stage ensures complete encoding of the initial context, while the autoregressive decoding stage utilizes a caching mechanism for efficient iteration. The combination of these two stages enables the model to smoothly complete complex text generation tasks. The Transformer model inference process is as follows: Figure 3 As shown.
[0045] As a concrete example, the model first splits the input data into a token sequence ["increased soil moisture", "greater surface deformation", "increased rainfall", "decreased groundwater level"]. After one forward pass, the model generates the first output token "low risk" and stores the calculated K and V matrices in the KV cache. Then, the model enters the autoregressive decoding stage, which is a cyclical process: the first token "low risk" generated in the input pre-filling stage is combined with the KV cache and forward passed to generate "medium risk"; the "medium risk" token is input and combined with the KV cache to generate "warning"; finally, the "warning" result is input and combined with the KV cache to generate the end marker "EOS", and the inference ends.
[0046] Each forward pass in the aforementioned autoregressive inference process involves a large number of floating-point operations. To accurately assess its computational resource requirements so that the subsequent Markov decision process can accurately determine whether the edge device has the computing power to complete the inference locally, it is necessary to mathematically model the floating-point computation volume of the pre-filling stage and the autoregressive decoding stage respectively.
[0047] During the pre-filling stage, the inference process mainly includes a multi-head attention layer and a feedforward neural network layer.
[0048] First, in the multi-head attention layer, the input cue word sequence needs to undergo Q, K, V matrix operations for each attention head. This stage requires a significant amount of floating-point computation. d represents the hidden layer dimension of the Transformer model (i.e., the vector representation dimension of each token after the embedding layer transformation). This represents the length of the input prompt word sequence. Then, all Q matrices need to be multiplied by the K matrix to calculate the attention score. Next, the attention matrix needs to be multiplied by the cached V matrix. The required floating-point computation is... Finally, output projection is required, and the floating-point computation time is... Therefore, the floating-point computation cost of the multi-head self-attention layer is: The feedforward neural network layer, following the self-attention layer, is used for feature transformation and non-linear activation. It contains two fully connected layers, FC1 and FC2. The floating-point computation cost of the feedforward neural network layer is... .in, This represents the dimension of the intermediate layer in a feedforward neural network. It is generally proportional to the input dimension, denoted as , This represents the scaling factor of the intermediate layer dimension in a feedforward neural network.
[0049] The computational cost described above is only for a single Transformer layer. Assume the large language model contains a total of... Transformer layers (i.e.) (A combination of sequentially stacked self-attention layers and feedforward neural network layers), then the total floating-point computation of the large language model in the pre-filling stage is: After the pre-filling phase, the model enters the autoregressive decoding phase. In this phase, the model generates the next token step by step based on the context saved in the pre-filling phase and updates the KV cache until the maximum generation length is reached or the generation end symbol is reached. Unlike the pre-filling phase, the autoregressive decoding phase avoids redundant computation by reusing the KV cache, so it does not need to reason about the entire input sequence, but only needs to process the previous output token.
[0050] The autoregressive decoding stage avoids recalculating the prompt with all previously generated tokens as new inputs by reusing the KV cache, and caches the newly generated KV values in the K cache for easy reuse in subsequent autoregressive generation.
[0051] In multi-head attention, the floating-point computation required to calculate the Q, K, and V vectors is: Then, the Q vector needs to be multiplied by the K vector in the KV cache to calculate the attention score, and the new K and V vectors are appended to the KV cache. When the m-th token is generated, the KV cache already stores the pre-filled phase data. Each token and those generated during the previous autoregressive decoding phase. Each token needs to be cached. Calculating the attention score from the K vectors of each token requires a floating-point computation of . Next, the attention matrix needs to be multiplied by the V vector in the cache, which requires a floating-point computation of [calculation value missing]. Finally, output projection is required, and the floating-point computation time is... In feedforward neural networks, similar to the pre-filling stage, the required floating-point computation is... .
[0052] Therefore, the total number of tokens predicted in the autoregressive decoding stage is The autoregressive generation task of each token, considering The total floating-point computation of a large language model with one Transformer layer and an autoregressive decoding stage is: In a preferred embodiment, the dimensionality multiplier r of the intermediate layer of the feedforward neural network is set to 4, in which case the floating-point computation cost per step of the feedforward neural network layer is 16d. 2 .
[0053] The floating-point computation amount in the pre-filling stage The floating-point computational complexity of the autoregressive decoding stage The sum of these amounts represents the total floating-point computation required for this autoregressive temporal reasoning task. : .
[0054] The computational cost of the two-stage process varies with the length of the input prompt. and the total number of output tokens The growth exhibits a completely different pattern: the computational load of the pre-filling stage and... It forms a quadratic relationship, and the computational cost of the decoding stage is... The relationship is approximately linear. This differentiated modeling allows the state assessment in the subsequent Markov decision process to accurately perceive the computational load characteristics at different inference stages, thereby making more accurate task offloading decisions: when the input prompt is long (i.e., When the output sequence is relatively large, the secondary growth characteristic of the pre-filling stage makes the edge device prone to computing power overload, and the system tends to offload the task to the cloud accordingly; while when the output sequence is short, the edge device can complete the inference efficiently. This refined modeling is the key technical foundation for the accurate matching of computing power between the edge and the cloud in this invention, and it is also the core improvement that distinguishes it from the existing coarse-grained computing power evaluation methods.
[0055] The total floating-point computation This will directly serve as the basis for evaluating whether the local computing resources of the mobile device can support the autoregressive temporal inference task and determining the amount of data to be unloaded to the cloud layer during the S4 Markov decision process.
[0056] S2.2, Construct the underlying communication model.
[0057] After completing the computing power requirement model, it is also necessary to construct an underlying communication model to evaluate the transmission rate of data flowing between the edge layer, the terminal layer, and the cloud layer. When the inference task is offloaded to the cloud layer, the data needs to pass through two communication links in sequence: the first link is the wireless link from the mobile terminal device to the edge communication base station (first communication link), and the second link is the link from the edge communication base station to the cloud server (second communication link). Therefore, it is necessary to establish transmission rate models for these two links separately. The transmission rates calculated by the two link models will be combined to form the dynamic data transmission rate, and together with the aforementioned floating-point computation, they will be used in S3 to calculate the expected total latency and expected total energy consumption.
[0058] Constructing the first communication link model (mobile terminal device) The process of edge communication base stations is as follows: Considering the mobility of mobile devices and the constantly changing distance between them and edge communication base stations, this invention assumes that the channel state information from the mobile device to the edge communication base station is time-varying. The mobile device and the edge communication base station use a Time Division Multiple Access (TDMA) communication method to share bandwidth on average. The first communication link model models the uplink and downlink communication links between the mobile device and the edge communication base station as independent time-varying Rayleigh fading channels.
[0059] According to Shannon's theorem, at a certain moment Mobile devices With edge communication base stations The formula for the uplink data transfer rate between them is as follows: in, Mobile device and edge communication base stations Uplink bandwidth resources Mobile device The transmission power, It is noise power. Mobile device With edge communication base stations At any moment Channel gain.
[0060] The formula for calculating channel gain is: in, It's the speed of light. It is the carrier frequency. Mobile device With edge communication base stations At any moment distance, It is the Rayleigh fading coefficient.
[0061] Due to mobile devices The distance to the edge communication base station continuously changes, causing instantaneous transmission rates to fluctuate accordingly. To obtain a stable metric reflecting communication capability over a period of time, this invention continuously integrates the instantaneous transmission rate within a connection time window to calculate the average transmission rate. (Mobile terminal device) With edge communication base stations During connection time (The average uplink data transmission rate within this connection time is given by the dynamic monitoring trajectory model in S3) is formulated as follows: in, Denotes a continuously integral variable, with a range of values [t, t+T]. k,i (t)], ( )express The instantaneous uplink data transmission rate between the mobile terminal device k and the edge communication base station i at any given time.
[0062] Similarly, edge communication base stations With mobile devices The formula for the average downlink data transmission rate between them is as follows: in, It is an edge communication base station and mobile devices Downlink bandwidth resources between It is an edge communication base station The transmission power, This indicates that the edge communication base station i and the mobile terminal device k are in... Downlink channel gain at time t.
[0063] Constructing a second communication link model (edge communication base station) The process (cloud layer) is as follows: After data reaches the edge communication base station via the first communication link, it still needs to be transmitted to the cloud server via the second communication link. Unlike the first communication link, the location relationship between the edge communication base station and the cloud server is relatively fixed, and there are no time-varying channel characteristics caused by mobility. The second communication link uses a time division multiple access (TDMA) mechanism to evenly allocate bandwidth resources for communication.
[0064] Edge communication base station With cloud layer nodes The formula for the uplink data transfer rate between them is as follows: in, It is an edge communication base station and cloud layer nodes The uplink bandwidth between them is evenly distributed. It is an edge communication base station and cloud layer nodes The distance between them It is an edge communication base station The transmit power. The channel gain between edge communication base station i and cloud layer node j is: in, Indicates edge communication base station With cloud layer nodes The Rayleigh fading coefficient between them.
[0065] Similarly, cloud layer nodes With edge communication base stations The formula for the downlink data transmission rate between them is as follows: in, It is a cloud layer node and edge communication base stations The downlink bandwidth between them is evenly distributed. It is a cloud layer node The transmission power. Represents cloud layer nodes With edge communication base stations Downlink channel gain between.
[0066] Combining the two communication link models above, the dynamic data transmission rate is calculated from the average uplink / downlink transmission rate of the first communication link model. , ) and the uplink / downlink transmission rate calculated by the second communication link model ( , These four transmission rates will be used in the next step S3 to calculate the segment components of the task upload delay and the result return delay, respectively.
[0067] S3. Calculate the expected total delay and expected total energy consumption, and construct the system utility function.
[0068] In S2, the computing power requirement model and the underlying communication model have been constructed, and the total floating-point computation required for the autoregressive temporal inference task has been obtained. And the dynamic data transmission rate of each communication link segment. This step will utilize the above modeling results to first construct a dynamic monitoring trajectory model to determine the effective communication connection time constraint between the mobile terminal device and the edge communication base station. Then, under this constraint, the expected total latency and expected total energy consumption when the task is executed on the terminal or in the cloud will be calculated. Finally, the three factors of latency, energy consumption, and service quality score will be weighted and combined into a system utility function, which will serve as the optimization objective for the subsequent S4 Markov decision process. Specifically, the following processes are included: S3.1, Construct a dynamic monitoring trajectory model: Because mobile devices are mobile, if they leave the coverage area of the current edge communication base station, the communication link will be interrupted, and the ongoing cloud-based collaborative inference task will be unable to complete. Therefore, before calculating latency and energy consumption, it is necessary to first establish a dynamic monitoring trajectory model to quantify the remaining communicable time of the mobile device within the current communication coverage area, using this as a spatiotemporal hard constraint for all subsequent calculations.
[0069] Mobile devices can only initiate collaborative inference requests within the communication range of the edge communication base station. If you want to use edge communication base stations When uploading a task, the distance between the two must satisfy the following constraint: in, Indicates edge communication base station The effective communication coverage area (i.e., communication radius). and Indicates edge communication base station Location coordinates, and Indicates in Mobile devices at all times The location coordinates.
[0070] Since the actual movement direction of mobile devices is diverse, to simplify modeling and ensure the robustness of the scheduling strategy, we assume that the mobile devices... exist Constantly requesting communication with edge communication base stations If the mobile device is considered to be traveling at a constant speed within a certain time slot during communication, then the mobile device... The maximum drivable distance from the current location along the most favorable direction of movement to the boundary of the effective communication coverage area, i.e., the upper bound estimate of the remaining communicable distance. for: Dividing the remaining communication range by the constant travel speed allows us to deduce the mobile device's capabilities. After driving out of the edge communication base station Absolute time window constraint boundary for maintaining communication connection with the base station before the communication range. : in, Indicates mobile device The remaining communicable distance from the current location to the boundary of the effective communication coverage area. This represents the moving speed of mobile device k at time t.
[0071] The technical effect of introducing this absolute time window constraint boundary is that when a mobile device travels near the communication coverage boundary at a geological safety monitoring site, the reinforcement learning scheduling engine can sense the impending risk of communication disruption and proactively avoid high-latency cloud offloading solutions in its policy decision-making. Instead, it prioritizes completing inference tasks locally on the device, thereby preventing task failure due to network disconnection. This mechanism enables the resource scheduling strategy to not only optimize latency and energy consumption when communication conditions are good, but also ensure reliable task completion when communication conditions deteriorate, significantly improving the system's robustness in highly dynamic mobile scenarios.
[0072] It should be noted that here... This also represents the upper limit of continuous integration in the first communication link model of the S2 underlying communication model when calculating the average transmission rate—that is, the effective communication connection time between the mobile device and the edge communication base station. This reflects the inherent coupling relationship between the trajectory model and the communication model.
[0073] S3.2, Calculate the expected total delay: Once the communication time constraints of the mobile device are defined, the expected total latency of the autoregressive temporal inference task under different execution paths (local execution on the device or offloading execution in the cloud) can be calculated. The system latency includes three parts: task upload latency, task inference latency, and task return latency.
[0074] (1) Delay of the local inference path If task If executed locally on the endpoint, its latency is determined solely by local inference latency. constitute: in, Indicates the mobile terminal device per unit time The number of FLOPs that can be calculated.
[0075] (2) Delay of cloud uninstallation path If task When inference is performed on the cloud layer, the latency consists of three parts: upload latency, cloud inference latency, and return latency.
[0076] Upload latency: Data needs to be uploaded from the mobile device. Transmitted to the edge communication base station via the first communication link Then it is transmitted to the cloud layer node via the second communication link. .in, Indicates task The amount of data uploaded after the input prompt sequence is tokenized. Mobile device. To edge communication base station The upload latency is: Edge communication base station To cloud layer nodes The upload latency is: Combining the two segments, the total upload latency for unloading to the cloud layer is: Cloud inference latency: in, Represents cloud layer nodes Assigned to Computing resources.
[0077] Return latency: After the cloud-based inference is completed, the inference results need to be returned to the mobile device. Above. Among them, This represents the amount of data in the cloud layer inference output. (From cloud layer nodes) To edge communication base station The return delay is: From edge communication base stations To mobile devices The return delay is: Combining the two stages, the task result is returned from the cloud layer to the mobile device. The total return latency is: (3) Segmented expression of expected total delay In summary, reasoning tasks The expected total latency has the following segmented structure: S3.3, Calculate the expected total energy consumption: Based on the calculated total expected latency, it is also necessary to assess the total expected energy consumption in order to construct a system utility function in S3.4 that simultaneously considers latency and energy consumption. System energy consumption comprises two parts: inference energy consumption and communication energy consumption. Inference energy consumption is the energy consumed during inference tasks, either locally or in the cloud, and primarily depends on the computational load of the task and the power characteristics of the devices. Communication energy consumption is the energy consumed during data transmission and communication, and is affected by factors such as data volume, transmission distance, communication protocols, and the power characteristics of the communication equipment.
[0078] (1) Energy consumption of local inference path In the Within each time slot, the reasoning task Mobile devices The energy required to perform reasoning is: in, Indicates mobile device The calculated power.
[0079] (2) Energy consumption of cloud unloading path Reasoning task The energy required to perform inference at the cloud layer is: in, Represents cloud layer nodes The calculated power.
[0080] Mobile devices will perform inference tasks The communication energy consumption generated when uploading to the cloud layer is: in, Indicates mobile device With edge communication base stations Transmission power between Indicates edge communication base station With cloud layer nodes The power transmitted between them.
[0081] The cloud layer returns the inference results to the mobile device. The resulting communication energy consumption is: in, Represents cloud layer nodes To edge communication base stations Transmission power when transmitting inference results; Indicates edge communication base station To mobile devices Transmission power when sending out inference results.
[0082] (3) Piecewise expression of expected total energy consumption In summary, for The expected total energy consumption is structured as follows: S3.4, Calculate the system utility function.
[0083] The aforementioned expected total latency and expected total energy consumption quantify the cost of task execution from two dimensions, but they may conflict in their optimization directions—for example, offloading tasks to the cloud can usually reduce inference latency but increase communication energy consumption. Therefore, it is necessary to integrate latency, energy consumption, and the service quality score that characterizes inference quality into a single system utility function as a comprehensive optimization objective for resource scheduling.
[0084] The system utility function is formed by a weighted combination of the expected total latency, expected total energy consumption, and service quality score for each task. The service quality score is expressed as a step function: when the total task latency does not exceed the maximum tolerable latency limit... At that time, different fixed scores are assigned based on whether the processing is done on the edge or in the cloud; when the total latency of the task exceeds the maximum tolerable latency limit, the service quality score is reset to zero. System utility function The definition is as follows: in, , , These are the weighting coefficients for service quality score, latency, and energy consumption, respectively. Indicates time slot Total system utility within; Indicates time slot The total number of tasks pending processing; Indicates the task number. The service quality score is defined as follows: in, and These are fixed service quality scores for edge processing and cloud processing, respectively. This demonstrates the improved service quality resulting from the enhanced reasoning capabilities of cloud-based large language models.
[0085] Furthermore, when the total task latency exceeds the absolute time window constraint boundary defined in S3.1... When the mobile device has moved out of the communication coverage area, it is also considered a task failure, and the service quality score is reduced to zero, resulting in a severe penalty effect in the reward function. This mechanism organically couples the trajectory constraints of S3.1 with the utility function here, making it necessary for the reinforcement learning scheduling engine to consider the spatiotemporal constraints of communication coverage when optimizing resource allocation.
[0086] S4. Model the resource allocation problem as a Markov decision process.
[0087] In S3, a system utility function has already been constructed, whose inputs involve three adjustable dimensions: task offloading location (edge or cloud), communication bandwidth allocation ratio, and cloud computing power allocation quota. This step abstracts the joint decision-making process of these three dimensions into a Markov Decision Process (MDP) so that it can be solved using reinforcement learning algorithms in S5.
[0088] A standard MDP model consists of a quadruple It indicates. Among them, Represents the state space. Represents the action space, It is the state transition probability. The reward is based on the state of the action performed. In the problem of this invention, the state transition probability... Since the state of communication environment, device location, etc. is unknown (because the evolution of state is random and unpredictable), it cannot be solved directly using model-based dynamic programming methods. Instead, model-free reinforcement learning algorithms are needed to learn the optimal policy by repeatedly interacting with the environment.
[0089] State space: State space It contains all variables that may affect the agent's decision-making, such as computational load, channel state, and available computing resources. System state Representing time slots The environmental information observed in the study. Among them, The definition is as follows: This includes the size of the task prompt words. Maximum tolerable delay limit Location information of mobile devices and Remaining computing resources on mobile devices Remaining computing resources on cloud servers Distance matrix between nodes and channel state information System status It can be represented as , where n represents the number of mobile devices that have initiated collaborative reasoning requests in the current time slot. k is the mobile device ID that initiated the task, used as part of the state to help the agent identify the source of the request. {c j (t)|j∈[1,M]} represents the set of remaining computing resources of each server node in the cloud layer, and M represents the total number of cloud server nodes.
[0090] Motion space: Motion space It includes decisions on offloading all mobile-side device tasks and allocating bandwidth and computing resources. For actions... , can be represented as .in, , This indicates that the task is executed locally. This indicates that the process will be uninstalled and executed in the cloud layer. bandwidth Cloud server computing resources .in, This represents the bandwidth resources allocated to the uplink between mobile device k and edge communication base station i. This represents the bandwidth resources allocated to the downlink between edge communication base station i and mobile device k. This represents the computing resources allocated by cloud layer node j to the task submitted by mobile device k. The above variables represent the total number of edge communication base stations in the system. All of the above variables are positive continuous variables. V represents the total number of mobile terminal devices in the system.
[0091] Reward function: The agent in the state Next action You will receive a reward later. The optimization problem of this invention is to maximize the system utility function. The reward function is defined as: That is, the system utility function constructed in S3.4 This serves as the reward function. The reward function is already implicitly subject to a maximum tolerable latency limit. and absolute time window constraint boundary The dual penalty mechanism is as follows: when a task fails due to timeout or communication disconnection, the service quality score is reduced to zero, causing a significant drop in the utility function, which guides the agent to learn to avoid such decisions.
[0092] S5. Solving Markov decision processes based on the improved TD3 algorithm.
[0093] Given that the MDP state transition probabilities defined in S4 are unknown, and the action space contains continuous variables (bandwidth allocation) , and computing power allocation This invention selects the TD3 (Twin Delayed Deep Deterministic Policy Gradient) algorithm as the solution framework. The TD3 algorithm is a model-free deep reinforcement learning algorithm oriented towards continuous action spaces, capable of handling high-dimensional continuous decision-making problems. Based on the standard TD3, this invention introduces an experience buffer partitioning mechanism to address the problem that high-value experience samples (such as decision data generated by mobile devices near communication coverage boundaries) are extremely sparse in geological safety monitoring scenarios and easily overwhelmed by a large number of conventional samples.
[0094] like Figure 4 As shown, the network architecture of this improved TD3 algorithm consists of two parts: a main network and a target network. The main network includes one Actor network and two Critic networks (i.e., a dual Critic network): the Actor network receives the environmental state of the current time slot. As input, output continuous action (Including offloading decisions, bandwidth allocation, and computing power allocation); the two Critic networks respectively receive state-action pairs. Each independently evaluates the Q value and The TD errors (TD-error1 and TD-error2) are calculated separately, and the network parameters are updated by minimizing the TD errors. The target network has the same structure as the main network, containing one target Actor network and two target Critic networks: the target Actor network receives the next state. Generate target action Two target Critic networks are used to evaluate the Q-values in the next state, and the smaller of the two values is taken as the target Q-value. Used to calculate TD error. The parameters of the target network are slowly updated to track the parameters of the main network through a soft update mechanism to ensure the stability of the training process. Based on this network architecture, this invention further introduces an experience buffer partitioning mechanism to optimize the training process. The specific steps of this improved TD3 algorithm are as follows: S5.1, Initialize the network and experience pool: Actor Network and dual Critic network , Through randomized parameters , and Initialization. Then, initialize the parameters of the three target networks according to the three networks respectively. , and , making , and At the same time, independent ordinary memory buffers are created within the memory system. and reward buffer Together, they form an experience pool. Among them, the Actor network is responsible for outputting continuous actions based on the current state (i.e., offloading decisions, bandwidth allocation, and computing power allocation), while the dual Critic network is responsible for evaluating the Q-value of the state-action pair to guide the Actor's policy improvement.
[0095] S5.2, Initialize environment parameters: Set initial state (Including the initial location of each mobile device, the remaining computing resources of each node, the current channel state, etc.), initialize the random noise standard deviation. σ represents the Gaussian exploration noise ε∼N(0,σ) in S5.3. 2 The preset hyperparameters of the intensity.
[0096] S5.3, Execute the action: In each time slot The agent performs actions based on the current strategy and the noise being explored. The formula is as follows: Among these, exploration noise is used to ensure that the agent fully explores the action space during the initial training phase. This action... It includes decisions on offloading all current tasks (on the device or in the cloud), the allocation ratio of uplink and downlink bandwidth, and the cloud computing power allocation quota.
[0097] S5.4, feedback received: Execute action Subsequently, the environment calculates the instantaneous reward value based on the mathematical models (delay model, energy consumption model, utility function) defined in S3 and S4. At the same time, the state transitions to the next state. (Updates to device locations, consumption / release of computing resources, changes in channel status, etc.)
[0098] S5.5, Experience Diversion Storage: At the end of the time slot for the agent's interaction with the environment, the action experience data generated in the current time slot needs to be processed. The experience is stored in an experience pool for subsequent training. This invention introduces an experience buffer partitioning mechanism, based on the immediate reward value. Has the preset reward threshold been exceeded? Judgment: Write the action experience data that has not exceeded the reward threshold into the ordinary memory buffer. Action experience data exceeding the reward threshold is written to the reward buffer. The reward threshold is in the middle. The threshold can be set based on the statistical distribution of immediate reward values obtained in the initial training, such as using the median or upper quartile of the immediate reward values in the initial training as the threshold. Alternatively, it can be manually calibrated according to the target success rate requirements of the specific geological safety monitoring scenario. In actual implementation... The value of the threshold needs to balance the amount of data in the two buffers. If the threshold is too high, there will be too few samples in the reward buffer, making effective training impossible. If the threshold is too low, the distinction between the reward buffer and the normal buffer will be insufficient.
[0099] This physical offloading design ensures that, in geological safety monitoring scenarios, high-value experience samples generated by mobile devices making correct decisions near the communication coverage boundary (such as timely switching to local inference to avoid disconnection failure) are saved separately and are not overwhelmed by the massive amount of conventional value samples generated under normal communication conditions. This ensures that the agent can continuously learn from these key experiences during the training process.
[0100] S5.6, extract the first empirical data subset from the ordinary memory buffer according to the scaling factor: When ordinary memory buffer and reward buffer Once the amount of action experience data reaches the preset minimum training sample size threshold, the neural network enters the iterative training phase. The total size of the mini-batch matrix is set to... (b is a preset positive integer hyperparameter, representing the number of samples used in a single gradient update), and a scaling factor is set. (0 < ξ < 1) is used to control the proportion of samples in the reward buffer in the training batch. Based on this proportion factor, a first batch of samples of size MN is randomly drawn from the ordinary memory buffer. The action experience data is divided into a first subset of experience data; each action experience data in the first subset of experience data includes state, action, immediate reward and next state.
[0101] S5.7, Calculate the Importance Sample Weight (ISW) for data in the ordinary memory buffer: Since subsequent joint training will involve sampling from two buffers of different sizes and distributions, a non-independent and identically distributed bias will be introduced. Therefore, it is necessary to correct for the gradient contribution of each empirical data point using Importance Sampling Weights (ISW). For data extracted from the ordinary memory buffer in S5.6... The data is processed by combining the initial probability of sampling, the current total amount of data in the ordinary memory buffer, and the annealing coefficient to generate the numerator of the sampling weight. This numerator is then normalized by dividing the numerator by the maximum sampling weight among all samples in the ordinary memory buffer to obtain the gradient correction weight w for the ordinary region. i N .
[0102] The first sampled from the ordinary memory buffer One data point, The annealing coefficient determines the degree of gradient correction. P(j) represents the initial probability of sampling the i-th data in the ordinary memory buffer, which is determined by the normalized absolute value of the TD error of the data; P(j) is calculated independently in the same way in the reward buffer below. Represents a regular memory buffer The current total amount of data.
[0103] S5.8, Sampling from the reward buffer: After sampling and ISW calculation are completed in the normal memory buffer, data is synchronously transferred from the reward buffer. Randomly select the second size subset of empirical data First scale With the second scale The sum is exactly equal to the total size of the mini-batch matrix. , scaling factor This determines the minimum proportion of high-value samples that appear in each training iteration.
[0104] It should be noted that the aforementioned fixed-ratio guaranteed sampling mechanism differs fundamentally from the existing Prioritized Experience Replay (PER) technique in its sampling strategy. PER dynamically calculates the priority of each sample in a single experience pool based on TD-error, and the frequency of high-value samples fluctuates with the training process—in the later stages of training, as TD-error tends to homogenize, the sampling probability of high-value samples gradually decays to be close to that of regular samples, causing the agent's learning strength for critical boundary conditions to decrease with the training progress. In contrast, this invention physically isolates high-value samples and independently stores them in a reward buffer, using a fixed-ratio factor. This mechanism ensures that the proportion of high-value samples remains constant in each training iteration, unaffected by the training process. Even as the policy approaches convergence in the later stages of training, the agent continues to access key decision-making experiences near the communication coverage boundary, thus maintaining its sensitivity and ability to cope with extreme conditions.
[0105] S5.9, Calculate the Importance Sample Weight (ISW) of the reward buffer data: For S5.8, the extraction from the reward buffer The data is processed by exponentiation of the initial probability of sampling with the current total amount of data in the reward buffer and the annealing coefficient, then normalized by dividing by the maximum sampling weight among all samples in the reward buffer, and the reward zone gradient correction weight w is output. j R .
[0106] The first sampled from the reward buffer One data point, Represents the reward buffer The current total amount of data.
[0107] In another embodiment, .
[0108] It should be noted that S5.7 and S5.9 use their respective buffers' total data volume ( and The importance sampling weight correction formulas are calculated independently for each buffer and its maximum sampling weight, resulting in two sets of heterogeneous formulas. The technical reason for using heterogeneous formulas instead of a unified formula is that ordinary memory buffers... and reward buffer The data sizes typically differ significantly (the number of high-value samples in the reward buffer is far less than the number of regular samples in the ordinary buffer). If a uniform ISW formula is used to correct the samples in both buffers, the gradient contribution ratio between the two buffers will be severely imbalanced—the smaller reward buffer samples will be either over-amplified or over-suppressed, making the network training process unstable. Independent normalization ensures a reasonable gradient correction ratio within each buffer while avoiding the interference of non-independent identically distributed bias caused by cross-buffer sampling on the training process.
[0109] S5.10, Merge sampled data: The first-sized subset of empirical data extracted from the general memory buffer in S5.6 and the second-sized subset of empirical data extracted from the reward buffer in S5.8 are concatenated to form a training mini-b matrix of size b. At this point, a complete training batch of data is ready, containing both a large amount of basic experience reflecting normal communication states and... The fixed percentage guarantee contains valuable experience reflecting key operating conditions such as communication coverage boundaries.
[0110] S5.11, Updated Reward Buffer: Update reward buffer Data priority within.
[0111] S5.12, Calculate the target Q value: Calculate the target Q value using the target network The formula is as follows: in, It is an instant reward value. This represents the discount factor, indicating the importance of future rewards. It is the target Actor network based on The generated action is then processed, and truncated noise is added to smooth the target value: Where v represents the upper and lower bounds of the target policy's noise truncation. The target policy smooths the noise, which is independent of the noise ε used for action exploration in S5.3, and follows a Gaussian distribution with a mean of 0.
[0112] Take the smaller Q value from the dual Critic target network output ( The operation is the core design of the TD3 algorithm, used to alleviate the problem of overestimation of Q value.
[0113] S5.13, Updated Dual Critic Network: The loss function is calculated based on the target Q-value bias equation, which includes importance sampling weights. The following weighted loss function is minimized to update the dual Critic network: in, For the first The importance sampling weights corresponding to each empirical data point (based on their respective source buffers) or ), Represents the Critic network The Q-value is evaluated by weighting the ISW. By implanting a loss function, samples from different buffers contribute gradients in proportion to their true distribution, thereby ensuring the unbiasedness of network parameter updates.
[0114] S5.14, Delayed update of Actor network: During the delay period (every time) step, The Actor network is updated under the control of preset positive integer hyperparameters (representing the update delay steps of the Actor network relative to the Critic network). Using policy gradient: The purpose of delayed updates is to allow the Critic network to converge fully first, and then guide the Actor's policy improvement with a more stable Q-value estimate, thereby avoiding training oscillations caused by the mutual coupling between the Actor and the Critic.
[0115] S5.15, soft update target network: Within the same time slot where S5.14 triggers a delayed update of the Actor network, soft updates are performed sequentially on the parameters θ1' and θ2' of the target Actor network and the two target Critic networks. The update formulas are as follows: in, This represents the preset soft update factor hyperparameter. φ, φ', θ are used to control the rate at which parameters from the main network migrate to the target network. i θ i 'These are the Actor main network parameters, target Actor network parameters, dual Critic main network parameters, and dual Critic target network parameters initialized by S5.1, respectively.
[0116] The soft update mechanism updates the number of updates by a small percentage. By gradually integrating the main network parameters into the target network, the changes in the target Q-value become smoother, further improving training stability.
[0117] Repeat steps S5.3 to S5.15 until the dual Critic network and Actor network converge, obtaining the parameters of the converged scheduling model. At this point, the Actor network can handle any input state. Output optimal resource allocation and unloading strategy This includes the unloading location of each task (on the client or in the cloud), the bandwidth allocation ratio of each communication link, and the computing power allocation quota of the cloud server.
[0118] S6. Perform collaborative reasoning and output geological safety time series prediction and response instructions.
[0119] After training and convergence of S5, the global resource collaborative orchestration center obtains the optimal resource allocation and offloading strategy. During the actual deployment and operation phase, the system responds to this strategy by executing end-cloud collaborative inference, and the specific process is as follows.
[0120] S6.1, Policy Instruction Distribution: The global resource collaborative orchestration center adjusts the environmental status of the current time slot. (Including the real-time location of each mobile device, the remaining computing resources of each node, the current channel status, etc.), Input the converged Actor network to obtain the optimal action. This action includes three types of decision instructions: (1) Task unload command Specify whether each pending autoregressive temporal inference task should be executed locally on the device or offloaded to the cloud. (2) Bandwidth allocation command Specify the uplink and downlink bandwidth allocation ratio for each communication link segment; (3) Computing power allocation instructions The system specifies the amount of computing resources allocated by the cloud server to each unloading task. The global resource coordination and orchestration center then sends these instructions to each mobile device via edge communication base stations, while simultaneously transmitting the computing power allocation instructions to the corresponding cloud servers.
[0121] S6.2, Edge-side local inference path: For tasks decided to be executed locally on the mobile device, the mobile device directly calls the on-device large language model to perform autoregressive temporal inference. The specific process is as follows: The mobile device sends the tokenized input prompt sequence to the on-device large language model. The model first performs a pre-filling phase, performing a complete forward pass on all tokens in the input sequence, outputting the first predicted token and establishing a key-value cache. Then, it enters the autoregressive decoding phase, where the model progressively generates subsequent tokens. At each step, the output token from the previous step is combined with the key-value cache and fed into the model for the next forward pass, until the end marker "EOS" is generated or the preset maximum generation length is reached. Under this path, the data never leaves the mobile device, resulting in no communication latency or energy consumption. This is suitable for scenarios where the mobile device has ample computing resources and the inference task has a relatively small computational load, or for emergency scenarios where the mobile device is about to leave the communication coverage area and the reliability of the cloud offloading path cannot be guaranteed.
[0122] S6.3, Cloud-based unloading of inference path: For tasks that are decided to be offloaded to the cloud for execution, the data needs to go through three stages: "upload → cloud inference → return". First, the mobile device will assign the tokenized input prompt sequence according to the bandwidth allocation instructions. The specified uplink bandwidth resources are transmitted to the edge communication base station via the first communication link, and then forwarded to the specified cloud server via the second communication link. The cloud server then follows the computing power allocation instructions. The specified computing resource quota The system invokes a cloud-based large language model to perform autoregressive temporal inference. The inference process of the cloud-based large language model is the same as that on the mobile device (pre-filling stage → autoregressive decoding stage). However, because the cloud-based large language model is typically an uncompressed, complete model, it has a larger parameter scale and stronger inference capabilities, enabling deeper semantic understanding and risk inference of complex multi-source temporal data. Finally, the cloud server transmits the inference results (output token sequence) back to the edge communication base station via the second communication link according to the downlink bandwidth resource configuration in the bandwidth allocation instruction, and then sends it to the mobile device via the first communication link.
[0123] S6.4, Instruction Generation and Output: After receiving the output token sequence from local inference or cloud transmission, the mobile device decodes and maps it into a geological safety time series prediction and response command. The geological safety time series prediction and response command includes two parts: The first part is the geological risk level assessment results, which are the time-series evolution sequences of risk levels output by the large language model based on the temporal characteristics of multi-source sensing data. For example, the model may output a progressive risk level assessment of "low risk → medium risk → high risk", reflecting the trend of geological environmental parameters evolving from a stable state to an abnormal state within a continuous time window.
[0124] The second part consists of the corresponding early warning response instructions, which are tiered response measures automatically generated based on the risk level assessment results. For example, when the assessment result is "low risk", the instruction to "maintain the regular monitoring frequency" is generated; when the assessment result is "medium risk", the instruction to "start encrypted monitoring and expand the collection range of sensor nodes" is generated; and when the assessment result is "high risk", the instruction to "issue regional risk warnings and trigger emergency response procedures" is generated.
[0125] The generation of the aforementioned geological safety time-series prediction and response commands marks the completion of the entire technical chain within a single time slot, from "data acquisition → computing power assessment → communication modeling → trajectory constraints → utility optimization → strategy solving → collaborative reasoning → command output". In the next time slot, the system will again collect the latest environmental status information and repeat the entire process from S1 to S6, achieving continuous dynamic monitoring and real-time response to the geological safety situation.
[0126] It should be noted that the aforementioned geological risk level assessment and early warning response instructions are only a typical output form in a geological safety monitoring scenario. The core technology chain of the method described in this invention—namely, computational demand modeling based on autoregressive inference of large language models, communication-trajectory joint constraint modeling, and reinforcement learning-driven resource scheduling optimization under the edge-cloud collaborative architecture—is universal and can be extended to other scenarios that require collaborative scheduling of large language model inference tasks between resource-constrained mobile devices and the cloud.
[0127] Example 2: Experimental Verification To verify the effectiveness of the improved TD3 algorithm proposed in this invention, the following comparative experiment was conducted.
[0128] Convergence verification: like Figure 5As shown, the number of tasks per training session is set to 10, and the number of training iterations is 2000. The instantaneous reward obtained during training is recorded. The original TD3 algorithm converges in approximately 1400 iterations, with a training reward of approximately 2.1 after convergence. The improved TD3 algorithm proposed in this invention converges in approximately 800 iterations, representing a convergence speed improvement of approximately 43%, with a training reward of approximately 2.7 after convergence. The improved TD3 algorithm converges faster and yields a higher reward value at convergence. This significant improvement in convergence performance stems from the experience buffer partitioning mechanism: by physically isolating high-value experience samples from a massive amount of regular samples and sampling them at a fixed minimum ratio, the agent can access decision-making experience under key boundary conditions in each training iteration, thereby accelerating the policy learning process.
[0129] The impact of task quantity on experiments: like Figures 6-10 As shown, the impact of the number of tasks on system performance is studied using the controlled variable method. The number of tasks is set to a range of [10, 50], the maximum tolerable latency is 8s, and the task prompt size is 3000 tokens.
[0130] Experimental results show that, Figures 6-10 As shown, the number of requested tasks has a significant impact on the average inference latency, average energy consumption, average service quality score, and task completion rate.
[0131] from Figure 6 and Figure 7 As can be seen, the average latency and average energy consumption gradually increase with the increase in the number of tasks. This is because mobile devices need to occupy communication resources such as bandwidth when uploading tasks. As the number of tasks increases, the bandwidth resources allocated to each task decrease, leading to a decrease in data transmission rate, which in turn increases the latency and energy consumption of the tasks. In contrast, the improved TD3 algorithm proposed in this invention produces lower latency and energy consumption than the other three comparative algorithms under different task numbers. Among them, when the number of tasks is 50, the improved TD3 algorithm proposed in this invention has a more prominent advantage, reducing average latency by 16.32%, 8.67%, and 4.52%, respectively, and reducing average energy consumption by 29.19%, 25.56%, and 10.81%, respectively.
[0132] from Figure 8It can be seen that the average service quality score (SHS) of a task gradually decreases as the number of tasks increases. This is because when there are too many tasks on the mobile device, some tasks may exceed the maximum tolerable latency, resulting in an average SHS score of 0. Furthermore, when there are too many tasks in the cloud, the global resource orchestration center may be more inclined to offload tasks to local execution, leading to a lower SHS score for that task. The improved TD3 algorithm proposed in this invention achieves higher average SHS scores than the other three comparative algorithms under different task numbers. Specifically, when the number of tasks is 50, the improved TD3 algorithm's advantage is more pronounced, increasing by 11.3%, 9.29%, and 5.75%, respectively.
[0133] from Figure 9 It can be seen that the task completion rate generally declines as the number of tasks increases. This is because the increased number of tasks leads to a situation where the total communication resources are increasingly unable to meet the needs of all tasks, and some tasks may fail due to exceeding the maximum tolerable latency. The improved TD3 algorithm proposed in this invention achieves a higher task completion rate than the other three comparative algorithms under different task numbers. Among them, the improved TD3 algorithm proposed in this invention has a more significant advantage when the number of tasks is 50, increasing by 11.87%, 6.62%, and 5.75%, respectively.
[0134] Experiment on the effect of Prompt size: like Figures 10-13 As shown, the prompt size is set to [0, 3000], the number of tasks is 50, and the maximum tolerable latency is 7s.
[0135] Experimental results show that, Figures 10-13 As shown, the size of the prompt has a significant impact on the average inference latency, average energy consumption, average service quality score, and task completion rate.
[0136] from Figure 10 and Figure 11 It can be seen that as the prompt size increases, the average latency and average energy consumption gradually increase. This is because the prompt size reflects the workload; the larger the prompt, the larger the workload, and the greater the inference latency and communication latency, as well as the inference energy consumption and communication energy consumption. The improved TD3 algorithm proposed in this invention produces lower latency and energy consumption than the other three comparative algorithms under different prompt sizes. Among them, when the prompt size is 3000, the improved TD3 algorithm proposed in this invention has more prominent advantages, reducing average latency by 24.05%, 14.03%, and 8.12%, respectively, and reducing average energy consumption by 31.88%, 19.07%, and 9.88%, respectively.
[0137] from Figure 12 It can be seen that as the prompt size increases, the average service quality score of the task also gradually increases. This is because when the task volume is too large, the inference latency on the edge side is very high, and the global resource coordination and orchestration center will prioritize offloading the task to the cloud for processing, thus obtaining a higher service quality score. The improved TD3 algorithm proposed in this invention achieves a higher average service quality score than the other three comparative algorithms under different prompt sizes. Among them, when the prompt size is 3000, the improved TD3 algorithm proposed in this invention has a more prominent advantage, increasing by 17.93%, 13.03%, and 7.48%, respectively.
[0138] from Figure 13 It can be seen that the task completion rate gradually decreases as the prompt size increases. This is because as the number of tasks increases, the latency generated by the inference task also increases, and some tasks may exceed the maximum tolerable latency, leading to task failure and thus a decrease in the task completion rate. The improved TD3 algorithm proposed in this invention has a higher task completion rate than the other three comparison algorithms under different prompt sizes. Among them, when the prompt size is 3000, the improved TD3 algorithm proposed in this invention has a more prominent advantage, increasing the completion rate by 8.25%, 2.5%, and 1.55%, respectively.
[0139] Maximum tolerance delay effect experiment: like Figures 14-17 As shown, the number of tasks is set to 50, the task prompt size is 3000 tokens, and the maximum tolerable latency interval is [4s, 8s].
[0140] Experimental results show that, Figures 14-17 As shown, the maximum tolerable latency has a significant impact on the average inference latency, average energy consumption, average service quality score, and task completion rate of the task.
[0141] from Figure 14 and Figure 15It can be seen that as the maximum tolerable latency increases, the average latency gradually increases, while the average energy consumption gradually decreases. This is because, with the increase of the maximum tolerable latency, in order to maximize utility, the global resource orchestration center often offloads more tasks to the cloud for processing to obtain a higher quality of service score. Therefore, the average latency of the system increases. When more tasks are offloaded to the cloud, the efficient computing power of the cloud server reduces energy consumption. The improved TD3 algorithm proposed in this invention produces lower latency and energy consumption than the other three comparative algorithms under different maximum tolerable latency conditions. Among them, when the maximum tolerable latency is 8s, the improved TD3 algorithm proposed in this invention has more prominent advantages, reducing average latency by 19.48%, 11.41%, and 6.15%, respectively, and reducing average energy consumption by 29.75%, 26.06%, and 9.08%, respectively.
[0142] from Figure 16 It can be seen that as the maximum tolerable latency increases, the average service quality score of the task also gradually increases. This is because when more tasks are offloaded to the cloud, a higher service quality score is obtained. The improved TD3 algorithm proposed in this invention achieves a higher average service quality score than the other three comparative algorithms under different maximum tolerable latency conditions. Among them, the improved TD3 algorithm proposed in this invention has a more significant advantage when the maximum tolerable latency is 8s, increasing by 12.13%, 10.38%, and 7.16%, respectively.
[0143] from Figure 17 It can be seen that the task completion rate gradually increases with the increase of the maximum tolerable delay. This is because as the maximum tolerable delay increases, the probability of the task completion time exceeding that delay decreases, thus allowing more tasks to be completed on time. The improved TD3 algorithm proposed in this invention achieves a higher task completion rate than the other three comparative algorithms under different maximum tolerable delay conditions. Among them, the improved TD3 algorithm proposed in this invention has a more significant advantage when the maximum tolerable delay is 8s, increasing by 27.04%, 12.40%, and 9.68%, respectively.
[0144] In summary, experimental results demonstrate that the improved TD3 algorithm proposed in this invention can significantly accelerate the convergence speed. Compared with the three comparative algorithms TD3, DDQN, and DDPG-LARA, the average latency and average energy consumption for task completion are reduced, while the average quality of service score and task completion rate are increased. Particularly under extreme conditions (high load conditions with 50 tasks and a prompt size of 3000), the performance advantage of the improved algorithm is even more significant, indicating that the experience buffer partitioning mechanism can exert greater decision optimization efficiency in resource-constrained boundary scenarios.
[0145] Example 3: System Example This embodiment provides a geological safety monitoring and resource scheduling system based on a large language model, used to implement the method described in Embodiment 1. The system includes: The edge-cloud collaborative topology module comprises an edge layer with multi-source sensing nodes and mobile devices deployed, an edge layer with edge communication base stations deployed, and a cloud layer with a global resource collaborative orchestration center and cloud servers deployed. The mobile devices deploy an edge-side large language model, and the cloud servers deploy a cloud-based large language model.
[0146] The micro-computing power and kinematic modeling unit is used to evaluate the floating-point computation volume of the two stages (pre-filling stage and autoregressive decoding stage) of the autoregressive process of a large language model using a computing power demand model, and integrates a dynamic monitoring trajectory model of the mobile terminal device leaving the effective communication coverage area of the base station.
[0147] The state composite orchestration center is responsible for coordinating the collection of dynamic network data transmission rates, available bandwidth, and remaining computing resources, and encapsulating these parameters into the state space of a Markov decision process.
[0148] The reinforcement learning decision processor, equipped with an experience buffer partitioning mechanism, is used to train the scheduling model according to the improved TD3 algorithm training steps described in this invention and output the optimal resource allocation and unloading strategy.
[0149] The collaborative reasoning and instruction output module is used to respond to the optimal resource allocation and unloading strategy by calling the local terminal-side large language model at the terminal layer or sending it back to the cloud layer to call the cloud-side large language model to perform collaborative reasoning and output geological safety time series prediction and response instructions.
[0150] Example 4: Computer Equipment and Storage Media This embodiment provides a computer device, including at least one processor and a memory communicating with the processor. The memory stores a computer program executable by the processor. When the computer program is executed by the processor, it implements the geological safety monitoring and resource scheduling method based on a large language model as described in Embodiment 1.
[0151] This embodiment also provides a computer-readable storage medium storing a computer program. When the computer program is read and run by a computing device, the computing device executes the geological safety monitoring and resource scheduling method based on a large language model as described in Embodiment 1. The computer-readable storage medium includes, but is not limited to, various media capable of storing program code, such as hard disks, flash memory, optical discs, USB flash drives, and magnetic tapes.
[0152] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A geological safety monitoring and resource scheduling method based on a large language model, characterized in that, Includes the following steps: S1. Construct an edge-cloud collaborative system model, which includes an edge layer, an edge layer, and a cloud layer. The edge layer deploys multi-source sensing nodes and mobile devices, which are mobile devices deployed at geological safety monitoring sites and equipped with an edge-side large language model. The edge layer deploys edge communication base stations. The cloud layer deploys a global resource collaborative orchestration center and a cloud server, with the cloud server deploying a cloud-based large language model. The mobile devices are used to collect data from the multi-source sensing nodes, and the data is converted into an input prompt word sequence for an autoregressive temporal reasoning task. S2. Construct a computational power requirement model for the autoregressive temporal reasoning task based on the input prompt word sequence, and construct an underlying communication model; use the computational power requirement model to evaluate the amount of floating-point computation required to complete the autoregressive temporal reasoning task, and use the underlying communication model to evaluate the dynamic data transmission rate; S3. Combining the floating-point computational complexity and the dynamic data transmission rate, calculate the expected total latency and expected total energy consumption of the autoregressive temporal inference task flowing between the mobile terminal device and the cloud layer; construct a dynamic monitoring trajectory model of the mobile terminal device, and construct a system utility function based on this model, together with the expected total latency and the expected total energy consumption. S4. The process of determining the task unloading location, communication bandwidth allocation ratio, and cloud computing power allocation quota between the mobile terminal device and the cloud layer is abstracted into a Markov decision process. The task prompt word size, maximum tolerable latency limit, mobile terminal device location information, remaining computing resources of the mobile terminal device and the cloud server, distance matrix between nodes, and channel state information are defined as the state space. The system utility function, which includes a penalty mechanism subject to the maximum tolerable latency limit, is defined as the reward function. S5. Start the reinforcement learning scheduling engine deployed in the global resource collaborative orchestration center, and use the TD3 algorithm with an empirical buffer partitioning mechanism to solve the Markov decision process, and output the optimal resource allocation and unloading strategy. S6. In response to the optimal resource allocation and unloading strategy, the device locally calls the terminal-side large language model, or sends it back to the cloud layer to call the cloud-side large language model to perform collaborative reasoning of the autoregressive temporal reasoning task, and outputs geological safety temporal prediction and response instructions.
2. The geological safety monitoring and resource scheduling method based on a large language model according to claim 1, characterized in that, The multi-source sensing nodes include at least two of the following: surface deformation sensors, rainfall sensors, groundwater level sensors, and ground strain sensors; the geological safety time-series prediction and response instructions include geological risk level assessment results and corresponding early warning response instructions.
3. The geological safety monitoring and resource scheduling method based on a large language model according to claim 1, characterized in that, The underlying communication model includes a first communication link model between the mobile terminal device and the edge communication base station, and a second communication link model between the edge communication base station and the cloud layer; The first communication link model establishes the uplink and downlink communication links as time-varying Rayleigh fading channels, and calculates the average data uplink and downlink transmission rates within a preset time window based on Shannon's theorem continuous integration. The second communication link model uses a time-division multiple access mechanism to allocate bandwidth resources on an average basis and calculates the uplink and downlink data transmission rates between the edge communication base station and the cloud layer. The dynamic data transmission rate is jointly calculated by the transmission rates obtained from the first communication link model and the second communication link model.
4. The geological safety monitoring and resource scheduling method based on a large language model according to claim 1, characterized in that, The computing power requirement model deconstructs the execution process of the large language model for the autoregressive temporal reasoning task into a parallel pre-filling stage and a serial iterative autoregressive decoding stage. The floating-point computation cost of the pre-filling stage is calculated based on the quadratic polynomial equation constructed from the length of the input prompt word sequence, the dimension of the model hidden layer, and the dimension of the feedforward network. The floating-point computation amount of the autoregressive decoding stage is calculated based on the total number of predicted output tokens and the gradual accumulation of key-value cache reused in each generation operation. The sum of the floating-point computation amount in the pre-filling stage and the floating-point computation amount in the autoregressive decoding stage is taken as the floating-point computation amount, and the floating-point computation amount is used as the basis for the decision-making process in the Markov decision-making process to evaluate whether the local computing resources of the mobile terminal device can support the autoregressive temporal inference task and to determine the amount of data to be unloaded to the cloud layer.
5. The geological safety monitoring and resource scheduling method based on a large language model according to claim 1, characterized in that, In the step of constructing the dynamic monitoring trajectory model of the mobile terminal device: By obtaining the location coordinates of the mobile terminal device, the location coordinates of the edge communication base station and their effective communication coverage, the remaining communicable distance from the current location of the mobile terminal device to the boundary of the effective communication coverage is calculated simultaneously. Divide the remaining communication distance by the uniform speed of the mobile device to derive the absolute time window constraint boundary for leaving the communication range. The absolute time window constraint boundary is set as the threshold for determining the failure of the autoregressive temporal reasoning task and triggering the penalty mechanism in the reward function.
6. The geological safety monitoring and resource scheduling method based on a large language model according to claim 1, characterized in that, The calculation logic for the expected total latency and expected total energy consumption is as follows: The expected total latency is the local inference latency of the mobile terminal device, or the sum of the communication latency of the task data being uploaded to the cloud layer via the edge communication base station, the latency of the cloud layer allocating preset computing resources for inference, and the downlink communication latency of the instruction result being transmitted back from the cloud layer to the mobile terminal device via the edge communication base station. The expected total energy consumption is the inference energy consumption of the mobile terminal device, or the sum of the inference energy consumption of the cloud layer and the communication energy consumption during the task data upload and result return process. The system utility function is formed by a weighted combination of the expected total latency, the expected total energy consumption, and the service quality score for each task. The service quality score is in the form of a step function. When the total latency of the task does not exceed the maximum tolerable latency limit, different fixed scores are assigned according to the processing on the edge and the processing on the cloud. When the total latency of the task exceeds the maximum tolerable latency limit, the service quality score is reset to zero.
7. The geological safety monitoring and resource scheduling method based on a large language model according to claim 1, characterized in that, The steps in S5 using the TD3 algorithm, which incorporates an empirical buffer partitioning mechanism, to solve the Markov decision process include: Initialize the Actor network, dual Critic network, and their respective target network parameters of the TD3 algorithm agent, and initialize the experience pool; The TD3 algorithm agent is driven to interact with the Markov decision process in the environment, and the action experience data, which includes state, action, immediate reward and next state, is collected into the experience pool. Based on the aforementioned experience buffer partitioning mechanism, the action experience data within the experience pool is distributed and stored separately. During the triggering of neural network iterative training phase, the action experience data is extracted across the buffer by a scaling factor and grouped into a training mini-batch matrix. Calculate the importance sampling weights for the sampled data in different buffers; The loss function is calculated based on the target Q-value deviation equation containing the importance sampling weights, and the dual Critic network and the Actor network are updated to obtain the converged scheduling model parameters. The step of dividing and storing the action experience data in the experience pool based on the experience buffer partitioning mechanism is as follows: In the memory system, separate ordinary memory buffers and reward buffers are created; At the end of the time slot for the agent's interaction with the environment, a determination is made based on whether the instant reward value exceeds a preset reward threshold. Action experience data that does not exceed the reward threshold is written into the ordinary memory buffer, while action experience data that exceeds the reward threshold is written into the reward buffer.
8. The geological safety monitoring and resource scheduling method based on a large language model according to claim 7, characterized in that, The step of extracting the action experience data across the buffer using a scaling factor and grouping it into a mini-batch matrix for training is as follows: Set a ratio factor to balance the exploration depth and utilization intensity of the strategy; Based on the scaling factor, a first-sized subset of empirical data is randomly extracted from the ordinary memory buffer each time, and a second-sized subset of empirical data is randomly extracted from the reward buffer simultaneously. The first-sized subset of empirical data and the second-sized subset of empirical data are then concatenated to form the training mini-batch matrix.
9. The geological safety monitoring and resource scheduling method based on a large language model according to claim 7, characterized in that, In the step of calculating the importance sampling weights of sampled data from different buffers respectively: If the action experience data is extracted from the ordinary memory buffer, the initial probability of its sampling and the current total amount of data in the ordinary memory buffer are combined with the annealing coefficient to generate the numerator of the sampling weight. This numerator is then normalized by dividing the numerator by the maximum sampling weight among all samples in the ordinary memory buffer to obtain the gradient correction weight for the ordinary region. If the action experience data is extracted from the reward buffer, the initial probability of its sampling is multiplied by the current total amount of data in the reward buffer, combined with the annealing coefficient, and then normalized by the maximum sampling weight among all samples in the reward buffer, and the gradient correction weight of the reward area is output.
10. A geological safety monitoring and resource scheduling system based on a large language model, characterized in that, The system for implementing the method as described in any one of claims 1 to 9, the system comprising: The edge-cloud collaborative topology module includes an edge layer with multi-source sensing nodes and mobile devices deployed, an edge layer with edge communication base stations deployed, and a cloud layer with a global resource collaborative orchestration center and cloud servers deployed; wherein, the mobile devices are equipped with an edge-side large language model, and the cloud servers are equipped with a cloud-side large language model. The micro-computing power and kinematic modeling unit is used to evaluate the floating-point computation volume of the two-stage autoregressive process of the large language model using the computing power demand model, and to integrate the dynamic monitoring trajectory model of the mobile terminal device leaving the effective communication coverage area of the base station. The state composite orchestration center is responsible for coordinating the collection of dynamic data transmission rates, available bandwidth, and remaining computing resources of the network, and encapsulating the above parameters into the state space of the Markov decision process. A reinforcement learning decision processor, equipped with an experience buffer partitioning mechanism, is used to train a scheduling model based on the experience buffer partitioning mechanism and output the optimal resource allocation and unloading strategy; The collaborative reasoning and instruction output module is used to respond to the optimal resource allocation and unloading strategy by calling the edge-side large language model locally at the edge layer, or by sending it back to the cloud layer to call the cloud-side large language model to perform collaborative reasoning and output geological safety time series prediction and response instructions.
Citation Information
Patent Citations
Large model end-side cloud collaborative reasoning optimization method oriented to time delay optimization
CN117793110A
Unmanned aerial vehicle assisted mobile edge computing performance optimization method based on large language model and deep reinforcement learning
CN121008942A