## 3 Methodology
### Multi-Task Optimization  
The Multi-Task Optimization module is designed to enhance the model's ability to handle multiple objectives simultaneously, ensuring that the framework effectively addresses diverse risk prediction tasks. In this framework, GT1, GT2, and GT3 represent three specific tasks: deformation risk prediction (GT1), environmental impact assessment (GT2), and temporal trend analysis (GT3). These tasks are tightly connected to the overall goal of identifying and mitigating railway deformation risks by incorporating both spatial and temporal factors. In this module, a shared representation is first generated by upstream components, such as the Spatial Attention Encoder and Temporal Risk Predictor. This representation captures common features across all tasks and serves as input to task-specific fully connected layers. Each task is assigned a dedicated feedforward network (FFN), which transforms the shared representation into task-specific predictions. For task \(m\), the predicted output is denoted as \(\hat{\mathbf{y}}^{(m)}\), corresponding to its ground truth \(\mathbf{y}^{(m)}\). The optimization process for each task is driven by a task-specific loss function. For task \(m\), the loss is computed as  
\[\mathcal{L}_{m}=\frac{1}{N}\sum_{i=1}^{N}\Bigl{(}\hat{y}_{i}^{(m)}-y_{i}^{(m)} \Bigr{)}^{2}, \tag{25}\]  
where \(N\) is the number of samples, \(\hat{y}_{i}^{(m)}\) is the predicted value for sample \(i\), and \(y_{i}^{(m)}\) is the corresponding ground truth. To balance the contributions of different tasks, a weighted sum of these individual losses is used to define the overall multi-task loss:  
\[\mathcal{L}_{\text{multi-task}}=\sum_{m=1}^{M}w_{m}\mathcal{L}_{m}, \tag{26}\]  
where \(w_{m}\) is a weight that adjusts the importance of task \(m\) during optimization. These weights can be predefined based on domain knowledge or learned dynamically during training to improve overall model performance. The shared representation enables the model to learn common features across tasks, improving efficiency and enabling robust knowledge transfer. At the same time, the task-specific FFNs ensure that each task receives specialized attention to its unique requirements. For instance, deformation risk prediction focuses on capturing local variations in spatial features, while environmental impact assessment integrates external factors like weather conditions. Temporal trend analysis, on the other hand, emphasizes the sequential relationships within historical data, providing insights into long-term deformation patterns. By aligning predictions across these tasks, the Multi-Task Optimization module ensuresthat the model comprehensively addresses the complexities of railway deformation risk assessment. This approach enhances the adaptability and robustness of the framework, making it well suited for scenarios with heterogeneous and multi-faceted objectives. Mixture of Experts (MoE) for Adaptive Specialization  
To enhance the model's ability to dynamically focus on specialized tasks, a Mixture of Experts (MoE) module is integrated into the framework. This module allocates computational resources adaptively by selecting the most relevant sub-models, or experts, for each input based on its characteristics. The MoE structure includes a router network that determines the activation of experts and combines their outputs to generate refined feature representations. The MoE module contains \(M\) experts \(\{E_{1},E_{2},\ldots,E_{M}\}\), where each expert is trained to specialize in different aspects of deformation risk prediction. For example, one expert may focus on temporal dependencies, another on spatial correlations, and a third on environmental factors.