## 3 An Interactive Learning Network That Maintains Sentiment Consistency
### Interaction Layer  
Then, use two transformer decoder [20] modules to consider the relationship between aspect items and between two subtasks. The transformer decoder module is formed by stacking layers of multiple multi-headed attention mechanisms on top of each other, which can learn the behavior of different tasks and then combine different behaviors as knowledge, which can take into account multiple aspects. The transformer decoder module in this article consists of a layer of multi-head self-attention, a layer of multi-head cross-attention, and a feedforward neural network (FNN); the specific structure of the transformer decoder module is shown in Figure 2. In the multi-head attention mechanism, \(Q\) represents the query matrix, \(K\) represents the key matrix, \(V\) represents the value matrix, and \(Q\), \(K\), and \(V\) are obtained by different linear transformations based on different weight matrices, \(W_{Q}\), \(W_{K}\), and \(W_{V}\), respectively. The operating principle is to calculate the attention distribution of the current \(Q\) under all \(K\), add weight to the distribution and Softmax, attach to \(V\) in the form of a score to obtain the attention calculation result, and then set multiple heads. Each head performs the same operation to make the model pay attention to different aspects of information, and finally, the attention calculation results of each head are spliced together and multiplied with the output weight to obtain the final multi-head attention mechanism result. When \(Q\), \(K\), and \(V\) are transformed from the same input, the multi-head attention mechanism at this time is called the multi-head self-attention mechanism, and when their inputs are different, it is the multi-head cross-attention mechanism. FNN is a simple neural network containing an input layer, an intermediate layer, and an output layer. Using the GELU activation function, the specific formula is shown in Equation (5), where \(\varnothing(x)\) refers to the cumulative function of the Gaussian normal distribution of \(x\).  
Figure 2: Transformer decoder structure.  
The module represents \(H_{ate}\) as input using the features of the generated aspect entity sequence \(Y_{a}\), and in the first layer, the multi-head self-attention mechanism is used, and \(H_{ate}\) is operated as \(Q\), \(K\), and \(V\). In the second layer, the bull cross-attention is used, \(H_{share}\) as \(K\) and \(V\), and the output \(H_{1}\) of the first layer as \(Q\) input into it. Finally, the output \(H_{2}\) of the second layer is input into the feedforward neural network layer, and finally, a preliminary result \(S\) is obtained. Each layer in the transformer decoder is followed by a residual connection [21] and layer normalization [22] to process the result. The specific formula is shown in Equations (6)-(8), where \(LN\) denotes layer normalization. The main function of this module is to realize the interaction between aspect items, consider the relationship between aspect items, use the previously obtained aspect items to extract the results, and combine the context information of the text to obtain a preliminary prediction result.  
In the second transformer decoder module, the output of the previous module is taken as input, and the rest remains unchanged. This module uses preliminary prediction information, then combines the context and sentiment of the text to produce more accurate results.  
\[GELU(x)=x\varnothing(x) \tag{5}\]  
\[H_{1}=LN(H_{ate}+SelfAtten(H_{ate},H_{ate},H_{ate})) \tag{6}\]  
\[H_{2}=LN(H_{1}+CrossAtten(H_{1},H_{share},H_{share})) \tag{7}\]  
\[S=LN(H_{2}+FNN(H_{2})) \tag{8}\]