## 3 Our Approach
### Dynamic Decouple Loss  
The fusion module incorporates an attention mechanism to integrate local features and short-term features. The binary loss function adjusts the difference between the output and input. However, the model may face challenges with slow convergence and instability due to large model parameters and diverse user types. To overcome these issues, we use the attention scores obtained from the attention mechanism to represent the contribution  
Figure 1: The fusion module is the main component of our model, which requires both long-term and short-term user interest features as input, and the user interest model can be replaced according to actual needs. GRU is a variant of recurrent neural networks, but with fewer parameters, which alleviates the gradient problem in long-term memory and back propagation. attention is the attention mechanism. Multi split splits longer long-term interest features into multiple copies.  
of each local feature in the interaction feature of the output. We introduce a ternary comparison loss function that uses the feature similarity differences as an index to sum to the final loss value. The final loss function is reformulated as follows:  
\[Loss=L_{BCE}+\sum_{i=1}^{n}a_{i}L_{tri,i} \tag{5}\]  
The loss function used in this study is a combination of binary cross entropy loss (\(L_{BCE}\)) and triplet loss (\(L_{tri}\)), where \(a\) represents the attention fraction. The traditional triplet loss function is defined as follows:  
\[L=\sum_{i=1}^{n}\max(d(o_{u}^{i},p_{l}^{u,i})-d(o_{u}^{i},p_{s})+margin,0) \tag{6}\]  
\(d(o_{u}^{i},p_{l}^{u,i})\) computes the Euclidean distance between interaction features and local features, \(d(o_{u}^{i},p_{s})\) counts the Euclidean distance between interaction features and short-term features, and margin is a custom constant. However, the default setting is dominated by local features, which may reduce the weight of short-term features and lead to biased results. This shortcoming can be attributed to the traditional triplet loss function, which calculates the difference between the anchor sample and the positive and negative samples, and the result is mandatory. To account for varying user preferences in prediction results, constraints are incorporated into the loss function and dynamic parameters are introduced through attention scores. The formula for this is as follows:  
\[sim_{min},sim_{max}=sorted(s(o^{u,i},p_{l}^{u,i}),s(o_{u}^{i},p_{s}^{u})) \tag{7}\] \[L_{tri}=max(\frac{1}{n}\sum_{i=1}^{n}a_{i}(1-sim_{max})+sim_{min} +margin,0)) \tag{8}\]  
For each set of triplet features, we sort the similarity between the remaining interaction features and the two features. The similarity is calculated using the formula \(s\), which is the reciprocal of the Euclidean distance between the features. The group of features with the highest similarity is considered dominant. \(n\) is the number of interaction features and \(a_{i}\) represents the attention weights of each interaction feature. \(1-sim_{max}\) and \(sim_{min}\) will gradually increase the distance between dissimilar features during the iterative learning process, which can serve to regulate the ratio of long-term interest to short-term interest contribution to the final result.  
To summarize, we propose an enhanced triplet loss function that incorporates an attention score to regulate the influence of local interests, a similarity term to measure the difference between local and short-term interests, and an indexing mechanism to incorporate these factors into the overall loss function. In our comparative experiments, we demonstrate that this loss function efficiently accelerates model convergence.