## 3 Proposed Joint Traffic Prediction and Handover Design Framework
### Attention\(-\)Enhanced Rainbow DQN  
To address the satellite handover problem formulated as an MDP, we propose the attention\(-\)enhanced rainbow DQN, a reinforcement learning framework that integratesa self\(-\)attention mechanism with the dueling architecture of a rainbow DQN, which dynamically selects the optimal satellite for handover from a variable set of visible satellites. The model input is obtained by zero\(-\)padding \(\mathbf{S}\in\mathbb{R}^{M_{k}^{\mathrm{tr}}\times 7}\) to form \(\mathbf{S}_{e}\in\mathbb{R}^{M_{k}^{\mathrm{tr}}\times 7}\), where \(M_{k}^{\mathrm{tr}}\) represents the maximum number of visible satellites for TTG \(k\). As shown in Figure 4, the proposed attention\(-\)enhanced rainbow DQN architecture integrates a self\(-\)attention mechanism with a dueling network structure to process satellite data and estimate Q\(-\)values. The input \(\mathbf{S}_{e}\) is passed through a series of layers, including a self\(-\)attention module, fully connected layers, and the dueling architecture, ultimately producing selection probabilities for handover decisions. This structure effectively captures inter\(-\)satellite dependencies and adapts to varying numbers of visible satellites. In particular, the self\(-\)attention layer captures contextual relationships between satellites and adapts dynamically to changes in \(M_{k}^{\mathrm{t}}\). For satellite \(m\), the feature vector \(\mathbf{s}_{m}=\mathbf{S}_{e}(m,:)\) is projected into query, key, and value vectors, which are expressed as  
\[ \begin{split}\mathbf{q}_{m}&=\mathbf{s}_{m}\mathbf{ W}_{Q},\\ \mathbf{k}_{m}&=\mathbf{s}_{m}\mathbf{W}_{K},\\ \mathbf{v}_{m}&=\mathbf{s}_{m}\mathbf{W}_{V},\end{split}  \tag{26}\]  
where \(\mathbf{W}_{Q}\), \(\mathbf{W}_{K}\), and \(\mathbf{W}_{V}\) are learnable matrices, and the output dimension is denoted as \(D\). Then, the attention score is calculated by  
\[\alpha_{m,n}=\frac{\exp(\mathbf{q}_{m}\cdot\mathbf{k}_{n}/\sqrt{D})}{\sum_{n=1 }^{M_{k}^{\mathrm{t}}}\exp(\mathbf{q}_{m}\cdot\mathbf{k}_{n}/\sqrt{D})}, \tag{27}\]  
where \(\sqrt{D}\) is a scaling factor to stabilize the gradients. The output vector for satellite \(m\) is  
\[\mathbf{z}_{m}=\sum_{n=1}^{M_{k}^{\mathrm{t}}}\alpha_{m,n}\mathbf{v}_{n}, \tag{28}\]  
constituting the \(m\)-th column of matrix \(\mathbf{Z}\), where each row captures the inter\(-\)satellite dependencies and global contextual information. The matrix \(\mathbf{Z}\) then passes through several fully connected layers with ReLU activations, each processing rows independently to preserve the matrix structure, thereby producing  
Figure 4: An illustration of the detailed architecture of the attention\(-\)enhanced rainbow DQN for handover decision generation. and extracting higher\(-\)level features via nonlinear transformations. A mask \(\mathbf{o}\) identifies valid satellites, defined as  
\[\mathbf{o}_{m}=\left\{ \begin{array}{ll}1,&\text{if}\quad\mathbf{S}_{c}(m_{i}, :)\
eq 0,\\ 0,&\text{otherwise},\end{array} \right. \tag{29}\]  
yielding \(\mathbf{H}^{\prime}=\mathbf{H}\odot\mathbf{o}\) and retaining valid satellite features. The dueling architecture, a core component of a rainbow DQN, then estimates the Q\(-\)value distributions across two branches. For the state\(-\)value branch, the valid features in \(\mathbf{H}^{\prime}\) are averaged, denoted as  
\[\mathbf{h}_{\text{avg}}=\frac{1}{M_{k}^{\text{r}}}\sum_{m=1}^{M_{k}^{\text{r} }}\mathbf{H}^{\prime}(m,:), \tag{30}\]  
and processed through a fully connected layer to obtain the state value \(\mathbf{v}\). In parallel, the advantage branch processes \(\mathbf{H}\) with a similar fully connected structure to generate the advantage values \(\mathbf{A}\), where each row \(\mathbf{A}(m,:)\) represents the advantage distribution corresponding to satellite \(m\). Finally, the network combines the state value \(\mathbf{v}\) and the output of the advantage value \(\mathbf{A}\) to obtain the Q\(-\)value estimation matrix \(\mathbf{Q}\).