Social robot detection method and system based on causal intervention and mixed experts
By combining causal intervention and hybrid expert social robot detection methods with pseudo-environment estimators and graph Transformer encoders, cross-environment invariant causal features are extracted, solving the problem of declining generalization performance of social robot detection methods in different environments and achieving stable cross-environment detection and evaluation.
Patent Information
- Application Number
- CN202511516143.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-10-23
AI Technical Summary
Existing social robot detection methods exhibit decreased generalization performance when faced with different environmental distributions, making it difficult to effectively identify social robots, especially in cross-platform and cross-time period detection.
We employ a social robot detection method based on causal intervention and hybrid experts. This method combines a pseudo-environment estimator with a graph Transformer encoder enhanced by a hybrid expert mechanism. By extracting cross-environment invariant causal features, we generate environment-aware weights using the Gumbel-Softmax relaxation technique. Finally, we train the model by jointly optimizing the objective function to enhance its generalization ability.
It breaks through the bottleneck of out-of-distribution generalization, improves the stability and detection performance of the model in cross-environment detection, significantly improves the extraction accuracy and detection accuracy of key features of social robots, establishes a complete OOD evaluation system, and fills the standard gap in cross-domain verification.
Smart Images

Figure CN120996084A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of social robot detection, and in particular to a social robot detection method and system based on causal intervention and mixed experts. BACKGROUND
[0002] Social robots pose a serious threat to social network platforms. They manipulate public opinion, disrupt information dissemination, and engage in malicious advertising activities by automating interactions and generating deceptive content, thereby undermining the integrity of the online ecosystem. As social networks become increasingly complex, effective identification of social robots has become a pressing research problem. At the same time, social robots often play the role of "information amplifiers" in public opinion dissemination, and their abnormal active interaction behavior can mislead public perception, exacerbate information polarization, and even interfere with social governance and public policy formulation. Therefore, conducting social robot detection research not only helps to maintain the credibility and healthy development of social networks, but also has important significance for strengthening network public opinion supervision and ensuring social information security.
[0003] Most existing social robot detection methods assume that training data and test data come from the same environmental distribution. However, in real-world applications, the characteristics of social platform data will continue to evolve due to platform mechanism updates, changes in user behavior, and the emergence of new social trends. When the model cannot effectively adapt to changes in the environmental distribution, its generalization performance will decrease significantly. For example, certain features may have strong discriminative power in a specific platform or time period, but may become irrelevant or even misleading in different contexts. Cresci et al. pointed out that before 2015, features such as the number of likes and the number of retweets had strong discriminative power in social robot detection, but after 2015, the role of these features gradually weakened, and even became potential interference factors. To address this challenge, some researchers have attempted to improve the robustness and generalization ability of the model through more extensive feature engineering and contrastive learning techniques.
[0004] However, methods based on feature extraction or contrastive learning still generally assume consistent training and test data distribution, making it difficult to capture key features that remain stable and are not affected by external interference in different environments. This limitation reduces the model's cross-domain generalization ability. SUMMARY
[0005] The existing detection method mainly focuses on the performance on a single data set, ignoring the key challenge of out-of-distribution (OOD) generalization. To overcome this limitation, the present application proposes a social robot detection method based on causal intervention and mixed experts, which combines a pseudo-environment estimator and a mixed expert mechanism enhanced graph Transformer (MoE-GT) encoder to extract robust causal features and eliminate the interference of mixed environmental factors. By ensuring that the extracted features remain unchanged under distribution migration, the causal inference framework significantly improves the generalization ability of the model.
[0006] To achieve the above object, the technical scheme adopted is: The present application provides a social robot detection method based on causal intervention and mixed experts, comprising the following steps: Step 1, obtain the graph structure data of the social network, determine the account real label through expert annotation, and construct a graph with accounts as nodes according to the interaction relationship; Step 2, build a CausBot model, which includes a pseudo-environment estimator and a mixed expert mechanism enhanced graph Transformer encoder; Step 3, estimate the potential environment distribution to which each node belongs through the pseudo-environment estimator, and generate environment perception weights based on the Gumbel-Softmax relaxation technique; Step 4, use the mixed expert mechanism enhanced graph Transformer encoder to encode the node features at multiple levels under the regulation of the environment perception weights, to extract causal features that are invariant across environments; Step 5, train the CausBot model by using a joint optimization objective function, which optimizes the parameters of the pseudo-environment estimator and the mixed expert mechanism enhanced graph Transformer encoder, and the objective function includes a supervised loss term and a KL divergence regularization term; Step 6, extract causal features based on the trained CausBot model, estimate the robot probability of the input social network account node, and output its label whether it is a robot by Softmax.
[0007] According to the social robot detection method based on causal intervention and mixed experts of the present application, further, the specific implementation process of the pseudo-environment estimator in step 3 is: In the first l layer graph Transformer, the hidden representation v of the node is linearly mapped and normalized to obtain the pseudo-environment probability distribution : ; wherein, A learnable environment perception projection matrix, representing nodes v In the first l layer after aggregation of the feature vectors, representing nodes v In the first l layer of the pseudo-environment probability distribution; Generating nodes v In the first l layer of the environment perception weight of the k environment factor : ; wherein, is random noise, , is a temperature coefficient, when the output approaches discrete sampling, and when the distribution degenerates into a uniform distribution; is the probability distribution of node l in the first v layer belongs to the k pseudo-environment.
[0008] According to the social robot detection method based on causal intervention and mixed experts according to the present application, further, the specific implementation process of the enhanced graph Transformer encoder of the mixed expert mechanism in step 4 is: In the first l layer of each expert module, the features v of node and the features u of neighbor nodes are respectively linearly transformed to generate query vectors , key vectors and value vectors , and the calculation formula is: ; wherein, represents a linear layer, are the learnable weight matrices of the first l layer query, key and value, respectively; The attention coefficient v between node u and node is calculated, activated by LeakyReLU function and normalized by Softmax; The features of the neighbor nodes are weighted and aggregated based on the attention coefficient , and the outputs of multiple attention heads are calculated in parallel and spliced to obtain node v in the first lIntermediate feature representation of a layer ; Environment-aware weight according to pseudo-environment estimator output , the outputs of the K expert modules are weighted and fused to obtain the node v feature representation of the node l in the first layer.
[0009] According to the social robot detection method of the present application based on causal intervention and mixed experts, further, the node v feature representation of the node l in the first layer, the calculation formula is: ; wherein, is the node k output by the v expert module. l feature in the first layer.
[0010] According to the social robot detection method of the present application based on causal intervention and mixed experts, further, the expression of the joint optimization objective function in step 5 is: ; wherein, E represents a pseudo-environment, G represents a graph structure, represents a predicted label, is a pseudo-environment estimator, is a predictor, is an environment prior distribution, is a supervised loss expectation under the pseudo-environment distribution , is the KL divergence of the pseudo-environment distribution and the environment prior distribution , is a balance coefficient.
[0011] According to the social robot detection method of the present application based on causal intervention and mixed experts, further, the specific calculation form of the joint optimization objective function is: ; wherein, is the number of nodes in the training set, is the one-hot vector of the true label of the node v , is the predicted probability distribution output by the model, L is the total number of layers of the graph Transformer, K is the number of pseudo-environment categories, node v In the first l layer the k environmental perception weight of the environmental factor, In the first l layer node v The probability distribution of the first k pseudo environment.
[0012] According to the social robot detection method based on causal intervention and mixed experts of the present application, further, the environment prior distribution Set to uniform distribution, that is, the prior probability of each pseudo environment is .
[0013] According to the social robot detection method based on causal intervention and mixed experts of the present application, further, the method also includes distribution out generalization test strategy, including the following two modes: CausBot-SD: generate multiple pseudo environments on a single dataset, where part of the pseudo environment dataset is used for training and distribution in test, and the remaining pseudo environment dataset is used for distribution out test; CausBot-MD: use multiple real world datasets, where one dataset is used as the source domain for training and distribution in test, and the remaining datasets are used as the target domain for distribution out generalization evaluation.
[0014] According to the social robot detection method based on causal intervention and mixed experts of the present application, further, in the CausBot-SD mode, the generation method of pseudo environment is: Through the environment-specific perturbation of the original graph structure by the graph structure generator, multiple pseudo environment graph data are generated: ; Wherein, The generated graph data under the first P pseudo environment, Indicates the graph structure generator based on the original graph data, Indicates the noise generator based on the environment indication vector, Is the indication vector of the first P pseudo environment, when the node belongs to the first P pseudo environment, the corresponding position is 1, and the remaining positions are 0.
[0015] Further, the present application also provides a social robot detection system based on causal intervention and mixed experts, comprising: A data acquisition module for acquiring graph structure data of a social network, determining account real labels through expert annotation, and constructing a graph with accounts as nodes according to interaction relationships; a model construction module configured to construct a CausBot model, the CausBot model comprising a pseudo-environment estimator and a mixed-expert mechanism enhanced graph Transformer encoder; an environment estimation module configured to estimate a potential environment distribution to which each node belongs by the pseudo-environment estimator, and generate environment-aware weights based on a Gumbel-Softmax relaxation technique; a feature encoding module configured to utilize the mixed-expert mechanism enhanced graph Transformer encoder to encode node features at multiple levels under the regulation of the environment-aware weights, so as to extract cross-environment invariant causal features; a model training module configured to train the CausBot model by using a joint optimization objective function, and simultaneously optimize parameters of the pseudo-environment estimator and the mixed-expert mechanism enhanced graph Transformer encoder, the objective function comprising a supervised loss term and a KL divergence regularization term; a detection prediction module configured to extract causal features based on the trained CausBot model, estimate robot probability of an input social network account node, and output a label indicating whether the input social network account node is a robot by Softmax.
[0016] The above technical solution has the following beneficial effects: 1. Breaking the distribution out generalization bottleneck and improving the cross-environment detection stability The present application first focuses on the distribution out generalization problem in the field of social robot detection, effectively decouples the environment pseudo-related factors (such as platform-specific features and time period data bias) and the cross-environment invariant causal features (such as robot abnormal interaction mode and fixed network structure) through the causal inference framework and the “backdoor adjustment” strategy, so that the model can maintain stable detection performance in the data distribution migration scene (such as cross-platform and cross-time period detection), and solves the generalization performance degradation problem caused by environmental changes in traditional methods.
[0017] 2. Innovating the model architecture to strengthen the feature extraction and global interaction capturing ability The graph Transformer (GT) encoder is designed to integrate causal modeling and mixed-expert mechanism (MoE), which can dynamically adjust the feature extraction strategy of multiple expert modules through MoE to adapt to feature differences in different environments, and can accurately capture complex global interactions and high-order dependencies between accounts by the multi-head self-attention mechanism of GT, significantly improving the extraction accuracy of key features of social robots, and the detection performance is superior to the comparative method without introducing causal modeling.
[0018] 3. Establishing a complete OOD evaluation system to improve the verification standard of the detection method A distribution out-of-distribution generalization evaluation protocol for the first social bot detection task is constructed, including two modes of "generative pseudo-environment verification (CausBot-SD)" and "cross-real dataset verification (CausBot-MD)": the former enhances the environmental diversity by generating pseudo-environment dataset with simulated distribution offset; the latter realizes the system verification of cross-domain generalization ability by integrating multi-source real world dataset. The system provides a standardized paradigm for OOD performance evaluation in the field of social bot detection, filling the gap of the lack of unified cross-distribution verification standard in existing research. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings of the embodiments of the present application will be briefly introduced below. The drawings are only used to show some embodiments of the present application, and not to limit all embodiments of the present application to this.
[0020] Figure 1 is a flowchart of the social bot detection method based on causal intervention and mixed experts of the embodiments of the present application; Figure 2 is a CausBot model framework diagram of the embodiments of the present application; Figure 3 is a comparison of the CausBot and the existing social bot detection method flow of the embodiments of the present application. DETAILED DESCRIPTION
[0021] In the following, the example solutions of the embodiments of the present application will be clearly and completely described in combination with the drawings of the embodiments of the present application. Unless otherwise defined, the technical terms or scientific terms used in the present application should be understood as the usual meaning understood by persons having ordinary skills in the art.
[0022] The existing social bot detection method usually learns the representation of each account by optimizing the likelihood function , but this optimization strategy is easily disturbed by environmental confounding factors. Inspired by causal inference theory, the present application aims to eliminate the influence of these environmental confounding factors through intervention strategy, i.e. , so as to improve the cross-distribution generalization ability of the model.
[0023] The embodiments of the present application disclose a social bot detection method based on causal intervention and mixed experts, as shown in Figure 1 , including the following contents: Step S101, acquiring the graph structure data of the social network (including account attributes and text information, account interaction edges such as follow and forward), determining the account real label Y (the label Y is used to identify whether the account is a social bot) through expert labeling, and constructing a graph with account as node according to the interaction relationship , wherein, is a set of account nodes, E is a set of interaction edges between accounts, and X is the initial feature of a node is composed of vectorized text and attribute information.
[0024] Step S102, a CausBot model is constructed, which mainly consists of two modules: a pseudo-environment estimator and a mixed-expert mechanism enhanced graph Transformer encoder (MoE-GT) (structure as shown in Figure 2 Unlike traditional graph Transformer models, CausBot effectively decouples the interference of environmental mixed factors on detection performance through causal inference and mixed-expert mechanism, enabling the model to rely more on causal relationships rather than only based on empirical correlations for judgment, thereby enhancing the generalization ability under different platforms or data distributions.
[0025] Step S103, the pseudo-environment estimator is used to estimate the potential environment distribution to which each node belongs, and environment-aware weights are generated based on Gumbel-Softmax relaxation technology.
[0026] In the CausBot framework, a learnable pseudo-environment estimator is introduced to estimate the potential environment distribution of the training data to reduce the impact of environment-specific mixed factors. Specifically, in the layer of the graph Transformer (GT) process, the implicit environment representation v of each node is modeled as a latent variable and is sampled from the distribution , where K represents the number of potential environmental factors in the social network. The parameters of this distribution are obtained by normalizing the node representation after nonlinear mapping of the current layer:
[0027] where is a learnable environment-aware projection matrix, d is the dimension of the feature vector; represents the feature vector of node v after aggregation in the l layer, represents the pseudo-environment probability distribution of node v in the l layer.
[0028] However, if The non-differentiability will hinder the gradient backpropagation. To overcome this limitation, the Gumbel-Softmax relaxation technique is introduced, which approximates the discrete sampling process with a differentiable continuous distribution, thus ensuring the integrity of the gradient transmission.
[0029] The core idea of Gumbel-Softmax is to inject random noise from the Gumbel distribution into the sampling process . Then, a continuous relaxation form of the discrete distribution is constructed using this noise, and is controlled by a temperature coefficient to achieve efficient gradient-based optimization. The environmental perception weight of the node v in the l layer of the k environmental factor is generated by the Gumbel-Softmax relaxation technique :
[0030] where the temperature coefficient dynamically controls the degree of relaxation: when , the output tends to one-hot discrete sampling; when , the distribution degenerates into a uniform distribution; is the probability distribution of the node l in the v layer belonging to the k pseudo-environment.
[0031] Step S104, using the hybrid expert mechanism enhanced graph Transformer encoder, under the regulation of the environmental perception weight, multi-level encoding of node features is performed to extract cross-environment invariant causal features.
[0032] First, the causal modeling logic is introduced for the graph Transformer: As shown in the upper half, the existing graph-based social robot detection method usually trains the model by optimizing the likelihood function Figure 3 to predict whether a certain account in the social graph is a robot (the corresponding label is ), and the optimization process can be represented as:
[0033] where represents sampling an environment from the training distribution, represents the graph structure and the label under the environment . The joint distribution of .
[0034] However, these methods may be affected by environmental variables (such as platform characteristics, like Twitter) on graph structures. With predictive labels The confounding effect can lead to spurious correlations.
[0035] To address this problem, this invention proposes an intervention-based training method, the optimization objective of which is the likelihood function under intervention. (like Figure 3 (lower half), in which This represents a causal intervention used to eliminate environmental variables. right The intervention can guide the model to focus on causal features that are stable across environments (such as anomalous behavior and network structure), while ignoring features that are sensitive to the environment (such as account registration time).
[0036] While the ideal intervention can be achieved by randomizing the graph structure, this is difficult to implement directly in large-scale experiments due to platform rules and ethical constraints. Therefore, this approach employs a causal framework based on backdoor adjustment and do-calculus to simulate the effects of the intervention.
[0037] By implementing interventions on social graphs Cut off the path The predicted distribution under intervention was derived:
[0038] Formula (4) directly uses the law of total probability to decompose the predicted distribution under intervention into the distribution in each specific environment. The weighted average of intervention predictions, where the weights are the post-intervention environment. E Distribution .
[0039] Based on the action / observation exchange property of do-calculus, in the post-intervention graph From (i.e., from) All directed edges originating from this point are cut off, when the condition is met. Independent of the diagram When it is established (i.e. The conditional probability under intervention can be simplified to the observation conditional probability. Its form can be expressed as:
[0040] Furthermore, based on the insertion / deletion properties of do-calculus, in the graph after intervention... middle (i.e. cut all incoming edges to the middle), when the environment variable E is independent of the graph G, i.e. , the environment distribution will no longer depend on the intervention operation.
[0041]
[0042] where, denotes the prior distribution of the environment variable E (e.g. the sampling proportion of different environments in multi-platform data).
[0043] Substitute the above equations (5) and (6) into the total probability equation (4), and we can get the final expression of the intervention distribution:
[0044] After introducing the variational distribution of step S103 , the objective function is updated as:
[0045] The transformation of equation (8) is to prepare for the application of Jensen's inequality in the next step, so as to convert the difficult-to-handle form into the easy-to-optimize form.
[0046] Using Jensen's inequality, it can be decomposed into two parts: one part is used to optimize the predictive ability of the model in the variational environment, and the other part is used to regularize the environment distribution to keep it consistent with the prior distribution:
[0047] Jensen's inequality states that for a convex function (here is log) and a set of weights (here is , the weighted average of the function value is greater than or equal to the weighted average of the function value. Equation (9) is just the application of this inequality, which moves the log inside the summation symbol .
[0048] The right side of equation (9) can be further split into two terms, the first term is the weighted reconstruction term, which requires the model to make accurate predictions under different environment weights allocated by . The second term is the KL regularization term, which is the KL divergence between the variational distribution and the prior distribution .
[0049] Finally, through the above causal analysis, we can get the joint optimization objective:
[0050] Equation (10) is the final formulation of equation (9), is a balance coefficient used to adjust the weight between the two parts of the objective function. The first term on the right is the expected prediction loss, which encourages accurate prediction. It forces the encoder and the pseudo environment estimator to work together so that for each input , the assigned environment e helps the model make the most accurate judgment. The second term on the right is the KL regularization term. Without this term, in order to minimize the loss of the first term, may take shortcuts, such as assigning all samples to one environment, thereby degenerating back to traditional models. The KL term prevents this behavior.
[0051] The specific implementation process of the hybrid expert mechanism enhanced graph Transformer encoder is as follows: Based on the pseudo environment estimator , the scheme proposes a MoE enhanced graph Transformer encoder to realize environment adaptive coding. The core idea is as follows: under the control of the environment representation provided by the pseudo environment estimator , the self-centered graph of each node is encoded in multiple levels. The encoding process is completed by K expert modules, which can dynamically adjust the feature extraction strategy at different levels. In each layer, the input features are first encoded by the graph Transformer (GT), and then the output by the pseudo environment estimator dynamically adjusts the contribution of each expert, so as to realize the effective fusion of expert learning features.
[0052] Specifically, under the guidance of the pseudo environment estimator, the MoE enhanced GT encoding process is as follows: Step a): in the first l layer of each expert module, the features v of node and the features u of neighbor nodes are linearly transformed to generate query vectors , key vectors and value vectors , and the calculation formula is:
[0053] wherein, represents a linear layer, are the learnable weight matrices of the first l layer query, key and value, respectively; Step b): Computing node v with the attention coefficient between node u , which is activated by LeakyReLU function and normalized by Softmax:
[0054] Through the above calculation, node v will aggregate the features of its neighbor nodes based on the attention coefficient. In the multi-head attention mechanism, multiple attention heads are calculated in parallel, and the outputs of each attention head are spliced together. This process can be described as follows:
[0055] where, represents the output of the th attention head in the i th layer; where represents the initial features of the account, which are obtained by splicing the tweet feature vector and the attribute feature vector of the account.
[0056] Based on the MoE enhanced GT encoding process, each input is encoded by K experts, and each expert module has an independent path to process the same input data. The output results are weighted and fused according to the environment weight provided by the pseudo environment estimator:
[0057] where, represents the node in the l +1 layer , which is composed of semantic information and attribute information of the account, and its encoding method is the same as that used in BotRGCN.
[0058] Step S105, train the CausBot model using a joint optimization objective function, which optimizes the parameters of the pseudo environment estimator and the mixed expert mechanism enhanced graph Transformer encoder at the same time. The objective function includes a supervised loss term and a KL divergence regularization term.
[0059] During model training, gradient-based optimization methods are used to optimize the pseudo environment estimator and the GT predictor at the same time. In order to define the prior distribution of the pseudo environment , it is assumed to follow a uniform distribution, i.e., all K possible pseudo environment categories have the same probability.
[0060] Based on the objective function derived from causal analysis (Formula 10), the loss function can be expressed as:
[0061] in, To determine the number of nodes in the training set, L This represents the total number of layers in the Transformer graph. K The first term represents the number of pseudo-environment categories (i.e., the total number of possible environments). Indicates monitoring losses, It is a node v The one-hot vector of the true label, It is a GT model enhanced by MoE. Output nodes v The predicted probability distribution. This term is essentially the cross-entropy loss. The second term is a regularization term based on KL divergence, which aims to constrain the estimated pseudo-environment distribution. With prior distribution The differences between them improve the stability and generalization ability of the model. Specifically, the formula... middle, For nodes v In the l Layer k The environmental perception weights of each environmental factor are obtained by Gumbel-Softmax sampling. For the first l Layer nodes v Belongs to the k The probability distribution of each pseudo-environment. It is a hyperparameter that controls the strength of the KL divergence regularization term.
[0062] Due to the assumption Following a uniform distribution, the prior probability of each pseudo-environment category is: ,then This regularization term characterizes the learned pseudo-environment distribution. With uniform prior distribution The differences between them guide the model to learn features that are relevant to the environment but more general, while avoiding overfitting to environment-specific noise.
[0063] In this scheme, the number of potential environmental factors of social networks K This is equal to the number of expert models in the hybrid expert mechanism. This design aims to achieve precise matching between "environment and expert", ensuring that each expert can specifically handle the features of the corresponding environment, and enabling the model to achieve distributed out-generalization, which is a key linkage design.
[0064] Step S106: Employ an out-of-distribution generalization testing strategy, including a generative pseudo-environment verification mechanism and a cross-domain verification mechanism, to evaluate the effectiveness of the model under out-of-distribution testing.
[0065] To evaluate the effectiveness of the proposed method under out-of-distribution (OOD) testing, this scheme introduces a "two-dimensional validation framework," including: (1) a generative pseudo-environment validation mechanism based on a single dataset (CausBot-SD); and (2) a cross-domain validation mechanism based on multiple real-world datasets (CausBot-MD). This setup follows common practices in graph OOD generalization research, namely, assuming that the environment label (such as dataset / domain identifier) of each training sample is known during the training phase, thereby performing environment-aware modeling; while during the OOD testing phase, no environment information needs to be used or provided. All baseline methods are trained and evaluated under exactly the same data partitioning and conditions to ensure fair comparison.
[0066] CausBot-SD: In social robot detection tasks, a single dataset is typically used only for InD (In-Distribution) testing. To enhance environment diversity and achieve OOD (Out-of-Depth) evaluation, this approach employs a generative strategy to construct multiple pseudo-environment datasets. Specifically, for each node, an environment indicator vector is generated to represent the specific environment to which the node belongs. For each environment i, the corresponding environment vector is constructed by setting the i-th position of the vector to 1 and the remaining positions to 0.
[0067] Next, we will introduce a generator based on GCN. This generator is used to generate graph structures under given environmental conditions. It takes the original graph G as input and outputs a set of features to simulate the environment-specific effects:
[0068] in, Represented as the generated first P Graph data in a pseudo-environment. Component Implemented by linear layers, this introduces environment-related random noise into the generated features. During training, each node is assigned a unique environment ID to indicate its environment, a standard assumption in OOD methods. Finally, P pseudo-environment datasets are synthesized. In the CausBot-SD setting, the original dataset and the first m pseudo-environment datasets are used for training, validation, and InD testing, while the remaining P - m pseudo-environment datasets are reserved for OOD testing.
[0069] CausBot-MD: When using multiple real-world datasets, each dataset is treated as an independent environment. The first dataset is used for training, validation, and InD testing, with its environment label set to 1; the remaining datasets are assigned different environment labels and are only used for OOD testing. This setup enables a comprehensive evaluation of cross-domain generalization capabilities.
[0070] The overall algorithm pseudocode is as follows:
[0071] Step S107, based on the trained CausBot model, extract causal features, estimate the probability of the input social network account node being a robot, and output its label whether it is a robot by Softmax.
[0072] Corresponding to the above method, the embodiment of the application also discloses a social robot detection system based on causal intervention and mixed experts, comprising: A data acquisition module is configured to acquire graph structure data of a social network, determine account real labels through expert annotation, and construct a graph with accounts as nodes according to interaction relationships; A model construction module is configured to construct a CausBot model, which includes a pseudo-environment estimator and a mixed expert mechanism enhanced graph Transformer encoder; An environment estimation module is configured to estimate a potential environment distribution to which each node belongs through the pseudo-environment estimator, and generate environment perception weights based on Gumbel-Softmax relaxation technology; A feature encoding module is configured to utilize the mixed expert mechanism enhanced graph Transformer encoder to encode node features at multiple levels under the regulation of the environment perception weights, so as to extract causal features that are invariant across environments; A model training module is configured to train the CausBot model by using a joint optimization objective function, and simultaneously optimize parameters of the pseudo-environment estimator and the mixed expert mechanism enhanced graph Transformer encoder, the objective function including a supervised loss term and a KL divergence regularization term; A detection prediction module is configured to extract causal features based on the trained CausBot model, estimate the probability of the input social network account node being a robot, and output its label whether it is a robot by Softmax.
[0073] Unless specifically stated otherwise, the relative steps, numerical expressions, and numerical values of the components and steps set forth in these embodiments do not limit the scope of the present application.
[0074] The various embodiments described in the specification are progressive in nature, and each embodiment highlights the differences from other embodiments. The same or similar parts between the various embodiments can be mutually referred to. For the system disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part.
[0075] The units and method steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been described in the above description in general terms. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person of ordinary skill in the art can use different methods to implement the described functions for each specific application, but such implementation does not exceed the scope of the present application.
[0076] A person of ordinary skill in the art can understand that all or part of the steps in the above method can be instructed by a program to complete by relevant hardware, and the program can be stored in a computer readable storage medium, such as a read-only memory, a magnetic disk or an optical disk. Alternatively, all or part of the steps of the above embodiments can also be implemented using one or more integrated circuits, and accordingly, each module / unit in the above embodiments can be implemented in the form of hardware or in the form of a software function module. The present application is not limited to any specific form of combination of hardware and software.
[0077] Finally, it should be noted that: the above described embodiments are only specific embodiments of the present application, used to illustrate the technical solutions of the present application, and not to limit it. The protection scope of the present application is not limited thereto, although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that any person skilled in the art within the technical scope disclosed by the present application can modify or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to part of the technical features; and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A social bot detection method based on causal intervention and mixed experts, characterized in that, The method comprises the following steps: Step 1, obtaining graph structure data of a social network, determining real labels of accounts through expert annotation, and constructing a graph with accounts as nodes according to interaction relationships; Step 2, constructing a CausBot model, which comprises a pseudo-environment estimator and a graph Transformer encoder enhanced by a mixed expert mechanism; Step 3, estimating a potential environment distribution to which each node belongs through the pseudo-environment estimator, and generating environment-aware weights based on a Gumbel-Softmax relaxation technique; Step 4, using the graph Transformer encoder enhanced by the mixed expert mechanism to encode node features at multiple levels under the regulation of the environment-aware weights, so as to extract cross-environment invariant causal features; Step 5, training the CausBot model by using a joint optimization objective function to optimize parameters of the pseudo-environment estimator and the graph Transformer encoder enhanced by the mixed expert mechanism, wherein the objective function comprises a supervised loss term and a KL divergence regularization term; Step 6, extracting causal features based on the trained CausBot model, performing robot probability estimation on an input social network account node, and outputting a label of whether the node is a robot by Softmax. 2.The social bot detection method based on causal intervention and hybrid experts according to claim 1, wherein, The specific implementation process of the pseudo-environment estimator in Step 3 is as follows: In the l In a layered graph Transformer, for nodes v Hidden representation By performing linear mapping and normalization, the pseudo-environment probability distribution is obtained. : ; wherein, is a learnable environment perception projection matrix, represents a node v at the first l layer aggregated feature vector, represents a node v at the first l layer pseudo-environment probability distribution; Generating nodes by Gumbel-Softmax relaxation technique v In the first l Layer the k Environmental perception weight of the : ; where, is a random noise, , is a temperature coefficient, when the output tends to a discrete sampling, when the distribution degenerates to a uniform distribution; is the l node in the v th layer belongs to the k th pseudo-environment. 3.The social bot detection method based on causal intervention and hybrid experts according to claim 2, characterized in that, The specific implementation process of the graph Transformer encoder enhanced by the mixed expert mechanism in Step 4 is as follows: The first in each expert module l In the layer, for nodes v Features with neighboring nodes u Features Perform linear transformations respectively to generate query vectors. Key vector Sum value vector The calculation formula is: ; wherein, represents a linear layer, are the learnable weight matrices for the l layer queries, keys, and values, respectively. Computing node v Attention coefficients between nodes u Attention coefficients between nodes , activated by a LeakyReLU function and normalized by Softmax Based on attention coefficient The features of the neighbor nodes are weighted aggregated, and the outputs of multiple attention heads are calculated in parallel and spliced to obtain the node v In the first l Intermediate feature representation of the layer ; Environment perception weights outputted according to the pseudo environment estimator , the outputs of the K expert modules are weighted and fused to obtain a node v feature representation at the l +1 layer .
4. The social bot detection method based on causal intervention and hybrid experts according to claim 3, characterized in that, The node v In the first l Characteristics of the +1 layer The calculation formula is: ; wherein, is the output of the k expert module at the v feature at the l layer. 5.The social bot detection method based on causal intervention and hybrid experts according to claim 1, wherein, The combined optimization objective function described in step 5 The expression for the combined optimization objective function is: ; in, E Indicates a pseudo-environment. G Representing the graph structure, Indicates the predicted label, For pseudo-environment estimators, For predictors, As a priori distribution of the environment, For distribution in pseudo-environment The expected loss of supervision, For pseudo-environment distribution Prior distribution of the environment KL divergence, This is the balance coefficient.
6. The social bot detection method based on causal intervention and hybrid experts of claim 5, wherein, The joint optimization objective function The specific calculation form is: ; wherein, is the number of nodes in the training set, is the true label of a node v in one-hot vector, is the predicted probability distribution output by the model, L is the total number of layers of the graph Transformer, K is the number of pseudo-environment classes, is the environmental perception weight of the node v in the l layer for the k environmental factor, is the probability distribution of the node l belonging to the v pseudo-environment in the k layer. 7.The social bot detection method based on causal intervention and hybrid experts according to claim 5, wherein, The environmental prior distribution Set to uniform distribution, i.e. prior probability of each pseudo-environment is . 8.The social bot detection method based on causal intervention and hybrid experts according to claim 1, wherein, The method further comprises a distribution-out generalization test strategy, including the following two modes: CausBot-SD: generating multiple pseudo-environments on a single dataset, wherein part of the pseudo-environment datasets are used for training and distribution-in test, and the remaining pseudo-environment datasets are used for distribution-out test; CausBot-MD: using multiple real-world datasets, wherein one dataset is used as a source domain for training and distribution-in test, and the remaining datasets are used as target domains for distribution-out generalization evaluation. 9.The social bot detection method based on causal intervention and hybrid experts according to claim 8, characterized in that, In the CausBot-SD mode, the pseudo-environment is generated in the following manner: An original graph structure is disturbed by a graph structure generator to generate multiple pseudo-environment graph data: ;in, For the generated first P Graph data in a pseudo-environment, This represents a graph structure generator based on the original graph data. This represents a noise generator based on an environment indicator vector. It is the first P The indicator vector of the pseudo-environment, when the node belongs to the first... P When there is a pseudo-environment, the corresponding position is 1, and the other positions are 0.
10. A social bot detection system based on causal intervention and hybrid experts, characterized in that, including: A data acquisition module is configured to obtain graph structure data of a social network, determine real labels of accounts through expert annotation, and construct a graph with accounts as nodes according to interaction relationships; A model construction module is configured to construct a CausBot model, which comprises a pseudo-environment estimator and a graph Transformer encoder enhanced by a mixed expert mechanism; An environment estimation module is configured to estimate a potential environment distribution to which each node belongs through the pseudo-environment estimator, and generate environment-aware weights based on a Gumbel-Softmax relaxation technique; A feature encoding module is configured to use the graph Transformer encoder enhanced by the mixed expert mechanism to encode node features at multiple levels under the regulation of the environment-aware weights, so as to extract cross-environment invariant causal features; The model training module is configured to train the CausBot model by using a joint optimization objective function, so as to optimize parameters of the pseudo-environment estimator and the mixed expert mechanism enhanced graph Transformer encoder, and the objective function comprises a supervised loss term and a KL divergence regularization term. The detection prediction module is configured to extract causal features based on the trained CausBot model, perform robot probability estimation on an input social network account node, and output a label of whether the input social network account node is a robot by using Softmax.
Citation Information
Patent Citations
Account tag prediction method and device, storage medium and electronic equipment
CN116307078A
Denoised image fraud detection method and device based on multi-stage data enhancement
CN118537119A
Social robot detection method and system based on modal specific expert multi-gating mixing
CN119150231A
Online public opinion research, judgment, analysis, classification and grading early warning method and system
CN119577144A
Artificial intelligence-based sentiment analysis system for monitoring social media
DE202025101480U1
Cited By
Public opinion robot identification method and system based on gated hybrid expert and prototype comparative learning
CN121598052A