# LIransformer: A Transformer-Based Framework for Task Offloading in Vehicular Edge Computing
###### Abstract  
Vehicular edge computing (VEC) is essential in vehicle applications such as traffic control and in-vehicle services. In the task offloading process of VEC, predictive-mode transmission based on deep learning is constrained by limited computational resources. Furthermore, the accuracy of deep learning algorithms in VEC is compromised due to the lack of edge computing features in algorithms. To solve these problems, this paper proposes a task offloading optimization approach that enables edge servers to store deep learning models. Moreover, this paper proposes the LIransformer, a transformer-based framework that incorporates edge computing features. The framework consists of pre-training, an input module, an encoding-decoding module, and an output module. Compared with four sequential deep learning methods, namely a Recurrent Neural Network (RNN), Long Short-Term Memory (LSTM), a Gated Recurrent Unit (GRU), and the Transformer, the LIransformer achieves the highest accuracy, reaching 80.1% on the real dataset. In addition, the LIransformer achieves 0.008 s when predicting a single trajectory, fully satisfying the fundamental requirements of real-time prediction and enabling task offloading optimization.  
edge computing; task offloading; trajectory prediction; deep learning +
Footnote †: journal: Medical Imaging  
1
Footnote 1: email: {[[https://www.mdpi.com/journal/applsci/code/uplo/upl](https://www.mdpi.com/journal/applsci/code/uplo/upl)]([https://www.mdpi.com/journal/applsci/code/uplo/upl](https://www.mdpi.com/journal/applsci/code/uplo/upl))  
Therefore, the current task offloading scheme with predictive-mode transmission encounters two issues: (1) Existing edge servers have limited resources to deploy deep learning models, which consume massive storage and computational resources. (2) Neither the short trajectory prediction based on a Recurrent Neural Network (RNN), Long Short-Term Memory (LSTM), and a Gated Recurrent Unit (GRU) nor the long trajectory prediction based on the Transformer takes into account the features of VEC.  
In order to solve the above problems, we propose the LTransformer, a transformer-based prediction framework in VEC. Meanwhile, a task offloading scheme applied in VEC is proposed. Specifically, the contributions of this paper can be summarized as follows:  
1. We propose a task offloading approach, in which the deep learning model can be deployed for predictive-mode transmission. On the cloud server, the predictive model is trained based on historical trajectory data. On the edge server, real-time trajectory prediction and task offloading optimization are achieved based on the predictive model.
2. We propose the LTransformer, which has a four-module structure. In the pre-training stage, stationary latitude and longitude data are embedded. In the pre-training stage, stationary latitude and longitude data are embedded. In the input module, multidimensional information such as geography, sequence, and time are integrated. In the encoding-decoding module, encoders and decoders are used to train the trajectory data. In the output module, problematic results are removed using an error correction method.
3. Experiments are carried out in a real dataset. The proposed method is compared with other deep learning models to analyze its accuracy and applicability in VEC.  
The composition of our manuscript is as follows. In Section 2, we describe existing vehicular edge computing schemes and machine learning algorithms related to trajectory prediction. In Section 3, we introduce the task offloading optimization method and the LTransformer. In Section 4, we conduct experiments to analyze the accuracy and efficiency of the LTransformer. Section 5 summarizes the accomplishments and provides an overview of potential avenues for future research.