{'fraction_non_alphanumeric': 0.02817677383810161, 'fraction_numerical': 0.008080490076476066, 'mean_word_length': 4.896813118811881, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
RoSGAS: Adaptive Social Bot Detection with Reinforced Self-Supervised GNN Architecture Search

Social bots are referred to as the automated accounts on social networks that make attempts to behave like human. While Graph Neural Networks (GNNs) has been massively applied to the field of social bot detection, a huge amount of domain expertise and prior knowledge is heavily engaged in the state-of-the art approaches to design a dedicated neural network architecture for a specific classification task. Involving oversized nodes and network layers in the model design, however, usually causes the over-smoothing problem and the lack of embedding discrimination. In this paper, we propose RoSGAS, a novel Reinforced and Self-supervised GNN Architecture Search framework to adaptively pinpoint the most suitable multi-hop neighborhood and the number of layers in the GNN architecture. More specifically, we consider the social bot detection problem as a user-centric subgraph embedding and classification task. We exploit heterogeneous information network to present the user connectivity by leveraging account metadata, relationships, behavioral features and content features. RoSGAS uses a multi-agent deep reinforcement learning (RL) mechanism for navigating the search of optimal neighborhood and network layers to learn individually the subgraph embedding for each target user. A nearest neighbor mechanism is developed for accelerating the RL training process, and RoSGAS can learn more discriminative subgraph embedding with the aid of self-supervised learning. Experiments on 5 Twitter datasets show that RoSGAS outperforms the state-of-the-art approaches in terms of accuracy, training efficiency and stability, and has better generalization when handling unseen samples.


INTRODUCTION
Social bots -the accounts that are controlled by automated software and mock human behaviours [1] -widely exist on online social platforms such as Twitter, Facebook, Instagram, Weibo, etc. and normally have malicious attempts. For example, interest groups or individuals can use social bots to influence the politics and economy, e.g., swaying public opinions at scale, through disseminating disinformation and on-purpose propaganda, and to steal personal privacy through malicious websites or phishing messages [47]. Such deception and fraud can reach out to a huge community and lead to cascading and devastating consequences.
Social bots have been long studied but not yet well-resolved due to the fast bot evolution [7]. The third generation of bots since 2016 with deepened mixture of human operations and automated bot behaviors managed to disguise themselves and survived platform-level detection using traditional classifiers [7,9]. The cat-and-mouse game continues -while new work-around, camouflage and adversarial techniques evolve to maintain threats and escape from perception, a huge body of detection approaches emerge to differentiate the hidden behaviors of the emerging socials bots from legitimate users. The recent advancements in Graph Neural Networks (GNNs) [40] can help to better understand the implicit relationships between abnormal and legitimate users and thus improve the detection efficacy. GNN-based approaches [6,14,15,17,31,37,50] formulate the detection procedure as a node or graph classification problem. Heterogeneous graphs are constructed by extracting the accounts' metadata and content information from social networks before calculating numerical embedding for nodes and graphs. However, there are still several interrelated problems to be addressed: GNN architecture design has a strong dependence upon domain knowledge and manual intervention. In most of the existing works, the embedding results are inherently flat because the neighbor aggregation ignores the difference between the graph structure pertaining to the target node and the structures of other nodes. This will result in the lack of deterministic discrimination among the final embeddings when the scale of the formed graph structure grows to be tremendous. To address this issue, subgraphs are leveraged to explore the local substructures that merely involve partial nodes, which can obtain non-trivial characteristics and patterns [45]. However, the subgraph neural network based approaches heavily rely on experiences or domain knowledge in the design of rules for extracting subgraphs and of model architectures for message aggregation [3,29,35]. This manual intervention substantially impedes the elaborated design of a neural network model that can adapt to the evolving changes of the newer social bots. Using fixed and fine-grained subgraph extraction rules is not sufficiently effective [9,18].
Over-assimilated embedding when aggregating a huge number of neighbors. The most intractable and demanding task is to effectively perceive and pinpoint the camouflages of the new-generation social bots. Camouflage technology mainly comprises two distinct categories -feature camouflage and relation camouflage. Feature camouflage is referred to as the procedure where bots steal the metadata of the benign accounts and transform into their own metadata. They also employ advanced generation technology to create content information [7]. Apart from mimicking features of legitimate users, relation camouflage techniques further hide the malicious behaviors by indiscriminately interacting with legitimate users and establishing friendships with active benign users [57]. The interactions, particularly with the influencers, can considerably shield the bots from being detected. It is thus critical to include sufficient heterogeneous nodes in the neighborhood when extracting the subgraph for the target user so that camouflaged bots can be picked up. Meanwhile, it is also important to differentiate the subgraph embeddings of different target users while similarizing the embeddings within the same target user. However, the over-smoothing representation problem will manifest [30,53] as the involvement of a huge number of nodes in the GNNs tends to over-assimilate the node numerical embedding when aggregating its neighbor information.
Inadequate labeled samples. A large number of labeled samples are presumably acquired and massively used in the supervised model training. However, this assumption can be hardly achieved in the real-world social bot detection. In fact, there are always very limited users with annotated labels, or limited access to adequate and labelled samples [21]. This will hamper the precision of supervised deep learning models and particularly lead to poor performance in identifying outof-sample entities, i.e., the new types of social bots out of the existing datasets or established models.
To address these issues, the state-of-the-art works [20,27,52,62,63] adopt reinforcement learning (RL) to search the GNN architecture. However, such approaches sometimes lack generalizability; the effectiveness of determining the optimal GNN architecture is tightly bound to specific datasets and usually have huge search space, and hence low efficiency. They are not suited for social network networks where the graph structure follows a power-law distribution [4,34]. In this scenario, dense and sparse local graph structures co-exist and huge disparities manifest among different users. Additionally, as only taking a small fraction of the labelled users as the environment state, the existing RL agents can hardly learn the state space in an accurate manner and will lead to a slow convergence in the RL agents. Hence, it is highly imperative to personalize the selection of subgraphs and GNN architecture of the model for each target user, without prior knowledge and manual rule extraction, and to devise automated and adaptive subgraph embedding to fit the ever-changing bot detection requirements.
In this paper, we propose RoSGAS, a subgraph-based scalable Reinforced and Self-supervised GNN Architecture Search approach to adaptively extract the subgraph width and search the model architecture for better subgraph embedding, and to speed up the RL model convergence through self-supervised learning. Specifically, we use Heterogeneous Information Network (HIN) to model the entities and relationships in the social networks and use meta-schema and meta-path to define the required relationship and type constraints of nodes and edges in the HIN, on the basis of real-world observations in social network platforms. We formulate the social bot detection problem as a subgraph classification problem. We firstly propose a multi-agent reinforcement learning (RL) mechanism for improving the subgraph embedding for target users. The RL agent can start to learn the local structure of the initial 1-order neighbor subgraph of a given target user and help to select the most appropriate number of neighbor hops as the optimal width of the subgraph. The RL agent is also elaborately devised to select the optimal number of model layers such that the neural networks are well-suited for encoding the dedicated subgraphs with sufficient precision, without introducing oversized architecture and computation overhead. We then exploit the residual  structure to retain the characteristics of a target user as much as possible, thereby overcoming the over-smooth problem on the occasion of message aggregations from a huge number of neighbor nodes. While using RL to automate the neighbor selection and model construction, we additionally develop a nearest neighbor mechanism in the early stage of RL for accelerating the training process of the proposed RL approach. A self-supervised learning mechanism is further investigated and integrated with the RoSGAS framework to overcome the deficiency of over-assimilated embedding. The self-supervised module can facilitate more discriminative representation vectors and help to enhance the capability of expressing discrepancies among different target users. Experimental results show that RoSGAS outperforms the state-of-the-art approaches over five Twitter datasets and can achieve competitive effectiveness when compared with hand-made design of the model architecture.
Particularly, the main contribution of this work are summarized as follows: • proposed for the first time a user-centric social bot detection framework based on Heterogeneous Information Network and GNN without prior knowledge. • developed an adaptive framework that leverages Deep Q-learning to optimize the width of the subgraph and the GNN architecture layers for the subgraph corresponding to each target user. • investigated a nearest neighbor mechanism for accelerating the convergence of training process in RL agents. • proposed a self-supervised learning approach to enable homologous subgraphs have closer representation vectors whilst increasing the disparities of representation vectors among non-homologous subgraphs after information aggregation. • presented an explicit explanation for the model stability.
Organization. This paper is structured as follows: Section 2 outlines the problem formulation, and Section 3 describes the technical details involved in RoSGAS. The experimental setup is described in Section 4 and the results of the experiment are discussed in Section 5. More discussions are given in Section 6. Section 7 presents the related work before we conclude the paper in Section 8.

Target User
Hashtag Tweet Entity Unlabel User Comment

PROBLEM FORMULATION
In this section, we introduce HINs and information network representation before discussing the scope of this work and formulating the target problem.

Preliminaries
In this work, we follow the terminologies used in the work of [13,24,36,42] to define Heterogeneous Information Network (HIN) embedding. The aim is to project different nodes in the HIN into a low-dimensional space whist preserving the heterogeneous structure and relationships between heterogeneous nodes. Definition 1. Heterogeneous Information Network. A heterogeneous information network (HIN) denoted as G = G(V, E, F , R, , ), where V denotes the nodes set, E denotes the edges set, F denotes the node types set and R denotes the edge types set. In real-world settings, there may be multiple types of nodes or edges, i.e., |F | + |R| > 2. Each individual node ∈ V is associated with a node type mapping function : V → F ; similarly, each individual edge ∈ E has an edge type mapping function : E → R.
In a nutshell, real-life information networks have different structures consisting of multi-typed entities and relationships. A relationship is referred to as the link between entities in a network or graph system. For example, Fig. 1(a) shows an example of social network HIN that we construct for Twitter. It comprises five types of nodes (user, tweet, comment, entity and hashtag) and six types of relationships (write, follow, post, reply, retweet, and contain). Definition 2. Network Schema. Given a HIN G(V, E, F , R, , ), the network schema for network G can be denoted as T (F , R), a directed graph with the node type set F and edge types set R. In simple words, HIN schema comprehensively depicts the node types and their relations in an HIN, and provide a meta template to guide the exploration of node relationships and extract subgraphs from the HIN. Fig. 1 (b) exemplifies the network schema that can reflect entities and their interactions in a generic social network.
is a path on T that connects a pair of network nodes and defines the composite relation R which contains multi types of relationships.
In reality, a meta-path describes the semantic relationship between nodes. Mining such semantic relationship is the cornerstone of subsequent tasks such as classification, clustering, etc. As shown in Fig. 2, we extracted five most useful meta-paths from our defined meta-schema, based on observations in social network platforms.

Problem Statement
We consider the social bot detection problem as a subgraph classification task, instead of a node classification task, in a semi-supervised learning manner. Definition 4. Semi-supervised Subgraph Classification. Given a collection of target users, the subgraph pertaining to the -th target user can be defined as G = {V , X , {E }| =1 , }. V is the collection of nodes in the subgraph, including 0 , the target user itself, and the neighbors { 1 , . . . , } within a few hops from the target user. These nodes are extracted from the entire graph G and consist of different types. Each node initially has a -dimensional feature vector and X represents the vector set of all node embeddings, i.e., X = { 0 , . . . , } where each element ∈ R. The edge in the subgraph can be represented as , = ( , ) ∈ E , where and is connected through a certain relationship ∈ {1, . . . , }. ∈ {0, 1} represents a binary label of the target user 0 ; 0 indicates benign account while 1 represents a social bot. Once a dedicated subgraph is extracted, the subsequent task is to conduct a subgraph binary classification. At the core of the adaptive architecture search is to pinpoint the subgraph width ( ) and the optimal value of model layers ( ) that constitute the whole bot detection model.

Research Questions
For achieving discriminative, cost-effective and explainable subgraph embedding, there are three main research challenges facing the RL-based social bot detection: [Q1] How to determine the right size of the subgraph for an individual target user in a personalized and cost-effective manner? The major issue with the DNN construction is the selection of neighbor hops and the model layers. In fact, two interrelated yet opposite factors may affect the choice of a detection model. On the one hand, a larger number of hops and model layers can involve more nodes, including both benign and malicious nodes, in the neighbor aggregation. This is beneficial for the detection quality since the hidden camouflages of social bots could be identified by the higher-order semantic embedding enabled by the continuum of HIN-based data engineering and DNN model training. However, excessive involvement will bring performance issues in terms of time-and computation-efficiency, and, more severely, lead to the over-smooth problem commonly manifested in graphs at scale [30]. On the other hand, a small portion of the neighbors would overlook node information and lead to less informative node embeddings. To resolve this dilemma -balancing competitive accuracy and high computation efficiency -whilst addressing the assimilation within the neighborhood, it is critical to automatically pick up an appropriate hops of neighbors and to stack up just-enough neural network layers to be assembled in the detection model. This requires the reinforcement learning process to properly define dedicated policies and optimize the setting of environment states and actions.
[Q2] How to accelerate the convergence of reinforcement learning? It is observable that in the initial stage of training, the learning curve substantially fluctuates and this phenomenon will slow down the training process and model convergence. This is because in the starting phase the noisy data may take up a high portion of the limited memory buffer and thus misdirect to the wrong optimization objective. To ensure the training efficiency, it is necessary to boost the action exploration in RL agent and speed up the training stabilization.
[Q3] How to more efficiently optimize the reinforcement learning agents in the face of limited annotated labels? Data annotation is expensive and sometimes difficult in practical problem solving. If only a small portion of the labelled users are used as the input of the RL agent as environment state, the state space cannot be accurately and efficiently learnt within a required time frame. This will consequently delay the optimization of a RL agent and further have a cascading User; tweet; comment; hashtag G; G ; V; E Graph; -th subgraph; node set; edge set F ; R Node type; relation type ; Mapping a node to the type F ; mapping a edge to the type R V ; X Node set of subgraph G ; node feature set of subgraph G 0 ; ; -th target user; -th node in Subgraph G ; label of -th target user , ; An edge connecting , through a relationship ∈ R ; The number of neighbor hops and the number of model layers D; ℎ ; The target user set; the original feature of ; the model for target user 0 ; L The last layer number and the error correction parameter ; The -th attention coefficient and the -th weight matrix ; The embedding of the -th subgraph and the policy network ; ; The state, chose action, and the reward at timestamp R, The advantage function measurement of ( , ) and the history window size , The value of state-action pair and the future cumulative rewards discount parameter ; The observation experience set and the state-action pair , Θ The state distance measurement function and the parameter of RL agent 0 , The initial weight and decay rate of in the nearest neighbor mechanism The weight parameter of the GNN loss function G A subgraph G for -th target user with hop neighbors L , The loss of the -th pretext task, the -th stacked GNN encoder the stands for the ground truth of subgraph G acquired by pretext task G ′ ,Ḡ G ′ is a positive sample for G .Ḡ is a negative sample for G . ′ ,¯′ is the representation of G ′ ,¯is the representation ofḠ impact on the multi-agent training. This issue therefore necessitates an self-supervised learning mechanism for optimizing the training effectiveness and efficiency.

METHODOLOGY
In this section, we will introduce how we design the social bot detection framework through adaptive GNN architecture search with reinforcement learning. We first introduce the basic process of subgraph embedding (Section 3.1). In response to [Q1], we introduce a reinforcement learning enhanced architecture search mechanism (Section 3.2). To address [Q2], we propose a nearest neighbor mechanism (Section 3.3) for accelerating the convergence process of reinforcement learning. The self-supervised learning approach is discussed (Section 3.4) to tackle [Q3] before we present how to tackle parameter explosion and outline the holistic algorithm workflow (Section 3.5 and Section 3.6). Fig. 3 depicts the overall architecture of RoSGAS to perform the subgraph embedding. The workflow mainly consists of three parts: graph preprocessing and construction, RL-based subgraph embedding and the final-stage attention aggregation mechanism among graph nodes before feeding into the final classifier for determining the existence of social bots. To aid discussion, Table 1 depicts the notations used throughout the paper.  3.1.1 Graph Construction. Initially, the feature extraction module transforms the original information into a heterogeneous graph. The edges between nodes in the heterogeneous graph are established based on the account's friend relationships and interactions in the social network platform. We retrieve the meta features and description features of each account as its initial node feature in a similar way as [56]. Extra tweet features and entities are extracted by using NLPtool 1 from the original tweets. The composition of features for each type of node may vary. For user node, features such as status, favorites, list, etc. are extracted from user metadata. For tweet node, we normally extract the number of retweets and the number of replies, whilst embedding the tweet content into a 300-dimension vector and concatenating them together as their original features. Similarly, we embed the content of hashtag and entity to 300-dimension vectors. To simplify the feature extraction and processing, the feature vector of each node type is set to be 326 dimensions. Those with insufficient dimensions are filled with zero. More details will be given in Section 4.3.

Overview
To refine the heterogeneous graph under the given semantics, we further conduct a graph pre-processing by enforcing meta-paths upon the original graph and only the entities and edges conforming the given meta paths will be retained in the graph structure. As shown in Fig. 2, we extracted five meta-paths that are widely-recognized in social graphs and represent most of the typical behaviors in the meta-schema defined in Section 2.1. The main purpose is to cut down the information redundancies in the graph at scale and thus substantially improve the computational efficiency. The transformed graph will be further used to extract subgraphs for the target users before feeding the subgraphs into the down-streaming tasks including the numerical embedding and classification.

RL-based Parameter
Searching. The primary goal of the parameter selection is to determine the appropriate subgraph width ( ) and the model layers ( ) for each target user in the target user collection D with users. In a nutshell, for each target user, we take it as the center node and first extract a fixed width (e.g., 1 hop) subgraph G as the initial subgraph. Afterwards, we encode the subgraph into the embedding space and regard the embedding as the environment state before feeding it into the reinforcement learning agent. To be more specific, the embedding representation of the -th target user can be obtained by using an encoder (e.g., average encoding operation, sum encoding operation, etc.): (1) At the core of the embedding improvement is the RL agent. The preliminary encoding result will be fed into the policy 1 and 2 in the RL agent, successively. 1 is responsible for selecting the appropriate width of subgraph G ′ while 2 is in charge of pinpointing the most suitable number of layers for constructing model for the target user 0 . The types of specific model layer can be selected from the most popular models such as GCN [26], GAT [48] and GraphSAGE [23], etc. Generally speaking, the goal of reinforcement learning is to maximize the expected accuracy: More details about the learning procedure will be discussed in Section 3.2.
To calibrate the subgraph embeddings, we can then aggregate the -hop neighbors and stack models with various layers. However, the aggregation from the stacked GNN models would blur the original detectable features of the target user in the subgraph embedding. To mitigate this issue, we apply the residual network to aggregate the target node's input features and its corresponding embedding delivered by the last layer of the model: where is the last layer of the stacked GNN model. Then we can apply a pooling operation (e.g., average, sum, etc.) to integrate the subgraph G into a super node:

Attention Aggregation and Classification.
We adopt an attention mechanism for integrating the influence of subgraphs belonging to the relevant neighbors into the final embedding: where is the attention coefficient, W ∈ R d L ×d l is the weight matrix and is the number of independent attention. is the final embedding for detecting if the target user is a social bot. Eventually, the bot classifier digests the learned vector embeddings to learn a classification model and determines if a given social user behaviors normally or maliciously. General purpose techniques including Random Forest, Logistic Regression, SVM, etc. can be adopted for implementing the classifier.

Reinforced Searching Mechanism
In this subsection, we will introduce how to obtain the optimal policies˜ * 1 and˜ * 2 through the searching mechanism. The learning procedure of the optimal˜ * 1 and˜ * 2 can be formulated as a Markov Decision Process (MDP). An RL agent episodically interacts with the environment where each episode lasts for steps. The MDP includes state space, action space, reward and the transition probability that maps the current state and action into the next state. State Space. In each timestamp , the state is defined as the embedding of the subgraph extracted from G. Action Space. Since we need two policies to pinpoint the optimal width of subgraph and the optimal number of model layers respectively, the action at timestep consists of dual sub-actions ( (1) , (2) ). The RL agent integrated in our proposed framework RoSGAS performs an action (1) to get the value of , and performs an action (2) to get the value of . For instance, (1) is chosen at the timestep to re-extract the subgraph of the target user 0 . We then calculate the number of reachable paths from target user 0 to the other target users in this subgraph as the connection strength. For those target users that are included in the collection D yet excluded from this subgraphs, the connection value will be set to 0. 1 normalization is performed upon these values as the reachability probabilities from the target user to the other target users. After selecting certain actions ( (1) , (2) ) at the timestep , the RL environment forms a probability distribution . Transition. The probability serves as the state transition probability of the reinforcement learning environment. The subgraph embedding of any other target user is used as the next state +1 . The whole trajectory of the proposed MDP can be described as −1 ), −1 , ). Reward. We need to evaluate whether the search mechanism is good enough at the current timestep . In other words, it reflects if the parameters in the current RL agent can achieve better accuracy than the parameters at the previous timestep − 1. To do so, we firstly define a measure to flag the improvement of model accuracy when compared with the previous timesteps: where is a hyperparameter that indicates the window size of historical results involved in the comparison and ACC ( , ) is the accuracy of subgraph classification on the validation set at the timestep .
reflects the average accuracy in the most recent timestep windows. The training RL agent continuously optimizes the parameters to enable a rising accuracy and accordingly positive rewards. This will give rise to the cumulative rewards in finite timesteps and eventually achieve the optimal policies.
We use a binary reward combined with Eq.6 to navigate the training direction as follows: otherwise.
The value is set to be 1 if can increase the R compared with that of the previous timestep − 1; otherwise it will be set -1.
Termination. State-action values can be approximated by the Bellman optimal equation: Nevertheless, to improve both training speed and stability, we will introduce an enhanced approximation approach in Section 3.3. We exploit the -greedy policy to select the action with respect to * and obtain the policy function :

Nearest Neighbor Mechanism for Accelerating Model Stabilization
Conventionally, at each time step , the RL agent employs its prediction network to determine the value of state-action pairs for choosing the best action to maximize the future cumulative rewards. Inspired by [41], we applied the nearest neighbor mechanism for assisting and accelerating the training process of the RL agent. The intuition behind the scheme is that when the RL agent observes similar or the same state-action pairs, the environment is highly likely to produce a similar reward value. In other words, the distance between state-action pairs can indicate their relative reward values. Therefore, we aim to find out the similar state-action pairs and determine the reward of the current state-action pair by combining the reward estimated by the Q-network (i.e., the prediction network) and the reward of the existing similar pairs. This means that the model training benefits from both the RL environment and the prediction network, which can boost the action exploration and accelerate the training stabilization.
To look into and record the historical actions, we set up an observation experience set = { 1 , . . . , }; each element in represents a pair of explored state and the corresponding selected action , namely, ( , ). While recording the action-state pairs, we also record the corresponding value labels { ( )} ⊆ R. We employ the distance function -for example using cosine to calculate the similarity -to measure the distance between the explored state-action pairs and the incoming state-action pairs. We use the distance to ascertain the nearest neighbor of the state-action pair to be estimated from the recorded state-action pairs. Subsequently, the value label of the nearest neighbor can be used to estimate the value of the state-action pair: whereˆ( ) is the estimated value of , and L is a parameter to correct the estimated error. We combineˆ( ) estimated by the nearest neighbor mechanism and ( , ; Θ ) estimated by the target network into a new estimated valueˆ( , ): where is an exponentially decaying weight parameter andˆ( ) is the estimated value of = ( , ) by using the nearest neighbor search mechanism. In fact, is used to assist the RL optimization in the early stage, and gradually reduce the effect of the proposed nearest neighbor mechanism when the training procedure moves forward. To achieve this, we set = 0 · (1 − ) , where 0 ∈ (0, 1] is an initial weight; ∈ (0, 1) is a decay rate and is the episode number. We then define the RL loss function as: where Θ is the parameters of the DQN agent's prediction network, and the Θ is the parameters of the target network.

Self-supervised Learning
To better differentiate the subgraph representations among graphs, we propose a contrastive selfsupervised learning approach to maximize the difference between two distinct patches, without relying on the human-annotated data samples. The task of self-supervised learning (also known as pretext task) is to minimize the distance between positive samples whilst maximizing the distance between negative samples. In the context of this work, all substructures (e.g., subgraphs with 1-hop neighbors or 2-hop neighbors) pertaining to the same user should have similar representation vectors. Subgraphs belonging to two distinct target users should have discriminative embeddings.
In general, given a subgraph G = {V , X , {E }| =1 , }, the loss L for a self-supervised learning task can be defined as follows: where is the stacked GNN encoder for the extracted subgraph G and the stands for the ground truth of subgraph G acquired by a specific self-supervised pretext task.
Practically, the key step is to generate positive samples in our self-supervised pretext task. After the RL algorithm outputs the customized width value for the target node , we random select ā ∈ [1, ]! = as the width of a new subgraph G ′ , to serve a new positive sample of the original subgraph G . Meanwhile, to provide the negative-sampled counterparts, we randomly select the target user from the target user set D and directly use the learnt value . We use the stacked GNN encoder and the proposed RL pipelines to perform feature extraction and summary, and obtain the final subgraph embedding , ′ ,¯for the subgraphs G , G ′ ,Ḡ , respectively. Then we use the margin Triplet loss for model optimization to obtain high-quality representations that can well distinguish the positive and negative samples. The loss function is defined as follows: where is the margin value. The loss function of the pretext task will be incorporated into the holistic loss function as the optimization objective of RoSGAS. Since there may exist many overlapping nodes between different subgraphs, especially in a large-scale social graph, the adoption of the loss function can effectively avoid excessive differentiation between positive and negative samples and prevent from any performance degradation of representation.

Parameter Sharing and Embedding Buffer Mechanism
The customized model construction for each individual target user will lead to a substantial number of training parameters. We use the following two schemes to alleviate this problem.
• Parameter Sharing: We first determine a maximum base layer number to initialize the model, and then repeatedly stack the whole or part of these layers according to output from the RL agent in each timestep in the initialization order. This can avoid training a large number of model parameters. • Embedding Buffer: We buffer the embeddings of the relevant subgraphs as a batch to carry out (2) in each timestep to reduce unnecessary operations for embedding passing. Once the buffer space approaches the specified batch size, the model re-construction will be triggered by leveraging the obtained number of layers from (2) and adopting the buffered embeddings. We cleanse the buffer space once the GNN model training terminates to ensure the buffer can be refilled in the later stage.

Put Them Together
Algorithm 1 summarizes the overall training process of the proposed RoSGAS including the initialization of the subgraph embedding and the follow-up architecture search via the proposed RL process. Specifically, We first construct the social graph according to our definition in Section 2.1 before initializing the GNN model with the max layers and the parameters of the two RL agents (Line 1). At the training stage, we randomly sample a target user and embed its -hop subgraph as the initial state 0 (Lines 2-4). Afterwards, at each time step, an action pair was chosen to indicate the width of the subgraph and the number of GNN layers for the target user (Line 6). Then we re-extract subgraph G ′ , store G ′ and the value represented by (2) into the buffer B (Lines 7-9).
Once the number of G ′ reaches a threshold value , we stack the GNN model with (2) layers, and generate the positive and negative pair for the -th target user in B. Then we train the model together with the self-supervised learning mechanism described in Section 3.4 (Lines 11-15). After the stacked GNN model training, we valid it on the validation dataset to get the reward (Line 18) and store the corresponding transition into memory M (1) and M (2) (Lines 20-21).
To optimize the 1 , we fetch batches of transitions from M (1) . For a specific transition (1) = ( , (1) , +1 , ), we use the Q-network to select the best action (1) +1 for the state +1 and use the target network to estimate the target value = + max +1 ( +1 , +1 ; Θ ). Then we use nearest neighbor mechanism to search the nearest neighbor of state-action pair ( , (1) ) and

Algorithm 1: The overall process of RoSGAS
Input: The max neighbor hop number, layer number: and ; initial neighbor hop number , the batch size of GNN and DQN: , , DQN training step , the total training epoch , epsilon value , the window size , the error correction parameters L, the initial decay parameter 0 , the decay rate ,the full graph G, targeted node set . 1 Initialize GNN layers, RL agent networks 1 , 2 ; 2 Initialize the memory buffer M (1) , M (2) , and the GNN buffer B ; 3 Sample a target node, extract -hop subgraph G 0 ; ) via Eq. 9; add its reward value upon the value of to obtain a new target valueˆ( , ). Then we can optimize the 1 through Eq.12. This method is also applied to optimize 2 (Lines 22-24). Eventually, we retrain the GNN with the help of the trained policies 1 and 2 (Line 26). The final embedding of each targeted user will be produced by the last attention layer and used for the downstream classification task.
We combine the the loss function of GNN and the self-supervised loss L in Eq.13. The loss L of RoSGAS is defined as follows: where the first term represents the cross-entropy loss function and ∥ Θ ∥ 2 is the 2-norm of GNN model parameters, is a weighting parameter. reduce the embedding dimension of to the number of categories.

Software and Hardware
We implement RoSGAS with Pytorch 1.8.0, Python 3.8.10, PyTorch Geometric [19] with sparse matrix multiplication. All experiments are executed on a sever with an NVIDIA Tesla V100 GPU, 2.20GHz Intel Xeon Gold 5220 CPU with 64GB RAM. The operating system is Ubuntu 16.04.6. To improve the training efficiency and avoid overfitting, we employ the mini-batch technique to train RoSGAS and other baselines.

Datasets
We build heterogeneous graph for experiments based upon five public datasets. The detailed description of these datasets is as follows: • Cresci-15 [8] encompasses two types of benign accounts, including a) TFP, a mixture of account set from researchers and social media experts and journalists, and b) E13, an account set consists of particularly active Italian Twitter users.  Table 2. The number of each class of labelled nodes in each data set are basically balanced.

Feature Extraction
The original datasets above merely include the metadata such as age, nickname, etc. and the posted tweet of the social account. This information, however, is insufficient to construct the heterogeneous graph, required for the effective subgraph embedding. These publicly released datasets originally included the social accounts' metadata (e.g., accounts' age, nickname) and the account's posted tweet data. Since these public data are not enough to construct the heterogeneous graph we designed, we use twitter APIs to further crawl and obtain the the metadata and tweet data of the friends and followers of the original accounts. We form these nodes into a huge heterogeneous social graph via the multiple relationships aforementioned in Fig. 2. We then use the NLP toolkit spaCy to extract name entities and treat them as a type of node in the heterogeneous graph.
In addition, we extracted the original feature vector for each type of node in the heterogeneous graph and further explored the following information as additional features: • Account nodes: We embed the description field of the account metadata into a 300-dimension vector through the pre-trained language model Word2Vec. We also extracted some features such as status, favorites, and list field that would be helpful for bot detection according to [56].
We count the number of followers and the number of friends as the key account features, because the number of followers and friends are the most representative of a Twitter user, and using them could more efficiently and accurately describe a Twitter user. In addition, we divide the numbers by the user account lifetime (i.e., the number of years since the account was created) to reflect the changes during the whole life-cycle of an account. We also use boolean value to flag the fields including default_profile, verified and profile_use_background_image, count the length of screen_name, name and description fields and the number of digits in screen_name and name fields. We combine all these values as the original node features. • Tweet nodes: We embed the text of the original tweet by the pre-trained language model Word2Vec into a 300 dimension vector. Apart from the original node features, we further combine additional information -the number of retweets, the number of replies, the number of favorites, the number of mentioning of the original tweet, and the number of hashtags and the number of URLs involved in the tweet. • Hashtag and entity nodes: we also embed the text of hashtag and entity into a 300-dimension vector. We use zero to fill the blank holes if the number of dimension is less than 300.
The graph constructed by each data set contains millions of edges and nodes, which greatly increases the difficulty of the social bot detection task. Noticeably, most samples in the datasets are unlabelled, i.e., more than 99% samples are not annotated.

Baselines.
To verify the effectiveness of our proposed RoSGAS, We compare with various semi-supervised learning baselines. Because these baselines will run on very large-scale graphs, to ensure training and inference on limited computing resources, we use the PyG [19] which calculation on sparse matrix multiplication to implement these baselines. The detail about these baselines as described as follows: • Node2Vec [22] is built upon DeepWalk and introduces two extra biased random walk methods, BFS and DFS. Compared with the random walk without any guidance, Node2Vec sets different biases to guide the procedure of the random walk between BFS and DFS, representing the structural equivalence and homophily at the same time. • GCN [26] is a representative of the spectral graph convolution method. It uses the firstorder approximation of the Chebyshev polynomial to fulfill an efficient graph convolution architecture. GCN can perform convolutional operation directly on graphs. • GAT [48] is a semi-supervised homogeneous graph model that utilizes attention mechanism for aggregating neighborhood information of graph nodes. GAT uses self-attention layers to calculate the importance of edges and assign different weights to different nodes in the neighborhood. GAT also employs a multi-head attention to stabilize the learning process of self-attention.
• GraphSAGE [23] is a representative non-spectrogram method. For each node, it samples neighbors in different hops for the node and aggregates the features of these neighbors to learn the representation for the node. GraphSAGE improves the scalability and flexibility of GNNs. • GraphSAINT [59] is an inductive learning method based on graph sampling. It samples subgraphs and performs GCN on them to overcome the neighbor explosion problem while ensuring unbiasedness and minimal variance. • SGC [51] is a simplified graph convolutional neural network. It reduces the excessive complexity of GCNs by repeatedly removing the non-linearity between GCN layers and collapsing the resulting function into a single linear transformation. This can ensure competitive performance when compared with GCN and significantly reduce the size of parameters. • ARMA [5] is a non-linear and trainable graph filter that generalizes the convolutional layers based on polynomial filters. ARMA can provide GNNs with enhanced modeling capability. • Policy-GNN [27] is a meta-policy framework that adaptively learns an aggregation policy to sample diverse iterations of aggregations for different nodes. It also leverages a buffer mechanism for batch training and a parameter sharing mechanism for diminishing the training cost.

Variants.
We generate several variants of the full RoSGAS model, to more comprehensively understand how each module works in the overall learning framework and better evaluate how each module individually contribute to the performance improvement. RoSGAS mainly comprises three modules: Reinforced Searching Mechanism, Nearest Neighbor Mechanism, and self-supervised learning. We selectively enable or disable some parts of them to carry out the ablation study. The details of these variations are described as follows: • RoSGAS-K: This variant only enables the reinforced searching, without the aid of any other modules, to find out the width ( ) of the subgraph for every target user . Due to the huge scale of the constructed social graph, the search range will be limited to [1,2] to prevent the explosion of neighbors. Nevertheless, such search range can be flexibly customized to adapt to any other scenarios and datasets. In the context of this model variant, the number of layers is fixed to be = 3. • RoSGAS-L: This variant only switches on the reinforced searching mechanism for pinpointing the number of the layers ( ) to stack the GNN model for every target user . The search range will be limited to [1,3] to save computing resources. The width of the subgraph is fixed = 2. In the optimization process of the RL agent, the nearest neighbor module can stabilize the learning in the early stages of RL as soon as possible, and accelerate the model convergence. • RoSGAS contains all modules in the learning framework. The self-supervised learning mechanism is additionally supplemented upon RoSGAS-KL-NN.

Model Training
We use the following setting: embedding size (64), batch size (64), the base layer of RoSGAS (GCN), learning rate (0.05), optimizer (Adam), L2 regularization weight ( 2 = 0.01), and the training epochs (30). As aforementioned in Section 4.4.2, we set the action (range) of searching GNN layers from 1 to 3 and the action (range) of subgraph width searching from 1 to 2 to prevent neighbors from exploding for the DQN [33]. The agent training episodes is set to be 20 and we construct 5-layer of MLP with 64, 128, 256, 128, 64 hidden units. We use the accuracy obtained from the validation set to select the best RL agent and compare the performance with the other models in the test set. As for the nearest neighbor mechanism, we set the (L = 7), the initial 0 = 0.5.

Evaluation Metrics
As the number of labelled benign accounts and malicious accounts in the several data sets used is well-balanced, we utilize Accuracy to indicate the overall performance of classifiers: where is True Positive, is True Negative, is False Positive, is False Negative.

EXPERIMENT RESULTS
In this section, we conduct several experiments to evaluate RoSGAS. We mainly answers the following questions: • Q1: How different algorithms perform in different scenarios, i.e., algorithm effectiveness (Section 5.1). • Q2: How each individual module of RoSGAS contributes to the overall effectiveness (Section 5.2). • Q3: How the RL search mechanism work in terms of effectiveness and explainability (Section 5.3). • Q4: How fast different algorithm can achieve, i.e., efficiency (Section 5.4) and how the RL algorithms can converge effectively (Section 5.5). • Q5: How different algorithms perform when dealing with previously unseen data, i.e., generalization (Section 5.6). • Q6: How to explore the detection result and visualize the high-dimensional data (Section 5.7).

Overall Effectiveness
In this section, we conduct experiments to evaluate the accuracy of the social bot detection task on the five public social bot detection datasets. We report the best test results of baselines, RoSGAS, and the variants. We performed 10-fold cross-validation on each dataset. As shown in Table 3, RoSGAS outperforms other baselines and different variants under all circumstances. This indicates the feasibility and applicability of RoSGAS in wider ranges of social bot detection scenarios. Compared with the best results among all the state-of-the-arts, our method can achieve 3.38%, 9.55%, 5.35%, 4.86%, 1.73% accuracy improvement, on the datasets of  and Botometer-Feedback, respectively.
In the baselines, Node2Vec is always among the worst performers in the majority of datasets. This is because Node2Vec controls the random walk process by setting a probability p to switch between the BFS and the DFS strategy. Node2Vec sometimes fails to obtain the similarity of adjacent nodes in large-scale social graph with extremely complex structures, and does not make good use of node features. GraphSAGE samples the information of neighbors for the aggregation for each node. This design can not only reduce information redundancy but also increase the generalization ability of the model through randomness. However, the proposed random sampling is not suited for super large-scale graph, and the inability to adapt to the change of the receptive field drastically limit its performance. GCN multiplies the normalized adjacency matrix with the feature matrix and then multiplies it with the trainable parameter matrix to achieve the convolution operation on the whole graph data. However, obtaining the global representation vector for a node through full-graph convolution operations would massively reduce the generalization performance of the model. Meanwhile, the increases of receptive field will lead to a soaring number of neighbors, and thus weaken the ability of feature representation. GAT shares weight matrix for node-wise feature transformation and then calculates the importance of a node to another neighbor node, before aggregating the output feature vector of the central node through the weighted product and summation. GAT also experiences the explosion of receptive field and the consequent increase of the neighbor number. Unlike GraphSAGE, GraphSAINT sets up a sampler to sample subgraphs from the original graph. It uses GCN for convolution on the subgraph to resolve neighbor explosion and sampling probability is set to ensure unbiasedness and minimum variance. However, extracting subgraphs in GraphSAINT is random and thus limit the precision of subgraph embedding. SGC simplifies the conventional GCNs by repeatedly removing the non-linearities between GCN layers and collapsing the resulting function into a single linear transformation. Namely, the nonlinear activation function between each layer is removed to obtain a linear model. Compared with GCN, SGC can achieve similar performance, with a slightly-reduced accuracy among all datasets. In addition, RoSGAS also outperforms Policy-GNN and ARMA since these counterparts merely make exclusive improvement on convolution layers. By comparison, our approach takes advantage of subgraph search and GNN architecture search, whilst leveraging self-supervised learning to overcome the limitation of limited labelled samples. These functionalities can fulfill better performance even only based upon the basic GCN layer.

Ablation Study
The second half of Table 3 also compares the performance of multiple variants to demonstrate how to break down the performance gain into different optimization modules. While RoSGAS-only uses the RL agent for subgraph width search, the achieved effectiveness is competitive against the state-of-the-arts in some datasets, such as Varol-17, Cresci-19, and Botometer-Feedback. RoSGAS-that only enables the architecture search can even achieve better accuracy than other baselines in most datasets, except the vendor-19 dataset. These observations are in line with the enhancement provided by the RL capability. Intrinsically, putting the searching mechanisms together will bring synergetic benefits to the effectiveness. Particularly, for datasets Vendor-19, the combination of width search and layer search can significantly make RoSGAS outstanding from the other counterparts, reaching 87.84% accuracy on average. We can also observe that the contribution of layer search to the performance gain appears to be more significant than the width search. This is because the embedding effectiveness is less insensitive to the neighbor selection, and the number of GNN layers can more effectively affect the overall effectiveness. The increased layer can make the nodes closer to the target node more frequently aggregated to form the embedding of the target node. Likewise, nodes far from the target node will be less involved in the embedding. Hence, an enhanced embedding effectiveness can be gained from enabling GNN layer search. These findings indicate the necessity of jointly searching the width of subgraphs and the number of GNN layers to unlock the full potential of performance optimization. As shown in the result of RoSGAS-KL-NN, integrating the nearest neighbor mechanism with the backbone searching mechanism can further enhance the performance gain stemming from the learning process in the RL agent. Most noticeably, the accuracy can be substantially augmented from 68% to 75% by the nearest neighbor design when tackling Varol-17 dataset. Even if in some cases, the improvement is not as significant as that in Varol-17, the similarity driven nearest neighbor scheme can boost the action exploration in the RL agent and thus help with accuracy promotion. Furthermore, we demonstrate an incremental performance gain from adopting the proposed selfsupervised learning mechanism. Across all different datasets, up to 0.7% improvement can be further achieved despite marginal increment observed in some datasets. Further investigation would be required to better leverage large quantities of unlabeled data and enhance the generalization ability of the self-supervised classifiers in different scenarios. This is beyond the core scope of this paper and will be left for future study.

Parameter Searching Result by the RL Agent.
To conduct an in-depth investigation in how effectiveness of the RL search mechanism, we randomly select 20 labeled nodes from the Cresci-15 dataset as the target users and examine the accuracy when adopting some given circumstances of GNN layers. For example, we create 3 types of GNN models, by manually stacking 1 layer of GCN, 2 layers of GCN, and 3 layers of GCN, respectively. We feed the same graph data used in the previous testing into the three models and train 100 times. The trained models are used for validating if the RL can obtain the most proper number of layers for the selected nodes. For each node in the 20 target users, we count the ratio of being correctly classified out of the 100 runs. The   main purpose of this investigation is to examine if the RL-based mechanism can pick up the layer with the highest classification ratio, to automatically enable the best model performance. Fig. 4 shows the ratio obtained for each target node when using different layers. Observably, different GCN layers have a varying impact on the correct prediction of a certain node. For example, the prediction effectiveness of other nodes (e.g., node index 2, 4, 5, 11, 12, 13 and 18 ) will be drastically affected by the number of GNN layers. We reason this phenomenon is because the range of GNN's receptive field will gradually increase when the layer number ramps up; meanwhile, higher order neighbor information will be involved and aggregated, thereby having a direct impact on the detection accuracy. By contrast, some nodes (e.g., node index 6, 8, 9, 15, 16 and 19) can be better predicted no matter what information is aggregated from neighbors with different orders. It is therefore necessary to elaborately select the number of GNN layers for these nodes to increase the probability of correct prediction of these nodes.
We use underline, e.g., 0.92, to mark the final decision made by the RL agent when searching the model layer. The proposed RL agent can select the optimal layer that can deliver the highest prediction ratio. There is only 10% (2 of 20 classification tasks) mismatch between the best layer option and the choice made by the RL agent. This indicates the proposed approach can effectively reduce the manual tuning whilst reaching the best effectiveness. 5.3.2 Impact of different search ranges on the effectiveness. We dive into the impact of parameter selection on the overall effectiveness and demonstrate the sensitivity to such parameter changes. To do so, we first fix the maximum searching bound of the number of search layers of the graph neural network to be 3, whilst gradually increasing the searching bound for the width of the subgraph from 1 to 3. As shown in Fig. 5(a), for all datasets without exception, all the model instances experience a rise of accuracy when the searching range of width grows to 2 but a slight drop when the range is further extended to 3. This is because the increase of width range will lead to a hugely growing number of neighbors involved in the extracted subgraph. Particularly the scale of the constructed graphs in the large-scale datasets are normally large and will lead to the explosion of neighbors, which in turn give rise to the reduced quality of graph embedding and lower accuracy. This observation indicates the search range for extracting subgraphs needs to be carefully modified and adaptive to the scale of a given scenario. Given the best result can be stably obtained by adopting [1,2] as the width range, we then fix this setting and varying the the search range of the number of model layers. We gradually ramp up the upper bound of the rang from 2 to 5. As shown in Fig. 5(b), there is no significant disparities in the effectiveness among different options. The effectiveness is insensitive to the change of model layers despite some noticeable variations. For example, in the Cresci-15 dataset, the model accuracy will reach the peak when choosing 4 as the upper bound of the searching range while for Vendor-19 the accuracy peak will come when searching up to 3 layers. Nevertheless, the discrepancy in accuracy is negligible and the proposed RL-based searching mechanism can more flexibly and adaptively make the best decision in ensuring the best model performance without incurring excessive cost in exploring additional GNN layers.

Efficiency
We primarily evaluate the efficiency by measuring the training time. As the reward signal needs to be obtained from the validation dataset to train the RL agent before constructing GNN stack, we break down the time consumption into two parts -RL and GNN model training. It is worth noting that sparse matrix multiplication used in PyTorch Geometric can enable GNNs to be applied in very large graphs and accelerate the model training. Table 4 presents the average time consumption of running each model 10 times. Overall, RoSGAS can strike a balance between the training time and the effectiveness. Although ARMA and SGC take less time to train their model due to the simplified GCN model through removing non-linearity and collapsing weight matrices between consecutive layers, the achieved accuracy is far lower than RoSGAS across all datasets, particularly on Cresci-19 where the labels are scarcer. Policy-GNN takes the longest time for model training simply because the GNN stacking and convolution operation will be carried out for all nodes in the entire graph.
Most notably, the variant RoSGAS-which does not include the nearest neighbor mechanism and the self-supervised learning mechanism can achieve competitive training efficiency compared with GCN, GAT, and GraphSAINT, only with a marginal time increase. The slight difference is negligible when considering RoSGAS-needs to train both the RL agent and the GNN model separately. Compared with RoSGAS-, RoSGAS--intrinsically needs extra time to search the set of state-action pairs that have been explored and ascertain the nearest neighbor to the     current state-action pair, before modifying the expectation of the reward for optimized network parameters. RoSGAS additionally involves the self-supervised learning based on the target user batch to extract the homologous subgraphs for additional forward propagation.
In addition, the time consumption for Cresci-15 is far larger than that for . There is a linearly-increased time consumption of GCN and GAT when the graph scale soars. In fact, the GNN training is more efficient since we only need to perform convolution operations on the sampled subgraph; by contrast, each iteration of GCN and GAT will have to perform a convolution operation on all nodes of an entire graph. RoSGAS is solely relevant to the extracted number of subgraphs for detecting the target users, and thus independent from the scale of the entire graph. This clearly showcases the inherent scalability and robustness of our sample and subgraph based mechanism adopted in RoSGAS.

Stability
We also compare the stability of the RL-based architecture search between RoSGAS and Policy-GNN. Fig. 6 demonstrates the detailed training process with the RL agent on  and Botometer-Feedback, respectively. The dotted line represents the accuracy obtained in the validation set during the 150 episodes. Obviously, RoSGAS can promptly achieve high accuracy under all the datasets and the mean accuracy can be achieved only after 15 RL agent training episodes. Meanwhile, once reaching this point, a stable state of Nash equilibrium can be steadily maintained without huge turbulence.
By contrast, the accuracy of Policy-GNN is noticeably lower than RoSGAS and lacks stability, i.e., very obvious fluctuations manifest. The disparity mainly stems from the design of the state transition and the nearest neighbor mechanism. RoSGAS uses the embedding of the initial subgraph as the state input to the RL agent, and jumps between the initial subgraphs as the state transition, while Policy-GNN uses the node embedding as the state input and jumps between the nodes as the state transition. Undoubtedly, the embedding of the initial subgraph as a state can better reflect the local structure of a targeted node, resulting in a stronger representation ability, and hence the enhanced stability. At the same time, during the RL agent training episodes, for a specific state-action pair of one transition, the nearest neighbor mechanism explores the existing pairs and exploits the reward pertaining to this nearest neighbor from the environment. The reward is used as a part of the label to optimize the Q-network, which greatly eliminates the difference between the target network prediction and the actual reward in the initial stage. As a result, the RL agents can achieve higher accuracy with only a few training episodes.
Interestingly, RoSGAS has different volatility across different datasets and the magnitude of volatility is positively correlated to the average correct rate. This indicates the node feature distribution and graph structure pertaining to each individual dataset have a non-trivial impact on the model training. The in-depth study will be left for future work.

Generalization
In the field of social bot detection, the continuous evolution of social bots' camouflage technology has brought generalization challenges to the model design. To identify the emerging attack methods of social bots and mine diverse user information, a robust detection model should have a high level of generalization. In this subsection, we examine the generalization of RoSGAS and compare with other baselines. 5.6.1 Out-of-sample Validation Accuracy. Apart from the in-sample validation in previous subsections, the most effective way to demonstrate the strong generalization is to perform out-of-sample validation, i.e., retaining some of the sample data for model training, and then using the model to make predictions for unseen data and examine the accuracy. To do so, we select one dataset as the training dataset and then use other datasets as the test dataset. We divide the training set into 10 equal parts, take one part of the training set for training each time, and train each baseline for 30 epochs. We use the trained models to predict the labelled accounts in the test datasets to calculate the accuracy.
A series of figures including Fig. 7, Fig. 8, Fig. 9, Fig. 10 and Fig. 11 show the prediction results when the training is based upon , and Botometer-Feedback, respectively. It is obviously observable that RoSGAS outperforms all other baselines in the vast majority of scenarios. The only exceptions are when the model is trained based on Vendor-19 and validated on Cresci-15 dataset, or when the model is trained based on Cresci-15 whilst validating upon Vendor-19. In this two cases, the accuracy of RoSGAS is slightly lower than GCN. We reason this phenomenon is possibly because GCN is less sensitive to the disparity between two datasets.  Unsurprisingly, all models has a reduced accuracy when conducting the out-of-sample prediction as opposed to its in-sample accuracy, simply because of the potential overfitting in the in-sample evaluations. The experiments carried out in this subsection generically showcase the robustness and generalization of our approach when handling new data where different noise manifests.  Fig. 11. Train on the Botometer-Feedback and testing on different dataset Fig. 12 visualizes the result of t-SNE dimensionality reduction on the representation vectors of users. We evaluate each model based on three given datasets, respectively. For each baseline model, the results on the three datasets are placed in a row. Numerically, the homogeneity score of RoSGAS is higher than other baselines when adopting all datasets. For example, the score of RoSGAS is over 2 times higher than that of GraphSAGE on average, indicating the most distinguishable represent vectors can be obtained by our approach. The visualization completely aligns with the measurement. Observably, the bots in RoSGAS can be far more easily differentiated from the benign users.

DISCUSSION
Significance of subgraph-based and RL-guided solution. This work is to advance the development and application of GNNs in the field of social bot detection. The performance of features-based, statistics-based and deep learning based methods fades facing the evolving bot technologies. We applied the GNN to leverage the information of the neighborhood and relationship to counter the development of bots. This work is non-trivial when tackling massive datasets with hundreds of thousands or even millions of nodes. The existing solutions to complex model architecture search is not well-suited for the problem of social bot detection at scale under study -the data distribution becomes more non-IID due to the evolution of the bots, which complicates the model design with good generalization in practice. The extremely-large scale of the social network graph also leads to tremendously different user structures and necessitates adaptive detection of such structures with reasonable computational costs. To this end, we proposed to search subgraphs to realize the reduction of graph scale, the simplification of model architectures, and the improvements of the detection performance. Necessity of using RL. The width ( ) of the subgraph cannot be a common hyperparameter shared by all nodes and requires node-by-node personalization. In fact, social bots tend to randomly follow benign accounts as a disguise. The selection of primarily derives from our behavioural studies -There are noticeably enough bots in the subgraph within 2th-order subgraph while benign nodes could be well recognized in the 1th order subgraph. Increasing the value would not incur additional performance gain but involve an overwhelming number of neighbors. Nevertheless, the range can be flexibly configured to adapt to any other scenarios and datasets. This necessitates the adoption of RL to facilitate the customized parameter search for each individual subgraph. Dealing with real-time streaming scenarios. Critical challenges for on-the-fly bot detection encompass the need of message delivery, distributed event store and the capability of handling revolution and uncertainty of events and entities in the social network platform over time. This is particularly intricate due to the presence of new bots. The accuracy of offline learning models highly relies on the quality and quantity of the dataset that is fed into the models. However, this will be time-consuming and costly in real-time scenarios and the model update is required to maintain the high standard of model accuracy. In practice, to implement the streaming pipeline, a distributed crawler needs to be developed to continuously fetch social network information. The collected data is then forwarded to processing modules through distributed event streaming such as Kafka. More online and incremental designs are desired to underpin the on-the-fly version of the current bot detection framework.

RELATED WORK
In this section, we summarize the related literature and state-of-the-art approaches. The existing literature can be roughly classified into three categories: GNN based approaches, subgraph and RL based approaches, and self-supervised enhanced approaches.

GNN based Social Bot Detection
Early social bot detection mainly focuses on manually analyze the collected data to find discriminative features that can be used to detect the social bot. However, the detection features are easy to imitate and escaped by social bots which are constantly evolving, and eventually become invalid. The recent boom of Graph Neural Networks (GNNs) has promoted the latest progress in social bot detection. The first attempt to use GNN to detect social bots [2] is mainly by combining the graph convolutional neural network with multilayer perception and belief propagation. The heterogeneous graph is constructed and original node features are extracted by the pre-trained language model to get the final node embedding after aggregating by the R-GCN model [17], the BotRGCN successfully surpass the performance of traditional detection methods on the newly released dataset called TwiBot-20 [16]. The heterogeneous graph is also applied in [15], it also proposes a relational graph transformer inspired from natural language processing to model the influence between users and learn node representation for better social bot detection, and its performance exceeds the BotRGCN. However, these node embedding and node classification based methods perform convolution at the level of the entire graph, after stacking multiple layers of GNN on the tremendous scale of social graph will cause the over-smoothing problem [30,53]. Subgraph provides a new perspective to solve this issue, [31] constructs a heterogeneous graph and reconstructs subgraphs based on manually-defined heuristic rules for detecting malicious accounts in online platforms. However, this kind of manual-based method not only consumes energy to set the extraction rules but also cannot be easily generalized to the field of social bot detection.

Subgraph and RL based Approaches
The scale of the graph constructed from the social network is tremendous. Performing convolution operation on the entire graph will not only consume computing resources but also lead to performance degradation due to problems such as over-smoothing. The extraction of subgraphs either requires domain-specific expert knowledge to set the heuristic rules [31,58] or needs to design motif for matching subgraphs [35,54], which drastically limits the flexibility and capability of generalization. To address this issue, we leverage Reinforcement Learning (RL) to adaptively extract subgraphs. There have been a few attempts to marry RL and GNNs. DeepPath [52] establishes a knowledge graph embedding and reasoning framework that utilizes the RL agent to ascertain the reasoning paths in the knowledge base. RL-HGNN [62] devises different meta-paths for any node in a HIN for adaptive select meta-path to learn its effective representations. CARE-GNN [14], RioGNN [37] RTGNN [61] and FinEvent [38] all marry the RL and GNNs for dynamically optimizing the similarity threshold to achieve the purpose of selecting more valuable neighbour nodes for the aggregated nodes, to obtain more effective representation vectors for fraud detection or event detection. Policy-GNN [27] utilizes RL to select the number of GNN architecture layers for aggregating the node embedding vectors to classify nodes. GraphNAS [20] is among the first attempts to combine the recurrent neural network with GNNs. It continuously generates descriptions of GNN architecture to find the optimal network architecture based on RL by maximizing the expected accuracy. Similarly to the architecture search in GraphNAS, Auto-GNN [63] additionally proposes a parameter sharing mechanism for sharing the parameters in homogeneous architecture for reducing the computation cost. However, these methods are not combined with the subgraph method and their optimization is tightly coupled with specific datasets. They are not suited for detecting graphs that follow a power-law distribution with huge disparities among different users [4,34]. By contrast, our approach relies on subgraph embedding to achieve high detection effectiveness without compromising time efficiency, and has strong generalization across multiple datasets.

Self-Supervised Learning Approaches on Graphs
In recent years, self-supervised learning has hugely advanced as a promising approach to overcome the limited data annotation and limited and to enable a target objective achieved without supervision. The technology has been investigated in a wide range of domains, such as natural language processing [11,60], computer vision [28,46] and graph analysis [22,25]. At the core of selfsupervised learning is to define an annotation-free pretext task to train an encoder for representation learning. Particularly for graph analysis, there are a few works of literature about designing selfsupervised tasks based on either edge attributes [10,44] or node attributes [12]. However, the inherent dependencies among different nodes in the topology hinder the appropriate design of the pretext tasks. DGI [49] trains a node encoder to maximize the mutual information between the node representations and the global graph representation. GMI [39] defines a pretext task that maximizes the mutual information between the hidden representation of each node and the original features of its 1-hop neighbors. InfoGraph [43] maximizes the mutual information between the graph embeddings and the substructure embeddings at different scales to more effective learn graph embeddings. However, the aforementioned self-supervised learning approaches need to take the holistic graph as the input, which is time-and resource-consuming and thus restricts the scalability on large-scale graphs. Our approach aims to obtain a subgraph-level representation to ensure non-homologous subgraphs are discriminative while homologous subgraphs have similar representation vectors.

CONCLUSION
This paper studies a RL-enabled framework for GNN architecture search. The proposed RoSGAS framework can adaptively ascertain the most suitable multi-hop neighborhood and the number of layers in the GNN architecture when performing the subgraph embedding for the social bot detection task. We exploit HIN to represent the user connectivity and use multi-agent deep RL mechanism for steering the key parameter search. The subgraph embedding for a targeted user can be more effectively learnt and used for the downstream classification with competitive accuracy whilst maintaining high computation efficiency. Experiments show that RoSGAS outperforms the state-ofthe-art GNN models in terms of accuracy, training efficiency and stability. RoSGAS can more quickly achieve, and carry on with, high accuracy during the RL training, and has strong generalization and explainability. We believe the data-centric solution guided by behavioural characterization and reinforcement learning -instead of heavily complicating the network architecture itself -would be a promising and innovative direction, which is both scientifically and engineering-wise challenging in the field of bot detection. In the future, we plan to examine the impact of feature distribution and graph structure on model training, and extend RoSGAS to underpin the streaming scenarios.