{'fraction_non_alphanumeric': 0.032193421912437375, 'fraction_numerical': 0.012764103681115226, 'mean_word_length': 5.0125720272393925, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Interpretable Multimodal Learning for Intelligent Regulation in Online Payment Systems

With the explosive growth of transaction activities in online payment systems, effective and realtime regulation becomes a critical problem for payment service providers. Thanks to the rapid development of artificial intelligence (AI), AI-enable regulation emerges as a promising solution. One main challenge of the AI-enabled regulation is how to utilize multimedia information, i.e., multimodal signals, in Financial Technology (FinTech). Inspired by the attention mechanism in nature language processing, we propose a novel cross-modal and intra-modal attention network (CIAN) to investigate the relation between the text and transaction. More specifically, we integrate the text and transaction information to enhance the text-trade jointembedding learning, which clusters positive pairs and push negative pairs away from each other. Another challenge of intelligent regulation is the interpretability of complicated machine learning models. To sustain the requirements of financial regulation, we design a CIAN-Explainer to interpret how the attention mechanism interacts the original features, which is formulated as a low-rank matrix approximation problem. With the real datasets from the largest online payment system, WeChat Pay of Tencent, we conduct experiments to validate the practical application value of CIAN, where our method outperforms the state-of-the-art methods.


Introduction
As a new term in the financial industry, FinTech has become a popular term that describes novel technologies adopted by the financial service institutions. At the juncture of these phenomena, the risk of online transaction and shopping becomes increasingly prominent. Establishing a reliable intelligent regulation infrastructure, e.g., to detect whether the transaction flow of a merchant is beyond the scope of its licensed business, is essential to accommodating more Fin-Tech startups and e-commerce. Thanks to the advance of personal computers, smart phones, and internet, the quantity of digitized multimedia contents has increased dramatically [YouTube, 2020]. Consequently, despite of the efforts utilizing subtle feature engineering and classifiers for AI-enabled regulation [Cao et al., 2019], the efficient utilization of digitized multimedia contents is still a core research challenge for intelligent regulation.
Inspired by the recent advances in deep learning, multimodal machine learning has been widely employed to interpret such multimedia information during the past few years. These techniques can be roughly classified into four categories: multimdedia speech recognition [Afouras et al., 2018], multimdedia content analysis (e.g., automatic shot boundary detection [Lienhart, 1998], video summarization ), human behavior understanding (e.g., emotion recognition [Chu et al., 2016]), and multimodal matching (e.g., visual question-answering [Antol et al., 2015], image-text matching ).
In this paper, we focus on the general line regulation problem, i.e., to detect whether the transaction flow of a merchant is beyond the scope of its licensed business, which can be formulated as a multimodal matching problem. In the past few years, many research efforts have been devoted to multimodal matching. For instance, [Cheng et al., 2019] and [Verma et al., 2019] concatenated features from different modalities via a fusion layer for sentiment analysis and crowdfunding success prediction, respectively. Inspired by the great success of attention in nature language processing (NLP), many studies have validated the attention is helpful to model a more reliable relationship between image and text . Most recently, a popular framework to model the multimodal relationship is the two-branch embedding network, where one branch encodes the first modality information and another modules the other one Gu et al., 2018;. It is desired if the cross-modal and intra-modal relationships could be jointly investigated in a unified two-branch embedding network for AI-enabled regulation problem. Unfortunately, the existing multimodal learning methods and attention mechanisms mostly focus on the textual and visual information. To the best of our knowledge, transaction flow information as the most important modality in FinTech has  Figure 1: CIAN consists of two modules: (i) the feature extraction module which extracts text and transaction features using their corresponding backbone architectures; (ii) the cross-modal and inter-modal attention projection that match the feature distributions originating from the same identity. The network is trained by the incremental-margin triplet loss.
not been studied yet.
In particular, the intra-modality relations within text and transaction flow are complementary to the inter-modality relations between text and transaction flow, which were mostly ignored by existing mechanisms. For example, if the description of a merchant indicates it is a restaurant, the meal-time transaction flows express the main semantics of the merchant with high probability, while the gender of the customers may not be that important. Moreover, on one hand, fully exploiting interaction relations leads to complex models and thus becomes hard to explain. On the other hand, "need to explain" is already enforced in many industries, especially in FinTech. To tackle the gap, we propose a novel cross-modal and intramodal attention network (CIAN) to investigate the relation between the textual and transaction flow views. Moreover, we also propose a CIAN-Explainer and formulate it as an optimization problem, i.e., a low-rank matrix approximation problem. Consequently, CIAN-Explainer identifies a small subset of transaction flow features that have a crucial role in transaction-text matching. The major contributions are summarized as follows: • To the best of our knowledge, this paper is among the first to propose an attention mechanism to text and transaction flow for AI-enabled regulation.
• We propose both intra-modal and cross-modal attention to capture the correspondences inside the financial behavior, and between the financial behavior and text description.
• We also investigate a novel CIAN-Explainer, which provides a variety of benefits, from the ability to visualize semantically relevant features to interpretability, to saving a huge amount of human-resources for manually auditing.
• We validate the performance and evaluate the application value on a practical e-payment dataset, which is with heavy noise. The results show that the performance of the proposed method is significantly better than all the benchmark methods with regard to different evaluation metrics.

Problem and Methodology
In this section, we first define the problem accurately and then elaborate the details of CIAN: a cross-modal matching approach that learns to match the feature representations from the two modalities in order to perform both text-to-transaction and transaction-to-text retrieval.

Motivation
In a multimedia e-commerce system (e.g., WeChat Pay), there is a set of resident merchants V. Each merchant i ∈ V is composed of its transaction flow logs T i (transaction information) and descriptions D i (text information). Without confusion, we would use the term of transaction and text interchangeably in this paper. In the e-commerce system, each merchant is only allowed to carry out the designated business. In order to avoid potential harm to consumer and small business borrowers, merchants should be appropriately regulated at their licensed business scope. As a result, if the descriptions of a merchant are conflict with its transaction logs, the merchant will be suspended or limited. However, the merchants could fake the descriptions to match the designated business, which are at high-risk of regulation. To tackle this problem, we propose CIAN to investigate the transaction-text matching problem and figure out the dismatching merchants, which could significantly enhance the FinTech regulation.

Joint Feature Learning
In our multimodal matching problem, one of the main objectives is to learn discrimiative transaction and text feature representations that accurately retrieve transaction/text from text/transaction. Fig. 1 shows the the training procedure. Specifically, the CIAN framework consists of a transaction encoder and a text encoder, which are described in detail below.

Transaction Encoder
As the problem of AI-enabled regulation is vital to a financial business, efforts have been spent for years, where about 415 features are carefully engineered in WeChat Pay system. We call such features as transaction flow features. Specifically, given transaction flow logs T i ∈ T , we obtain the transaction

Text Encoder
Similarly, the corresponding description of a merchant is also represented by features through a text encoder. Thanks to the recent advance in NLP, we adopt RoBERTa [Liu et al., 2019] as the text encoder, where all sentences are padded and truncated to the same length 128. Given the description of merchant D i ∈ D, we obtain the text features

Objective
We denote the transaction and text encoder as function f : T → R 1024 and g : D → R 1024 , which map transaction and text to vectors with the same dimension 1024, respectively ( Fig.1). For a transaction-text pair (T i , D i ) of merchant i, the similarity S i is measured by cosine similarity: According to the similarity, the network is trained by the incremental-margin triplet loss , which clusters positive pairs and push negative pairs away from each other. There are mainly two kinds of blocks inside f and g: cross-modal attention blocks and intra-modal attention blocks, which will be introduced in the next section.

Attention Mechanism
Intuitively, the transaction behavior and description of a merchant are highly correlated and coupled. For example, if the description of a merchant indicate it is a restaurant, the mealtime transaction flows may express the main semantics of the merchant with higher probability, while the genders of the customers may not be significant. However, if the description is highly related to makeup, the genders of the customers become very essential. To tackle this issue, we propose the cross-modal attention blocks and inter-modal attention blocks as shown in Fig. 1. In the remaining of this section, we explain the underlying attention mechanisms employed at the blocks.  The cross-modal attention blocks learn to capture the interaction between different modalities. In particular, we adopt the text to transaction attention block (Fig. 3a) as an example to illustrate how the cross-modal attention works. Then, the transaction to text attention block could be easily understood by swapping the transaction features and text features. Each merchant transaction and text features are first transformed into value, key, and query features following [Vaswani et al., 2017;, where the transformed features are denoted as v i , k i , q i ∈ R dim . Notation dim represents the common dimension of transformed features from both modalities 1 . Given merchant i, the block first captures the value v i and key k i from the transaction features:

Cross-modal Attention
v and the query Q i from the text features: where W v , W k , W q , and b v , b k , b q are the weights and bias, respectively. The block then packs k i and q i together and calculate their attention to v i : where a i ∈ R dim is the set of attention weights. The dot product values are proportional to the dimension of the common feature space. Consequently, the product is normalized by √ dim. The softmax non-linearity function is applied rowwisely. Notice that the package operation could be Gaussian e kiq T i , Kernel Gaussian e φ(ki)φ(qi) T , dot product k i q T i , and etc. Interestingly, we will show by experiments that CIAN is not sensitive to the choices and thus choose the dot product operation for its simplicity and interpretability. With the attention weights, the block outputs the embedding features simply by element-wise multiplication as shown in Fig. 3a: where o i is the cross-modal attention output of merchant i.

Intra-modal Attention
On top of the cross-modal attention, we also observe the relationships within each modality are complementary to the cross-modal relations. For instance, we should pay more attention to the gender related features when we figure out the merchant is related to makeup. Meanwhile, if the gender related features are essential, we should also focus on the repurchase rate due to the difference of purchasing habits among different genders.
Therefore, we also design intra-modal attention block in f and g. The implementation of intra-modal attention block is illustrated at Fig.3b, which differs from the cross-modal attention block only on the input and thus we omit the details due to the page limitation.

CIAN-Explainer
To sustain the requirements of financial regulation, we should not only detect whether the transaction flow of a merchant is beyond the scope of its licensed business but also figure out the reason of the dis-match. Consequently, we also design a CIAN-Explainer to interpret how the attention mechanism interact the original features. In this section, we pro-  pose a CIAN-Explainer, an approach for explaining matching made by CIAN. The proposed CIAN-Explainer takes a trained CIAN and its match results as input, and returns an explanation in the form of a small subset of transaction flow features that are most crucial for the match (Fig. 4). CIAN-Explainer specifies an explanation as a rich subset of the entire transaction flow information, such that the subset minimizes the distance between the approximate embedding and real embedding of CIAN match. Based on this, we formulate CIAN-Explainer as a low-rank approximation problem: Unfortunately, the constraint ||â|| 1 ≤ 10 describes a nonconvex set, which makes Problem (6) hard to solve. Thanks to the duality principle, we could re-formulate CIAN-Explainer as the dual problem of Problem (6): where λ is the Lagrange multiplier and the problem could be solved by alternating direction method of multipliers (ADMM). As a result, the explainer learns a real-valued feature maskâ which selects the important transaction flow features and masks out unimportant ones. In our experiments, we evaluate CIAN-Explainer and the results show that CIAN-Explainer provides consistent and concise explanations of CIAN match. The visualization of CIAN-Explainer will be shown in Section 4.3.

Experiments
In order to demonstrate the effectiveness of our proposed methods, we conduct CIAN on a practical e-payment dataset: WeChat Pay. We systematically make comparisons with several latest start-of-the-art methods and thoroughly investigate the performance of the proposed CIAN framework. As for the performance measure criterion for transaction-text matching, we apply the commonly used precise, recall, and F1-Score as the performance evaluation metrics.

Implement Details
WeChat Pay Dataset For a merchant, its transaction flow records make up a basic data identification, and the remarks and comments are regarded as the description of this transaction flow. From the real-world datasets in WeChat Pay, we extract two subdatasets for the evaluation. In the first sub-dataset, namely 31-D dataset, we collect 50,000 merchants from 2019/07/01 to 2019/07/31 for training, 1,000 merchants from 2019/08/01 to 2019/08/31 for validating, and 1,000 merchants from 2019/07/01 to 2019/07/31 for testing, from WeChat Pay system. In the second dataset, namely 7-D dataset, we collect 50,000 merchants from 2019/07/01 to 2019/07/07 for training, 1,000 merchants from 2019/08/01 to 2019/08/07 for validating, and 1,000 merchants from 2019/07/01 to 2019/07/07 for testing. Through the hardest negative sampler [Hermans et al., 2017], there are total 500,0000 training pairs, 10,000 pairs for validating, and 10,000 for testing. In our datasets, we define the positive pairs as the merchants' transaction flow stats and their corresponding descriptions, and the negative pairs as the merchants' transaction flow stats and the descriptions of the merchants who belong to other categories.

Training details
All of our experiments are conducted on a machine with an Intel Xeon E5-2630 CPU, two NVIDIA GTX 1080 Ti GPUs, and 64GB RAM. The text embedding is achieved with the pre-trained RoBERTa [Liu et al., 2019]. 2 After text embedding and feature engineering, the dimension of transaction and text information are 415 and 768, respectively. For information interaction, the transaction and text information are projected into the same dimension, which is fixed as 1024 in our experiment. The networks are constructed using Pytorch for computational speed boost. The model parameters are initialized with kaiming normal initializer and Adam optimization algorithm is used to train the overall network. Moreover, we set the batch size to 256, the initial learning rate to 0.01 and the regularizer parameter as 0.01 to prevent over-fitting.

Embedding Visualization
We use t-SNE [Maaten and Hinton, 2008] to visualize our transaction features before and after cross-modal embedding, coloring each merchant according to its category in Fig.5. In the two-dimensional visualization, the left figure shows that the transaction features before cross-modal embedding are vaguely clustered but the boundaries merge together and some categories are diffuse. Meanwhile, in the right figure, the transaction features after cross-modal embedding are less noisy and clearly clustered corresponding to the merchant category. The above observations corroborate our motivation of combining intra-modal and cross-modal attention mechanism in our CIAN design. Through cross-model embedding, more attentions are paid to the information that helps identify the scope of business.

Performance Evaluation Comparison versus Different Package Operations
We observe through our experiments that CIAN is not sensitive to the choices of the package operation in Eq. (4) and thus choose the dot product operation for its simplicity and interpretability. To validate the observation, we exhibit the comparison among different types of the package operation in Table 2. We can see that the Gaussian, Kernel Gaussian, and Dot product versions achieve the similar performance, up to some random variations (77.5 to 78.3). Due to the simplicity, we adopt dot product in the proposed CIAN framework. Thanks to the simplicity, we proposed the CIAN-Explainer in section III, which provides inspiring insights and save a huge amount of human-resources for manually auditing.    Table 1.  ror. Moreover, the convergence rate of CIAN is much faster than the baseline and the converged performance of CIAN also outperforms the baseline. Table 1 exhibits the performances of all methods on WeChat Pay dataset. The major findings from the experimental results can be summarized as follows:

Comparison with Competing Methods
• Our model outperforms all the baselines, which indicates our model adopts a more principled way to leverage intra-modal information and cross-modal relations for improving match performance. The performance of all the methods under 31-D dataset is notably better than the one under 7-D dataset. Our model achieves 85.9% precise, which is a remarkable performance under the real-world data with randomness and noise.
• Among these baselines, we can find that the overall performance order is as follows: (attention+triplet loss) based methods, (fully-connected layers+triplet loss) based methods, (attention+fusion layer+classification) based methods, (fully-connected layers+fusion layer+classification) based methods.
It indicates that the better performances can be achieved through attention mechanism and two-branch embedding structure with triplet loss.
• Comparing the only cross-modal attention network and only intra-modal attention network, we can find that the cross-modal attention network outperforms the intramodal attention one, which further demonstrates the importance of capturing the correspondences inside the trading behavior and between the trading behavior and the meaning of the sentences.

Explainer Visualization
To sustain the requirements of financial regulation, we design a CIAN-Explainer to interpret how the attention mechanism interact the original features in Section III. In Fig. 7, we visualize the CIAN-Explainer to analyze transaction and text matching for WeChat Pay. An exemplary visualization result is shown in Fig. 7a. There are two major observations: • The correspondences between the text and transaction are satisfied, most of the phrases can attend to their related transaction features, like the phrases "outlet mall", "duty free", "Jeweller", and so on.
• The sign of the attention indicates the positive or negative text-transaction correlation. The absolute value of attention could filtered out unrelated information flows, like the average transaction amount of a outlet mall. Intuitively, the merchants with similar text should focus on relative features. In order to see if the learned attention preserves the similarity, we cluster the merchants with their categories and then plot the average attentions for selected 10 features in Fig. 7b. We observe that the closer categories share higher attention similarity in most cases. For example, merchants of Restaurant and Shopping Mall, i.e., column 0 and 1 in Fig. 7b, both pay more attentions on the features related to the transaction time distribution and pay less attentions on the features related to the gender distribution. However, merchants of Clothes and Makeup, i.e., column 9 and 10 in Fig. 7b, focus on the features related to the repurchase rate and gender. As a consequence, CIAN-Explainer could not only visualize relevant features, but also save a huge amount of human-resources for manually auditing, which is quiet important in financial business.

Conclusion
In this paper, we develop a novel cross-modal and intra-modal attention network (CIAN) for the transaction-text matching task. Our proposed CIAN framework can be adapted to any cross-modal matching problem, e.g., image-text, imagetransaction, transaction-text. We show the CIAN framework alternatively passes information within and across transaction and text based on the proposed attention mechanism. To sustain the requirements of financial regulation, we also design a CIAN-Explainer to interpret how the attention mechanism interacts the original features. Furthermore, we collect a dataset from a practical online payment (WeChat Pay) and make the first attempt to evaluate the application value of our transaction-text model, which provides solid improvement over baselines. We hope CIAN as well as CIAN-Explainer provides a big insight for both the AI-enabled FinTech and interpretable multimodal learning.