Source-linked AI summary
LMBot: Distilling Graph Knowledge into Language Model for Graph-less Deployment in Twitter Bot Detection
Zijian Cai, Zhaoxuan Tan, Zhenyu Lei, Zifeng Zhu, Hongrui Wang, Qinghua Zheng, Minnan Luo
TL;DR
Twitter bot detection needs alternatives to graph-based inference because multi-hop neighbor retrieval is time-consuming and may introduce sampling bias. LMBot distills GNN knowledge into language models through iterative mutual enhancement, enabling graph-less inference. It achieves state-of-the-art performance on four benchmarks, while training cost, sequence length, and deployment risks remain important boundaries.
Problem
Graph-based Twitter bot detection depends on costly multi-hop neighbor retrieval, while graph-less methods need stronger adaptation and graph knowledge.
Source: §1 · pp. 1–2, §2.1 · p. 4Method
LMBot represents users as text, adapts an LM, and iteratively transfers information between the LM and GNN using embeddings and soft labels.
Source: §3.2.1 · p. 5, §3.2.3 · p. 6Results
Takeaways & Limitations
The resulting LM can perform bot detection without graph structure, avoiding neighbor fetching and graph sampling bias during inference.
Source: §5 · p. 8LMBot is more computationally intensive to train, and limited LM sequence length excludes some user information.
Source: E LIMITATIONS AND FUTURE WORK · p. 11
Abstract
from arXiv · showhide
As malicious actors employ increasingly advanced and widespread bots to disseminate misinformation and manipulate public opinion, the detection of Twitter bots has become a crucial task. Though graph-based Twitter bot detection methods achieve state-of-the-art performance, we find that their inference depends on the neighbor users multi-hop away from the targets, and fetching neighbors is time-consuming and may introduce bias. At the same time, we find that after finetuning on Twitter bot detection, pretrained language models achieve competitive performance and do not require a graph structure during deployment. Inspired by this finding, we propose a novel bot detection framework LMBot that distills the knowledge of graph neural networks (GNNs) into language models (LMs) for graph-less deployment in Twitter bot detection to combat the challenge of data dependency. Moreover, LMBot is compatible with graph-based and graph-less datasets. Specifically, we first represent each user as a textual sequence and feed them into the LM for domain adaptation. For graph-based datasets, the output of LMs provides input features for the GNN, enabling it to optimize for bot detection and distill knowledge back to the LM in an iterative, mutually enhancing process. Armed with the LM, we can perform graph-less inference, which resolves the graph data dependency and sampling bias issues. For datasets without graph structure, we simply replace the GNN with an MLP, which has also shown strong performance. Our experiments demonstrate that LMBot achieves state-of-the-art performance on four Twitter bot detection benchmarks. Extensive studies also show that LMBot is more robust, versatile, and efficient compared to graph-based Twitter bot detection methods.
1 INTRODUCTION
Twitter bot detection needs effective methods that avoid graph-based inference’s costly multi-hop neighbor queries and sampling bias. LMBot addresses this by distilling graph knowledge into language models for graph-less deployment.
- The framework is motivated by bots’ role in disseminating misinformation, manipulating opinion, and facilitating fraudulent activities.Source: §1 · p. 1
- Graph-based inference requires increasingly many multi-hop neighbors, making API-based deployment time-consuming and vulnerable to sampling bias.Source: §1 · p. 2, Figure 1 · p. 2
- Finetuned language models outperform state-of-the-art non-graph-based methods and closely rival graph-based performance without neighbor information.Source: §1 · p. 2, Figure 2 · p. 2
- LMBot represents users as textual sequences, adapts the language model, and iteratively exchanges embeddings and soft labels between the LM and GNN.Source: §1 · p. 2
- Replacing the GNN with an MLP extends LMBot to datasets without graph structure.Source: §1 · p. 3
- LMBot achieves state-of-the-art performance on four Twitter bot detection benchmarks while outperforming 10 competitive baselines.Source: §1 · p. 3
2 RELATED WORK
Prior Twitter bot detection uses metadata, text, graph structure, or multiple modalities, while knowledge distillation transfers information between teacher and student models. LMBot extends this direction by distilling heterogeneous graph knowledge into language models that can perform graph-free inference.
2.1 Twitter Bot Detection
- Twitter bot detection research includes feature-based, text-based, graph-based, and multimodal methods using metadata, tweets, network structure, and combined information sources.Source: §2.1 · p. 3
- Graph-based methods exploit Twitter’s network structure and generally outperform non-graph methods, but require expensive neighborhood retrieval for deployment.Source: §2.1 · pp. 3–4
2.2 Knowledge Distillation
- Knowledge distillation typically transfers a trained teacher’s knowledge to a student model to reduce parameters and computation.Source: §2.2 · p. 4
- Existing cross-model work includes distilling GNN knowledge into MLPs and alternately training language models and GNNs through pseudo-labels.Source: §2.2 · p. 4
- LMBot addresses the under-explored problem of distilling text-rich heterogeneous network information into language models, with LM and GNN mutually enhancing one another.Source: §2.2 · p. 4, Figure 3 · p. 4
3 METHODOLOGY
LMBot represents Twitter users as textual sequences, adapts a language model to the task, and iteratively exchanges information between the LM and GNN/MLP. This process distills graph knowledge into the LM while supporting graph-based and graph-less deployment.
3 METHODOLOGY
- LMBot presents each user as a textual sequence, obtains LM embeddings, and iteratively transfers graph knowledge from GNNs into the LM through soft labels.The framework first performs LM domain adaptation, then alternates LM and GNN/MLP updates using knowledge distillation.Source: §3 · p. 4, §3.2 · p. 5, §3.2.1 · p. 5
3.1 User as a Textual Sequence
- Metadata, descriptions, and tweets are organized with special tokens into a unified user sequence that can be processed by the language model.The representation includes metadata, descriptions, and tweets, with noise such as hashtags, mentions, and URLs normalized before encoding.Source: §3.1 · pp. 4–5
3.2.1 LM domain adaptation finetuning.
- Domain-adaptation finetuning encodes user sequences, mean-pools LM outputs into 768-dimension embeddings, and trains a two-class prediction head with hard labels.The objective includes L2 regularization for LM parameters, while the adaptation step is intended to improve stability and convergence speed.Source: §3.2.1 · p. 5
3.2.2 GNN/MLP step.
- For graph-structured datasets, the GNN consumes LM embeddings, performs message passing and aggregation, and produces user prediction logits.For datasets without graph structure, LMBot replaces the GNN with an MLP operating on LM-generated embeddings.Source: §3.2.2 · p. 5
- After GNN/MLP training, the best validation model generates soft labels that serve as teacher signals for the subsequent LM update.The distillation temperature controls the difficulty of transferring this knowledge.Source: §3.2.2 · p. 5, §3.2.3 · p. 6
3.2.3 LM step.
- The LM step combines hard-label cross entropy with soft-label Kullback-Leibler divergence, balancing them with coefficient α.The best LM checkpoint on the validation set supplies embeddings for the next GNN training step.Source: §3.2.3 · p. 6
3.3 Training and Inference
- Training begins with LM domain adaptation and then alternates GNN/MLP and LM updates until validation performance stops improving.After convergence, both the LM and GNN/MLP can be used for inference as LMBot-LM and LMBot-GNN/MLP.Source: §3.3 · p. 6
4 EXPERIMENTS
Across four Twitter bot detection benchmarks, LMBot consistently outperforms all baselines, while its LM component remains robust across GNN choices and supports efficient iterative training and graph-less deployment. The studies further show prediction consistency, data efficiency, and the importance of the full iterative design.
4.1 Experimental Settings
- The experiments use four benchmarks and compare LMBot with ten feature-, text-, and graph-based baselines across repeated runs.Results are averaged over five runs with standard deviations.Source: §4.1 · p. 6
4.2 Main Results
- LMBot consistently outperforms all baseline methods across four datasets with or without graph structure, including graph-less inference.It surpasses state-of-the-art baselines by 0.37%, 0.97%, 0.67%, and 0.40% on the reported datasets.Source: §4.2 · p. 6, Table 1 · p. 7
4.3 Combination of Different GNNs and LMs
- LM performance remains relatively stable across GNN combinations, whereas GNN performance depends strongly on both the LM and GNN selected.T5 averages 84.94, close to 85.5 for the other models, while GAT reaches 84.46 with DeBERTa but 76.47 with T5.Source: §4.3 · pp. 6–7, Figure 4 · p. 7
4.4 Convergence Analysis
- The iterative process mutually improves LM and GNN performance, and domain-adapted LMs converge in fewer iterations than untuned LMs.Even lower-performing models such as T5 require fine-tuning to converge to the optimal value.Source: §4.4 · p. 7, Figure 5 · p. 7
4.5 Prediction Consistency
- LM and GNN/MLP predictions are highly consistent, with matching prediction regions comprising 99.59% of Cresci-2017 points and 95.77% of TwiBot-20 points.The remaining probability differences are attributed to model-specific inductive biases that can be learned through iteration.Source: §4.5 · p. 8, Figure 6 · p. 8
4.6 Data Efficiency Study
- LMBot remains relatively stable with only 10% to 100% of training labels and robust when retaining only 10% to 100% of graph edges.These experiments evaluate label-level and edge-level data efficiency separately.Source: §4.6 · p. 8, Figure 7 · p. 8
4.7 Ablation Study
- The full LMBot model outperforms ablations, while removing metadata has an especially large effect on performance.The ablations compare LM-only finetuning, GNN-only training, and replacing GNN with MLP during iteration.Source: Table 2 · p. 8, §4.7 · p. 8
5 CONCLUSION
LMBot distills social-network information from GNNs into an LM, enabling graph-free Twitter bot detection. It achieves state-of-the-art performance on four benchmarks and is reported as more robust, versatile, and efficient than prior graph-based methods.
- LMBot achieves state-of-the-art performance on four widely used Twitter bot detection benchmarks.Source: §5 · p. 8
- Graph-free LM inference addresses the time and sampling-bias issues caused by retrieving multi-hop neighbors.Source: §5 · p. 8
- Extensive studies report that LMBot is more robust, versatile, and efficient than previous state-of-the-art graph-based methods.Source: §5 · p. 8
6 ETHICAL CONSIDERATIONS
LMBot is intended to assist rather than replace human judgment in Twitter bot detection. Its predictions and underlying models may create risks through false positives and inherited bias.
- LMBot is designed as an assistive tool rather than the sole decision maker, so human judgment remains essential for deployment on real social networks.Source: §6 · p. 9
- False positives may identify legitimate accounts as bots and create serious implications for individuals or organizations spreading crucial information.Source: §6 · p. 9
- Both the LM and GNN may inherit biases, including stereotypes from pretraining data and discrimination against certain demographic groups.Source: §6 · p. 9
A ALGORITHM FOR TRAINING LMBOT
Algorithm 1 initializes LM and GNN/MLP parameters, preprocesses each user’s textual sequence, and obtains user embeddings during LMBot training.
- The algorithm outputs optimized LM parameters ΘLM and optimized GNN/MLP parameters ΘGNN/MLP.Source: A ALGORITHM FOR TRAINING LMBOT · p. 11
- Training initializes ΘLM and ΘGNN/MLP before iterating over users in the dataset S.Source: A ALGORITHM FOR TRAINING LMBOT · p. 11
- For each user, the algorithm preprocesses the textual sequence t_i and obtains the user embedding z_i from Equation (1).Source: A ALGORITHM FOR TRAINING LMBOT · p. 11
B DATASET STATISTICS
Table 3 presents statistics for the four selected datasets.
- Table 3 reports statistics for the four selected datasets.Source: Table 3 · p. 11
C BASELINE DETAILS
The baselines span feature-based, graph-based, and graph-transformer approaches, combining engineered metadata and tweet features with increasingly structured graph models.
- BotRGCN combines RoBERTa encodings of tweets and descriptions with numerical and categorical features in an RGCN classifier.Source: C BASELINE DETAILS · p. 11
- RGT uses graph transformers for each relationship type and semantic attention across relationships to learn user representations.Source: C BASELINE DETAILS · p. 11
- SGBot, BotHunter, Kudugunta et al., and LOBO use metadata or tweet features with random forests or boosting-based classifiers.Source: C BASELINE DETAILS · p. 11
- GLNN distills GNN knowledge into an MLP for fast inference without graph structure, while BIC and BotBuster combine multimodal or mixture-of-experts designs.Source: C BASELINE DETAILS · p. 11
D IMPLEMENTATION DETAILS
LMBot is implemented with established deep-learning, graph-learning, machine-learning, and transformer libraries, with reproducibility supported by reported hyperparameters.
- The implementation uses PyTorch, PyTorch Geometric, scikit-learn, and Transformers.Source: D IMPLEMENTATION DETAILS · p. 11
- Experiments run on one Tesla V100 GPU with 32 GB of memory.Source: D IMPLEMENTATION DETAILS · p. 11
- LMBot hyperparameter settings are provided in Table 4.Source: D IMPLEMENTATION DETAILS · p. 11, Table 4 · p. 11
E LIMITATIONS AND FUTURE WORK
LMBot’s main limitations are training cost and limited input coverage caused by language-model sequence-length constraints, motivating future scalability and representation improvements.
- Training LMBot is more computationally intensive and time-consuming than graph-based methods, complicating application to large-scale datasets such as TwiBot-22 [9].Source: E LIMITATIONS AND FUTURE WORK · p. 11
- A 512-token maximum input length for RoBERTa [30] prevents LMBot from incorporating all user information and limits the proportion of included tweets.Source: E LIMITATIONS AND FUTURE WORK · p. 11
- Future work targets large-scale deployment, more comprehensive use of user information, and more effective textual information extraction.Source: E LIMITATIONS AND FUTURE WORK · p. 11