## 1 Introduction
### Motivation for the Global Model (GM)  
Existing anomaly-detection methods used in trading platforms consider users as isolated individuals, which causes model underfitting and is inconsistent with the human judgment process.  
In Table 1, the average number of user actions in some trading platforms is only a few dozen. That is, when training a model for each user, the amount of data that can be used for training is insufficient and very likely to cause model underfitting. More data are needed to train the models.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Dataset**} & \multirow{2}{*}{**Users**} & \multicolumn{2}{c}{**Behavior Sequence**} & \multicolumn{2}{c}{**Dimensions**} \\ \cline{3-6}  & & **Length (Averaged)** & **Decimal** & **One-Hot** & **Embedding** \\ \hline Commodity & 562 & 27,366 & 11 & 2 & 1 \\ Eshop & 1624 & 32 & 1 & 33 & 2 + 3 \\ Yoochoose & 68,790 & 15 & 0 & 12 & 2 \\ Taobao & 969,529 & 103 & 0 & 4 & 5 \\ \hline \hline \end{tabular}
\end{table}
Table 1: The characteristics of datasets after preprocessing.  
Although users have different behavioral habits on trading platforms such as those for commodities, stocks, and e-commerce, they also have certain similar behavioral habits. For example, while users may have their investment preferences when making purchases, they avoid incurring losses in their commodity or stock trading. Meanwhile, digital enthusiasts may prefer to buy computer accessories, while stock speculators may choose to do many trading operations in a short period, and so on.  
Therefore, when performing anomaly detection, judging individual users based only on their behavior without considering the behavior of similar users is insufficient. That is, making correct judgments requires similarities between users. A model can learn common sense only when it is used to recognize different users. We train the model using behavior data from all users to learn similarities, rather than building a model that incorporates prior knowledge. In addition, since the model is trained in advance, using similarities between users can also reduce the need for individual user data during detection.  
Therefore, we propose a new contrastive learning framework to detect anomalous behavior on trading platforms using neural network sequence models. And our motivations are shown in Figure 2. The main contributions are as follows:  
* Differences between users are utilized to perform supervised training on unlabeled trading platform data using contrastive learning.
* To use similarities between users and avoid underfitting, we use GM to perform anomaly detection for all users instead of a separate model for each user, which can reduce complexity and increase efficiency.
* Our models were tested on four trading platform datasets and achieved the best results on three of the datasets, with AUC scores of 0.85+. This demonstrated that the behavioral habits of users on these trading platforms are different, which is the basis of our framework.  
Figure 1: Our contrastive learning framework trains a neural network model with mutual supervision on trading platforms. To perform contrastive learning, our framework generates negative samples by replacing the last action in the user behavior sequence with the action of other users to obtain anomalous behavior sequences. To make better use of similarities between users, our framework trains a global model instead of a model for each user.  
The remainder of this paper is organized as follows. Section 2 discusses related work. Section 3 proposes the design and modification for sequence models. Section 4 presents the experiment. Section 5 presents the conclusions of the study.