## 3 Methodology
### Dual Loss Functions  
In deep learning, the choice of the loss function is crucial to the model's performance and training stability. Traditional loss functions, such as cross-entropy loss [35], Focal Loss, and Multi-Margin Loss, are commonly used and achieve good results in many tasks. However, these functions often fall short in specific scenarios, such as handling imbalanced datasets or noisy data, which are common challenges in real-world applications. This has motivated the exploration of novel loss function designs to address these limitations better.  
In this study, we introduce a novel approach that combines traditional cross-entropy loss with an inconsistency loss function [36], inspired by [PERSON]'s work [37], which showed promising results for several datasets. The rationale behind this combination is to capitalize on the complementary strengths of both loss functions. Cross-entropy loss is effective for multi-class classification tasks and works well with gradient-based optimization methods, while the inconsistency loss helps to mitigate issues arising from class imbalances and noisy data, thereby improving the model's robustness.  
By integrating these two loss functions, our approach aims to overcome the limitations of traditional loss functions, particularly in the presence of class imbalances, noise, and other data irregularities. This design allows the model to generalize to real-world scenarios better, where traditional loss functions might be inadequate, thus enhancing the overall performance of the model in complex tasks such as fraud detection. Equation (4) is the calculation formula for the cross-entropy loss function:  
\[L_{\text{CE}}=-\frac{1}{N}\sum_{i=1}^{N}\sum_{j=1}^{M}y_{ij}\log\left(y^{ \prime}_{ij}\right) \tag{4}\]  
\(N\) is the number of samples, \(M\) is the number of categories, \(y_{ij}\) is the true label of sample \(i\), and \(y^{\prime}_{ij}\) is the model's predicted probability that sample \(i\) belongs to category \(j\).  
The inconsistency loss function consists of three parts: subspace inconsistency, position inconsistency, and representation inconsistency. Subspace inconsistency means that different heads should focus on different subspaces, which is achieved by calculating the subspace similarity between different heads. Position inconsistency means that different heads should focus on different positions, which is achieved by calculating the position overlap between different heads. Representation inconsistency means that different heads should produce different output representations, which is achieved by calculating the similarity of the output representation between different heads. The inconsistency loss function can effectively improve the diversity of multi-head attention, thereby improve ing the performance and generalization ability of the model. Equation (5) provides the calculation formula for the subspace inconsistency loss function:  
\[L_{\text{subspace}}\ =-\frac{1}{H^{2}}\sum_{i=1}^{H}\sum_{j=1}^{H}\frac{V^{i} \cdot V^{j}}{\|V^{i}\|\|V^{j}\|} \tag{5}\]  
Equation (6) provides the calculation formula for the position inconsistency loss function:  
\[L_{\text{position}}=-\frac{1}{H^{2}}\sum_{i=1}^{H}\sum_{j=1}^{H}\left|A^{i} \odot A^{j}\right| \tag{6}\]  
Equations (7) and (8) provide the calculation formulas for the representation inconsistency loss function:  
\[L_{\text{representation}}=-\frac{1}{H^{2}}\sum_{i=1}^{H}\sum_{j=1}^{H}\frac{O^{i} \cdot O^{j}}{\|O^{i}\|\|O^{j}\|} \tag{7}\]  
\[O^{h}=A^{h}V^{h} \tag{8}\]  
\(V\) represents the value of attention, \(H\) represents the attention head, \(A^{h}\) represents the attention distribution of the h-th attention head, \(O^{h}\) represents the output of the h-th head, \(\odot\) represents element-wise multiplication, and \(\mid V^{i}\mid\mid\) represents the L2 norm of the V-th head.  
Equation (9) provides the calculation formula for the total loss function:  
\[L=L_{CE}+\alpha L_{\text{subspace}}+\beta L_{\text{position}}+\gamma L_{\text{ representation}} \tag{9}\]