## 3 Materials and Methods
### Uni-Loss Function  
The uni-loss is a critical component of the user-centered data privacy protection framework proposed in this study, as shown in Figure 5.  
Its design aims to optimize both model performance and privacy protection simultaneously. Unlike the traditional loss function used in Transformers, uni-loss combines classification loss, privacy loss, and attention loss to ensure comprehensive performance in multi-task processing. Traditional Transformer models typically use cross-entropy loss during training to measure classification performance, which is given by the following formula:  
\[\text{Loss}_{\text{CE}}=-\frac{1}{N}\sum_{i=1}^{N}[y_{i}\log(\hat{y}_{i})+(1- y_{i})\log(1-\hat{y}_{i  
2. Privacy loss: To protect user privacy, differential privacy techniques are introduced during the model parameter update process. Privacy loss measures the model's effectiveness in privacy protection, which is calculated as \[\text{Loss}_{\text{DP}}=\frac{1}{N}\sum_{i=1}^{N}\
orm{\theta_{i}-\theta_{i}^{ \prime}+\mathcal{N}(0,\sigma^{2})}^{2}\] (25) where \(\theta_{i}\) represents the model parameters, \(\theta_{i}^{\prime}\) represents the updated model parameters, and \(\mathcal{N}(0,\sigma^{2})\) represents Gaussian noise with mean 0 and variance \(\sigma^{2}\). Adding noise during parameter updates effectively prevents the leakage of user data during training.
3. Attention loss: Attention loss optimizes the effectiveness of the user attention mechanism, ensuring the model can protect sensitive user information while processing data. The attention loss is calculated as \[\text{Loss}_{\text{Attention}}=\frac{1}{N}\sum_{i=1}^{N}\
orm{a_{i}-\alpha_{i}^{ \prime}}^{2}\] (26) where \(\alpha_{i}\) represents the original attention weights, and \(\alpha_{i}^{\prime}\) represents the adjusted attention weights. Optimizing attention weights enables the dynamic protection of sensitive information.  
Uni-loss combines classification loss, privacy loss, and attention loss to achieve the unified optimization of model performance and privacy protection. The total loss function is calculated as  
\[\text{Loss}_{\text{Total}}=\lambda_{\text{CE}}\text{Loss}_{\text{CE}}+\lambda_ {\text{DP}}\text{Loss}_{\text{DP}}+\lambda_{\text{Attention}}\text{Loss}_{ \text{Attention}} \tag{27}\]  
where \(\lambda_{\text{CE}}\), \(\lambda_{\text{DP}}\), and \(\lambda_{\text{Attention}}\) represent the weight coefficients for classification loss, privacy loss, and attention loss, respectively. To demonstrate the effectiveness of uni-loss in multi-task processing, the weights for classification loss, privacy loss, and attention loss  
Figure 5: Calculation of uni-loss function.  
in the total loss function are considered. Setting the weights \(\lambda_{\text{CE}}\), \(\lambda_{\text{DP}}\), and \(\lambda_{\text{Attention}}\) as constants, the total loss function can be rewritten as  
\[\text{Loss}_{\text{Total}}=\lambda_{\text{CE}}\Bigg{(}-\frac{1}{N} \sum_{i=1}^{N}[y_{i}\log(\hat{y}_{i})+(1-y_{i})\log(1-\hat{y}_{i})]\Bigg{)}+ \tag{28}\] \[\lambda_{\text{DP}}\Bigg{(}\frac{1}{N}\sum_{i=1}^{N}\
orm{\theta _{i}-\theta_{i}^{\prime}+\mathcal{N}(0,\sigma^{2})}^{2}\Bigg{)}+\lambda_{ \text{Attention}}\Bigg{(}\frac{1}{N}\sum_{i=1}^{N}\
orm{\alpha_{i}-\alpha_{i}^{ \prime}}^{2}\Bigg{)}\]  
The gradient of the total loss function is calculated by summing the gradients of the individual loss components:  
\[\
abla_{\theta}\text{Loss}_{\text{Total}}=\lambda_{\text{CE}}\
abla_{\theta} \text{Loss}_{\text{CE}}+\lambda_{\text{DP}}\
abla_{\theta}\text{Loss}_{ \text{DP}}+\lambda_{\text{Attention}}\
abla_{\theta}\text{Loss}_{\text{ Attention}} \tag{29}\]  
Since \(\text{Loss}_{\text{CE}}\), \(\text{Loss}_{\text{DP}}\), and \(\text{Loss}_{\text{Attention}}\) represent classification, privacy, and attention losses, respectively, the gradient calculation results indicate that uni-loss can optimize classification performance while balancing privacy protection and attention mechanisms.