# Research on Chinese Nested Entity Recognition Based on IDCNNLR and GlobalPointer
## 3 Model
### GlobalPointer  
Research on flat entity recognition has been extensive, and many flat entity recognition models have achieved high performance on multiple flat entity recognition datasets. [PERSON] et al. [33] proposed a Multi-criteria Fusion Model, which has achieved excellent experimental results on the flat entity recognition dataset MSRA. [PERSON] et al. [34] constructed a Bert-MRC-Biaffine entity recognition model, which has achieved excellent experimental results on the flat entity recognition dataset CCKS2017. These flat entity recognition datasets are characterized by the fact that each text fragment can represent only one entity, and entities cannot share the same characters. However, in a complex context, one entity may contain another entity, which is impossible in a flat entity recognition dataset. It is necessary to evaluate the capability of entity recognition models with nested entity recognition datasets. In real life, nested entities are quite common. For example, in the text segment \"(\"Peking University\"), the text segment \" is an organizational entity, and the text segment \" (\"Beijing, China\") is a location entity. These two entities overlap in the text segment \". The annotation method based on individual character labels alone cannot identify multiple overlapping entities. To address this issue, [PERSON] et al. proposed a nested entity recognition model called GlobalPointer, which considers all entity boundaries in the text. The model constructs a score matrix for entity boundaries to calculate the scores of entity boundaries for different categories, predicting the nested entities and their types in the text.  
The GlobalPointer module first splits the input feature vectors into two equally sized feature vectors \(q\) and \(k\) in the last dimension and adds positional encoding information using RoPE [35]. The two feature vectors \(q\) and \(k\) undergo multiple steps of multidimensional matrix multiplication to obtain the raw score matrix of entity boundaries _Logits_first_.  
Figure 4: Internal structure diagram of IDCNNLR.  
The module uses masking matrix to discard the entity boundary that exceeds the length of the sequence, eliminates invalid entity boundary from the lower triangular matrix, and finally obtains the score matrix of entity boundary \(Logits_{final}\). The score matrix contains confidence scores for each entity boundary in each category, and the model predicts nested entities and their entity types based on these confidence scores.  
The RoPE (Rotation Positional Encoding) method incorporates positional information into the feature vectors. The working principle of RoPE is to first calculate the position embedding vectors \(pos\_emb\) based on the size of the feature vectors \(q\) and \(k\). The odd-indexed and even-indexed data of the embedding vectors \(pos\_emb\) are separately extracted, and each element is duplicated in its original position, resulting in sine positional vectors \(pos_{sin}\) and cosine embedding vectors \(pos_{cos}\). The feature vectors \(q\) and \(k\) are split into odd-indexed and even-indexed data, respectively, which are then concatenated to obtain new feature vectors \(q_{2}\) and \(k_{2}\). The original eigenvector takes the matrix product of the sinusoidal embedding vector \(pos_{sin}\), the new eigenvector takes the matrix product of the cosine embedding vector \(pos_{cos}\), and the sum of the two product results is the final eigenvector containing the sum of the position information \(q_{w}\) and \(k_{w}\). The calculation formulas of \(q_{w}\) and \(k_{w}\) are shown in Equations (3) and (4).  
\[q_{w}=q_{w}\times pos_{cos}+q_{2}\times pos_{sin} \tag{3}\]  
\[k_{w}=k_{w}\times pos_{cos}+k_{2}\times pos_{sin} \tag{4}\]