## 2 Named Entity Recognition Model for Government Audit Text
### Loss Functions  
The focus loss function [27] is based on the traditional cross-entropy loss function [28] and introduces the weight parameter \(\alpha\) and the modulation factor \(\gamma\) to balance the weights of different categories of entities and difficult-to-classify entities. However, when constructing the audit dataset, there exists a certain level of randomness in the fundamental audit corpus, leading to an imbalanced distribution of entity categories within the dataset. Specifically, certain categories contain a significantly larger number of entities compared to others, the model is insufficient in identifying a few categories of entities. Data annotators lacking knowledge of the auditing domain often misjudge the types of auditing entities, resulting in labeled anomalous and noise entities in the dataset. These difficulties in differentiating entities can adversely affect model evaluation by diverting its attention towards these labeled anomalies and noise instances, leading to convergence issues and potential overfitting. Additionally, achieving optimal results requires simultaneous adjustment of both parameters in the focal loss function. Therefore, this study employs the GHM classification loss function during model training to adjust entity weights and reconcile entity losses, thereby enhancing audit entity recognition accuracy. The GHM classification loss function characterizes the entity attributes by defining the gradient modulus \(g_{i}\), which quantifies the difficulty of classifying entity \(i\). The magnitude of \(g_{i}\) indicates the level of complexity in predicting learning outcomes. Equation (11) illustrates the computation, where \(p\) represents the model's predicted value for the entity label and \(p^{*}\) denotes the true value of the entity label. \[g_{i}=\left|p-p^{*}\right|= \begin{cases}1-p&p^{*}=0\\ p&p^{*}=1\end{cases}  \tag{11}\]  
Through statistics on the input batch training data, \(R(g_{i})\) is used to represent the number of entities with similar gradient modulus \(g_{i}\) in the training data, and \(l_{e}(g_{i})\) is used to represent the gradient interval length of gradient modulus \(g_{i}\) within a certain offset \(\varepsilon\). Then, gradient density \(GD(g_{i})\) can be approximately expressed by Equation (12), which measures the number of entities with gradient modulus \(g_{i}\) within a certain gradient interval. \[GD(g_{i})=\frac{R(g_{i})}{l_{e}(g_{i})}=\frac{\sum_{k=1}^{N}\delta_{e}(g_{k},g _{i})}{l_{e}(g_{i})} \tag{12}\]  
With regards to the focus loss function, a weight equilibrium coefficient \(\beta_{conf-i}\) is introduced for each entity during model training based on the gradient density \(GD(g_{i})\). This adjustment balances the contribution of each entity to the model gradient update and reconciles entity loss, thereby alleviating any impact from labeled abnormal entities or noise entities on the model gradient. The algorithm is presented in Equation (13), where N represents the number of samples. \[\beta_{conf-i}=\frac{N}{GD(g_{i})} \tag{13}\]  
The classification loss function \(L_{GHM-C}\) introduces the weight equilibrium coefficient \(\beta_{conf-i}\) to balance the weight of entity categories and reconcile the loss of abnormally labeled entities and noise entities. On the one hand, the gradient density \(GD(g_{i})\) of the most numerous entity categories is large, and the weight equilibrium coefficient \(\beta_{conf-i}\) is introduced to balance the number of entity categories, adjust the weight of entities, and inhibit the number of entity categories so that the model focuses on the entity categories with a small number, captures more feature information of the entity categories with a small number, and improves the recognition accuracy of the model. On the other hand, the fitting difficulty of the model to different entities is inconsistent in the training stage, and the error of abnormally labeled entities and noise entities is large and difficult to fit, and the modulus gradient value \(g_{i}\) is large.