Distributed anti-cheating behavior feature extraction method based on federated learning
By constructing a spatiotemporal behavior graph and generating an anchor point graph in a distributed system, and combining it with an adaptive gradient pruning mechanism, the problem of cross-user topology fragmentation is solved, and consistency in the extraction of covert gang behavior features and model representation across participants is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU XUANCHEN INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-21
AI Technical Summary
Due to data privacy protection requirements, existing distributed anti-fraud systems have user behavior logs from different business units forming independent data silos. This results in the fragmentation of cross-user topological connections, and the standard federated average aggregation algorithm of the central server cannot restore or align the local graph topology of each business unit. Consequently, the global model learns distorted topological representations and cannot effectively extract distributed covert gang behavior characteristics across business units.
By constructing spatiotemporal behavioral graphs locally on each participant's premises and extracting local graph embedding vectors using graph neural networks, the central server generates anchor graphs containing typical gang topologies. Participants calculate the contrast loss between local graph embedding vectors and anchor graph embedding vectors. The central server aligns the node order and uses an adaptive gradient pruning mechanism to remove abnormal gradients, generating global graph neural network parameters.
It achieves semantic alignment of cross-participant graph topology without transmitting original associated data, enhances the model's ability to extract features of covert group behavior, blocks poisoning attacks by malicious participants, and improves the expressive ability of long-range temporal dependencies and local spatial interactions.
Smart Images

Figure CN122433003A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of federated learning technology and discloses a distributed anti-fraud behavior feature extraction method based on federated learning. Background Technology
[0002] Existing distributed anti-fraud systems are constrained by data privacy protection requirements, resulting in isolated data silos of user behavior logs from different business units. Conventional federated learning-based anti-fraud feature extraction methods independently extract single-user behavior sequence features locally at each business unit, encode these features using conventional neural networks, and upload the resulting parameter gradients to a central server. The central server then employs a standard federated averaging aggregation algorithm to directly average all received parameter gradients, generating global model parameters and distributing them. During this process, each business unit processes its local data independently, and the central server only performs basic parameter value fusion, without interacting with any cross-user related data.
[0003] The aforementioned conventional implementation method suffers from a core technical problem: the core of anti-fraud detection lies in identifying cross-user collaborative group behavior, which manifests at the data level as a connection topology between different user identifiers. The practice of each business unit independently extracting single-user behavior sequence features directly severs the cross-user topological connections. The standard federated averaging aggregation algorithm of the central server performs fusion at the parameter numerical level, failing to reconstruct or align the fragmented graph topology of each business unit. When user distributions differ across business units, the graph topology extracted locally by each business unit semantically conflicts. Directly averaging the gradients of parameters containing conflicting semantics leads to the global model learning distorted topological representations, making it impossible to form a complete behavioral feature extraction structure targeting distributed, covert groups across business units. Summary of the Invention
[0004] The purpose of this invention is to provide a distributed anti-fraud behavior feature extraction method based on federated learning, which can effectively solve the problems in the background art mentioned above.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] A distributed anti-fraud behavior feature extraction method based on federated learning includes: each participant constructs a spatiotemporal behavior graph locally based on user behavior logs, and uses a graph neural network to extract the local graph embedding vector of the spatiotemporal behavior graph;
[0007] The central server generates an anchor point map containing a typical gang topology, extracts the anchor point map embedding vector using a preset graph neural network, and distributes the anchor point map and the anchor point map embedding vector to each of the participating parties.
[0008] The participant calculates the contrast loss between the local graph embedding vector and the anchor point graph embedding vector locally, updates the graph neural network parameters locally based on the contrast loss through backpropagation, and uploads the gradient corresponding to the updated graph neural network parameters to the central server.
[0009] The central server aligns the node order in the gradients uploaded by each participant, uses an adaptive gradient pruning mechanism to remove abnormal gradients with deviations exceeding a preset abnormal threshold, aggregates the remaining valid gradients, generates global graph neural network parameters, and distributes them to each participant.
[0010] Preferably, each participant constructs a spatiotemporal behavior graph locally based on user behavior logs, and uses a graph neural network to extract the local graph embedding vector of the spatiotemporal behavior graph, including: each participant uses a single user identifier in the user behavior log as a node, converts the behavior sequence of the same user within a preset time window into a temporal feature vector of the node, and uses the interaction frequency between different user identifiers within the preset time window as the weight of the edge to construct the spatiotemporal behavior graph;
[0011] The graph neural network includes a temporal convolutional layer and a spatial mapping layer. The temporal convolutional layer performs one-dimensional convolution on the temporal feature vector of the node to obtain temporal features. The spatial mapping layer aggregates the temporal features of neighboring nodes according to the weight of the edge and outputs the local graph embedding vector.
[0012] Preferably, the central server generates an anchor graph containing a typical gang topology, comprising: the central server extracting global graph neural network parameters generated during historical multi-round federated aggregation, inputting the global graph neural network parameters into a preset graph generator, the graph generator sampling topological latent variables from a standard normal distribution using reparameterization techniques, and decoding the topological latent variables into the anchor graph containing multiple virtual nodes and the connection relationships between the virtual nodes, wherein the number of virtual nodes is dynamically adjusted according to the total number of cheating tags reported by each participant in the current round;
[0013] The central server uses the graph neural network with frozen parameters to extract the anchor point map embedding vector, and then sends the anchor point map and the anchor point map embedding vector to each of the participating parties through an encrypted channel.
[0014] Preferably, the participant calculates the contrast loss between the local map embedding vector and the anchor map embedding vector locally, including: the participant uses the local map embedding vector as a positive sample feature, uses the anchor map embedding vector as a baseline feature, and calculates the cosine similarity between the positive sample feature and the baseline feature as the positive sample similarity.
[0015] The participating party applies Gaussian noise perturbation to the benchmark feature to generate multiple negative sample features, and calculates the cosine similarity between the positive sample feature and each negative sample feature as the negative sample similarity;
[0016] An InfoNCE loss function is constructed based on the positive sample similarity and the negative sample similarity. Cross-entropy loss is calculated by combining the local real user labels of each participant. The weighted sum of the output value of the InfoNCE loss function and the cross-entropy loss is used as the contrast loss.
[0017] Preferably, the central server aligns the node order in the gradients uploaded by each participant, including: after each participant calculates the gradient corresponding to the graph neural network parameters, extracting the degree centrality features of each node in the spatiotemporal behavior graph, and arranging them in descending order according to the degree centrality features to generate a node arrangement sequence;
[0018] Each of the participating parties rearranges the corresponding node dimensions in the gradient according to the node arrangement sequence, and appends the node arrangement sequence as an index header to the gradient data packet when uploading the gradient;
[0019] The central server parses the index header in each of the received gradient data packets, extracts the standard degree centrality features of each virtual node in the anchor point graph, maps the node arrangement sequence of each participant to the dimensional order corresponding to the standard degree centrality features, and completes the node order alignment of the gradient.
[0020] Preferably, the step of using an adaptive gradient pruning mechanism to remove abnormal gradients whose deviation exceeds a preset abnormal threshold includes: the central server calculating the L2 norm of the gradient uploaded by each participant, and obtaining a norm history sequence composed of the L2 norms of all participants in the most recent preset round.
[0021] The central server calculates the mean and standard deviation of the norm historical sequence, and adds the standard deviation by a preset multiple to the mean as a dynamic pruning threshold.
[0022] For each participant in the current round, when the L2 norm of the participant is greater than the dynamic pruning threshold or less than the reciprocal of the dynamic pruning threshold, the gradient uploaded by the participant is determined to be an abnormal gradient and is removed. Gradients whose L2 norm is between the dynamic pruning threshold and the reciprocal of the dynamic pruning threshold are determined to be valid gradients.
[0023] Preferably, the temporal convolutional layer performs one-dimensional convolution on the temporal feature vector of the node to obtain temporal features, and the spatial mapping layer aggregates the temporal features of neighboring nodes according to the weight of the edge, including: the temporal convolutional layer uses multiple sets of dilated convolution kernels of different scales to perform convolution operations on the temporal feature vector respectively, and concatenates the results of multiple sets of convolution operations to obtain the temporal features;
[0024] The spatial mapping layer transforms the weights of the edges into attention coefficients, and constructs a multi-head cross-attention mechanism with the current node as the query vector and the time features of the neighboring nodes as the key vector and value vector;
[0025] The spatial mapping layer performs a weighted summation of the temporal features of the neighboring nodes through the multi-head cross-attention mechanism, and outputs aggregated features after processing the weighted summation result through a nonlinear activation function. The aggregated features are then used as the local graph embedding vector.
[0026] Preferably, the number of virtual nodes is dynamically adjusted based on the total number of cheating tags reported by each participant in the current round, including: the central server counts the total number of cheating tags reported by each participant in the current round, and calculates the ratio of the difference between the total number of cheating tags in the current round and the average number of cheating tags in historical rounds.
[0027] When the difference ratio is greater than a preset growth threshold, the central server adds a number of virtual nodes to the anchor point map corresponding to the difference ratio, and randomly connects the newly added virtual nodes to the existing virtual nodes.
[0028] When the difference ratio is less than a preset attenuation threshold, the central server deletes the virtual node with the highest isolation degree in the anchor point graph and synchronously updates the dimension of the topological latent variable in the graph generator so that the size of the anchor point graph matches the actual cheating scale of the current round.
[0029] Preferably, the participant applies Gaussian noise perturbation to the benchmark feature to generate multiple negative sample features, including: the participant calculates the Euclidean distance between the local map embedding vector and the anchor point map embedding vector;
[0030] When the Euclidean distance is less than a preset distance threshold, the participating party introduces an inverse adjustment factor based on the Euclidean distance into the variance matrix of the Gaussian noise perturbation to reduce the initial variance of the Gaussian noise perturbation and generate difficult negative sample features that are close to the baseline feature distribution.
[0031] When the Euclidean distance is greater than the preset distance threshold, the participants keep the initial variance of the Gaussian noise perturbation unchanged and generate easy negative sample features that are far from the baseline feature distribution;
[0032] When constructing the InfoNCE loss function, the features of the difficult negative samples are assigned a loss weight greater than that of the features of the easy negative samples.
[0033] Preferably, after determining that the gradient uploaded by the participant is an abnormal gradient and removing it, the method further includes: the central server assigning a trust decay value to the participant whose abnormal gradient has been removed, and subtracting the trust decay value from the participant's historical trust value to obtain a real-time trust value.
[0034] When the real-time trust value is lower than the preset isolation threshold, the central server stops sending the anchor point map and the anchor point map embedding vector to the participants and marks it as an isolated state.
[0035] When the real-time trust value is greater than or equal to the preset isolation threshold and less than the historical trust value, if the participant uploads the effective gradient in a subsequent round, the central server calculates a gradient scaling factor based on the real-time trust value, multiplies the gradient scaling factor by the effective gradient to obtain a weighted gradient, and uses the weighted gradient to replace the effective gradient to perform aggregation to generate the global graph neural network parameters.
[0036] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0037] 1. This invention constructs spatiotemporal behavioral graphs locally at each participant and distributes anchor graphs containing typical gang topologies from a central server. It calculates the contrast loss between the local graph embedding vectors and the anchor graph embedding vectors locally, forcing the gradient updates of the local graph neural network parameters to follow globally unified topological semantic constraints. After aligning the node order, the central server employs an adaptive gradient pruning mechanism to remove abnormal gradients with deviations exceeding a preset anomaly threshold, and aggregates the remaining valid gradients. This mechanism internalizes the semantic alignment constraints of the cross-participant graph topology into the gradient update process of federated learning, overcoming the deficiency of standard federated average aggregation in resolving topological semantic conflicts between the separated graphs of each participant. This enables the global model to extract consistent hidden gang behavioral features across participants without transmitting the original associated data.
[0038] 2. Participants employ multi-scale dilated convolutional kernels to process temporal feature vectors and utilize a multi-head cross-attention mechanism based on edge weights to aggregate temporal features of neighboring nodes, enhancing the ability of local graph embedding vectors to express long-range temporal dependencies and local spatial interactions. The central server dynamically adds or removes virtual nodes in the anchor graph based on the total number of cheating labels reported by each participant in the current round, ensuring that the scale of the distributed anchor graph matches the actual scale of cheating in the current round. When calculating the contrast loss, participants adjust the Gaussian noise perturbation variance inversely based on the Euclidean distance between the local graph embedding vector and the anchor graph embedding vector, generating difficult negative sample features close to the baseline feature distribution, strengthening the model's ability to distinguish similar non-group behaviors. The central server calculates a dynamic pruning threshold based on the norm mean and standard deviation of gradients from multiple historical rounds, intercepting gradients with norms exceeding this dynamic threshold range, thus blocking malicious participants from poisoning attacks implemented by tampering with parameters. Attached Figure Description
[0039] Figure 1 This is an overall flowchart of the distributed anti-fraud behavior feature extraction method based on federated learning of the present invention;
[0040] Figure 2 This is a flowchart of the process by which the participants in this invention locally construct a spatiotemporal behavior graph and extract local graph embedding vectors;
[0041] Figure 3 A flowchart for generating and distributing anchor point maps to the central server of this invention;
[0042] Figure 4 This is a flowchart illustrating the local calculation of the comparative loss by the participants in this invention;
[0043] Figure 5 This is a flowchart illustrating the alignment order of gradient nodes in the central server of this invention.
[0044] Figure 6 This is a flowchart of the adaptive gradient clipping and aggregation process of the central server in this invention. Detailed Implementation
[0045] Please refer to the attached document. Figure 1 This embodiment provides a distributed anti-fraud behavior feature extraction process based on federated learning that is completed collaboratively between multiple distributed participants and a trusted central server. The participants are business nodes with local user behavior data storage, graph construction, and model training computation capabilities, while the central server is a trusted service node with global topology constraint generation, gradient aggregation, and global model parameter management capabilities. The participants and the central server complete data interaction through a pre-set encrypted channel. The encrypted channel is constructed using a two-way authenticated transport layer security protocol to ensure the confidentiality, integrity, and immutability of the interactive data.
[0046] Each participating party completes the collection and preprocessing of user behavior logs locally. User behavior logs are full records of user actions generated by the participating party's local business systems during service provision. Each log entry includes a unique user identifier, a timestamp of the action, an action type code, a unique identifier of the interacting object, an identifier of the terminal environment triggering the action, and a business result code field corresponding to the action. Participating parties preprocess the collected user behavior logs, including missing value imputation, abnormal timestamp filtering, action type code normalization, and duplicate log deduplication. Specifically, for missing values in user behavior logs, participants use nearest neighbor records of the same user and action type to imput them; for abnormal logs with timestamps exceeding the preset business time range, they are directly filtered out; for action type codes, a unified one-hot encoding method is used for normalization, converting discrete action types into fixed-dimensional vectors; for duplicate action logs generated by the same user at the same timestamp, only a single valid record is retained.
[0047] Participants construct a spatiotemporal behavior graph based on preprocessed user behavior logs. This graph is a directed weighted graph structure containing four core components: nodes, node features, directed edges, and edge weights. Each participant uses a unique identifier for each user in the user behavior logs as an independent node in the spatiotemporal behavior graph; the number of nodes matches the number of unique identifiers for each user in the participant's local preprocessed user behavior logs. Participants set a preset time window, the duration of which is determined based on the characteristics of their business scenario. The sliding step of the time window is consistent with the iteration step of the model training. The participants convert the behavior sequence of the same user within a preset time window into a temporal feature vector of the node. Specifically, the participants arrange all behavior records of the same user within the preset time window in ascending order of timestamps, and concatenate the normalized behavior type code, terminal environment identifier, and business result code corresponding to each behavior record to obtain the feature vector of a single behavior record. Then, the feature vectors of all single behavior records within the preset time window are arranged in chronological order to form a temporal feature vector with dimensions of [sequence length, single behavior feature dimension]. The sequence length is the number of valid behavior records of the user within the preset time window. When the number of valid behavior records is less than the preset minimum sequence length, the temporal feature vector is filled with a zero vector to make the temporal feature vector of all nodes have a uniform dimension.
[0048] Participants construct directed edges in a spatiotemporal behavior graph by using the frequency of interactions between different user unique identifiers within a preset time window as edge weights. Specifically, participants traverse preprocessed user behavior logs. When the unique identifier of an interaction object in a behavior record corresponds to another user's unique identifier, an interaction is considered to exist between the two users. The total number of interactions between the user initiating the interaction and the user receiving the interaction within the preset time window is counted and used as the weight of a directed edge, where the direction of the directed edge points from the node corresponding to the interaction initiator to the node corresponding to the interaction receiver. When there is no interaction between two users within the preset time window, no directed edge is constructed between the two corresponding nodes. After constructing all nodes, node temporal feature vectors, directed edges, and edge weights, participants generate a complete spatiotemporal behavior graph.
[0049] Participants utilize locally deployed graph neural networks to process the constructed spatiotemporal behavior graph, extracting local graph embedding vectors. The graph neural network comprises an input layer, a feature encoding layer, a graph convolutional layer, and an output layer. The input layer receives the temporal feature vectors of each node in the spatiotemporal behavior graph, along with the adjacency matrix and edge weight matrix of directed edges. The feature encoding layer performs a linear transformation on the input temporal feature vectors, mapping them to a unified hidden feature dimension. The graph convolutional layer aggregates the hidden features of neighboring nodes based on the adjacency matrix and edge weight matrix, updating the feature representation of the central node. The output layer performs global pooling on the node features output by the graph convolutional layer, generating fixed-dimensional local graph embedding vectors. These local graph embedding vectors represent a low-dimensional, dense representation of the global topology and node features of the corresponding spatiotemporal behavior graph.
[0050] The central server generates an anchor graph containing the topological structure of typical cheating groups. This anchor graph is a directed graph structure containing the connections between virtual nodes, and its topological structure corresponds to the interaction topological patterns of typical cheating groups identified during historical anti-cheating detection processes. The central server extracts global graph neural network parameters generated during historical multi-round federated aggregation. These global graph neural network parameters are model parameters with global topological representation capabilities generated by the central server aggregating the effective gradients uploaded by each participant during historical iterations. The central server inputs the extracted global graph neural network parameters into a pre-set graph generator. The graph generator is a topology generation network based on a variational autoencoder structure, consisting of an encoder and a decoder. The encoder maps the input global graph neural network parameters to the topological latent variable space, and the decoder decodes the latent variables in the topological latent variable space into the corresponding graph topological structure. The graph generator samples topological latent variables from a standard normal distribution using reparameterization techniques. It decodes these latent variables into an anchor graph containing multiple virtual nodes and the connections between them. The number of virtual nodes is dynamically adjusted based on the total number of cheating tags reported by each participant in the current round. The cheating tags are classification identifiers added locally by each participant to the nodes corresponding to the identified cheating users.
[0051] The central server uses a graph neural network with frozen parameters to extract anchor point graph embedding vectors. The structure of this graph neural network is identical to the locally deployed graph neural network of each participant, and its parameters are those of the global graph neural network generated after the most recent round of federated aggregation. During the extraction of anchor point graph embedding vectors, the parameters of this graph neural network remain frozen and are not updated. The central server inputs the generated anchor point graph into the graph neural network with frozen parameters. After feature encoding, graph convolution, and global pooling processing consistent with that of the participants' local networks, the output is the anchor point graph embedding vector. The dimension of the anchor point graph embedding vector is identical to that of the locally generated local graph embedding vectors of the participants. The central server then distributes the anchor point graph and its embedding vector to all participants participating in the federated learning process via an encrypted channel.
[0052] After receiving the anchor point map and anchor point map embedding vector from the central server, each participant calculates the contrastive loss between its locally generated local map embedding vector and the anchor point map embedding vector. The contrastive loss is a loss function that constrains the semantic distance between the local map embedding vector and the anchor point map embedding vector, forcing the participant's local graph neural network to learn feature representations consistent with the global topological semantics. Specifically, the participant uses the local map embedding vector as positive sample features and the anchor point map embedding vector as baseline features, calculating the semantic similarity between the positive sample features and the baseline features. The participant then generates multiple negative sample features that differ from the baseline features, calculating the semantic similarity between the positive sample features and each negative sample feature. Based on the positive and negative sample similarities, a contrastive loss function is constructed. The optimization objective of the contrastive loss function is to maximize the similarity between the positive sample features and the baseline features while minimizing the similarity between the positive and negative sample features.
[0053] Based on the calculated contrastive loss, each participant updates its local graph neural network (GNN) parameters using the backpropagation algorithm. Specifically, the participant uses the contrastive loss as the objective function and calculates the gradient of this objective function with respect to each trainable parameter in the GNN. The gradient calculation employs the chain rule, starting from the output layer and proceeding layer by layer to calculate the gradient values of each layer's parameters. Based on the calculated gradient values, the participant updates the GNN's trainable parameters using a pre-configured local optimizer. This local optimizer can employ optimization algorithms suitable for deep neural network training, such as stochastic gradient descent or the Adam optimizer. After completing one round of updating its local GNN parameters, the participant uploads the updated gradients to the central server via an encrypted channel.
[0054] After receiving the gradients uploaded by each participant, the central server first aligns the node order within the gradients. Because the number and order of nodes in the spatiotemporal behavioral graphs of different participants vary, the node dimensional order in the gradients uploaded by each participant is inconsistent, making direct aggregation impossible. Therefore, node order alignment is necessary. Specifically, the central server pre-sets a unified node sorting rule based on the topological characteristics of the nodes, independent of their local identifiers. During local gradient computation, each participant rearranges the corresponding node dimensions in the gradient according to this unified sorting rule. Upon receiving the rearranged gradients, the central server maps the gradients of each participant to the same node dimensional order based on the unified sorting rule, thus completing the node order alignment.
[0055] After the central server completes the node order alignment of gradients, it employs an adaptive gradient pruning mechanism to remove abnormal gradients whose deviation exceeds a preset abnormal threshold. This adaptive gradient pruning mechanism dynamically adjusts the abnormal gradient judgment threshold based on the statistical characteristics of gradients from multiple historical rounds. It eliminates the need for a fixed pre-set pruning threshold and can adapt to changes in gradient distribution across different rounds and participants. Specifically, the central server calculates the norm of the aligned gradient uploaded by each participant and statistically analyzes the norms of gradients uploaded by all participants in the most recent preset round, forming a norm history sequence. The central server calculates the statistical characteristics of the norm history sequence and uses these characteristics to calculate the dynamic pruning threshold for the current round. The central server compares the gradient norms of each participant in the current round with the dynamic pruning threshold. When the gradient norm exceeds the valid range corresponding to the dynamic pruning threshold, the gradient is determined to be an abnormal gradient and removed. When the gradient norm is within the valid range corresponding to the dynamic pruning threshold, the gradient is determined to be a valid gradient and retained.
[0056] After removing outlier gradients, the central server aggregates the remaining valid gradients to generate global graph neural network (GNN) parameters. Specifically, the central server performs a weighted average of all valid gradients across their respective parameter dimensions. The weights are the number of local training samples corresponding to each valid gradient, i.e., the number of nodes in the participant's local spatiotemporal behavioral graph. The central server then adds the aggregated gradient update values to the most recent GNN parameters to generate the current GNN parameters. The central server then distributes these current GNN parameters to all participants in the federated learning process via an encrypted channel. Upon receiving the global GNN parameters, each participant replaces its local GNN parameters with these parameters and enters the next federated learning iteration.
[0057] The mapping table between user behavior log fields and spatiotemporal behavior graph elements used in this embodiment is as follows. This table clarifies the mapping rules between each core field in the user behavior log and the constituent elements of the spatiotemporal behavior graph, providing a basis for the standardized construction of the local spatiotemporal behavior graph of the participating parties:
[0058] User unique identifier Graph Nodes Each unique user identifier corresponds to a unique node in the graph, and the node ID corresponds to the user's unique identifier. Remove duplicate user unique identifiers and filter invalid empty identifier fields. timestamp of the behavior Sequence dimension of node temporal feature vectors The user's behavior records are arranged in ascending order of timestamps, forming the sequence dimension of the time-series feature vector. Filter timestamps that exceed the preset time window and correct timestamps with abnormal formats. Behavior type coding Feature Dimensions of Node Temporal Feature Vectors After normalization, the behavior type encoding of a single behavior record serves as the core feature component of the temporal feature vector. One-hot encoding is used to normalize discrete behavior types and unify feature dimensions. Unique identifier of the interaction object Directed edges of the graph The interaction object in the behavior record uniquely identifies the target node, and a directed edge is constructed from the initiating node to the target node. Filter out non-user type interaction object identifiers and count the interaction frequency within a preset time window. Terminal Environment Identification Feature Dimensions of Node Temporal Feature Vectors After normalization, the terminal environment identifier serves as an auxiliary feature component of the temporal feature vector. Tag encoding is used to normalize discrete terminal types and unify feature dimensions. Business Result Coding Feature Dimensions of Node Temporal Feature Vectors After normalization, the business result encoding serves as an auxiliary feature component of the time-series feature vector. One-hot encoding is used to normalize discrete business results and unify feature dimensions.
[0059] This embodiment fully implements the entire process of distributed anti-fraud behavior feature extraction based on federated learning. By constructing a spatiotemporal behavior graph containing user temporal behavior features and user interaction topology locally on the participating parties, a unified representation of individual user behavior and group interaction behavior is achieved. Anchor graphs containing typical group topology structures and corresponding anchor graph embedding vectors are generated and distributed by the central server, providing globally unified topological semantic constraints for the local model training of each participating party. By calculating the contrast loss between the local graph embedding vector and the anchor graph embedding vector locally on the participating parties, the parameter updates of the local model are forced to follow the global topological semantics, achieving cross-participant graph representation semantic alignment. The central server performs node order alignment, adaptive gradient pruning, and effective gradient aggregation on the gradients uploaded by each participating party, solving the problems of gradient dimension mismatch between different participating parties and global model representation distortion caused by malicious gradient poisoning. Unified extraction of distributed anti-fraud behavior features across participating parties is achieved without transmitting the original user behavior data locally on the participating parties.
[0060] In one alternative embodiment, refer to Figure 2 The graph neural network deployed locally by the participants adopts a temporal-spatial dual-branch structure, which includes a temporal convolutional layer and a spatial mapping layer. The temporal convolutional layer is used to extract the temporal dependency features in the temporal feature vector of the node, and the spatial mapping layer is used to aggregate the features of neighboring nodes based on the topological connection relationship of the graph, generate the spatial aggregation features of the node, and finally output the local graph embedding vector.
[0061] Each participant uses individual user identifiers from user behavior logs as nodes, converts the behavior sequence of the same user within a preset time window into a temporal feature vector for the node, and uses the interaction frequency between different user identifiers within the preset time window as the edge weights to construct a spatiotemporal behavior graph. Specifically, the preset time window adopts a sliding window mechanism, with a window duration of T ranging from 1 hour to 72 hours and a sliding step size of Δt, which is consistent with the iteration step size of model training. After each round of model parameter updates, the time window slides forward by one Δt step. For each user corresponding to a node, the participants extract all their behavior records within the current sliding time window, arrange them in ascending order of timestamps, and obtain the behavior sequence. Where L is the length of the behavior sequence, i.e., the number of valid behavior records for the user within the current time window. Let L be the feature vector corresponding to the i-th behavior record. The participants perform length normalization on the behavior sequence S; when L is greater than the preset maximum sequence length... At that time, extract the nearest one. One action record; when L is less than the preset minimum sequence length At this time, zero vectors are used to fill the beginning of the sequence to make the length of the behavior sequence corresponding to all nodes uniform. , The value of and Consistency. The participants convert the normalized behavioral sequence into a sequence with dimension [missing information]. The temporal feature vector X, where For a single behavior record, the feature vector is obtained by concatenating the behavior type code, terminal environment identifier, and business result code.
[0062] Participants construct an adjacency matrix A and an edge weight matrix W for a spatiotemporal behavior graph based on user interaction behavior within a preset time window. Specifically, adjacency matrix A is a two-dimensional matrix of dimension [N,N], where N is the total number of nodes in the spatiotemporal behavior graph. When there is a directed interaction between node i and node j, A[i,j]=1; otherwise, A[i,j]=0. Edge weight matrix W is a two-dimensional matrix with the same dimension as adjacency matrix A, and W[i,j] is the total frequency of interactions initiated by the user corresponding to node i to the user corresponding to node j within the preset time window. Based on adjacency matrix A, edge weight matrix W, and temporal feature vector X, participants construct a complete spatiotemporal behavior graph.
[0063] The temporal convolutional layer of a graph neural network receives the temporal feature vector X of a node as input. It performs one-dimensional convolution operations on the temporal feature vector using multiple sets of dilated convolution kernels of different scales. The results of these convolution operations are then concatenated to obtain the temporal features of the node. The dimension of the input temporal feature vector X of the temporal convolutional layer is... Where N is the total number of nodes. For sequence length, The input feature dimension is defined as K parallel groups of one-dimensional dilated convolutional modules. Each group of dilated convolutional modules contains a dilated convolutional layer, a batch normalization layer, and a non-linear activation layer.
[0064] Specifically, the convolution operation of the k-th dilated convolution module is implemented using the following formula:
[0065]
[0066] in, Let k be the output feature of the k-th dilated convolutional module, where k ranges from 1 to K, and K is the total number of dilated convolutional modules. ReLU is used as the non-linear activation function; BN is the batch normalization operation, which is used to normalize the features of the convolution output to accelerate model convergence. Let k be the length of the dilated convolution kernel in the kth group; Let m be the weight parameter of the k-th convolutional kernel, with dimension ? , The output feature dimension of a single convolutional module; is the dilation coefficient of the k-th dilated convolution kernel. The value of the dilation coefficient increases with the increase of k, and is used to capture temporal dependencies of different lengths; t is the current time step of the convolution operation, and its value ranges from 0 to 1. -1.
[0067] The temporal convolutional layer concatenates the features output by K dilated convolutional modules along the feature dimension to obtain a layer with dimension . The intermediate features are then mapped to a fixed hidden feature dimension through a linear transformation layer. The dimension is obtained as Time characteristics Time characteristics Each row vector in the algorithm corresponds to the temporal dependency feature of a node at the corresponding time step, thus fully preserving the long-range and short-range temporal dependency information in the user behavior sequence.
[0068] The spatial mapping layer of the graph neural network receives the temporal features output by the temporal convolutional layer. The adjacency matrix A and the edge weight matrix W are used as inputs. The edge weights are converted into attention coefficients. A multi-head cross-attention mechanism is constructed with the current node as the query vector and the temporal features of the neighboring nodes as the key vector and value vector. The temporal features of the neighboring nodes are weighted and summed through the multi-head cross-attention mechanism. The weighted summation result is processed by a non-linear activation function and then output as an aggregated feature. The aggregated feature is used as the local graph embedding vector.
[0069] Specifically, the spatial mapping layer first processes the temporal features. Perform average pooling to obtain the dimension of each node. Node-level features Pooling operations are performed along the sequence length dimension and are implemented using the following formula:
[0070]
[0071] in, Let i be the node-level feature corresponding to the i-th node, where i ranges from 0 to N-1, and N is the total number of nodes.
[0072] Spatial mapping layer based on node-level features An adjacency matrix A and an edge weight matrix W are used to construct a multi-head cross-attention mechanism. The number of heads in the multi-head cross-attention mechanism is set to H, and each attention head corresponds to a set of independent linear transformation parameters, mapping node-level features to query vector Q, key vector K, and value vector V, respectively. For the h-th attention head, the corresponding linear transformation is implemented using the following formula:
[0073]
[0074] in, , , These are the linear transformation weight matrices for the query, key, and value corresponding to the h-th attention head, respectively, with each matrix having dimension 1. ; , , These are the query matrix, key matrix, and value matrix corresponding to the h-th attention head, respectively, all with dimension 1. .
[0075] The spatial mapping layer transforms the weight values in the edge weight matrix W into attention bias coefficients, thus weighting and adjusting the attention scores. For the i-th center node and the j-th neighbor node, when the adjacency matrix A[i,j]=1, the corresponding attention bias coefficients... Let W[i,j] be the normalized value of the edge weight matrix. The normalization operation is performed using the following formula:
[0076]
[0077] in, Let A[i,k] be the set of all neighboring nodes of the i-th node, that is, the set of all nodes k that satisfy A[i,k]=1; The value range is from 0 to 1, and the corresponding values of all neighboring nodes are... The sum of is 1.
[0078] The attention score matrix corresponding to the h-th attention head is achieved by the following formula:
[0079]
[0080] in, Let h be the attention score matrix of the h-th attention head, with dimensions [N, N]. B is a scaling factor used to avoid gradient vanishing in the softmax function due to excessively large inner product values; B is the attention bias matrix with dimensions [N,N], B[i,j]= When A[i,j]=1, otherwise B[i,j]=-∞, ensure that only the neighboring nodes of the central node participate in the attention-weighted summation.
[0081] The spatial mapping layer concatenates the outputs of each attention head and then performs a linear transformation to obtain the final node aggregation features, achieved through the following formula:
[0082]
[0083] in, The node aggregation features have a dimension of [N, ]; To output the weight matrix of the linear transformation, with dimension . Concat is a feature concatenation operation that concatenates the outputs of multiple attention heads along the feature dimension.
[0084] The spatial mapping layer performs global average pooling and global max pooling on the node aggregation feature H_s, concatenates the results of the two pooling operations, and then maps them to a fixed dimension through a linear transformation layer to obtain a dimension of... The local graph embedding vector Z, where The fixed dimension of the graph embedding vector is completely consistent with the dimension of the anchor point graph embedding vector issued by the central server.
[0085] The multi-scale dilated convolution kernel parameter configuration table used in this embodiment is as follows. This table clarifies the core parameter configuration of each group of dilated convolution modules in the temporal convolution layer. By combining different dilation coefficients, it achieves synchronous capture of temporal dependencies of different lengths in the user behavior sequence:
[0086] 1 1 3 1 Same fill 64 32 2 2 3 1 Same fill 64 32 3 4 3 1 Same fill 64 32 4 8 3 1 Same fill 64 32 5 16 3 1 Same fill 64 32
[0087] In this embodiment, the total number K of the dilated convolutional modules is set to 5, and the dilation coefficients of each group of convolutional modules are 1, 2, 4, 8, and 16, respectively, with corresponding receptive fields of 3, 5, 9, 17, and 33, respectively. This can cover the full range of temporal dependency capture, from short-range single-step interactions to long-range cross-day behaviors. All convolutional modules use the same padding method to ensure that the sequence length remains unchanged before and after the convolution operation, avoiding the loss of temporal information. The output feature dimension of all convolutional modules is set to 32, and the total feature dimension after concatenation is 160, which is then mapped to a 64-dimensional hidden feature dimension through a linear transformation. .
[0088] Please refer to Figure 4This embodiment refines the construction of the local spatiotemporal behavior graph and the graph neural network structure of the participants. A sliding time window mechanism is used to standardize the processing of user behavior sequences, ensuring the uniformity of the dimensionality of the temporal feature vectors. A temporal convolutional layer is constructed using multiple sets of dilated convolutional kernels with different dilation coefficients, enabling the synchronous capture of temporal dependencies of varying lengths in the user behavior sequence and enhancing the representational ability of temporal features on user behavior patterns. A spatial mapping layer is constructed using a multi-head cross-attention mechanism based on edge weights, converting the interaction frequency between users into attention bias coefficients, achieving adaptive weighted aggregation of neighbor node features, and strengthening the representational ability of graph features on the topological structure of user interactions. Global pooling is used to generate fixed-dimensional local graph embedding vectors, ensuring dimensionality matching with the anchor point graph embedding vectors issued by the central server, providing a unified feature foundation for subsequent contrastive loss calculations.
[0089] In another alternative embodiment, refer to Figure 3 The central server generates anchor point graphs through a graph generator based on variational autoencoders. It dynamically adjusts the number of virtual nodes in the anchor point graphs based on the total number of cheating tags reported by each participant in the current round. Participants construct comparative losses locally based on the InfoNCE loss function and the cross-entropy loss function. They dynamically adjust the generation method and loss weight of negative samples based on the Euclidean distance between the local graph embedding vector and the anchor point graph embedding vector.
[0090] The central server extracts global graph neural network (GNN) parameters generated during historical multi-round federated aggregation. These parameters include the weights and biases of all trainable layers in the GNN, specifically the kernel weights in the temporal convolutional layers, the scaling and offset parameters in the batch normalization layers, and the linear transformation weight matrix in the spatial mapping layers. The central server then flattens the extracted GNN parameters, converting them into a fixed-dimensional one-dimensional parameter vector. , The dimension is consistent with the total number of trainable parameters in a global graph neural network. The central server will store the parameter vectors. The input is fed into a preset map generator, which is a topology generation network based on a variational autoencoder structure, with both the encoder and decoder using a multilayer perceptron structure.
[0091] The encoder of the map generator receives parameter vectors As input, the output is the mean vector of the topological latent variables. With variance vector Mean vector μ and variance vector All dimensions are , Let be the dimension of the topological latent variables. The encoder output is achieved using the following formula:
[0092]
[0093]
[0094] in, , Here are the weight matrices for the two hidden layers of the encoder. , This is the corresponding bias vector; , These are the weight matrices for the mean and variance output layers, respectively. , Here, represents the corresponding bias vector; softplus is the activation function used to ensure the variance vector of the output. The value of is always positive.
[0095] The graph generator samples the topological latent variable z from the standard normal distribution using a reparameterization technique. This technique decouples the random sampling process from the gradient calculation process, ensuring that the graph generator can update parameters through backpropagation. The reparameterization process is implemented using the following formula:
[0096]
[0097] Where ϵ represents the standard normal distribution The random noise vector obtained from sampling has the same dimensions as μ and σ²; I is the identity matrix; z is the topological latent variable obtained from sampling, with dimensions of... .
[0098] The decoder of the graph generator receives the topological latent variable z as input and decodes it into an anchor graph containing multiple virtual nodes and the connections between them. Specifically, the decoder first maps the topological latent variable z to the number of virtual nodes M and an adjacency probability matrix P of dimension [M,M]. Each element P[i,j] in the probability matrix P ranges from 0 to 1, representing the probability that there is a directed edge between virtual node i and virtual node j. The decoder binarizes the probability matrix P. When P[i,j] is greater than a preset probability threshold, it is determined that there is a directed edge between virtual node i and virtual node j, and the corresponding adjacency matrix... ,otherwise The decoder is based on the adjacency matrix. Given the number of virtual nodes M, a complete anchor graph is generated. The anchor graph is a directed graph structure containing the connections between M virtual nodes and their corresponding directed edges.
[0099] The number M of virtual nodes in the anchor point graph is dynamically adjusted based on the total number of cheating tags reported by each participant in the current round. Specifically, at the beginning of each federated learning iteration, the central server receives the total number of cheating tags reported by each participant for the current round. The total number of cheating tags is the total number of nodes identified and marked as cheating users locally by each participant within the current time window. The central server then calculates the total number of cheating tags reported by all participants to obtain the total number of global cheating tags for the current round. The central server calculates the average total number of global cheat tags in the most recent R rounds of the history. The value of R ranges from 5 to 20 rounds. The central server calculates the ratio of the difference between the total number of cheat tags in the current round and the average number of cheat tags in historical rounds. Difference ratio This can be achieved through the following formula:
[0100]
[0101] in, The range of values for is from -1 to positive infinity. A value greater than 0 indicates that the global cheating scale in the current round has increased compared to the historical average; when... A value less than 0 indicates that the global cheating scale in the current round has decreased compared to the historical average.
[0102] The central server is pre-set with a preset growth threshold. With preset attenuation threshold , The value range is from 0.2 to 0.5. The value range is from -0.5 to -0.2. When the difference ratio... Greater than the preset growth threshold At that time, the central server adds a number of virtual nodes to the anchor point map corresponding to the difference ratio, and randomly connects the newly added virtual nodes to existing virtual nodes; when the difference ratio Less than the preset attenuation threshold At that time, the central server deletes the virtual node with the highest isolation degree in the anchor point graph and synchronously updates the dimension of the topological latent variables in the graph generator. This ensures that the size of the anchor point graph matches the actual scale of cheating in the current round. The isolation degree of a virtual node is measured by its degree centrality; a node with lower degree centrality has a higher isolation degree.
[0103] The following table shows the dynamic adjustment rules for the number of virtual nodes in the anchor point graph used in this embodiment. This table clarifies the adjustment actions, change ranges, and topological implicit variable dimension adjustment rules for the number of virtual nodes in the anchor point graph corresponding to different difference ratio ranges, ensuring that the scale of the anchor point graph can adapt to changes in the global cheating scale in real time:
[0104] Add virtual nodes New number = Initial number of virtual nodes × ×Adjustment coefficient α Dimension increase = Number of new virtual nodes × Dimension coefficient β No adjustment The number of virtual nodes remains unchanged. The dimensions of topological hidden variables remain unchanged. Delete virtual node Number of deleted nodes = Initial number of virtual nodes × ×Adjustment coefficient α Dimension reduction = Number of virtual nodes deleted × Dimension coefficient β
[0105] In this embodiment, the adjustment coefficient α is set to 0.8 to avoid drastic fluctuations in the number of virtual nodes; the dimension coefficient β is set to 2 to ensure that the dimension of the topological latent variable can adapt to the changes in the number of virtual nodes, providing sufficient representation space for the topological structure of the anchor point graph; the initial number of virtual nodes is set to 100, corresponding to the baseline value of the historical average scale of cheating.
[0106] The central server uses a graph neural network with frozen parameters to extract the anchor point graph embedding vector. The structure of this graph neural network is completely identical to the graph neural network structure deployed locally by the participants. Its parameters are the global graph neural network parameters generated after the most recent round of federated aggregation, and these parameters remain frozen during the extraction of the anchor point graph embedding vector. The central server generates an initial temporal feature vector for each virtual node in the anchor point graph. The initial temporal feature vector uses the same dimension as the temporal feature vector of the participant's local nodes and is generated from random numbers conforming to a standard normal distribution. The central server then uses the adjacency matrix of the anchor point graph... Edge weight matrix The temporal feature vectors of the virtual nodes are input into a graph neural network with frozen parameters. After processing by temporal convolutional layers and spatial mapping layers, the output is obtained with dimension [missing information]. Anchor point map embedding vector , The dimensions are completely consistent with the local graph embedding vectors generated locally by the participants. The central server merges the anchor graph with the anchor graph embedding vectors. It is sent to all participants via an encrypted channel.
[0107] The participants receive the anchor point map and the anchor point map embedding vector locally. Then, the locally generated local map embedding vector Z and the anchor point map embedding vector are calculated. The comparison loss between them. Specifically, the participants use the local map embedding vector Z as the positive sample feature and the anchor map embedding vector... As a baseline feature, the cosine similarity between the positive sample features and the baseline feature is calculated as the positive sample similarity. Cosine similarity is calculated using the following formula:
[0108]
[0109] in, Let L2 be the norm of the vector; The value ranges from -1 to 1. The closer the value is to 1, the higher the semantic similarity between the positive sample features and the baseline features.
[0110] Participants on benchmark features Gaussian noise perturbation is applied to generate multiple negative sample features. Specifically, the participants generate... A noise vector conforming to a Gaussian distribution, the dimension of the noise vector being equal to... Consistent, with a mean of 0 and an initial variance of . The participants then superimpose each noise vector onto the baseline feature. Above, generate negative sample features The value of i ranges from 1 to... , The total number of negative samples, ranging from 32 to 128. Each participant calculates the positive sample feature Z and the feature of each negative sample.
[0111] The cosine similarity between them is used as the negative sample similarity. The calculation method is the same as that for positive samples. Consistent.
[0112] Participants based on positive sample similarity Similarity with negative samples The InfoNCE loss function is constructed using the following formula:
[0113]
[0114] in, This is a temperature coefficient, ranging from 0.07 to 0.2, used to adjust the sharpness of the similarity distribution; The output value of the InfoNCE loss function is used to optimize the loss function by minimizing this value, thereby maximizing the similarity of positive samples while minimizing the similarity of negative samples.
[0115] The participants calculate the cross-entropy loss by combining local user real labels. Specifically, the participants' local graph neural network outputs local graph embedding vectors and, through a classification head, outputs the predicted cheating probability value for each node. The classification head consists of two linear transformation layers, and the input is the node aggregation features. The output is a 2-dimensional classification probability vector, corresponding to the probabilities of normal users and cheating users, respectively. Participants extract the set of nodes locally labeled with the true tags and calculate the cross-entropy loss based on the predicted probabilities and the true tags. The cross-entropy loss is calculated using the following formula:
[0116]
[0117] in, This represents the total number of local nodes with real labels. Let be the actual label of the i-th node, with a value of 1 representing a cheating user and a value of 0 representing a normal user; This represents the predicted probability that the i-th node in the model output is a cheating user.
[0118] The participants used a weighted sum of the output of the InfoNCE loss function and the cross-entropy loss as the contrast loss. This can be achieved through the following formula:
[0119]
[0120] in, and These are the weight coefficients for the InfoNCE loss and the cross-entropy loss, respectively. The value range is from 0.3 to 0.7. The value range is from 0.3 to 0.7. .
[0121] In the process of generating negative sample features, the participants first calculate the local map embedding vector Z and the anchor map embedding vector. Euclidean distance between The Euclidean distance is calculated using the following formula:
[0122]
[0123] Participants pre-set a preset distance threshold When Euclidean distance Less than the preset distance threshold When the semantic distance between the local map embedding vector and the baseline feature is relatively close, the model has a higher difficulty in distinguishing similar non-group behaviors. Therefore, the participants introduce an inverse adjustment factor based on Euclidean distance into the variance matrix of the Gaussian noise perturbation to reduce the initial variance of the Gaussian noise perturbation. This generates difficult negative sample features that closely approximate the baseline feature distribution. The inverse adjustment factor γ is achieved through the following formula:
[0124]
[0125] Where γ ranges from 0 to 1, when Less than When γ is less than 1, the adjusted Gaussian noise variance After the variance is reduced, the difference between the generated negative sample features and the baseline features is smaller, which is considered a difficult negative sample.
[0126] When Euclidean distance Greater than the preset distance threshold When the semantic distance between the local graph embedding vector and the baseline feature is large, the model has a lower difficulty in distinguishing non-group behaviors with large differences, and the participants maintain an initial variance with Gaussian noise perturbation. Without changing, generate easy negative sample features that are far from the baseline feature distribution.
[0127] When constructing the InfoNCE loss function, the participants assign greater loss weights to the features of difficult negative samples than to the features of easy negative samples. Specifically, the participants assign corresponding weights to each negative sample feature. When the negative sample features are difficult negative samples, The value ranges from 1.5 to 2.0; when the negative sample feature is a common negative sample, The value ranges from 0.5 to 1.0. The participants will assign weights... In the calculation of the InfoNCE loss function, the adjusted InfoNCE loss function is implemented using the following formula:
[0128]
[0129] This embodiment refines the generation mechanism of the anchor point graph and the calculation process of the contrastive loss. Through a graph generator based on a variational autoencoder and reparameterization techniques, it achieves automatic generation of anchor point graphs containing typical gang topologies, ensuring that the topology of the anchor point graph remains consistent with the cheating gang topology learned by the global model. A dynamic adjustment mechanism for the number of virtual nodes based on the total number of global cheating tags allows the size of the anchor point graph to adapt to the actual cheating scale of the current round in real time, improving the adaptability of the anchor point graph to different cheating scenarios. By combining the contrastive loss function with InfoNCE loss and cross-entropy loss, it simultaneously optimizes global topological semantic alignment constraints and local cheating classification tasks, ensuring that the model maintains its ability to identify local cheating behaviors while learning a globally unified topological representation. Through a difficult negative sample generation mechanism based on Euclidean distance and a weighted InfoNCE loss function, it strengthens the model's ability to distinguish similar non-gang behaviors, improving the model's feature extraction accuracy for concealed cheating gangs.
[0130] In yet another alternative embodiment, please refer to Figure 6 The central server aligns the node order of the gradients uploaded by each participant based on the degree centrality of the nodes, calculates the dynamic pruning threshold based on the norm statistical features of historical gradients to remove abnormal gradients, and builds a trust management mechanism based on the historical gradient upload behavior of the participants to control permissions and reduce gradient weight for the participants corresponding to abnormal gradients.
[0131] Please refer to Figure 5After calculating the gradients corresponding to the graph neural network parameters, each participant extracts the degree centrality features of each node in the spatiotemporal behavioral graph. These features are then sorted in descending order to generate a node arrangement sequence. The corresponding node dimensions in the gradient are rearranged based on this sequence, and the node arrangement sequence is appended as an index header to the gradient data packet when uploading the gradient. Specifically, the degree centrality feature of a node is the sum of its in-degree and out-degree, used to measure the importance of the node in the graph topology. The degree centrality of the i-th node... This can be achieved through the following formula:
[0132]
[0133] in, Let be the in-degree of the i-th node, which is the total number of directed edges pointing to that node; Let be the out-degree of the i-th node, which is the total number of directed edges originating from that node.
[0134] For all nodes in the spatiotemporal behavior graph, the participants determine their degree centrality. Sort the values in descending order to generate a node permutation sequence. Node arrangement sequence Let be an ordered list of node IDs, where the node ID at position k in the list corresponds to the node with the k-th highest degree centrality. In the gradients computed locally by the participants, the dimension of the gradients of parameters related to node features is... Where N is the total number of nodes. To hide the feature dimension, the node order is consistent with the original node ID order. Participants then proceed according to the node order sequence. The node dimensions in the gradient are rearranged so that the order of the node dimensions in the rearranged gradient corresponds to the node arrangement sequence. The order is completely consistent, that is, the sequence of nodes corresponding to the k-th row in the rearranged gradient. The gradient of the parameters corresponding to the k-th node.
[0135] After the participants complete the node dimension rearrangement of the gradient, they will combine the rearranged gradient data with the node arrangement sequence. Packed into gradient data packets, where the nodes are arranged in sequence. As an index header appended to the beginning of the gradient data packet, the index header also contains the participant's unique identifier, the iteration number of the current round, and the number of samples trained locally. The participant uploads the gradient data packet to the central server via an encrypted channel.
[0136] The central server parses the index headers in the received gradient data packets, extracts the standard degree centrality features of each virtual node in the anchor point graph, and maps the node arrangement sequence of each participant to the dimensional order corresponding to the standard degree centrality features, thus completing the node order alignment of the gradient. Specifically, the central server pre-calculates the standard degree centrality features of each virtual node in the anchor point graph, arranges them in descending order according to the standard degree centrality features, and generates a standard node arrangement sequence. Standard node permutation sequence The length is the preset maximum number of nodes. , The value is greater than the maximum number of nodes in the local spatiotemporal behavior graphs of all participants. The central server is a standard node arrangement sequence. Each position in the array is assigned a unique standard dimension index, and the standard dimension index corresponding to the k-th position is k.
[0137] The central server sorts the nodes uploaded by each participant. ,Will Each node ID in the sequence is mapped to a corresponding standard dimension index. Specifically, for the node permutation sequence... The node at position k in the sequence has a degree centrality rank of k, and the central server maps it to a standard permutation of nodes. The standard dimension index k corresponds to the k-th position in the matrix. When the number of nodes N of the participating parties is less than... When the number of nodes N exceeds N, the central server will fill the gradient values corresponding to the standard dimension indices with 0; when the number of nodes N of the participating parties is greater than N... At that time, the central server extracts the node arrangement sequence. Center front The gradient data corresponding to each node is unified in dimensionality. Through the above mapping process, the central server maps the gradients uploaded by all participants to the same standard dimensional index order, completing the node order alignment of gradients. After alignment, all gradients have completely consistent dimensions and can be directly aggregated.
[0138] After the central server completes the node order alignment of the gradients, it uses an adaptive gradient pruning mechanism to remove abnormal gradients whose deviation exceeds a preset abnormality threshold. Specifically, the central server calculates the L2 norm of the aligned gradients uploaded by each participant. The L2 norm of the gradient is calculated using the following formula:
[0139]
[0140] in, Let be the aligned gradient vector uploaded by the i-th participant. This represents the total dimension of the gradient vector, which is the total number of trainable parameters in the graph neural network. This represents the value of the m-th dimension in the gradient vector; Let L2 norm be the gradient of the i-th participant.
[0141] The central server retrieves the norm history sequence, which is composed of the L2 norms of the gradients of all participants within the most recent preset round R. The value of R ranges from 10 to 50. The central server calculates the norm of the historical sequence. mean with standard deviation The mean and standard deviation are calculated using the following formulas:
[0142]
[0143]
[0144] in, denoted as the total number of elements in the norm history sequence.
[0145] The central server will average Add the standard deviation of the preset multiple As a dynamic cropping threshold The preset multiplier ranges from 2 to 5, and the dynamic cropping threshold is... This can be achieved through the following formula:
[0146]
[0147] Where k is a preset multiple, and when the value is 3, it corresponds to the 3σ principle of the normal distribution, covering 99.7% of the normal gradient distribution.
[0148] The central server calculates the L2 norm of the gradients of each participant in the current round. With dynamic clipping threshold Perform a comparison. When Greater than the dynamic clipping threshold ,or Less than the dynamic clipping threshold reciprocal When the gradient uploaded by the participant is deemed an anomalous gradient, it is removed; when In arrive When the gradient is between 0 and 1, it is considered a valid gradient and is retained.
[0149] After the central server determines that the gradient uploaded by a participant is an anomalous gradient and removes it, it assigns a trust decay value to the participant whose gradient was removed. The real-time trust value is obtained by subtracting the trust decay value from the participant's historical trust value. Specifically, the central server sets an initial trust value for each participant accessing the federated learning process. The initial trust level is set to 100. The central server sets a fixed trust decay value for each anomaly gradient removal event. , The value ranges from 10 to 30. When a participant's uploaded gradient in a round is judged as an abnormal gradient and is removed, its real-time trust value is... This can be achieved through the following formula:
[0150]
[0151] in, This is the trust level score of the participant in the previous round.
[0152] When a gradient uploaded by a participant in a certain round is determined to be a valid gradient and used for aggregation, the central server assigns it a trust restoration value. , The value ranges from 1 to 5, and the real-time trust score is calculated using the following formula:
[0153]
[0154] Ensure that the real-time trust value of the participants does not exceed the initial trust value of 100.
[0155] The central server is pre-set with a preset isolation threshold. , The value ranges from 30 to 50. When the participant's real-time trust value... Below the preset isolation threshold At this point, the central server stops issuing anchor graphs and anchor graph embedding vectors to the participant and marks the participant as isolated. Participants in the isolated state cannot access subsequent federated learning iterations. The central server will only lift the isolation state and restore the participant's initial trust value after the participant completes identity verification and security audit.
[0156] When the real-time trust value of the participants Greater than or equal to the preset isolation threshold And less than the initial trust value If the participant uploads a valid gradient in a subsequent round, the central server calculates a gradient scaling factor based on the real-time trust value. This scaling factor is then multiplied by the valid gradient to obtain a reduced-weighted gradient. This reduced-weighted gradient is used to replace the valid gradient for aggregation to generate the global graph neural network parameters. (Gradient scaling factor) This can be achieved through the following formula:
[0157]
[0158] in, The value ranges from 0 to 1. The lower the real-time trust value, the smaller the gradient scaling factor, and the smaller the impact of the participant's gradient on the global model parameters. When performing gradient aggregation, the central server multiplies the effective gradient of the participant by the gradient scaling factor. The reduced-weight gradient is obtained, and then the reduced-weight gradient is aggregated together with the effective gradients of other participants by weighted averaging to generate the parameters of the global graph neural network.
[0159] The mapping table of participant trust status and corresponding processing rules used in this embodiment is as follows. This table clarifies the trust status, processing rules, and status transition conditions corresponding to different real-time trust value ranges of participants, realizing dynamic permission control and gradient weight adjustment for participants:
[0160] =100 Normal state Fully receive anchor point graphs and global parameters, with all gradient weights participating in aggregation. Upload valid gradients in multiple consecutive rounds, maintaining a trust level of 100. #imgpt252#≤#imgpt253#<100 Demotion status The anchor point map and global parameters are received in full, and the gradients are weighted according to the scaling factor before participating in the aggregation. When uploading valid gradients, the trust level gradually recovers to 100; when uploading abnormal gradients, the trust level decreases, and when it falls below #imgpt254#, it enters isolation mode. #imgpt255# Isolation Stop issuing anchor point maps and global parameters; gradients will not participate in aggregation. After completing the security audit and identity verification, the system is restored to its initial trust level of 100 and enters normal operation.
[0161] In this embodiment, the preset isolation threshold #imgpt256# is set to 40, the trust decay value #imgpt257# is set to 20, and the trust recovery value #imgpt258# is set to 2. For participants in the deweighted state, their gradient scaling factor is linearly related to the real-time trust value. When the real-time trust value is 60, the gradient scaling factor is 0.6, and the effective gradients uploaded by them only participate in the global aggregation with 60% weight, which reduces the negative impact of participants with abnormal gradient upload behavior in the past on the global model.
[0162] This embodiment refines the node order alignment, adaptive gradient pruning, and participant trust management mechanisms for gradients. By mapping the node arrangement sequence based on node degree centrality to the standard dimensional index, it achieves node order alignment for gradients uploaded by different participants, solving the problem of gradients not being able to be directly aggregated due to inconsistencies in the number and arrangement order of nodes in the local graphs of different participants. Through a dynamic pruning threshold based on the statistical characteristics of historical gradient norms, it achieves adaptive identification and removal of abnormal gradients, blocking malicious participants from carrying out poisoning attacks by tampering with gradient parameters and avoiding distortion of global model parameters. Through a trust management mechanism based on the historical gradient upload behavior of participants, it achieves dynamic permission control and gradient weight adjustment for participants, reducing the negative impact of participants with abnormal behavior in the past on the global model and improving the security, robustness, and stability of the federated learning process.
Claims
1. A distributed anti-fraud behavior feature extraction method based on federated learning, characterized in that, include: Each participant constructs a spatiotemporal behavior graph locally based on user behavior logs, and uses a graph neural network to extract the local graph embedding vector of the spatiotemporal behavior graph; The central server generates an anchor point map containing a typical gang topology, extracts the anchor point map embedding vector using a preset graph neural network, and distributes the anchor point map and the anchor point map embedding vector to each of the participating parties. The participant calculates the contrast loss between the local graph embedding vector and the anchor point graph embedding vector locally, updates the graph neural network parameters locally based on the contrast loss through backpropagation, and uploads the gradient corresponding to the updated graph neural network parameters to the central server. The central server aligns the node order in the gradients uploaded by each participant, uses an adaptive gradient pruning mechanism to remove abnormal gradients with deviations exceeding a preset abnormal threshold, aggregates the remaining valid gradients, generates global graph neural network parameters, and distributes them to each participant.
2. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 1, characterized in that, Each participant constructs a spatiotemporal behavior graph locally based on user behavior logs, and uses a graph neural network to extract the local graph embedding vector of the spatiotemporal behavior graph. This includes: each participant using a single user identifier in the user behavior log as a node, converting the behavior sequence of the same user within a preset time window into a temporal feature vector of the node, and using the interaction frequency between different user identifiers within the preset time window as the weight of the edge to construct the spatiotemporal behavior graph. The graph neural network includes a temporal convolutional layer and a spatial mapping layer. The temporal convolutional layer performs one-dimensional convolution on the temporal feature vector of the node to obtain temporal features. The spatial mapping layer aggregates the temporal features of neighboring nodes according to the weight of the edge and outputs the local graph embedding vector.
3. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 1, characterized in that, The central server generates an anchor graph containing a typical gang topology, including: the central server extracts global graph neural network parameters generated during historical multi-round federated aggregation, inputs the global graph neural network parameters into a preset graph generator, the graph generator samples topological latent variables from a standard normal distribution using reparameterization techniques, and decodes the topological latent variables into the anchor graph containing multiple virtual nodes and the connection relationships between the virtual nodes, wherein the number of virtual nodes is dynamically adjusted according to the total number of cheating tags reported by each participant in the current round; The central server uses the graph neural network with frozen parameters to extract the anchor point map embedding vector, and then sends the anchor point map and the anchor point map embedding vector to each of the participating parties through an encrypted channel.
4. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 1, characterized in that, The participating party calculates the contrast loss between the local map embedding vector and the anchor point map embedding vector locally, including: the participating party uses the local map embedding vector as a positive sample feature, uses the anchor point map embedding vector as a baseline feature, and calculates the cosine similarity between the positive sample feature and the baseline feature as the positive sample similarity; The participating party applies Gaussian noise perturbation to the benchmark feature to generate multiple negative sample features, and calculates the cosine similarity between the positive sample feature and each negative sample feature as the negative sample similarity; An InfoNCE loss function is constructed based on the positive sample similarity and the negative sample similarity. Cross-entropy loss is calculated by combining the local real user labels of each participant. The weighted sum of the output value of the InfoNCE loss function and the cross-entropy loss is used as the contrast loss.
5. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 1, characterized in that, The central server aligns the node order in the gradients uploaded by each participant, including: after each participant calculates the gradient corresponding to the graph neural network parameters, it extracts the degree centrality features of each node in the spatiotemporal behavior graph and generates a node arrangement sequence by arranging the nodes in descending order according to the degree centrality features. Each of the participating parties rearranges the corresponding node dimensions in the gradient according to the node arrangement sequence, and appends the node arrangement sequence as an index header to the gradient data packet when uploading the gradient; The central server parses the index header in each of the received gradient data packets, extracts the standard degree centrality features of each virtual node in the anchor point graph, maps the node arrangement sequence of each participant to the dimensional order corresponding to the standard degree centrality features, and completes the node order alignment of the gradient.
6. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 1, characterized in that, The step of using an adaptive gradient pruning mechanism to remove abnormal gradients whose deviation exceeds a preset abnormal threshold includes: the central server calculating the L2 norm of the gradient uploaded by each participant, and obtaining a norm history sequence composed of the L2 norms of all participants in the most recent preset round. The central server calculates the mean and standard deviation of the norm historical sequence, and adds the standard deviation by a preset multiple to the mean as a dynamic pruning threshold. For each participant in the current round, when the L2 norm of the participant is greater than the dynamic pruning threshold or less than the reciprocal of the dynamic pruning threshold, the gradient uploaded by the participant is determined to be an abnormal gradient and is removed. Gradients whose L2 norm is between the dynamic pruning threshold and the reciprocal of the dynamic pruning threshold are determined to be valid gradients.
7. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 2, characterized in that, The temporal convolutional layer performs one-dimensional convolution on the temporal feature vector of the node to obtain temporal features. The spatial mapping layer aggregates the temporal features of neighboring nodes according to the weight of the edge, including: the temporal convolutional layer uses multiple sets of dilated convolution kernels of different scales to perform convolution operations on the temporal feature vector respectively, and concatenates the results of multiple sets of convolution operations to obtain the temporal features. The spatial mapping layer transforms the weights of the edges into attention coefficients, and constructs a multi-head cross-attention mechanism with the current node as the query vector and the time features of the neighboring nodes as the key vector and value vector; The spatial mapping layer performs a weighted summation of the temporal features of the neighboring nodes through the multi-head cross-attention mechanism, and outputs aggregated features after processing the weighted summation result through a nonlinear activation function. The aggregated features are then used as the local graph embedding vector.
8. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 3, characterized in that, The number of virtual nodes is dynamically adjusted based on the total number of cheating tags reported by each participant in the current round, including: the central server counts the total number of cheating tags reported by each participant in the current round, and calculates the ratio of the difference between the total number of cheating tags in the current round and the average number of cheating tags in historical rounds. When the difference ratio is greater than a preset growth threshold, the central server adds a number of virtual nodes to the anchor point map corresponding to the difference ratio, and randomly connects the newly added virtual nodes to the existing virtual nodes. When the difference ratio is less than a preset attenuation threshold, the central server deletes the virtual node with the highest isolation degree in the anchor point graph and synchronously updates the dimension of the topological latent variable in the graph generator so that the size of the anchor point graph matches the actual cheating scale of the current round.
9. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 4, characterized in that, The participating party applies Gaussian noise perturbation to the benchmark feature to generate multiple negative sample features, including: the participating party calculates the Euclidean distance between the local map embedding vector and the anchor point map embedding vector; When the Euclidean distance is less than a preset distance threshold, the participating party introduces an inverse adjustment factor based on the Euclidean distance into the variance matrix of the Gaussian noise perturbation to reduce the initial variance of the Gaussian noise perturbation and generate difficult negative sample features that are close to the baseline feature distribution. When the Euclidean distance is greater than the preset distance threshold, the participants keep the initial variance of the Gaussian noise perturbation unchanged and generate easy negative sample features that are far from the baseline feature distribution; When constructing the InfoNCE loss function, the features of the difficult negative samples are assigned a loss weight greater than that of the features of the easy negative samples.
10. The distributed anti-fraud behavior feature extraction method based on federated learning according to claim 6, characterized in that, After determining that the gradient uploaded by the participant is an abnormal gradient and removing it, the process further includes: the central server assigning a trust decay value to the participant whose abnormal gradient has been removed, and subtracting the trust decay value from the participant's historical trust value to obtain a real-time trust value. When the real-time trust value is lower than the preset isolation threshold, the central server stops sending the anchor point map and the anchor point map embedding vector to the participants and marks it as an isolated state. When the real-time trust value is greater than or equal to the preset isolation threshold and less than the historical trust value, if the participant uploads the effective gradient in a subsequent round, the central server calculates the gradient scaling factor based on the real-time trust value, multiplies the gradient scaling factor with the effective gradient to obtain the weighted gradient, and uses the weighted gradient to replace the effective gradient to perform aggregation to generate the global graph neural network parameters.