## 3 Methodology
### Cooperative Adversarial Training  
In order to improve the generalization and robustness of the model, many adversarial training methods [54; 55; 56; 57] were used. In this section, we design an effective model training method, namely, the cooperative adversarial training method. Most current knowledge graph completion algorithms set and use negative sampling, which improves the recognition ability of a model in the face of negative samples. For this reason, researchers have designed a general framework for self-adversarial training using negative samples. Formula (12) describes the self-adversarial training process:  
\[ \begin{split} self\_adv\_loss=&-logsigmoid(\mu- score(h,r,t))\\ &-\sum_{i=1}^{l}p(h_{i}^{\prime},r,t_{i}^{\prime})logsigmoid( score(h_{i}^{\prime},r,t_{i}^{\prime})-\mu),\end{split}  \tag{12}\]  
where \((h,r,t)\) is a positive triple, \(\mu\) is a constant, \((h_{i}^{\prime},r,t_{i}^{\prime})\) is one of the negative triples, and \(p(h_{i}^{\prime},r,t_{i}^{\prime})\) is the probability distribution of negative sampling. However, it is insufficient to only set negative samples. Most current methods use representation learning to represent entities and relationships. Therefore, accurate embedded expressions have important impacts on the performance of a model. During the training process, it is easy for poor-quality samples to prevent a model from achieving the best fit. Because the embedding layer can directly represent entities and relationships, adding perturbations to the embedding layer trains the model in being able to accurately represent them in the presence of perturbations. Adversarial training needs to maximize the internal loss, and this form of training tries its best to reduce external losses to ensure that the model can effectively resist perturbations. Taking the classification task as an example, we can suppose that \(x\) is the input sample and \(y\) is the corresponding label; the well-known min-max formula [58] provides a good description of this idea:  
\[Min\{Max\{Loss(x+\eta,y;\psi)\}\}, \tag{13}\]  
where \(\eta\) is the value of the interference and \(\psi\) includes the parameters of the model. The machine learning model mainly relies on the gradient descent method to help the model converge to the optimal value. Inspired by the FGSM (Fast Gradient Sign Method) [54], we adjusted the perturbations based on the same backpropagation gradient in order to maximize the loss. In other words, we considered adding perturbations to the embedding layers of the model along the direction of the negative gradient. The perturbations are expressed as follows:  
\[\eta=\tau\cdot sign(\
abla_{x}Loss(x,y;\psi)), \tag{14}\]  
where \(\eta\) is the added perturbation, \(\tau\) denotes the numerical value of the perturbation, and \(sign()\) is a symbolic function. The above-mentioned adversarial training method generates perturbations for the embedding layer. This method can cooperate with the self-adversarial training method, thereby effectively realizing cooperative adversarial training and improving the anti-interference ability of the model. The final loss can be calculated as follows:  
\[ \begin{split} loss=&\rho\cdot self\_adv\_loss+ \omega\cdot FGSM\_self\_adv\_loss\\ &+\frac{\varepsilon}{|H|}\cdot\sum_{e\in H}(L2(House\_emb(e))+L2( Comp\_emb(e))+L2(Phase\_emb(e))),\end{split}  \tag{15}\]where \(self\_adv\_loss\) is the loss of the triples, \(FGSM\_self\_adv\_loss\) is the loss of the triples after adding perturbations, \(\rho\) and \(\omega\) are weights, \(\varepsilon\) is the regularization coefficient, \(H\) is the entity set, \(L2\) is the L2 normalization, \(House\_emb\) is the householder entity embedding, \(Comp\_emb\) is the complex entity embedding, and \(Phase\_emb\) is the phase entity embedding. **The selection of perturbations. ** The selection of perturbations has an important influence on the effect of adversarial training. If the perturbation is too small to produce effective interference, achieving the purpose of adversarial training is difficult.