CACL : Community-Aware Heterogeneous Graph Contrastive Learning for Social Media Bot Detection (2024)

Abstract: Social media bot detection is increasingly crucial with the rise of social media platforms. Existing methods predominantly construct social networks as graph and utilize graph neural networks (GNNs) for bot detection. However, most of these methods focus on how to improve the performance of GNNs while neglecting the community structure within social networks. Moreover, GNNs based methods still face problems such as poor model generalization due to the relatively small scale of the dataset and over-smoothness caused by information propagation mechanism. To address these problems, we propose the Community-Aware Heterogeneous Graph Contrastive Learning framework (i.e., CACL), which constructs social network as heterogeneous graph with multiple node types and edge types, and then utilizes community-aware module to mine both hard positive samples and hard negative samples for supervised graph contrastive learning with adaptive graph enhancement algorithms. Extensive experiments demonstrate that our framework addresses the previously mentioned challenges and outperforms competitive baselines on three social media bot benchmarks.

## introduction social media bots, widely found within social networks, are software systems designed to interact with humans @xcite , e.g., 9% to 15% active users on twitter exhibit bot-like behaviors @xcite . although social media bots have brought convenience to people's daily life, including news broadcasts, online customer service, etc., their negative applications, such as online disinformation @xcite , election interference @xcite , extremism advocacy @xcite , seem to be more widespread and absolutely cannot be figure 1: illustration of considering diff-class nodes within one community as hard negative samples while same-class nodes between communities as hard positive samples. based on these, graph contrastive learning is employed to push hard negative samples away and pull hard positive samples closer on the hypersphere. overlooked. to solve the above issues, numerous methods have been proposed to detect social media bots efficiently. existing works for social media bot detection primarily consist of feature based and graph based methods. in recent years, because feature engineering @xcite @xcite has been proven to be incapable of addressing the challenge of generalization @xcite , graph convolutional neural networks (gcns) @xcite based models have been designed to leverage graph structure information. while homogeneous graphs @xcite fail to model diverse relationships between social accounts, such as following and commenting, methods based on heterogeneous graphs, e.g., heterogeneous gcns @xcite , relational gcns @xcite , relational graph transformer @xcite , etc., can better extract node features by capturing information from various types of relationships. however, most of these efforts primarily focus on improving the performance of node feature extraction by designing sophisticated gnns, while neglecting the inherent characteristic of social networks, i.e., social networks naturally divide into groups of users with denser connections inside each group and fewer connections between different groups @xcite @xcite . for example, under a politically related topic, users tend to interact more frequently with each other than with others who are not interested in this topic @xcite . intuitively, these users form a political community. and in this community, to influence public opinion or achieve other objectives, bots often share political opinions and interact with humans. as a result, they exhibit shared interests and characteristics with humans in the same community, while bots from other communities are relatively different from the humans in this community @xcite . this phenomenon makes bots from other communities can be easily distinguished from users in this political community, once we identify the community structures. while leveraging these community structures can facilitate bot detection, it also introduces problems. when we treat users as nodes, due to the over-smoothing problem @xcite , gnns based methods will result in highly similar representations for nodes in the same community, and different representations for nodes in differernt communities. therefore, diff-class nodes in one community tend to have short distances in the feature space, while same-class nodes in different communities tend to have long distances between them @xcite . as illustrated in figure 1 , we define diff-class nodes in one community as hard negative samples and same-class nodes in different communities as hard positive samples. these hard samples bring difficulties to bot detection. to address the above challenges, we propose the community-aware heterogeneous graph contrastive learning framework (i.e., cacl) foot_0 , a graph contrastive learning framework capable of perceiving community structures. in general, this framework is divided into graph level and node level components. firstly, we design a communityaware module to perform community detection and mine both hard negative and positive samples. then, supervised graph contrastive learning is introduced to handle these hard samples, by guiding gnns model to focus on subtle differences among hard negative samples and push them away, and reasonably disregard the distinct features among hard positive samples and pull them closer. besides, the underlying feature extraction networks in community-aware module are shared with the networks in contrastive learning module, allowing us to perform dynamic and adaptive hard sample mining. in this manner, by continuously updating model parameters and mining new hard samples, the representations of same-class nodes are consistently gathered on the hypersphere while those of diff-class are separated, which is beneficial to classification. to construct contrastive graphs, we introduce link prediction, synonymy substitution, and node feature shifting that are adaptive to graph topology structure, text information, and users' attributes, respectively. we summarize our main contributions as follows: ## experimental setups datasets. our method is graph-based and heterogeneous-aware, which requires information of diverse relation types between nodes in datasets. @xcite , twibot-20 @xcite and twibot-22 @xcite all contain various relationships among users as well as between users and their tweets which are essential to build heterogeneous networks. we follow the same splits provided in the benchmarks to mitigate the potential impact on experiment results. baselines. to demonstrate the effectiveness of our proposed framework cacl, we choose three backbone models, i.e., gcn @xcite , gat @xcite , hgt @xcite , as convolution layers and compare them with previous representative works: implementation. we set λ to 0.9, τ to 0.07, learning rate to 0.0001, layer number of all gnns models to 2, and dropout rate to 0.5. in each epoch, we iteratively select 2000 adjacent users for twibot-22 dataset and 1000 for other datasets. we conduct all experiments on 2 nvidia rtx a5000 gpus. ## conclusion social media bot detection is an application problem that integrates various fields. to leverage the rich community structure information in social networks and address over-smoothness problem in gnns model, we propose the cacl framework, which utilizes community-aware module to mine hard positive and negative samples at graph level, and introduces graph contrastive learning to handle hard samples in node level. cacl also employs three efficient graph augmentation methods which enhance gnns model's robustness and generalization ability. we conducte extensive experiments on three comprehensive benchmarks which demonstrate the effectiveness of our framework.