Space-air-ground integrated vehicle networking task unloading method based on RAG enhanced DRL
By using the RAG-DRL collaborative task offloading framework and leveraging the MCP gateway to uniformly access static and dynamic traffic knowledge, the dynamic nature of task offloading and the response to emergencies in the vehicle-to-everything (V2X) environment are resolved, achieving efficient task scheduling and decision stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING TECH UNIV
- Filing Date
- 2025-11-22
- Publication Date
- 2026-05-05
AI Technical Summary
In the Internet of Vehicles (IoV) environment, task offloading faces challenges such as rapid topology evolution, base station load fluctuations, and sudden traffic events. Traditional scheduling strategies are difficult to cope with these challenges, and deep reinforcement learning lacks the ability to utilize traffic knowledge and respond to emergencies.
A RAG-DRL collaborative task offloading framework is constructed, which unifies access to static and dynamic traffic knowledge through the MCP gateway to enhance the decision-making ability of DRL. Combined with location semantic matching and time-sensitive feature extraction, knowledge-driven task scheduling is realized.
It significantly improved the success rate of tasks, reduced the average inference latency, and enhanced the stability of decision-making in scenarios involving sudden events and dynamic network changes.
Smart Images

Figure CN121985381A_ABST
Abstract
Description
Technical Field
[0001] This invention is an application of artificial intelligence technology in the field of vehicle networking, specifically a method for offloading tasks in an integrated air-space-ground vehicle networking system based on RAG-enhanced DRL. Background Technology
[0002] With the accelerated evolution of autonomous driving technology, deep learning tasks in vehicle visual perception, path planning, and object detection place stricter demands on computing resources and latency. Onboard computing units have inherent limitations in computing power and storage, making it difficult to stably support the real-time execution of high-precision inference tasks over long periods. Space-Air-Ground Integrated Vehicular Networks (SAGVNs) provide vehicles with continuous coverage and differentiated computing power support by collaboratively utilizing multi-layered heterogeneous network resources such as ground base stations, UAV small base stations, and low-orbit satellites. However, task offloading in SAGVNs requires comprehensive handling of rapid topology evolution, base station load fluctuations, and sudden traffic events on a millisecond-scale timescale, making traditional scheduling strategies inadequate.
[0003] Deep Reinforcement Learning (DRL) has become the mainstream method for constructing real-time task offloading strategies due to its adaptive optimization capabilities. However, the highly dynamic and heterogeneous nature of the connected vehicle environment presents it with two key bottlenecks: 1) a lack of explicit utilization of traffic domain knowledge, requiring extensive exploration to grasp basic patterns and incurring high training costs; 2) slow response to low-frequency but high-impact emergencies, making it difficult to make reliable decisions.
[0004] Large Language Models (LLMs) provide new technical support for introducing structured knowledge and semantic reasoning capabilities. The Retrieval-Augmented Generation (RAG) mechanism based on LLM can unify and integrate static expert knowledge (road terrain, communication coverage, historical congestion patterns) with dynamic real-time information (sudden accidents, short-term congestion, temporary construction), providing continuously updatable knowledge supplements for DRLs, thereby improving the adaptability and robustness of offloading strategies in non-stationary and sudden scenarios.
[0005] Despite the significant advantages that RAG technology has demonstrated in knowledge fusion and intelligent reasoning, building a RAG-enhanced collaborative reasoning and scheduling framework still faces the following challenges:
[0006] 1) Deep integration of traffic knowledge: The knowledge involved in the Internet of Vehicles scenario is significantly heterogeneous, including road structure, congestion patterns, communication coverage and sudden accidents. These knowledges differ in their sources, timeliness and expression. Existing studies such as Ren et al. [1] constructing a user configuration vector database, Hussien et al. [2] performing behavior prediction based on knowledge graphs, and the EACO-RAG framework [3] realizing cross-node knowledge sharing through hierarchical retrieval have verified the effectiveness of RAG, but they mainly focus on relatively stable semantic knowledge and lack systematic support for the unified modeling and deep integration of multi-dimensional knowledge such as static expert knowledge, dynamic road events, and time-varying communication conditions.
[0007] 2) Efficient retrieval of heterogeneous knowledge: Traffic-related knowledge includes geographic coordinates, road topology, link quality description, semantic traffic information and emergency event records, which are significantly heterogeneous. Park et al. [4] proposed a retrieval method based on keyword matching, Wang et al. [5] used place name recognition to realize the mapping from text to coordinates, and Zhang et al. [6] used a dynamic retrieval mechanism to integrate historical and real-time traffic data. However, these methods are difficult to capture the fine-grained differences in coordinate continuity and location semantics, and lack the ability to jointly retrieve three types of knowledge: geospatial, textual semantics and dynamic events.
[0008] 3) Improved environmental adaptability of agent decision-making: DRL relies on a lot of interaction and trial and error with the environment. When faced with low-frequency but high-impact events such as accidents and communication link mutations, the decision-making lacks generalization ability. Wang et al. [7] used deep deterministic policy gradient (DDPG) to optimize the offloading of vehicle networking tasks. Al-Tarawneh et al. [8] proposed a context-aware online offloading method. Li et al. [9] built a channel knowledge base to assist DRL in environmental perception. However, these methods lack the ability to supplement knowledge of time-varying scenarios and respond quickly to sudden events, so the decision-making performance of DRL agents under long-tail events and dynamic network conditions is still limited. Summary of the Invention
[0009] To address the aforementioned limitations and challenges, this invention proposes a RAG-DRL cooperative task offloading framework for integrated air-space-ground vehicle-to-everything (V2X) networks, supporting environmental understanding, target recognition, and reasoning tasks in autonomous driving scenarios. This framework achieves unified modeling and fusion of static and dynamic traffic knowledge through RAG and MCP, transforming it into state enhancement factors and action space constraints applicable to DRL, thereby constructing a knowledge-driven cooperative scheduling mechanism.
[0010] This invention proposes a deep reinforcement learning (DRL) method that uses a large language model (LLM) and retrieval-augmented generation (RAG) to provide knowledge support, thereby enhancing the agent's responsiveness and robustness in handling random events and unexpected scenarios.
[0011] First, a dynamic RAG system based on the Model Context Protocol (MCP) is constructed, which encapsulates the static road communication knowledge base, trajectory prediction service and real-time traffic situation into a searchable knowledge source, providing consistent, reliable and real-time knowledge support for decision-making in non-stationary environments.
[0012] Secondly, a multi-source knowledge retrieval mechanism combining location semantic matching and time-sensitive feature extraction is designed. The MCP gateway is used to obtain real-time information on road conditions, link changes and emergencies, so that the task offloading strategy can adapt to complex traffic scenarios.
[0013] Finally, in order to solve the problem of optimizing the number of tasks completed over long periods, an LLM-RAG-enhanced DRL collaborative reasoning framework is constructed. The retrieved static and dynamic knowledge is integrated into the offline training and online reasoning of DRL by means of state factor expansion and action space constraints, respectively. This enables the DRL agent to transform from the traditional "trial and error decision-making" to knowledge-driven "contextual response", thereby robustly handling random events, connection switching and abnormal traffic patterns.
[0014] This invention addresses the challenges of task offloading and inference in integrated air-space-ground vehicle-to-everything (V2X) networks, which simultaneously face highly dynamic environments, unstable link conditions, and frequent unexpected events. Simulation results demonstrate that the proposed method significantly outperforms mainstream model optimization and DRL baseline methods in terms of task success rate, average inference latency, and handling of unexpected events.
[0015] The main contributions of this paper include:
[0016] 1) Traffic Situation-Oriented RAG Framework: Unlike traditional RAG designs that rely on static knowledge bases, a RAG framework based on the Model Context Protocol (MCP) is constructed. The MCP gateway is used to uniformly access the static road communication knowledge base, trajectory prediction services, and real-time traffic situation awareness information, deeply integrating static and dynamic road knowledge to provide comprehensive and real-time knowledge support for collaborative reasoning of in-vehicle tasks under complex traffic situations.
[0017] 2) Collaborative Retrieval of Multi-Source Traffic Knowledge: This mechanism constructs a road network knowledge base encompassing terrain communication features and historical congestion patterns. It also designs a knowledge base retrieval strategy based on location semantic matching and time-sensitive extraction to achieve accurate filtering of long-term stable knowledge about the road network environment. By connecting edge nodes, the MCP gateway is used to access information on emergencies such as traffic accidents and road construction, forming a collaborative retrieval mechanism that combines static expert knowledge with dynamic real-time situational awareness.
[0018] 3) RAG-enhanced DRL offline training and online inference: Under the designed knowledge-driven framework, the static and dynamic road knowledge provided by RAG is integrated into the DRL training and inference process through state factor expansion and action space constraints, respectively. This mechanism effectively reduces the DRL's dependence on environmental trial and error, enabling the agent to make forward-looking decisions based on knowledge in complex traffic environments. This achieves a shift from an "experience-driven" to a "knowledge-driven" task scheduling paradigm, improving decision stability in the face of emergencies and dynamic changes in links. Attached Figure Description
[0019] Figures 1(a) to 1(c) respectively illustrate three typical traffic scenario scheduling cases, in which:
[0020] Figure 1(a) shows the shadow of communication in mountainous areas (Case 1);
[0021] Figure 1(b) shows a congested road section during peak hours (Case 2);
[0022] Figure 1(c) shows a sudden traffic accident (Case 3).
[0023] Figure 2 This represents the RAG-DRL collaboration framework diagram.
[0024] Figure 3 This indicates a Prompt orchestration generated for triples.
[0025] Figures 4(a) to 4(d) show the impact of training epochs on task unloading performance and the probability density distribution of the final reward value under different methods, respectively.
[0026] Figure 4(a) shows the impact of training rounds on rewards;
[0027] Figure 4(b) shows the impact of training rounds on the number of tasks completed;
[0028] Figure 4(c) shows the probability density distribution of the reward value;
[0029] Figure 4(d) shows the impact of training rounds on the task failure rate.
[0030] Figure 5 This indicates the impact of the amount of computing resources on the task failure rate.
[0031] Figure 6 This indicates the impact of the number of sub-channels on the task failure rate. Detailed Implementation
[0032] 1 Overview
[0033] To verify the effectiveness of the proposed framework, this invention constructs a SAGVN simulation platform integrating RAG, MCP gateway, and DRL agent. A dynamic road network and task generation model are constructed based on vehicle trajectory data collected from real road environments. The RAG module accesses static road communication knowledge, trajectory prediction results, and dynamic traffic conditions in real time through the MCP gateway, generating environmental perception factors and action constraints to enhance the offloading decision of the DRL agent. Comparative experiments with various baseline strategies show that the proposed method achieves significant advantages in task completion rate, average inference latency, and cumulative reward, especially demonstrating greater stability in scenarios with sudden events and rapidly changing network conditions, verifying the effectiveness and robustness of the proposed framework under complex traffic situations.
[0034] 2. RAG-assisted visual task collaborative reasoning framework
[0035] As shown in Figures 1(a) to 1(c), consider a SAGVN scenario consisting of ground base stations, drones, and low Earth Orbit (LEO) satellites. Ground base stations and drone small base stations provide localized signal coverage, while LEO satellites can cover the entire urban road network. Based on real-time location and network conditions, vehicles dynamically choose to utilize onboard computing power for computation (local inference) or offload tasks to ground base stations, drones, and satellites (collaborative inference). In addition to supporting deep learning model deployment, the MEC controller integrates RAG, which provides unified access to static (road network knowledge base) and dynamic (real-time traffic situation and trajectory prediction services) knowledge through the MCP gateway, facilitating knowledge-driven task offloading and collaborative inference services. To facilitate understanding of RAG's contribution to online decision-making, three typical task scheduling cases under traffic events are given below:
[0036] 1) Mountainous Communication Shadow (see Figure 1(a)): When a vehicle travels within the coverage area of a ground base station, a drone, and a satellite, a task request is generated and forwarded to the inference queue of the MEC controller via the nearest drone. The RAG queries the terrain impact knowledge of the current area through the MCP gateway and finds that mountain obstruction is causing serious interference to the ground base station signal. Based on feedback information from the trajectory prediction service, the vehicle will leave the drone's coverage area during task processing and remain within the coverage area of the satellite and base station. A feasible scheduling scheme is to select a low-load satellite with stable signal quality for collaborative task processing. This satellite allocates physical resources for the task according to the First-Come, First-Served (FCFS) principle and transmits the processed task back to the vehicle.
[0037] 2) Peak-hour congested road sections (see Figure 1(b)): Task requests are generated when vehicles are within the coverage area of ground base stations and satellites during weekday evening rush hours. According to road knowledge from RAG, the ground base station load in this area is continuously saturated during the evening rush hour. By calling the trajectory prediction service, it is known that vehicles will remain within the coverage area of UAVs, base stations, and satellites during task processing. Due to the low load, the MEC controller selects the UAV as a collaborator to process the task and transmit the results back.
[0038] 3) Sudden Traffic Accident (see Figure 1(c)): A task request is generated when the vehicle is traveling within the coverage area of ground base stations and satellites. The RAG acquires real-time traffic situation knowledge and discovers that a sudden traffic accident ahead has caused a surge in load and strong signal interference to surrounding base stations. Therefore, this task is processed locally on the vehicle.
[0039] 2.1 RAG Framework Based on MCP
[0040] This invention proposes a MCP-assisted RAG framework that integrates static and dynamic traffic knowledge. This framework uses an MCP gateway to uniformly access a static knowledge base, trajectory prediction services, and real-time traffic situation information, providing multi-source heterogeneous knowledge support for task reasoning and offloading. The sets of ground base stations, UAVs, and satellites are represented as follows: , , The sets of vehicles and base stations are represented as follows: , A vehicle can only establish a connection with one base station in the same time slot. Based on the timeliness and acquisition method of knowledge, the system divides vehicle-to-everything (V2X) environment knowledge into three categories:
[0041] 1) Static knowledge, including long-term, stable expert knowledge such as road terrain features, base station deployment topology, and historical congestion patterns. The set of item indexes in the road network knowledge base is represented as follows: Knowledge Entries The central location of the corresponding geographical region is represented as The degree of interference between the current location's terrain features and the base station's communication performance is described as follows: This includes information such as terrain features, base station deployment, and the impact on communication propagation. Peak-hour congestion communication is described as follows: This describes the historical traffic congestion characteristics of the current road segment during peak hours (such as morning and evening rush hours) and the pressure on base station communication. Based on this, the knowledge entry... The corresponding complete domain knowledge is .
[0042] 2) Dynamic knowledge, based on its generation method, is divided into the following two categories:
[0043] a) Computational knowledge: Foresighted knowledge generated by the trajectory prediction model through computation. This module is based on vehicle... At any moment Previous historical trajectory data It predicts the vehicle's future trajectory and potential risk areas. The trajectory prediction results provide a forward-looking decision-making basis for the selection of cooperative base stations, ensuring that the vehicle remains within the base station coverage area during mission inference.
[0044] b) Perception-based knowledge: Real-time information on sudden incidents perceived by IoT sensors, roadside units (RSUs), vehicle-mounted terminals, and satellite links. The road emergency information acquired by the MEC controller through the edge node sensing network is represented as This includes attributes such as event type (e.g., traffic accidents, road construction, severe weather), location coordinates, severity, and timestamp. This type of knowledge can promptly supplement real-time traffic changes that cannot be covered by static knowledge bases.
[0045] When the vehicle At any moment The generated visual reasoning task is uploaded to the base station. At the same time, the MEC controller accesses static and dynamic knowledge services through the MCP gateway to obtain decision support information: retrieving terrain communication features and historical congestion patterns from the knowledge base, calling trajectory prediction services to obtain forward-looking predictive knowledge, and querying real-time traffic situation services to obtain information on emergencies. The controller integrates static and dynamic knowledge to make offloading decisions for visual tasks, realizing intelligent collaborative reasoning in complex traffic scenarios.
[0046] 2.2 Communication model
[0047] This section considers the impact of high-speed vehicle movement on channel gain to characterize the communication quality between the vehicle and the base station. Let... Indicates vehicle With base station The time-varying decay factor. Assume at time... ,vehicle With base station The Euclidean distance between them is expressed as The channel gain between the two
[10] is expressed as
[0048] (1)
[0049] in, This is a reference distance, used as a benchmark for calibrating channel gain; for Channel gain at the location; This is the path loss exponent, determined based on the base station type. Let... For base stations The location coordinates. Based on ,vehicle In the future The set of movement trajectories within the time window is represented as So, the vehicle exist The position at time is predicted as Based on this, the vehicle With base station exist The channel gain at time t is predicted as
[0050] (2)
[0051] make and For vehicles and base stations The transmit power. The spectrum resources in the base station are allocated to each vehicle in units of mutually orthogonal sub-channels
[11]
[12] . Assume that the bandwidth of each sub-channel is .make This indicates assignment to the visual task. The number of sub-channels (e.g., a street view image). Then, the number of vehicles... to base station Submit Task The uplink transmission rate at that time is calculated as follows:
[0052] (3)
[0053] in, This represents the average background noise. Let... Indicates assignment to task The number of sub-channels in the calculation result (e.g., image classification or detection result), base station To the vehicle Return mission The downlink transmission rate based on the predicted channel gain is predicted as follows:
[0054] (4)
[0055] 2.3 End-to-end computation delay modeling
[0056] Various base stations and MEC controllers need to comprehensively consider factors such as vehicle location, base station load, and task latency when scheduling tasks. This section quantifies the service latency of tasks based on queuing theory. Visual Tasks Includes a set of characterization parameters ,in Represents the size of the task data (bits). Indicates task The time delay constraint (seconds).
[0057] A. Task unloading delay
[0058] Task offloading latency represents the time required for the receiving base station to transmit the visual task to the controller's offloading queue and then to the cooperating base station's processing queue. (Base station) The set of visual tasks collected within the coverage area is represented as follows: The total number of elements in the set is .make Indicates vehicle With base station A connection was established, otherwise Within the MEC controller's coverage area, the average time for a task to be uploaded from the vehicle to the base station is calculated as follows:
[0059] III (5)
[0060] The arrival of a task between a single vehicle and a base station is modeled as a Poisson process. Let the vehicle... The arrival rate of the visual task was [missing information]. The arrival rate of tasks in the MEC controller's unloading queue is...
[0061] (6)
[0062] The offloading queue processes only one vision task at a time. The task offloading process is modeled as an M / M / 1 queue model. To reflect the queue's busy level, the service intensity of the MEC controller's offloading queue is defined as...
[0063] (7)
[0064] The enqueue rate for unloading tasks is determined by the task arrival rate, while the dequeue rate is determined by the transmission rate. When the enqueue rate exceeds the dequeue rate, tasks will accumulate, eventually leading to queue overflow. Therefore, to ensure queue stability, the service intensity must meet certain requirements.
[0065] (8)
[0066] In the task The previous set of unloading queue tasks is represented as Assuming the vehicle The resulting visual task The latency from the base station to the controller and from the controller to the cooperating base station is Visual tasks The unloading delay is calculated as follows
[0067] (9)
[0068] B. Task reasoning latency
[0069] Task inference latency refers to the time it takes for a visual task to be processed from the time it enters the processing queue of the cooperating base station until the task is completed. For local processing tasks, task inference latency is the time it takes for the visual task to be processed in the local processing queue at the vehicle end. Let a binary variable... ( This indicates that the task is offloaded to the cooperating base station. (Processed locally on the vehicle) Otherwise, the value is 0. Vehicle Visual tasks Offload to cooperative base station The time spent on reasoning is expressed as .vehicle Local reasoning visual task The time spent is expressed as Therefore, cooperative base stations The average processing time for all vision tasks in the queue is calculated as follows:
[0070] (10)
[0071] The MEC controller assigns tasks from the offload queue to different collaborators for processing. Each collaborator processes the arrival of tasks in the queue according to a Poisson process. Let a binary variable... The controller will represent the vehicle Generated tasks Assigned to cooperative base stations Process, otherwise 0. The controller assigns the value to the base station. The percentage of tasks is expressed as
[0072] (11)
[0073] Cooperative base stations The arrival rate of tasks in the processing queue The processing queue is modeled as an M / M / 1 queue model. According to equations (6), (10), and (11), the cooperative base station... The service strength of the processing queue is defined as
[0074] (12)
[0075] To ensure queue stability, the service strength for processing the queue must meet the following requirements.
[0076] (13)
[0077] Tasks in the cooperative base station processing queue The previous task index set was Assuming the vehicle The resulting visual task The latency required for processing by the cooperating base station or vehicle is Then visual tasks Task inference latency calculation is
[0078] (14)
[0079] C. Result return delay
[0080] The result return latency represents the time required to transmit the result data from the cooperating base station back to the vehicle after the task inference is completed. Local processing tasks perform task inference on the vehicle side, so no task return is required. According to equation (4), the cooperating base station... Mid-vision task Send back to the vehicle The latency for the result return in this process is calculated as follows:
[0081] (15)
[0082] Visual tasks The total latency includes task unloading latency, task processing latency, and task return latency, which is the sum of equations (9), (14), and (15), expressed as:
[0083] (16)
[0084] 2.4 Problem Modeling
[0085] Define a binary variable
[0086] (17)
[0087] If the task In delay constraints If the following is completed, then ,otherwise .make This represents the set of visual tasks. The set of task scheduling strategies is represented as... Throughout the entire process from task completion to result reception, the vehicle must remain within the coverage area of the cooperating base station. If the vehicle has not received the task result when it leaves the coverage area of the cooperating base station, the task is considered a failure, even if the task's own latency has not been exceeded. Generated visual tasks The candidate set of cooperative base stations is represented as
[0088] (18)
[0089] in, Representative at Time vehicle With base station The predicted distance between them. Define the following binary variables.
[0090]
[0091] if , Otherwise, it is 0. Under the task delay constraint, the optimization objective of task scheduling is to maximize the number of successfully completed visual tasks in the system, modeled as follows:
[0092] : (19)
[0093] (19a)
[0094] (19b)
[0095] (19c)
[0096] (19d)
[0097] (8) and (13) (19e)
[0098] Constraint (19a) ensures that each vehicle can only connect to a single base station for transmission and cannot establish connections with multiple base stations simultaneously. Constraint (19b) ensures that each task can only be assigned to one cooperating base station for processing. Under constraint (19c), each task can only select one task processing mode. Constraint (19d) ensures that the selected cooperating base station can continuously cover the vehicle throughout the entire task processing and result transmission process, especially in high-speed moving scenarios, to avoid task failure due to the vehicle moving out of the base station's coverage area. Constraint (19e) ensures the stability of the controller's offload queue and the processing queues of each base station.
[0099] 3 RAG-DRL Joint Design Scheme
[0100] This section designs a collaborative reasoning task offloading scheme for RAG-DRL. For example... Figure 2 As shown, in offline training, RAG accesses static and dynamic knowledge uniformly through the MCP gateway, transforming heterogeneous traffic domain knowledge into decision-making basis that can be used by DRL, and realizing knowledge-driven task offloading decision-making.
[0101] The deep collaboration between RAG and DRL is reflected in the transformation from knowledge to decision-making. On the one hand, RAG acquires static knowledge and real-time traffic conditions through the MCP gateway, obtaining terrain communication features, historical congestion patterns, and information on sudden accidents. This heterogeneous knowledge, after being understood and reasoned through LLM, generates quantified environmental perception factors, providing road network situation enhancement information for DRL's offline training and online inference. On the other hand, candidate collaborators that can maintain connections, selected by trajectory knowledge, can constrain DRL's offloading actions. Through this knowledge enhancement mechanism, the DRL algorithm no longer relies solely on trial-and-error interactions with the environment, but makes decisions guided by rich prior knowledge and forward-looking information.
[0102] 3.1 Trajectory Knowledge Acquisition Based on MCP
[0103] The high-speed mobility of vehicles can easily lead to communication interruptions at edge nodes. Accurately predicting vehicle trajectories is crucial for identifying candidate collaborators for sustainable coverage. A Spatio-Temporal Graph Neural Network (STGNN) model is used to predict vehicle trajectories and is registered as a service with the MCP gateway, providing a unified trajectory prediction service for the RAG. This service is considered a form of computational dynamic knowledge, providing forward-looking knowledge support for collaborative reasoning in visual tasks.
[0104] STGNN model pre-training: Constructing a local traffic map centered on the target vehicle. Adjacency matrix The edge weights in the LSTM network are determined by the reciprocal of the distance between vehicles; vehicles that are closer together are assigned greater weights to reflect stronger spatial interactions. The LSTM network is responsible for processing temporal trajectory data to capture the temporal characteristics of vehicle movement. The GCN network is used to construct a spatiotemporal graph that aggregates neighborhood vehicle information to obtain spatial features reflecting the positional interactions between vehicles. In the feature fusion process, temporal and spatial features are fused using learnable weight parameters. and Linear combination, thus generating a comprehensive spatiotemporal representation. . The future is obtained through multi-layer perceptron mapping. Predicted trajectory within a time period
[0105] (20)
[0106] in, and These are the learnable parameters for temporal convolution and graph convolution, respectively. This is the bias term. Mean squared error is used to construct the loss function.
[0107] (twenty one)
[0108] in, Indicates vehicle exist The actual trajectory at each moment. Model parameters are updated using the AdamW optimizer during training. Parameters are randomly initialized and then continuously optimized based on gradient information from the loss function. The learning rate starts from an initial value, enters a decay period after a warm-up phase, and gradually converges the model to the optimal solution.
[0109] Trajectory prediction model service-oriented architecture: In the offline training phase, the STGNN model is pre-trained on historical trajectory datasets; in the service registration phase, the model is registered with the gateway as an MCP tool, exposing a standardized prediction interface; in the online invocation phase, the MEC controller obtains future data through the MCP gateway. Trajectory prediction results within the time window. The STGNN model pre-training, training, and service registration process is summarized in Algorithm 1 below.
[0110]
[0111] 3.2 Vector Library Construction and Multi-Source Knowledge Retrieval
[0112] To efficiently retrieve road knowledge, expert knowledge needs to be converted into a computable vector representation. Furthermore, a multi-source knowledge retrieval mechanism is designed to acquire heterogeneous traffic knowledge. A unified vector representation space is constructed to integrate static knowledge, while real-time traffic conditions are dynamically acquired through an MCP gateway, thus providing comprehensive knowledge support for task scheduling decisions.
[0113] like Figure 2 As shown, domain knowledge Converted into vector representation To support similarity calculation and fast retrieval. Assume the latitude and longitude boundary of the urban road network coverage area is... , , and .make The longitude and latitude coordinates are represented as and The coordinate vector is normalized to
[0114] (twenty two)
[0115] For knowledge entries Terrain communication description text The semantic features extracted by its pre-trained Sentence-BERT model
[13] are represented as follows:
[0116] (twenty three)
[0117] Location and terrain features were pieced together as
[0118] (twenty four)
[0119] This feature concatenation method considers both positional and semantic relevance, preventing the omission of knowledge items due to a single dominant dimension. To facilitate subsequent similarity calculations, Normalized by L2
[0120] (25)
[0121] Through this vectorization method, heterogeneous knowledge items are transformed into a unified vector representation. All normalized vectors... Its original knowledge entries The matched corresponding vector library collection .
[0122] Assume a query is represented as ,in This represents the current latitude and longitude coordinates of the vehicle. This represents a description of terrain features obtained through the open-source geographic data platform OpenStreetMap. The processing flow is similar to that of knowledge entries. Normalized to
[0123] (26)
[0124] Extracted by the Sentence-BERT model
[0125] (27)
[0126] By concatenating the features from (26) and (27), the query vector is obtained. The vector was L2 normalized to...
[0127] (28)
[0128] (29)
[0129] Based on cosine similarity and The similarity between them was quantified as
[0130] (30)
[0131] Based on cosine similarity score, the vector most similar to the query vector is selected. The knowledge entries were filtered from the traffic knowledge base. The set of indices for these knowledge entries is represented as...
[0132] (31)
[0133] From this, a terrain communication description set and a congestion communication description set can be extracted. The former is represented as... .make This is a time-mapping variable, corresponding to discrete time period identifiers. For example, when... , This represents the morning rush hour. The set of congestion communication descriptions for different time periods is represented as
[0134] (32)
[0135] The MCP service interface continuously receives reports from RSUs (Roadside Units), traffic cameras, and vehicle terminals. The event stream of moments, to get the current moment. Road construction information Accident Report Traffic control information The controller obtains information on sudden road accidents by accessing the current traffic situation through the MCP gateway, which is represented as follows: The controller integrates terrain communication description sets. A collection of peak-hour congestion communication descriptions and road emergency information This provides rich prior knowledge support for subsequent DRL decisions. The knowledge retrieval process is then arranged as Algorithm 2.
[0136]
[0137] 3.3 RAG-enhanced DRL algorithm
[0138] To address the dynamic and complex nature of task offloading decisions in connected vehicle environments, this section designs a RAG-enhanced deep reinforcement learning algorithm to achieve knowledge-driven collaborative reasoning for task offloading optimization. This algorithm deeply integrates traffic domain expert knowledge with the reinforcement learning decision-making process, guiding the agent to make optimal task scheduling decisions in complex connected vehicle environments through environmental perception factor generation and action space constraints.
[0139] 3.3.1 Generation and caching of environmental perception factors
[0140] Heterogeneous knowledge and Although it contains rich environmental information, it can only serve as the state input for the DRL model after being converted into quantifiable decision factors. LLM, as a knowledge understanding and inference engine, transforms the complex traffic situation described in natural language into quantifiable environmental perception factors. and The state-enhanced triples generated by LLM are represented as
[0141] (33)
[0142] Topographical influence factors ( ), indicating the impact of terrain on base stations The overall impact coefficient on communication quality; the smaller the value, the greater the impact of terrain on the base station. The greater the negative impact, the better. For example, when vehicles travel inside mountain tunnels, ground base stations may have low load rates, but signal interference can be severe. The value is relatively small; drone base stations are less affected. The value is relatively large; the S5 satellite signal is basically unaffected. Close to 1.
[0143] Peak period sensitive factors ( The value represents the congestion risk coefficient of the time-location combination, and its value is inversely proportional to the negative impact of congestion on task offloading. For example, during the evening rush hour on a weekday (6:00 PM), when vehicles are about to enter the core area of the CBD, the base station load in that area remains saturated. The load is relatively small; at the same location during nighttime hours, the base station load is low and it is not during peak congestion periods. Close to 1.
[0144] Impact factors of sudden accidents ( The coefficient represents the impact of a sudden event on the communication environment, and its value is inversely proportional to the negative impact of the sudden event on task offloading. For example, when a traffic accident ahead causes a surge in load and strong signal interference at surrounding base stations, a smaller impact factor is less likely to affect the communication environment. This means that task scheduling faces high risks under the current environment; under normal traffic conditions, Close to 1.
[0145] Structured Prompt Engineering was used to constrain the output format, requiring that the generated environment-aware factors must be within the specified range. It provides a clear definition of numerical meaning within a given range. Simultaneously, multi-round consistency checks are introduced, querying the LLM multiple times for the same scenario and calculating the variance. When the variance exceeds a threshold... When using mean or conservative estimation strategies, the negative impact of LLM noise on decision-making can be effectively reduced.
[0146] Considering the potential latency of RAG, the MEC controller employs a RAG result caching mechanism. During the cycle... Within the system, knowledge retrieval and factor generation are executed by RAG through the MCP gateway, and the results are cached and used by tasks within that cycle. This design takes into account the relative stability of the traffic environment over short timescales: within a 5-10 second time window, vehicle position changes are typically on the order of hundreds of meters, terrain features and congestion patterns remain largely unchanged, and information on sudden accidents does not change significantly.
[0147] 3.3.2 RAG-enhanced DRL offline training
[0148] Supported by a wealth of static and dynamic knowledge, LLM, as an intelligent agent in road networks, is used to understand complex geographical descriptions, analyze changes in the stability of communication quality between vehicles and base stations during emergencies, and comprehensively assess the risk level of task offloading under various intertwined conditions. Reinforcement learning algorithms, based on these precisely quantified environmental factors, can more accurately evaluate state value and action risk, thereby making better offloading decisions and processing patterns. The problem of RAG-assisted DRL in task offloading is modeled as a Markov Decision Process (MDP), where the expressions for the state space, action space, and reward are as follows:
[0149] State space S: Task scheduling needs to comprehensively consider vehicle position and speed information, task parameters, base station load, prediction information, and state enhancement triples. The original state is represented as
[0150] (34)
[0151] Environmental status enhanced by RAG Represented as
[0152] (35)
[0153] Action Space A: To ensure task completion, the system must satisfy the constraint that cooperating base stations can maintain continuous coverage when selecting actions. According to equation (18), only the candidate set of cooperating base stations... Only base stations within the specified range can be selected. System operation. Defined as
[0154] (36)
[0155] Reward R: Combining RAG-quantified environmental factors, the system designed a reward function for perceiving environmental risk. In rounds... The reward received when the task is successfully completed within the delay constraint is represented as...
[0156] (37)
[0157] The penalty received when a task fails to be completed within the delay constraint is represented as follows:
[0158] (38)
[0159] in and These are the performance weights and cost weights for the actions performed, respectively. , , These are the weighting coefficients for environmental factors. In the state... Next action The reward function obtained is expressed as follows:
[0160] (39)
[0161] The design of this reward function enables the system to reward successful decisions more and punish failed decisions more severely when environmental risks are high (factor values are small), thereby guiding the algorithm to learn to make more cautious and accurate task scheduling decisions in complex and ever-changing air-space-ground network environments.
[0162] This section employs the DDQN algorithm to iteratively optimize the unloading strategy to maximize the expected cumulative reward. The algorithm maintains two neural networks: a policy network and a target network. The policy network selects actions, and the target network calculates the target Q-value. The two networks have the same structure but different parameter update frequencies. Let... This represents the set of candidate scheduling strategies. The action that maximizes the reward in each state is represented as...
[0163] (40)
[0164] The formula for calculating the target Q value is expressed as follows:
[0165] (41)
[0166] in Representative policy network parameters, Represents the target network parameters. This represents a discount factor. The evaluation network selects the action that maximizes the Q-value, while the target network calculates the Q-value for that action, thus reducing overestimation bias.
[0167] The knowledge-driven DRL offline training process is described as Algorithm 3. The multi-source heterogeneous knowledge provided by RAG is strategically incorporated into the decision-making process of DRL: (1) State enhancement mechanism (see lines 3-6 of Algorithm 3): In each training step, the agent extracts the environment-aware factor triplet from the RAG cache. This is combined with the original state to form an enhanced state. This mechanism enables DRL to perceive the combined impact of terrain disturbances, congestion risks, and sudden accidents on offloading decisions. (2) Action space constraint mechanism (see lines 7-8 of Algorithm 3): Based on the prediction results fed back by the trajectory prediction service, the algorithm selects candidate collaborators that can maintain the connection according to equation (18). The policy network selects offloading actions only from these candidate collaborators. This avoids the waste of training samples caused by exploring invalid actions in traditional DRL. (3) Risk-aware reward mechanism (see line 10 of Algorithm 3): Environmental factor weights are introduced into the reward function calculation. , , (See equations (37)-(37)), which results in higher rewards for successful decisions and more severe penalties for failed decisions in high-risk scenarios (smaller factor values).
[0168]
[0169] 4. Simulation Experiments and Result Analysis
[0170] To verify the effectiveness of the proposed method, this section conducts simulation experiments in an integrated air-space-ground vehicle-to-everything (V2X) network scenario. Consider an urban road scenario incorporating emergencies such as traffic accidents and road construction. A series of edge servers are deployed in the scenario to provide computing services to different areas; the area covered by one of these edge servers is selected as the experimental range. This area includes two ground base stations, three drone base stations, and one satellite base station. The satellite base station covers the entire scenario, while the ground base station covers approximately 400m of road. The drone hovers above the road, with a coverage range of 100m. Vehicles move through the road network according to real traffic flow patterns, generating visual reasoning tasks such as object detection and image classification.
[0171] The experiment was configured with an Intel® Core™ Ultra 7 155H 3.80 GHz CPU processor and an NVIDIA GeForce RTX 4090 graphics card for accelerating deep learning model training and inference. The software environment was based on the Ubuntu 20.04LTS operating system, using Python 3.8.10 as the development language, and the PyTorch 1.12.0 deep learning framework in conjunction with CUDA 11.6.
[0172] The trajectory data is based on real urban traffic flow generated by SUMO traffic simulation, covering the complete driving trajectories of 2000 vehicles over 24 hours, including location coordinates (latitude and longitude), instantaneous speed, driving direction, and lane change information. The data sampling frequency is 1Hz to ensure trajectory continuity. The arrival rate of the vehicle-generated task follows a Poisson distribution. Other experimental parameters are shown in Table 1.
[0173] Table 1 Experimental parameters
[0174] Table 2 Ablation Experiment Method Setup
[0175] Comparative and ablation experiments were used to evaluate the performance of the proposed method. Two representative methods were selected for the comparative experiments:
[0176] Baseline-1 adopts a heuristic strategy based on maximum signal-to-noise ratio (Max-SINR)
[14] to select cooperative base stations based on channel quality.
[0177] Baseline-2 adopts an adaptive window slicing and DDQN task offloading method
[15] , performing resource slicing on a large time scale and selecting cooperative base stations through DDQN on a small time scale.
[0178] Baseline-3 adopts a task offloading method based on DQN
[16] , which makes task offloading decisions based on network status.
[0179] The ablation experiments verified the effectiveness of each component by gradually removing key modules, as shown in Table 2. The experiments evaluated the algorithm performance from multiple dimensions, including training convergence, resource utilization efficiency, and task completion quality. The main evaluation metrics included cumulative reward, number of completed tasks, task failure rate, and average latency.
[0180] 4.1 Impact of Training Rounds on Performance
[0181] Figures 4(a) to 4(d) show the impact of training epochs on task unloading performance and the probability density distribution of the final reward value under different methods. The learning rate of the DRL algorithm was set to 0.005, and 4000 data points were used for training.
[0182] Figure 4(a) illustrates the impact of different training rounds on the reward. It can be seen that Propose-1 consistently achieves the highest cumulative reward, stabilizing at around 3100 after convergence, thanks to the multi-source knowledge enhancement provided by the RAG module. Proposed-2's cumulative reward is approximately 2890, about 6% lower than Proposed-1, indicating that the trajectory prediction module effectively avoids task failure penalties caused by vehicles leaving the coverage area by providing forward-looking base station coverage information. Proposed-4's cumulative reward is approximately 2810, about 8.3% lower than Proposed-1, validating the significant contribution of dynamic sudden accident information to decision quality. Baseline-2's cumulative reward is approximately 2750, the lowest among all methods, about 11.7% lower than Proposed-1.
[0183] In the first 20 training rounds, the cumulative rewards of each method experienced a rapid increase followed by a slowdown and eventual stabilization. This is because the random initialization of neural network parameters makes it difficult for the agent to adapt to the environment in the initial stage, requiring continuous interaction with the environment to gradually learn the optimal policy. Notably, Proposed-1 learned significantly faster than other methods in the initial stage (first 10 rounds), indicating that the environment-aware factor provided by RAG can accelerate the convergence process of DRL and reduce exploration costs.
[0184] Figure 4(b) illustrates the impact of training epochs on the number of tasks completed under different methods. Since Baseline-1 uses a heuristic strategy and does not involve model training, we use it as the performance baseline (approximately 2540 tasks completed). Proposed-1 consistently maintained the highest number of tasks completed throughout the training process, stabilizing at approximately 2900 after convergence, representing an improvement of approximately 14.1% compared to Baseline-1. Proposed-3 completed approximately 2840 tasks, slightly higher than Baseline-2 (approximately 2790). This is mainly attributed to the trajectory prediction module's ability to predict vehicle movement trajectories in advance, avoiding the assignment of tasks to base stations about to lose coverage, thereby reducing task failures due to communication interruptions.
[0185] As shown in Figure 4(c), the reward probability density distribution of Proposed-1 is concentrated in the higher range, exhibiting a narrow distribution width and high concentration. This distribution characteristic indicates that the RAG-enhanced agent has stable decision-making quality and can maintain consistent high performance across different traffic scenarios. In contrast, the reward distribution of Baseline-2 is more dispersed and has a wider range, reflecting that the DRL method, lacking domain knowledge guidance, has insufficient decision-making stability in complex scenarios and is easily affected by environmental fluctuations.
[0186] As shown in Figure 4(d) of the failure rate curves for training epochs, the failure rates of all methods show a decreasing trend with increasing training epochs, but the rate of decrease and the final convergence value differ significantly. The failure rate of Proposed-1 rapidly decreased from approximately 42% to 14% in the first 10 epochs, then continued to decline steadily, finally converging to approximately 8%. This rapid decline indicates that the knowledge augmentation strategy can effectively reduce the possibility of task failure. Baseline-1 maintained a high failure rate of approximately 28% because it only considered channel quality and ignored key factors such as vehicle mobility and base station load. The failure rate of Baseline-2 decreased from approximately 45% to approximately 13%, showing improvement but still about 5 percentage points higher than Proposed-1. These results indicate that Proposed-1 responds more accurately to task requirements, thereby significantly reducing the task failure rate and accelerating model convergence.
[0187] 4.2 Impact of Resource Quantity on Performance
[0188] Figure 5 The paper demonstrates the impact of computational resources on task failure rate when the number of base station sub-channels is fixed at 15. As the number of computational resources increases, the task failure rate of each method gradually decreases. Proposed-1's failure rate drops from approximately 20% initially to approximately 7% at the end, significantly outperforming Baseline-2 (from 22% to 12%) and Baseline-1 (from 55% to 25%). Notably, when the number of computational resources exceeds 16, the downward trend of the curves for each method slows significantly. This indicates that sufficient computational resources give the MEC controller more offloading options, but at this point, system performance begins to be constrained by other factors (such as spectrum resources), and computational resources are no longer the primary bottleneck.
[0189] Figure 6 This demonstrates the impact of spectrum resources (number of sub-channels) on task failure rate when the number of computing resources is fixed at 20. In the initial phase of increasing the number of sub-channels from 10 to 16, the task failure rate decreases rapidly. Proposed-1 drops from approximately 21% to approximately 9%, a decrease of 12 percentage points; Baseline-1 drops from approximately 50% to approximately 27%, a decrease of 23 percentage points. This is because more spectrum resources can support higher uplink and downlink transmission rates, shorten task offloading and result return latency, thereby increasing the probability of the task completing within latency constraints.
[0190] Proposed-1 maintains the lowest failure rate across the entire resource range. When the number of sub-channels reaches 20, the failure rate drops to approximately 7%, while Baseline-1 remains at approximately 25%, and Baseline-2 at approximately 12%. Proposed-1 represents a 41.7% reduction in failure rate compared to Baseline-2, and a 72% reduction compared to Baseline-1. Once the spectrum resources reach 16 sub-channels, further increases in spectrum resources offer limited performance improvement. At this point, spectrum resources are relatively abundant, and task transmission latency is no longer the primary bottleneck. System performance begins to be limited by the processing power of computing resources and the service intensity of the base station queue.
[0191] 5. Conclusion
[0192] This invention proposes a RAG-enhanced DRL-based integrated air-space-ground vehicle network task offloading method, aiming to enhance the agent's response capability in handling emergencies and unexpected scenarios. The method constructs a dynamic knowledge access mechanism based on the Model Context Protocol (MCP) to achieve deep integration of static and dynamic road information. Addressing the heterogeneity of traffic knowledge, a collaborative retrieval mechanism for multi-source traffic knowledge is designed to achieve accurate retrieval of the static knowledge base and real-time access to traffic conditions. To achieve knowledge-driven decision-making, a RAG-enhanced DRL algorithm is designed, integrating static and dynamic knowledge into the DRL training and inference process. Simulation experiments show that the proposed scheme significantly outperforms traditional DRL and heuristic methods in terms of cumulative reward, number of completed tasks, and failure rate, effectively improving decision quality and stability while reducing training costs. With the same amount of resources, the proposed RAG-enhanced strategy also significantly reduces the task failure rate, improving system resource utilization.
[0193] References
[0194] [1]Ren R, Wu Y, Zhang X, et al. Retrieval-Augmented Generation for Mobile Edge Computing via Large Language Model[J]. arXiv preprint arXiv:2412.20820, 2024.
[0195] [2]Hussien MM, Melo AN, Ballardini AL, et al. Rag-BasedExplainable Prediction of Road Users Behaviors for Automated Driving UsingKnowledge Graphs and Large Language Models[J]. Expert Systems withApplications, 2025, 265: 125914.
[0196] [3]Li J, Xu C, Jia L, et al. EACO-RAG: Towards Distributed Tiered LLMDeployment Using Edge-Assisted and Collaborative RAG with Adaptive KnowledgeUpdate[J]. arXiv preprint arXiv:2410.20299, 2024.
[0197] [4]Park E J, Kim H, Jeong S, et al. Keyword-Based Vehicle Retrieval[C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and PatternRecognition. 2021: 4220-4227.
[0198] [5]Wang S, Dong H, Zhou Y, et al. Exploring Traffic AccidentLocations from Natural Language Based on Spatial Information Retrieval[C] / / 2017 29th Chinese Control and Decision Conference (CCDC). IEEE, 2017: 3490-3495.
[0199] [6]Zhang Z, Shen Z, Yuan M, et al. RAGTraffic: Utilizing Retrieval-Augmented Generation for Intelligent Traffic Signal Control[C] / / 2024International Annual Conference on Complex Systems and Intelligent Science(CSIS-IAC). IEEE, 2024: 728-735.
[0200] [7]Wang J, Zhao L, Liu J, et al. Smart Resource Allocation for MobileEdge Computing: A Deep Reinforcement Learning Approach[J]. IEEE Transactionson Emerging Topics in Computing, 2019, 9(3): 1529-1541.
[0201] [8]Al-Tarawneh M A, Alnawayseh S E. Performance Assessment ofContext-Aware Online Learning for Task Offloading in Vehicular Edge ComputingSystems[J]. International Journal of Advanced Computer Science andApplications, 2021, 12(4): 304-320.
[0202] [9]Li C, Tian M, Hui Y, et al. On-Demand Environment Perception andResource Allocation for Task Offloading in Vehicular Networks[J]. IEEETransactions on Wireless Communications, 2024.
[0203]
[10] Erceg V, Greenstein L J, Tjandra S Y, et al. An Empirically BasedPath Loss Model for Wireless Channels in Suburban Environments[J]. IEEEJournal on Selected Areas in Communications, 1999, 17(7): 1205-1211.
[0204]
[11] Zhang S, Luo H, Li J, et al. Hierarchical Soft Slicing to MeetMulti-Dimensional QoS Demand in Cache-Enabled Vehicular Networks[J]. IEEETransactions on Wireless Communications, 2020, 19(3): 2150-2162.
[0205]
[12] Chen Y, Wang Y, Liu M, et al. Network Slicing Enabled ResourceManagement for Service-Oriented Ultra-Reliable and Low-Latency VehicularNetworks[J]. IEEE Transactions on Vehicular Technology, 2020, 69(7): 7847-7862.
[0206]
[13] Reimers N, Gurevych I. Sentence-BERT: Sentence Embeddings UsingSiamese BERT-Networks[J]. arXiv preprint arXiv:1908.10084, 2019.
[0207]
[14] Gao Y, Wu W, Dong J, et al. Deep Reinforcement Learning BasedNode Pairing Scheme in Edge-Chain for IoT Applications[C] / / GLOBECOM 2020-2020IEEE Global Communications Conference. IEEE, 2020: 1-6.
[0208]
[15] Shen H, Tian Y, Wang T, et al. Slicing-Based Task Offloading inSpace-Air-Ground Integrated Vehicular Networks[J]. IEEE Transactions onMobile Computing, 2023, 23(5): 4009-4024.
[0209]
[16] Dai F, Liu G, Mo Q, et al. Task Offloading for Vehicular EdgeEomputing with Edge-cloud Cooperation[J]. World Wide Web, 2022, 25(5): 1999-2017。
Claims
1. A method for offloading tasks in an integrated air-space-ground vehicle network based on RAG-enhanced DRL, characterized by: The task offloading method is applied to a space-air-ground integrated vehicle-to-everything (SAGVN) scenario consisting of ground base stations, UAV small base stations, and low-orbit satellites. The ground base stations and UAV small base stations provide local signal coverage, while the low-orbit satellites cover the entire urban road network. Based on the real-time location and communication network conditions, the vehicle dynamically selects to use onboard computing power for local inference or offloads the task to ground base stations, UAVs, and satellites for collaborative inference. The MEC controller deploys a deep reinforcement learning (DRL) model for task scheduling decisions. A dynamic retrieval and enhancement generation (RAG) system based on the Model Context Protocol (MCP) is constructed. In this system, the static road communication knowledge base, trajectory prediction service, and real-time traffic situation are encapsulated as searchable knowledge sources. At the same time, the MEC controller integrates the RAG mechanism and accesses the knowledge sources uniformly through the MCP gateway, providing knowledge support for DRL's task scheduling decisions in non-stationary environments.
2. The method for offloading tasks in an integrated air-space-ground vehicle network based on RAG-enhanced DRL as described in claim 1, characterized in that... In SAGVN scenarios MCP-assisted RAG framework The collection of ground base stations, drones, and satellites is represented as follows: , , The sets of vehicles and base stations are respectively represented as , A vehicle can only establish a connection with one base station in the same time slot. Based on the timeliness and acquisition method of knowledge, SAGVN environment knowledge is divided into three categories: 1) Static knowledge, including long-term, stable expert knowledge of road terrain features, base station deployment topology, and historical congestion patterns; the item index set in the road network knowledge base is represented as... ; Knowledge Entries The central location of the corresponding geographical region is represented as ; The degree of interference between the current location's terrain features and the base station's communication performance is described as follows: This includes terrain features, base station deployment, and the impact on communication propagation; peak-hour congestion communication is described as follows: This describes the historical traffic congestion characteristics of the current road segment during peak hours and the pressure it places on base station communications; based on this, knowledge entries... The corresponding complete domain knowledge is ; 2) Dynamic knowledge, based on its generation method, is divided into the following two categories: a) Computational knowledge: Foresighted knowledge generated by the trajectory prediction model through computation; this trajectory prediction model is based on vehicle... At any moment Previous historical trajectory data It predicts the future trajectory of vehicles and potential risk areas; the trajectory prediction results provide a forward-looking decision-making basis for the selection of cooperative base stations, ensuring that vehicles remain within the coverage area of base stations during mission inference; b) Perceptual knowledge: Real-time information on sudden accidents perceived by IoT sensors, roadside units (RSUs), vehicle-mounted terminals, and satellite links; at any given moment... The road emergency information acquired by the MEC controller through the edge node sensing network is represented as It includes attributes such as event type, location coordinates, severity, and timestamp; When the vehicle At any moment The generated inference tasks are uploaded to the base station. At the same time, the MEC controller accesses static and dynamic knowledge services through the MCP gateway to obtain decision support information: it retrieves terrain communication features and historical congestion patterns from the knowledge base, calls trajectory prediction services to obtain forward-looking prediction knowledge, and queries real-time traffic situation services to obtain information on emergencies; the MEC controller integrates static and dynamic knowledge to make offloading decisions for tasks, realizing intelligent collaborative reasoning in complex traffic scenarios. communication model make Indicates vehicle With base station The time-varying decay factor; assuming at time... ,vehicle With base station The Euclidean distance between them is expressed as The channel gain between the two is expressed as (1), in, This is a reference distance, used as a benchmark for calibrating channel gain; for Channel gain at the location; The path loss index is determined based on the base station type; make For base stations Position coordinates, based on ,vehicle In the future The set of movement trajectories within the time window is represented as So, vehicles exist The position at time is predicted as Based on this, the vehicle With base station exist The channel gain at time t is predicted as (2), make and For vehicles and base stations The transmit power; the spectrum resources in the base station are allocated to each vehicle in units of mutually orthogonal sub-channels; assuming the bandwidth of each sub-channel is... ,make Indicates assignment to task The number of sub-channels, then, vehicle to base station Submit Task The uplink transmission rate at that time is calculated as follows: (3), in, Indicates average background noise; make Indicates assignment to task The number of sub-channels in the calculation results, base station To the vehicle Return mission The downlink transmission rate based on the predicted channel gain is predicted as follows: (4), End-to-end computation delay modeling Task Includes a set of characterization parameters ,in Represents the size of the task data (bits). Indicates task Delay constraints; A. Task unloading delay Task offload latency represents the time required for the receiving base station to transmit the task to the controller's offload queue and then to the cooperating base station's processing queue; base station The set of tasks collected within the coverage area is represented as The total number of elements in the set is ;make Indicates vehicle With base station A connection was established, otherwise Within the MEC controller's coverage area, the average time for a task to be uploaded from the vehicle to the base station is calculated as follows: III(5), The task arrival between a single vehicle and a base station is modeled as a Poisson process; Order the vehicle The arrival rate of generated tasks is The arrival rate of tasks in the MEC controller's unloading queue is... (6), The offloading queue processes only one task at a time; the task offloading process is modeled as an M / M / 1 queue model; the service intensity of the MEC controller's offloading queue is defined as... (7), The enqueue rate for the unloading queue is determined by the task arrival rate, while the dequeue rate is determined by the transmission rate. To ensure queue stability, the service intensity must meet certain requirements. (8), In the task The previous set of unloading queue tasks is represented as Assuming the vehicle The generated task The latency from the base station to the MEC controller and from the controller to the cooperating base station is ;Task The unloading delay is calculated as follows (9), B. Task reasoning latency Task inference latency refers to the time it takes for a task to be processed from the time it enters the processing queue of the cooperating base station until it is completed. For locally processed tasks, task inference latency is the time it takes for the task to be completed in the local processing queue at the vehicle end. Let the binary variable and These represent the task being offloaded to the cooperating base station. Processing occurs either locally on the vehicle side or 0 otherwise. vehicle The task Offload to cooperative base station The time spent on reasoning is expressed as ;vehicle Local reasoning task The time spent is expressed as Then the cooperative base station The average processing time for all tasks in the queue is calculated as follows: (10), The MEC controller assigns tasks in the offload queue to different collaborators for processing; each collaborator processes the arrival of tasks in the queue according to a Poisson process; let a binary variable... The controller will represent the vehicle Generated tasks Assigned to cooperative base stations Process, otherwise 0; the controller assigns to the base station. The percentage of tasks is expressed as (11), Cooperative base stations The arrival rate of tasks in the processing queue The processing queue is modeled as an M / M / 1 queue model; cooperative base stations The service strength of the processing queue is defined as (12), The service strength of the processing queue must meet the following requirements. (13), Tasks in the cooperative base station processing queue The previous task index set was Assuming the vehicle The generated task The latency required for processing by the cooperating base station or vehicle is Then the task Task inference latency calculation is (14), C. Result return delay Result return latency represents the time required to transmit the result data from the cooperating base station back to the vehicle after the task inference is completed; cooperating base station Medium task Send back to the vehicle The latency for the result return in this process is calculated as follows: (15), Task The total latency includes task unloading latency, task processing latency, and task return latency, expressed as... (16), Problem Modeling Define a binary variable (17), If the task In delay constraints If the following is completed, then ,otherwise ; make The set of tasks; the set of task scheduling policies is represented as ; Throughout the entire process from task completion to result reception, the vehicle must remain within the coverage area of the cooperating base station; if the vehicle does not receive the task result when it leaves the coverage area of the cooperating base station, even if the task's own latency has not been exceeded, the task is considered a failure; Generated tasks The candidate set of cooperative base stations is represented as (18), in, Representative at Time vehicle With base station The predicted distance between them; Define the following binary variables , if , Otherwise, it is 0; Under task delay constraints, the optimization objective of task scheduling is to maximize the number of tasks that are successfully completed, modeled as follows: : (19), (19a), (19b), (19c), (19d), and (19e), Constraint (19a) ensures that each vehicle can only connect to a single base station for transmission and cannot establish connections with multiple base stations simultaneously; Constraint (19b) ensures that each task can only be assigned to one cooperating base station for processing; Under constraint (19c), each task can only select one task processing mode; Constraint (19d) ensures that the selected cooperative base station can continuously cover the vehicle throughout the entire task processing and result transmission process, especially in high-speed moving scenarios, to avoid task failure due to the vehicle moving out of the base station's coverage area; Constraint (19e) ensures the stability of the controller offload queue and the processing queues of each base station.
3. The air-space-ground integrated vehicle networking task offloading method based on RAG-enhanced DRL according to claim 2, characterized in that: The RAG-DRL-based collaborative reasoning task offloading method is used to implement task offloading in the SAGVN scenario: In offline training, RAG accesses static and dynamic knowledge uniformly through the MCP gateway, transforming heterogeneous traffic domain knowledge into decision-making basis for DRL, and realizing knowledge-driven task offloading decision-making. First, RAG acquires static knowledge and real-time traffic conditions through the MCP gateway, obtaining terrain communication features, historical congestion patterns, and information on sudden accidents. This heterogeneous knowledge is then used by LLM to understand and infer quantified environmental perception factors, providing road network situation enhancement information for DRL offline training and online inference. Meanwhile, candidate collaborators for maintaining connections, selected by trajectory knowledge, constrain the DRL's unloading action.
4. The air-space-ground integrated vehicle networking task offloading method based on RAG-enhanced DRL according to claim 3, characterized in that: In the collaborative reasoning task offloading method using RAG-DRL, the trajectory knowledge acquisition method based on MCP uses the spatiotemporal graph neural network model STGNN to predict vehicle trajectories and registers them as services to the MCP gateway to provide unified trajectory prediction services for RAG. STGNN model pre-training: Construct a local traffic map centered on the target vehicle. Adjacency matrix The edge weights are determined by the reciprocal of the distance between vehicles, with closer vehicles assigned greater weights to reflect stronger spatial interaction effects. LSTM networks are used to process temporal trajectory data to capture the temporal characteristics of vehicle movement. ; The GCN network is used to construct a spatiotemporal graph that aggregates neighborhood vehicle information to obtain spatial features reflecting the positional interaction relationships between vehicles. ; During feature fusion, temporal and spatial features are fused using learnable weight parameters. and Linear combination, thus generating a comprehensive spatiotemporal representation. ; The future is obtained through multi-layer perceptron mapping. Predicted trajectory within a time period (20), in, and These are the learnable parameters for temporal convolution and graph convolution, respectively. For bias terms; Mean squared error was used to construct the loss function. (22), in, Indicates vehicle exist The true trajectory of time; The STGNN model parameters are updated using the AdamW optimizer during training; the parameters are randomly initialized and then continuously optimized based on the gradient information of the loss function; the learning rate starts from the initial value, enters the decay period after the warm-up phase, and allows the model to gradually converge to the optimal solution; Service-oriented approach to trajectory prediction models: During the offline training phase, the STGNN model is pre-trained on a historical trajectory dataset; during the service registration phase, the STGNN model is registered with the gateway as an MCP tool, exposing a standardized prediction interface; during the online invocation phase, the MEC controller obtains future predictions through the MCP gateway. Trajectory prediction results within the time window.
5. The air-space-ground integrated vehicle networking task offloading method based on RAG-enhanced DRL according to claim 3, characterized in that: In the collaborative reasoning task offloading method using RAG-DRL, the vector library construction and multi-source knowledge retrieval methods are as follows: A multi-source knowledge retrieval mechanism is constructed to acquire heterogeneous traffic knowledge. A unified vector representation space is constructed to integrate static knowledge, and real-time traffic conditions are dynamically acquired through the MCP gateway, thereby providing comprehensive knowledge support for task scheduling decisions. Domain knowledge Converted into vector representation To support similarity calculation and fast retrieval; Assume the latitude and longitude boundary values of the urban road network coverage area are respectively , , and ;make The longitude and latitude coordinates are expressed as follows: and The coordinate vector is normalized to (22), For knowledge entries Terrain communication description text Its pre-trained Sentence-BERT model [13] The extracted semantic features are represented as (23), Location and terrain features were pieced together as (24), Normalized by L2 (25), Then heterogeneous knowledge entries are converted into a unified vector representation; All normalized vectors Its original knowledge entries The matched corresponding vector library collection ; Assume a query is represented as ,in This represents the current latitude and longitude coordinates of the vehicle. This represents a description of terrain features obtained through an open-source geographic data platform; therefore, Normalized to (26), Extracted by the Sentence-BERT model (27), splicing and , obtain the query vector ; Normalized by L2 (28), (29), Based on cosine similarity and The similarity between them was quantified as (30), Based on cosine similarity score, the vector most similar to the query vector is selected. The information of each knowledge item is filtered from the traffic knowledge base, and the set of indexes of these knowledge items is represented as follows: (31), Extract the terrain communication description set from it. and congestion communication description set ; These are time-mapping variables, corresponding to discrete time period identifiers; The set of congestion communication descriptions for different time periods is represented as (32), The MCP service interface continuously receives reports from Roadside Units (RSUs), traffic cameras, and vehicle terminals. The event stream of moments, to get the current moment. Road construction information Accident Report Traffic control information ; The controller obtains road accident information by accessing the current traffic situation through the MCP gateway, which is represented as follows: , The controller integrates a set of terrain communication descriptions. A collection of peak-hour congestion communication descriptions and road emergency information This provides rich prior knowledge support for subsequent DRL decisions.
6. The air-space-ground integrated vehicle networking task offloading method based on RAG-enhanced DRL according to claim 3, characterized in that: In the RAG-DRL-based collaborative reasoning task offloading method, the RAG-enhanced DRL algorithm is employed to achieve knowledge-driven collaborative reasoning task offloading optimization. This algorithm deeply integrates traffic domain expert knowledge with reinforcement learning decision-making processes, guiding the agent to make optimal task scheduling decisions in complex vehicle-to-everything (V2X) environments through environmental perception factor generation and action space constraints. Specifically, it includes: a. Generation and caching of environmental perception factors Using LLM as the knowledge understanding and reasoning engine, heterogeneous knowledge is integrated. and It needs to be converted into quantifiable decision factors as state inputs to the DRL model. The method is as follows: based on and The state-enhanced triples generated by LLM are represented as (33), Among them: topographic influence factor Indicates the terrain to the base station The overall impact coefficient on communication quality; the smaller the value, the greater the impact of terrain on the base station. The greater the negative impact; the more sensitive factors during peak periods. This represents the congestion risk coefficient for time-location combinations, and its value is inversely proportional to the negative impact of congestion on task offloading; sudden accident impact factor. This represents the impact coefficient of a sudden event on the communication environment, and its value is inversely proportional to the negative impact of the sudden event on task offloading. Using the structured prompting engineering constraint output format, the generated environmental perception factors must be within the specified range. Within a given range, it provides a clear definition of numerical meaning; simultaneously, it introduces multi-round consistency checks to query the LLM multiple times for the same scenario and calculate the variance. When the variance exceeds a threshold... When using a mean or conservative estimation strategy; The MEC controller employs a RAG result caching mechanism: during the cycle Within the cycle, knowledge retrieval and factor generation are performed by RAG through the MCP gateway, and the results are cached and used by tasks within that cycle. b. RAG-enhanced DRL offline training The problem of RAG-assisted DRL task offloading is modeled as a Markov Decision Process (MDP), where the state space, action space, and reward are expressed as follows: State space S: Task scheduling needs to comprehensively consider vehicle position and speed information, task parameters, base station load, prediction information, and state enhancement triples. ; The original state is represented as (34), Environmental status enhanced by RAG Represented as (35), Action Space A: To ensure task completion, the selection of actions must satisfy the constraint that the cooperating base stations can maintain continuous coverage; select a set of candidate cooperating base stations. Base stations in the middle; action Defined as (36), Reward R: Combining RAG-quantified environmental factors, a reward function based on perceived environmental risk is adopted: In the round The reward received when the task is successfully completed within the delay constraint is represented as... (37), The penalty received when a task fails to be completed within the delay constraint is represented as follows: (38), in and These are the performance weights and cost weights for the actions performed, respectively. , , These are the weighting coefficients for environmental factors; In state Next action The reward function obtained is expressed as follows: (39), The DDQN algorithm is used to iteratively optimize the unloading strategy to maximize the expected cumulative reward. The DDQN algorithm maintains two neural networks: a policy network and a target network. The policy network is used to select actions, and the target network is used to calculate the target Q value. The two networks have the same structure but different parameter update frequencies. make The set of candidate scheduling strategies is represented by the action that maximizes the reward in each state. (40), The formula for calculating the target Q value is expressed as follows: (41), in Representative policy network parameters, Represents the target network parameters. Represents the discount factor; The evaluation network selects the action that maximizes the Q-value, and the target network calculates the Q-value of that action.
7. The air-space-ground integrated vehicle networking task offloading method based on RAG-enhanced DRL according to claim 1, characterized in that... Task scheduling methods under different traffic events include: a. Mountainous Communication Shadow: When a vehicle travels within the coverage area of a ground base station, drone, and satellite, a mission request is generated and forwarded to the inference queue of the MEC controller via the nearest drone. RAG accesses the road communication knowledge base through the MCP gateway to query the terrain impact knowledge of the current area and finds that the mountain blockage causes serious interference to the ground base station signal; at the same time, based on the feedback information from the trajectory prediction service, the vehicle will leave the drone's coverage area during the mission processing and remain within the coverage area of satellites and base stations. Therefore, a feasible scheduling scheme is to select a low-load satellite with stable signal quality to collaboratively process tasks; the satellite will allocate physical resources to the task according to the first-come, first-served principle and transmit the processed task back to the vehicle; b. Peak-hour congested road sections: During weekday evening rush hours, a mission request is generated when the vehicle is within the coverage area of ground base stations and satellites; According to road knowledge from RAG, the ground base station load in this area is continuously saturated during the evening rush hour; by calling the trajectory prediction service, it is known that the vehicle will remain within the coverage area of the drone, base station and satellite during task processing; due to the low load, the MEC controller selects the drone as a collaborator to process the task and transmit the results back. c. Sudden traffic accident: The mission request is generated when the vehicle is traveling within the coverage area of ground base stations and satellites; If the RAG acquires real-time traffic situation knowledge and discovers a sudden traffic accident ahead that causes a surge in load on surrounding base stations and strong signal interference, the task is processed locally on the vehicle.