Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

7 August 2026

37 Pages

A Federated Pyramid Swin Vision Transformer Framework with Generative AI for Sybil-Resilient Routing Optimization and Energy-Efficient Communication in Wireless Sensor Networks

and
Electronics and Communication Engineering, Sathyabama Institute of Science and Technology, Chennai 600119, India
*
Author to whom correspondence should be addressed.

Abstract

Mobile Ad Hoc Networks (MANETs) or Wireless Sensor Networks (WSNs) have a “decentralized” architecture and are very susceptible to sophisticated attacks, such as identity forgery attacks using deep learning (DL) methods. Secure routing and intrusion detection systems have been developed but they are usually not scalable, consume too much power, introduce too much communication overhead and do not provide enough privacy protection, or are not resilient to changes in adversarial behavior. This paper introduces a Federated Pyramid Swin Vision Transformer (FPSViT) framework that enhances the routing optimization and energy-efficient communication for MANET–WSN networks with the support of Generative AI (GAI), addressing these challenges. The proposed framework incorporates three modules: federated averaging for privacy-preserving distributed learning, Pyramid Swin Vision Transformer (PSViT) for extracting Sybil attack characteristics at multiple scales, and a GAI-based adversarial pattern generation module to boost the robustness of the detection process in the presence of evolving attack patterns. Energy-aware routing optimization: It takes into account the energy level of the nodes, power consumption of the links, link reliability and trust values to optimize the routing for minimum power consumption with secure communication. Results of experimental evaluations on various Sybil attack scenarios show that the proposed FPSViT is able to achieve 98.84%, 98.52%, 98.21%, and 98.36% detection accuracy, precision, recall, and F1-score, respectively, and consume 0.381 J/node on average and increase the lifetime of the network to 2876 rounds. The power consumption analysis demonstrates that FPSViT consumes 12–21% less energy than other methods such as Federated CNN, FL-LSTM, Lightweight Standalone Swin Detector, and RL-based Secure Routing, thanks to optimized routing decisions and avoiding unnecessary transmissions, as well as adaptive trust-based communication. Moreover, the proposed framework achieves an improvement in the packet delivery ratio to 98.24%, decreases communication overhead by 9–17% and increases network lifetime by 10–19%. The results have also validated that FPSViT is a scalable, privacy-preserving, and power-saving security solution for dynamic MANET–WSN environments and is able to successfully resist advanced DL-driven Sybil attacks.

1. Introduction

MANETs are self-organizing, infrastructure-less wireless communication networks in which mobile nodes dynamically form a network without relying on any fixed base station or centralized controller. In such environments, each node plays a dual role, acting both as a host for transmitting its own data and as a router for forwarding packets from other nodes. This cooperative and decentralized architecture enables MANETs to be rapidly deployed in scenarios where existing infrastructure-based communication systems are unavailable or impractical. Examples include military battlefield communication, disaster recovery operations, emergency medical response, and temporary sensor deployments [1]. The dynamic and flexible nature of MANETs makes them highly suitable for mobile and distributed environments where network topology frequently changes. A related and widely deployed paradigm is WSNs, which consist of a large number of small sensor nodes capable of sensing, processing, and communicating environmental data. These nodes are typically equipped with limited energy resources, low processing power, and constrained memory [2]. WSNs are extensively used in environmental monitoring, healthcare systems, smart agriculture, industrial automation, and IoT-enabled smart city applications. In many modern systems, MANETs and WSNs are integrated with Vehicular Ad Hoc Networks (VANETs) and fog/edge computing architectures to enhance real-time data processing, reduce latency, and support distributed intelligence in Internet of Things (IoT) ecosystems [3].
Despite their flexibility and wide applicability, MANETs and WSNs suffer from several inherent limitations. The most critical challenges arise from their decentralized architecture, dynamic topology, and resource-constrained nature. Limited battery capacity restricts network lifetime, while constrained bandwidth and processing power reduce computational efficiency [4]. Furthermore, frequent node mobility leads to unstable network links, increased packet loss, routing overhead, and reduced Quality of Service (QoS). These challenges are further amplified by the open wireless communication medium, which exposes transmissions to interference, eavesdropping, and malicious manipulation. Unlike wired networks, where security can be enforced through centralized monitoring, MANETs and WSNs lack a fixed infrastructure, making them significantly more vulnerable to distributed attacks [5]. Security remains one of the most critical concerns in MANET–WSN environments. The absence of centralized control makes it difficult to enforce authentication, trust management, and intrusion detection mechanisms [6]. As a result, these networks are susceptible to both passive attacks, such as traffic analysis and eavesdropping, and active attacks, such as data modification, routing disruption, and node impersonation. These attacks severely degrade network performance by increasing latency, reducing packet delivery ratio, and disrupting routing stability. Ensuring secure communication while maintaining network efficiency under such dynamic conditions remains a challenging research problem [7].
Among various security threats, identity-based attacks have emerged as one of the most dangerous categories in decentralized networks. In particular, the Sybil attack poses a significant threat to MANETs and WSNs. In a Sybil attack, a single malicious node illegitimately assumes multiple fake identities within the network. These fabricated identities are used to manipulate routing decisions, disrupt trust-based mechanisms, influence voting or consensus protocols, and mislead neighboring nodes [8]. Unlike routing-based attacks such as sinkhole or wormhole attacks, Sybil attacks are more complex because they exploit identity verification mechanisms rather than traffic behavior alone. This makes detection significantly more difficult, especially in highly dynamic and resource-constrained environments [9]. Existing Intrusion Detection Systems (IDSs) in MANETs and WSNs have primarily focused on routing anomalies, such as sinkhole, blackhole, and selective forwarding attacks. These methods typically rely on packet flow analysis, neighbor monitoring, or routing table inconsistencies. However, they are not sufficiently effective against Sybil attacks because identity spoofing does not always produce direct anomalies in routing behavior [10]. Existing security solutions often assume centralized monitoring or require high computational resources, which are unsuitable for distributed wireless sensor environments. This creates a significant research gap in the development of efficient, scalable, and lightweight detection mechanisms that specifically target identity-based attacks while preserving privacy and minimizing communication overhead [11].
Recent advances in machine learning (ML) and DL have significantly improved intrusion detection capabilities in network security systems. Federated learning (FL) has emerged as a promising paradigm for distributed environments such as MANETs and WSNs. FL enables multiple nodes to collaboratively train a shared global model without exchanging raw data. Instead, only model parameters or gradients are shared with a central aggregator. This decentralized learning approach preserves data privacy, reduces communication overhead, and improves scalability [12]. FL alone is insufficient to handle complex spatiotemporal dependencies in highly dynamic network traffic patterns. To address the limitations of existing IDS and enhance feature learning capability, DL models such as Long Short-Term Memory (LSTM) networks and transformer-based architectures have been widely explored. LSTM networks are effective in modeling sequential dependencies and temporal patterns, making them suitable for intrusion detection in dynamic networks. However, they may suffer from long-term dependency limitations and gradient-related challenges in complex environments [13]. Vision Transformers (ViTs), particularly Swin Transformer architectures, have demonstrated strong performance in capturing global contextual relationships using self-attention mechanisms. The hierarchical structure of Swin Transformers enables efficient representation learning across multiple scales, making them highly effective for complex pattern recognition tasks [14].
Building on these advancements, this paper proposes a novel FPSViT framework for Sybil attack detection in MANET–WSN environments. The proposed framework integrates FL with the PSViT architecture to achieve privacy-preserving, scalable, and highly accurate intrusion detection. In this framework, each network node performs local training on its own data, eliminating the need to transmit raw data. Only model updates are shared and aggregated globally, ensuring data confidentiality and reducing communication costs. The PSViT serves as the core feature extraction module of the proposed system. It leverages hierarchical feature representations and shifted-window-based self-attention to capture both local and global dependencies in network behavior. The pyramid structure enables multi-scale analysis of traffic patterns, allowing the model to effectively distinguish between legitimate nodes and malicious Sybil identities. This design is particularly suitable for MANET–WSN environments where network conditions are highly dynamic and heterogeneous. The integration of FL with transformer-based architectures enhances the model’s adaptability in distributed environments. It enables continuous learning from diverse network nodes while maintaining privacy and reducing dependence on a central authority. The proposed FPSViT framework is therefore capable of addressing both scalability and security challenges in real-world IoT-driven MANET–WSN systems. Key contributions of the paper are as follows:
  • A novel FPSViT framework is proposed for Sybil attack detection in MANET–WSN environments.
  • A privacy-preserving FL mechanism is incorporated to enable decentralized training without raw data exchange.
  • A Pyramid Swin Transformer-based architecture is designed to extract multi-scale spatial–temporal features for robust identity analysis.
  • The framework ensures improved detection accuracy, scalability, and robustness in highly dynamic network conditions.
  • Comprehensive experiments demonstrate reduced communication overhead and enhanced security performance compared to existing intrusion detection approaches.
The remainder of this paper is organized as follows. The works related to secure routing, FL and transformer-based Sybil attack detection in the MANET–WSN environment are discussed in Section 2. In Section 3, problem formulation consists of a system model, assumptions, and optimization objectives. Materials and methods are presented in Section 4 which includes the proposed FPSViT framework, architecture, federated training strategy, security and privacy preservation mechanisms and routing optimization methodology. In Section 5, the experimental results and discussions are presented, where the performance comparison, the ablation studies, the analysis of heterogeneous networks, the validation of attack scenarios and the statistical significance analysis are presented. Finally, Section 6 summarizes the principal contributions, discusses limitations of the proposed framework and suggests future research directions.

3. Problem Formation

Let us assume that the environment is a hybrid MANET–WSN, which is modeled as a graph G = V ,   E , where V = { v 1 ,   v 2 , … , v N }   is the set of mobile or sensor nodes and E is the set of links between them. The resources at each node consist of a limited amount of residual energy E x r   and a trust value T x   indicating its reliability when sending and routing messages. Because of the decentralized and open structure of the network, the network is extremely susceptible to attacks from adversarial nodes generating a set of malicious identities S = s 1 , s 2 , … , s k ⊂ V   and causing disruption to the network, known as a Sybil attack.
Each node i x is represented by a feature vector i x ∈ R d that describes the behavioral and communication properties of the node. The main goal is to construct a function f θ . dependent on the parameter θ that properly labels each node j ^ x = f θ ( i x ) with the actual label j x ∈ { 0,1 } .
The system is based on an FL framework that allows local training of models on local data and only reports model parameters to a top aggregator, thus maintaining data privacy and minimizing communication overhead. Global modeling is done by aggregating the local parameters based on the distribution of the data across the nodes and using a set of weights.
The optimization problem is formulated under the following objective functions: (i) the maximization of Sybil detection accuracy, (ii) the minimization of the energy consumption in communication and (iii) the enhancement of trust-aware secure routing performance. The following are constraints on these objectives: limited residual energy at each node, trust threshold requirement for participation in routing decision, communication constraints caused by FL process. The main goal of the formulation is to provide secure, efficient and privacy-preserving communication in dynamic MANET-WSN environments in the presence of Sybil attacks.

4. Materials and Methods

In this study, a simulated hybrid WSN–MANET environment was developed to investigate heterogeneous sensor nodes operating under limited energy resources and dynamic network connectivity. Network traffic traces were generated using benchmark scenarios comprising both normal communication behavior and Sybil attack activities, including identity impersonation, packet manipulation, and routing interference. Data preprocessing involved normalization, outlier removal, and categorical encoding of node-level attributes, including packet transmission rate, neighbor density, residual energy, link reliability, and trust indicators, to ensure a consistent input representation. The proposed FPSViT framework was implemented using Python 3.11 (Python Software Foundation, Wilmington, DE, USA) with the PyTorch 2.2 deep learning library (Linux Foundation, San Francisco, CA, USA), while data preprocessing and numerical analysis were performed using NumPy (NumPy Developers, Walnut, CA, USA), Pandas (Pandas Development Team, USA), and Scikit-learn (Scikit-learn Developers, Palaiseau, France). The federated learning process employed the Federated Averaging (FedAvg) algorithm, enabling distributed training of local detection models while preserving data privacy and reducing communication overhead, as illustrated in Figure 1. GAI module was incorporated to synthesize diverse Sybil attack patterns, thereby enhancing the robustness and generalization capability of the detection model. Secure routing decisions were determined by integrating energy-aware metrics, trust evaluation, and attack detection outcomes to establish reliable communication paths while minimizing energy consumption. Since this work is entirely simulation-based, no commercial chemicals, reagents, laboratory instruments, commercial cell lines, biological samples, or experimental materials were used.
Figure 1. Proposed architecture.
The training and validation was conducted based on repeated communication cycles with varying network densities, mobility conditions as well as attack levels. The measures of the system performance included detection accuracy, packet delivery ratio, routing overhead, delay, and energy usage to ensure the effectiveness and resilience of the framework.

4.1. Dataset Description

The dataset describes various features of the WSN activity to train and evaluate the proposed framework in Table 1. It also carries node information like identity, position, and energy availability and communication range, to capture topology well. Communication logs follow the packets’ change in direction, delay, throughput and hop count where energy logs show the power consumed in the transmission, idle, and sleep state. The mobility data is simulated as dynamic connected and injected attack traces of Sybil attacks injecting malicious identity and traffic patterns.
Table 1. Dataset description.

4.2. Pre-Processing

The pre-processing stage prepares heterogeneous WSN data for the FPSViT framework by cleaning, normalizing, structuring, and encoding it into graph-based inputs. Missing or noisy samples are corrected using mean imputation:
i x * = 1 N ∑ y = 1 N i y  
where i x * is the imputed feature, i y represents observed values, and N represents the number of samples. Abnormal values are detected using Z-score normalization:
z x = i x − μ σ
with μ as the mean and σ as the standard deviation.
Feature magnitudes are aligned through m i n − m a x scaling:
i x = i x − i m i n i m a x − i m i n
where i m i n and i m a x denote minimum and maximum feature bounds. Topology relationships among sensor nodes are modeled via an adjacency matrix:
A x y = { 1 ,     d x y ≤ r   0 ,     o t h e r w i s e    
d x y = i x − i y 2 + j x − j y 2
Where A x y   indicates connectivity between nodes x and y , d x y Euclidean distance, and r communication radius. Node features are projected into patch embeddings for FPSVIT processing:
Z   = I W p + b p
where I is the feature matrix, W p is projection weight, and b p   is bias. During FL, local datasets D k   across clients are aggregated using
θ t + 1 = ∑ k = 1 K n k n θ k t  
where θ k t   denotes local model parameters, n k local sample size, and n total samples. This pre-processing pipeline standardizes structured inputs, enabling robust routing optimization and Sybil attack detection within the FPSVIT-enabled WSN environment.

4.3. Feature Extraction Using Pyramid Swin Vision Transformer

Figure 2 illustrates how a MANET graph-encoded input image is processed through the PSViT for feature extraction. Initially, network data describing node attributes, connectivity, and mobility are converted into a structured image representation derived from the feature matrix and adjacency matrix. This image is passed through linear projection to map raw values into embedding space, followed by patch embedding that divides the input into tokens and applies self-attention to capture local relationships. Patch-merge stages create a pyramidal hierarchy of successively coarser spatial resolutions, with more and more information about the image carried in their semantic data. The hierarchical representation conserves the multi-scale communication patterns and allows the extraction of the routing behavior, energy distribution and abnormal structural features. Lastly, pyramid feature aggregation consolidates across scales to yield a unified feature representation with which downstream problems like optimization of secure routing and Sybil-resistant decision making can be performed in a dynamic mobile ad hoc network world.
Figure 2. Architecture of Pyramid Swin Vision Transformer.
The encoded transformer input tensor is formed as
X = f ( I , A )
Where X denotes the input tensor and f ( . ) represents reshaping and channel stacking. Linear projection maps are input into latent dimension D:
E = I W e + b e
Where E is embedded feature representation, W e ∈ R N × d weight matrix, and b e   bias vector. Tokenized patches are obtained as
Z 0 = P a t c h ( E )
With Z 0 denoting initial patch tokens. Within each shifted window, self-attention derives query, key, and value matrices
Q = Z 0 W Q
K = Z 0 W K
V = Z 0 W V
Where Q ,   K ,   V denote query, key, value projections and W Q , W K , W V are learnable weights. Scaled attention scores are
S = Q K T d k    
A = S o f t m a x ( S )  
Where S represents similarity scores, d k key dimension, and A t   attention weights. Contextual features become
Z 1 = A t V
with Z 1 representing attended features.
Patch merging gives hierarchical representation
F l = C o n c a t Z l − 1 1 , Z l − 1 2 , Z l − 1 3 , Z l − 1 4 W m
Where F l denotes pyramid-level features, W m merging weight, and concatenation combines four neighboring patches.
This produces multi-scale levels F 1 , F 2 , … , F L , where L is total pyramid depth. Finally, a unified representation is computed by feature fusion:
F = ∑ l = 1 L α l F l    
Where F the final extracted feature is vector and α l   represents learnable aggregation coefficients. This derivation enables PSViT to capture spatial–topological patterns reflecting routing behavior, mobility structure, and anomaly signatures for robust MANET optimization and detection tasks.

4.4. Generated AI Integration

The proposed framework incorporates a generative module that will work to increase the strength and detection in low and asymmetrical conditions of the MANET data. It works in conjunction with PSViT to generate realistic samples of features of various routing behaviors, mobility patterns, and Sybil attack characteristics, as illustrated in Figure 3. In local training, the nodes add synthetic examples of latent network variations to datasets, enhancing distribution coverage and minimizing overfitting. Data generated are then verified with quality analysis in order to combine them with actual observations to guarantee reliability. In the federated context, refined model parameters are communicated, whereas locality is maintained. This integration enhances resilience, better representation of anomalies, and can be used to facilitate stable collaborative learning among heterogeneous and dynamic nodes. The generative component follows an adversarial learning mechanism involving a Generator (G) and Discriminator (D).
Figure 3. Architecture of Generated AI Integration.
Let the real MANET feature distribution be denoted by p d a t a i , where i ∈ R d represents network feature samples, and let latent noise z ~ p z z with dimensionality m. The generator (G) parameterized by θ g maps noise to synthetic samples:
i ^ = G ( z ; θ g )
Where i ^ denotes generated data. D parameterized by θ d outputs the probability that an input originates from the real distribution:
D i ;   θ d = σ f ( i )  
Where σ ( . ) is the sigmoid activation and f ( . ) is the discriminator logit. Training begins by defining the adversarial value function:
V D ,   G = E z ~ p d a t a l o g   l o g   D i   + E z ~ p z l o g   l o g   1 − D G z  
D maximizes correct classification by optimizing V ( D , G )     and gradient ascent update is derived as
θ d t + 1 = θ d t + η d ∇ θ d 1 M ∑ x = 1 M l o g   l o g   D i x + l o g   l o g   1 − D G z x    
Where M denotes batch size and η d learning rate. Conversely, the generator minimizes the probability of generated samples being detected as fake, giving E z ~ p z l o g   l o g   1 − D G z     , which is commonly reformulated for stable gradients as E z ~ p z l o g   l o g   D G z       and parameter update becomes
θ g t + 1 = θ g t + η g ∇ θ g 1 M ∑ x = 1 M l o g   1 − D G ( z x )  
Through iterative optimization, G learns to approximate P d a t a ( i ) by generating realistic MANET feature representations, while D improves its discrimination capability. The generator–discriminator mechanism enables the proposed framework to learn realistic data representations through adversarial optimization. The generator transforms latent noise into synthetic MANET feature samples, while the discriminator evaluates their authenticity relative to real observations. By iteratively updating their parameters using opposing objectives, the generator improves its ability to approximate the true data distribution and the discriminator enhances its classification capability. The effect of this interaction is the high-quality augmented samples that augment local training datasets without viewing raw network data. As a result, adversarial generation integration helps enhance diversity in the dataset, strong model generalization, and resilience of the FPSViT framework in the dynamic MANET settings.

4.5. Federated Training Strategy

The proposed FPSViT framework supports distributed Sybil attack detection, data routing optimization, the confidentiality of the data, and is also robust against adversarial attacks. Each node in the MANET/WSN trains the PSViT model locally based on its private routing dataset D k , which comprises routing statistics, residual energy, mobility information and trust attributes without sharing raw observations with the central server, as shown in Figure 4. During the tth communication round, the local model parameters are optimized by minimizing the local objective function:
θ k t + 1 = θ k t − η ∇ L k θ k t ; D k
Figure 4. Architecture of privacy preservation using FL.
Here η represents the learning rate and L k . is the local loss function. To mitigate the risk of inversion attacks, differential privacy is added by normalizing the gradients with a clipping function and introducing Gaussian noises:
g ~ k = C l i p ∇ L k ,   C +   N ( 0 ,   σ 2 C 2 )
The privacy budget σ is controlled by the threshold C of the clipping.
The proposed framework achieves ( ε , δ ) -differential privacy with ε   ≤   2 l n l n   1.25 δ   σ   , which is mathematically bounded to achieve successful gradient reconstruction with only a small probability, thus limiting information leakage significantly. The gradients are encrypted using additive homomorphic encryption during communication, encrypted as
c k = E n c g ~ k ,   K k
The encrypted updates have the homomorphic property.
D e c ∏ k = 1 K c k = ∑ k = 1 K g _ k
Without accessing individual client updates, this ensures privacy in the federated aggregation process. In order to defend against malicious client poisoning attacks, the server aggregates data with a robust aggregator called Trimmed Mean estimator:
g g l o b a l = T r i m m e d M e a n   ( g _ 1 ,   g _ 2 ,   … ,   g _ K )
which removes extreme gradient values, before computing the global update. It is assumed that the number of compromised clients f   in a population is less than half of the total client number n: f < K / 2   . It is assumed that the fraction of compromised clients in a population is less than K / 2 . Here g * is the actual global gradient, and ϵ is the maximum deviation of benign updates. This bound shows that there is only a small impact of poisoned gradients on the global optimization process. Finally, the integrity of the communication is checked with cryptographic hash-signatures:
h k = H a s h ( c k )
which identify changes to updated transmissions that are not authorized. As a result, the proposed differential privacy, homomorphic encryption, robust aggregation, and integrity verification guarantee provable protection against the gradient leakage, inference attack, and malicious client poisoning in the dynamic MANET–WSN environment and reliable collaborative learning.

4.6. Security and Privacy Preservation Mechanism

The proposed PP-FPSViT scheme can facilitate the detection of Sybil attacks and secure routing optimization using the cooperative approach without revealing the sensitive information of the local network. With the MANET/WSN clients, as shown in Figure 5, local model optimization is done using local routing observations, while only encrypted model updates are exchanged with the federated server. The combination of Differential Privacy (DP), Homomorphic Encryption (HE), TLS/SSL secure communication, robust aggregation, and GAI-based augmentation is used to benefit joint privacy preservation, adversarial robustness, and model generalization.
Figure 5. Privacy-preserving FL framework utilizes PSViT.

4.6.1. Local Feature Representation

The proposed PP-FPSViT involves each participating client   k doing local training on its private routing dataset D k =   x i , y i i = 1 N k , comprising the routing feature vector x i   and the corresponding Sybil attack label y i .   The input routing feature map is split into a series of non-overlapping patches P =   P 1 , P 2 , … ,   P N to facilitate representation learning using the transformer model. The patch is then mapped into a latent embedding space by a linear map:
E i =   P i W e +   b e
Where W e is the learnable embedding matrix and b e   is the bias vector. This embedding converts the raw routing attributes to high-dimensional feature representations, which allows for extracting local structural information while also enabling hierarchical attention learning.

4.6.2. Pyramid Swin Transformer Feature Learning

The PSViT processes the embedded patches and utilizes shifted window self-attention to extract the local and global contextual relationships. The embedded features are represented in query, key, and value matrices for each attention window:
Q =   E W Q , K =   E W K , V =   E W V
W Q , W K , and W V are trainable projection matrices. The self-attention operation is defined as
A t t e n t i o n Q , K , V = S o f t m a x Q K T d + B V
Where d is the dimension of the matrix, and B is a bias vector. The relative positional bias B maintains spatial relationships between patches, and d is the feature dimension. The shifted window mechanism allows efficient modeling of long-range dependencies, without increasing the computational complexity.

4.6.3. Patch Merging

The proposed PSViT iteratively joins neighboring patches between successive iterations to build up hierarchical feature representations. The four neighboring patches are connected as
Z = C o n c a t E 1 , E 2 , E 3 , E 4
The representation was converted to a lower-resolution representation through the use of layer normalization and linear projection:
F l + 1 = L N ( Z ) W p
L N ( ⋅ ) is the layer normalization and W p is the learnable projection matrix. Spatial resolution is thus decreased from ( H , W ) to ( H / 2 , W / 2 ) , and the dimension of the features is increased from C to 2 C . This hierarchical reduction allows the network to learn more and more abstract semantic representations of the data, while also eliminating the computational load. The Patch Merging algorithm partitions the input feature map into non-overlapping 2 × 2 neighboring patches, concatenates their features, applies layer normalization and linear projection, doubles the channel dimension, and halves the spatial resolution, producing a compact feature representation for efficient hierarchical feature extraction (Algorithm 1).
Algorithm 1 Patch Merging
Input: Feature Map F of shape (n, m).
Output: Reduced Feature Map F’ of shape (n, m’).
1. Divide   the   map   of   the   area   into   2   ×   2 neighboring patches.
2 Concatenate four adjacent patches
3 Apply Layer Normalization
4 Apply Linear Projection
5 Double channel dimension
6 Halve spatial resolution
7 Return merged features

4.6.4. Pyramid Feature Fusion

Pyramid feature fusion is used to adaptively integrate the multi-level hierarchical features generated by the different transformer stages. Let F l be the output feature map of the l t h   pyramid level. The final fused representation is
F f u s i o n = ∑ l = 1 L α l F l
Where   L is the number of layers. The adaptive attention weight for each level is calculated by applying the Softmax function:
α l =   e x p e x p   s l   ∑ j = 1 L e x p e x p   s j  
where s l   is the importance of the corresponding pyramid level.
Algorithm 2 describes Pyramid Feature Fusion integrates multi-scale feature maps by first resizing them to a common resolution, computing attention scores, normalizing the scores with the Softmax function, generating weighted feature maps, and summing them to produce a unified, discriminative feature representation for robust downstream learning.
Algorithm 2 Pyramid Feature Fusion
Input :     Multi - scale   features     features     F 1 , F 2 , … F L
Output :     F f u s i o n
1 Resize all feature maps
2 Compute attention score
3 Normalize scores using Softmax
4 Compute weighted feature maps
5 Sum all weighted features
6 Return fused feature representation.

4.6.5. Local Loss Function

The PSViT model is locally optimized at each federated client using the cross-entropy loss function. The local objective is defined as
L k θ = − 1 N k ∑ i = 1 N k y i l o g   l o g   y ^ i  
It is a classification problem where y ^ i = f x i ;   θ   is the predicted probability given by the PSViT classifier using the parameters   θ and x i   is the input data point. When all clients are considered, the overall federated optimization objective is
L θ = ∑ k = 1 K N k N L k θ
In which N =   ∑ k = 1 K N k   denotes the total number of training samples. This weighted objective ensures that larger datasets make a more significant contribution to the global optimization process for the client.

4.6.6. Gradient Derivation and Parameter Optimization

The gradient of the loss function at the current point on the model parameters is approximated by
  g k = ∇ θ L k ( θ )
The error signal is backward-propagated through successive layers of the transformer during backpropagation, as shown by the following equation:
δ l = W l + 1 T δ l + 1 ʘ σ ′ z l
δ l   is the error term for layer l , W l + 1 is weight matrix for the next layer, and σ ′ . is the derivative of the activation function. Consequently, the gradient of each weight matrix is computed by
∂ L ∂ W l = δ l a l − 1   T
a l − 1 represents the activation of the previous layer. Then gradient descent is used to update the model parameters as
θ k t + 1 = θ k t − η g k
where η is the learning rate, and t   represents the round of the communication. This is an iterative optimization process that reduces the local classification error while being ready for federated aggregation.

4.6.7. Differential Privacy Protection

In order to keep the routing information from leaking to others, a differential privacy is implemented before sending the local gradients. The first is gradient clipping, which restricts overly large updates, and
g _ k = g k .   m i n 1 , C ‖ g k ‖
Where C is the threshold for clipping. Gaussian noise is then added to acquire the gradient with privacy:
g ~ k =   g _ k + N 0 , σ 2 C 2
Where σ is the size of the privacy budget. This mechanism allows adversaries to not be able to reconstruct private training samples, without sacrificing the utility of the model.

4.6.8. Homomorphic Encryption

The gradients are encrypted before they are sent, by homomorphic encryption:
E k = E n c g ~ k
The encrypted updates have the additive homomorphic property:
D e c ∏ k = 1 K E k =   ∑ k = 1 K g _ k
This provides secure aggregation without revealing each client’s gradient. As such, the information used for raw routing stays private throughout the FL process.

4.6.9. Robust Federated Aggregation

The server uses the Trimmed Mean aggregation rule for robustness against poisoned or malicious updates:
g g l o b a l = T r i m m e d M e a n   ( g _ 1 ,   g _ 2 ,   … ,   g _ K )
Which eliminates values that have abnormal gradients before averaging. The global FPSViT parameters are next updated as follows:
θ t + 1 =   θ t −   η g g l o b a l
The optimized global model is passed to all clients during the subsequent communication round, allowing the clients too collaboratively and privately refine the model.

4.6.10. Generative AI-Based Data Augmentation

Algorithm 3 initializes the generator and discriminator to adversarially generate realistic synthetic Sybil attack samples. After iterative training until convergence, the generated samples are combined with real training data to create an augmented dataset, which is then used to train the FPSViT model for improved robustness and generalization. The generator generates fake attack instances based on
x f a k e = G ( z )
For latent random vector z . The discriminator is trained to detect real samples from generated ones by minimizing
L D = − E l o g D x − E l o g ( 1 − D G z )
The generator minimizes
L G = − E l o g   l o g   D G z  
To create more and more realistic adversarial examples. The enhanced local information dataset is
D k a u g = D k ∪ G ( z )
Thus, it diversifies the training data, enhances adversarial generalization and increases the ability of the proposed FPSViT framework to accurately identify previously unseen Sybil attacks in dynamic MANET-WSN environments.
Algorithm 3 GAI Augmentation
Input:  Real training samples
Output:  Augmented dataset
1   Initialize   Generator   G
2   Initialize   Discriminator   D
3 Generate synthetic Sybil samples
4   Train   D using real and fake samples
5   Update   G   to   fool   D
6 Repeat until convergence
7 Merge generated samples with real data
8 Train FPSViT using augmented dataset

4.7. Routing Optimization and Energy Efficiency Mechanism

In the proposed routing optimization and energy efficiency mechanism, the extracted network features, such as node residual energy, link quality, and traffic load, are used to guide adaptive routing decisions and energy-aware communication policies to maximize network lifetime and overall performance. The residual energy of node x is defined as:
E x r e s = E x i n i t − ∑ t = 1 T E x t i t + E x T i t   ( R e s i d u a l   E n e r g y , R E )
Where E x i n i t is the initial energy, and E x t i t and E x r i t represent energy consumed for transmission and reception at time t . The link cost between nodes x and y considers both energy and distance:
C x y = α d x y E x r e s + β L x y   ( L i n k   C o s t ,   L C )
Where d x y is the distance, L x y is the link quality metric (e.g., packet loss), and α , β are weighting factors. The routing decision selects the path P* that minimizes the cumulative link cost while balancing energy consumption:
P * = a r g   ∑ ( x , y ) ∈ P n C x y     ( O p t i m a l   P a t h ,   O P )
To further enhance energy efficiency, nodes adapt their transmission power P x t i   based on distance and residual energy:
P x t i = P m i n + γ d x y 2   E x r e s   ( A d a p t i v e   T r a n s m i s s i o n   P o w e r ,   A T P )
Where P m i n the minimum required power and γ is a scaling factor. By integrating residual energy, link quality, distance, and traffic load metrics, the mechanism dynamically selects energy-efficient routes and adapts communication parameters. Based on extracted network features, it determines adaptive routing and transmission policies that reduce energy usage, avoid node depletion, increase network lifetime, and maintain high reliability and overall performance.

4.8. Model Optimization and Convergence Strategy

This module facilitates effective and stable training of the global model under a federated or a distributed environment. Parameters are optimized by local clients by minimizing losses and updating weights to be aggregated, thereby ranking reliable or representative data sources. Stability is maintained using adaptive learning rates, momentum, and gradient clipping to avoid divergence. Integrated within a Central-Orchestrator-based edge AI framework using Micro-PSViT, the approach enables privacy-preserving distributed learning while improving convergence, robustness, and overall model accuracy across heterogeneous nodes. The central orchestrator maintains the global model θ g l o b a l and updates it using Fast-FedAvg aggregation:
θ g l o b a l t + 1 = θ g l o b a l t − η ∑ x = 1 N w x g X ( F a s t − F e d A v g   U p d a t e ,   F F A )
Where g x   are local gradients from client x , w x is a weight based on client data quality, and η is the learning rate. Distillation compresses the global model for efficient edge deployment:
θ x c o m p a c t = C o m p r e s s   ( θ g l o b a l )   ( M o d e l   C o m p r e s s i o n ,   M C )
And the compact model is transmitted via a Quantum-Secure Channel (TLS/UAV-Net), ensuring privacy:
E n c θ x c o m p a c t   T L S U A V − N e t →   D e c ( θ x c o m p a c t )   ( S e c u r e   T r a n s m i s s i o n ,   S T )
Each edge AI client performs local updates using on-device PSVIT-Lite. The client computes local gradients:
g x = ∇ L x θ x     ( L o c a l   G r a d i e n t ,   L G )
Where L x , the local loss, is computed on sensor or sonar data. To enhance training and preserve privacy, GAI augmentation produces synthetic data:
I x a u g = G G e n A I ( I x )   ( A u g m e n t e d   S a m p l e s ,   A S )
Clients then generate adaptive gradients based on convergence or resource conditions:
g x a d a p t i v e = a g i x + 1 − α g x p r e v     ( A d a p t i v e   G r a d i e n t ,   A G )
Which are sent back securely to the orchestrator for aggregation. This process iteratively updates the global model while maintaining data privacy, secure communication, and convergence stability. Self-tuning hyperparameters at the orchestrator further ensure efficient learning and optimal performance across all edge clients.
The proposed FPSViT framework with GAI enables secure and energy-efficient communication in WSNs by integrating advanced FL, multi-scale feature extraction, and Sybil attack detection (Algorithm 4). Each sensor node learns a local PSViT model on its own data to estimate routing patterns in the presence of residual energy, enabling energy-conscious decision making. A GAI module is used to detect potential Sybil nodes by detecting anomalous behavior, improving the security of the network. Weighted federated averaging is used to add local model updates at a central server, with trust scores, so that nodes that were compromised have less weight. The world model results in optimistic routing policies which ensure minimum communication distance, energy usage and security risk, which is then refined through a series of federated rounds to ensure maximum network lifetime and resilience.
Algorithm 4 FPSViT with GAl for Sybil-Resilient Routing in WSN
   Input :   Local   datasets   for   each   sensor   node   D x ;   initial   global   model   parameters   θ g l o b a l ;   learning   rate   η ;   discount   factor   γ ; maximum communication rounds R; energy threshold Eth for sensor nodes.
   Output :   Optimized   routing   policy   π * ;   global   federated   model   θ g l o b a l R .
                Step 1: Local Data Pre-processing
   Each   node   x pre-processes its sensory and network data using Equations (1)–(7).
  Step 2: Local Pyramid Swin Transformer Training: Each node trains a local PSViT for routing pattern extraction using Equations (8)–(17).
  Loss function (Cross-Entropy Energy Penalty)
L x = − ∑ y = 1 n j x y l o g l o g   j ^ x y + λ ∑ k = 1 m m a x ( 0 , E k − E t h )  
   where   E k   is   the   residual   energy   of   node   k ;   λ is the energy penalty weight.
   Update   local   parameters   using   gradient   descent :
θ x ← θ x − η ∇ θ x L x
  Step 3: GAI for Sybil Node Detection
  GAI is employed to model and generate potential Sybil-like node behaviors.
   The   generator   G   produces   synthetic   malicious   node   features   as :   i x f a k e ~ G z ; ∅   z ~ N ( 0 , 1 )
  The discriminator evaluates the divergence between real and generated node behavior using Kullback–Leibler (KL) divergence. A node is classified as Sybil if the divergence exceeds a predefined threshold:
S y b i l F l a g x = { 1 ,     i f   D K L i x | | i x f a k e > δ   0 ,                   o t h e r w i s e                                            
   where   D K L is the Kullback–Leibler divergence and d is a threshold.
  Step 4: Federated Aggregation
  Nodes send local model updates to the central server:
∆ θ x = θ x − θ g l o b a l
  The global model is updated via FedAvg using Equation (7).
  Optionally, it is weighted by node trust for Sybil resilience.
   Step   5 :   Energy - Aware   Routing   Optimization :   After   training ,   the   global   model   outputs   routing   decisions   π ( x → y )   for   node   i   to   neighbor   y .
  Routing cost function:
C x , y = α . d x y + β . 1 E y + γ . S y b i l F l a g y
   where   d x y   =   distance   between   nodes ;   E y   =   residual   energy ;   α ,   β ,   γ = weights for distance, energy, and security.
  Routing decision:
y * = a r g a r g   C ( x , y )    
  Step 6: FL Loop: Repeat Steps 2–5 for R communication rounds or until convergence using Equation (7).
  Step 7: Output
   Global   optimized   routing   policy   π * ;   trained   FPS - VIT   model   θ g l o b a l R ; energy-efficient, Sybil-resilient paths for WSN communication
θ g l o b a l ← ∑ x = 1 N w x θ x ,     w x = 1 − S y b i l F l a g x

5. Results and Discussions

All baseline techniques were trained under the same federated learning settings as the suggested FPSViT framework in order to guarantee a fair comparison. Four convolutional layers and one fully connected classification layer made up the five-layer convolutional architecture used by Federated CNN. A dense output layer and two stacked LSTM layers, each with 128 hidden units, made up FL-LSTM. A Deep Q-Network with three fully linked hidden layers with 256, 128, and 64 neurons was used to create the RL-based Secure Routing baseline. The Adam optimizer was used to optimize all learning-based baselines with a batch size of 64, five local training epochs per communication round, fifty federated communication rounds, and a learning rate of 0.001. To provide uniform evaluation under the same distributed learning settings, FedAvg was employed as the aggregation algorithm for all federated baselines (Table 2). By eliminating implementation bias, these common settings make it possible to ascribe the observed performance differences—rather than variations in hyperparameter selection—to the architectural advantages brought about by the suggested FPSViT framework.
Table 2. Baseline experimental settings.
The hyperparameters were optimized to achieve a balance between the Sybil detection accuracy, privacy preservation, communication overhead, and energy-efficient secure routing. The hyperparameters of the FPSViT framework are optimized according to the accuracy, energy consumption and security requirements of WSNs presented in Table 3, with the help of tuning. PSViT uses 4 layers, 96-dimensional embeddings and dropout 0.1. GAI has a 100 latent space and learning rate of 0.0002. FL is placed over 20 nodes, and routing weights and KL threshold ensure secure communications.
Table 3. Hyperparameter settings.
The raw data is transformed into graph or image format such as adjacency matrices and feature maps, which are easily processed by transformers. Data are split on federated client partitions with distinct validation and test sets to evaluate robustness and generalization. This example depicts the common records of the combination of topology, communication and energy characteristics of sensor nodes, as shown in Table 4.
Table 4. Sample data.
As shown in Figure 6, the number of network nodes increases the higher the energy efficiency of the proposed FPSViT. While the energy efficiency gradually deteriorates as the number of nodes increases, because of the increase in communication and routing complexity, FPSViT still outperforms Federated CNN, FL-LSTM, Lightweight Standalone Swin Detector and Reinforcement Learning Secure Routing. The improvement is claimed to be due to its hierarchical FL, privacy-preserving federated optimization and energy-aware secure routing strategy.
Figure 6. Comparison of energy efficiency vs. number of nodes of proposed and existing systems.
Figure 7 and Figure 8 illustrate the comparative results in terms of connectivity stability, signal strength reliability, packet flow efficiency, topology adaptation, and Sybil attack detection, respectively, which demonstrate the superiority of the proposed FPSViT framework over the existing methods. The highest detection accuracy is 99.2%, with lower communication overhead of 18.4%, which shows efficient and secure FL, achieved by FPSViT. Additionally, the framework offers enhanced routing reliability and longer network longevity by optimizing routing based on trust and energy efficiency. These enhancements validate the strength, scalability and flexibility of FPSViT for MANET–WSN applications in dynamic scenarios with malicious attack conditions.
Figure 7. Comparison of connectivity, signal strength, packet flow, and topology dynamics.
Figure 8. Comparison of security, communication overhead, routing reliability, and network lifetime.
The proposed system has a larger number of live nodes over 2000 simulation rounds, as compared to the existing systems shown in Figure 9. This longer life is achieved thanks to routing based on FL and GAI, which reduces Sybil attacks and uses energy-efficient routing. Although all approaches suffer from node depletion, FPS-ViT-GAI reduces the number of nodes later in the rounds and is more balanced regarding loads; less energy is wasted and the WSN is more stable in the long run.
Figure 9. Comparison of number of alive nodes vs. number of rounds of proposed and existing systems.
The proposed system always has higher throughput than each of the existing systems shown in Figure 10. The routing is energy efficient, FL-optimized and Sybil-resilient to reduce the number of lost packets and retransmissions. Although the throughput is reduced as the nodes’ energy is consumed, FPS-ViT-GAI still has a higher delivery rate, indicating that the communication is reliable and demonstrating the benefits of a long-term implementation of the WSN.
Figure 10. Comparison of throughput vs. number of rounds of proposed and existing systems.
As shown in Figure 11, the proposed system has shown the least delay in the network as compared to the existing systems for 2000 rounds. Due to energy depleting processes and retransmissions, the existing protocols suffer from delays, but the low latency of FPS-ViT-GAI ensured that the long-term systems of WSN have a stable communication network by considering the FL and multi-scale Swin-ViT.
Figure 11. Comparison of delay vs. number of rounds of proposed and existing systems.
As the number of epochs (1 to 50) increases, the accuracy of the proposed FPS-ViT-GAI system gradually improves in terms of training, validation and testing. As the model gradually learns more multiscale features and Sybil patterns, it performs better, as displayed in Figure 12, with 68.5, 65.0 and 64.5 indicating the number of features or patterns the model has learned progressively. At epoch 50, accuracies are 95.8, 92.7 and 92.3. The high similarity between the validation and testing and training outcomes shows that there is a high level of generalization, low overfitting, and sound prediction capacity, leading to safe and energy-saving WSN routing.
Figure 12. Comparison of training, validation and testing accuracy vs. epochs of proposed system.
The proposed system, FPS-ViT-GAI, shows stable decreasing loss with an increase in epochs for both training and validation loss, as well as testing loss, and proves successful learning and convergence, as seen in Figure 13. Losses are large at the early stage, but get reduced with the aid of multi-scale feature extraction, federated optimization and Sybil detection using GAI. The loss values level off at a low value at epoch = 50, which means it shows good generalization and also low overfitting, low prediction error for the observed data, as well as good performance of the secure and energy-efficient WSN routing.
Figure 13. Comparison of training, validation and testing loss vs. epochs of proposed system.
The proposed FPS-ViT-GAI system outperforms the existing WSN protocols in terms of privacy-preserving performance, which can guarantee high data confidentiality, high anonymity and enhancement of trust, as illustrated in Figure 14. GAI is employed to identify malicious nodes, while FL will enable the protection of the central exposure of data. In sum, FPS-ViT-GAI is more private, secure, and reliable for deploying secure WSNs.
Figure 14. Comparison of security metrics of proposed and existing systems.
The proposed FPS-ViT-GAI system outperforms the available WSN protocols and it has the highest accuracy, precision, recall and F1-score, as shown in Figure 15. Strong recall can reduce the false positives and high precision reduces false negativity in a false positive instance. The F1-score is a measure of the quality of decisions made and represents a good level of competence. Existing systems, on the other hand, are less effective due to less robust feature extraction routing optimization and security integration. To conclude, FPS-ViT-GAI is a good, precise and power-efficient model for the operation of reliable WSNs.
Figure 15. Comparison of performance measures of proposed and existing system.
The results showed that the proposed FPSViT has the best privacy preservation and security balancing. It provides the smallest gradient leakage rate (2%), highest aggregation accuracy (96.5%) (Figure 16), and smallest privacy budget (ε = 0.05), meaning that it has better differential privacy guarantees. On the other hand, Federated CNN, FL-LSTM, Lightweight Standalone Swin Detector and Reinforcement Learning Secure Routing have higher information leakage, lower aggregation accuracy and bigger privacy budgets, which validate the robustness and ability to protect privacy of the proposed framework.
Figure 16. Comparison of privacy and security metrics.
The efficiency of each of the proposed components in the FPSViT-GAI framework is shown in the ablation study (Table 5). The removal of the PSViT pyramid resulted in a decrease in the accuracy of detection, due to multi-scale feature extraction decrease. Robustness against unseen Sybil attacks was decreased when excluding GAI, and the energy consumption and communication overhead were increased when replacing weighted federated aggregation with FedAvg. Combining all three modules achieved the best detection accuracy (98.71%), lowest energy consumption (0.381 J/node) and minimum communication overhead (18.54 MB/round), further proving that all three modules are indispensable and have complementary benefits.
Table 5. Ablation study of the proposed FPSViT-GAI framework.
The proposed framework maintains consistently high performance under increasingly challenging adversarial scenarios (Figure 17). Although dynamic Sybil nodes, adaptive fake identities, and coordinated malicious clusters slightly reduce detection accuracy and network performance, FPSViT consistently outperforms all baseline methods. These results demonstrate its superior robustness, adaptive generalization capability, and stable energy-efficient routing under complex and evolving Sybil attack environments, validating its effectiveness in realistic MANET–WSN deployments.
Figure 17. Comparison of Sybil detection accuracy vs. various attack scenarios of proposed and existing systems.
Figure 18 demonstrates the proposed framework performance under increasingly sophisticated Sybil attack scenarios. As attack complexity increases from a single Sybil node to coordinated malicious clusters, energy consumption and communication overhead increase slightly, while packet delivery ratio and network lifetime decrease marginally. The framework consistently maintains high routing reliability, energy efficiency, and resilient communication, confirming strong robustness against advanced adversarial attacks.
Figure 18. Performance comparison under advanced adversarial Sybil attack scenarios.
Figure 19 demonstrates that the proposed framework sustains excellent performance under heterogeneous sensor cluster configurations. As node heterogeneity increases, Sybil detection accuracy decreases only marginally from 98.84% to 97.83%, while energy consumption and communication overhead show slight increases. Despite these variations, packet delivery ratio remains above 97%, confirming the framework’s robustness, scalability, and energy-efficient operation in realistic heterogeneous WSN environments.
Figure 19. Comparison of scaled metrics vs. cluster configuration scenarios.
Figure 20 evaluates the proposed framework under heterogeneous sensor cluster configurations. The results show only a slight decline in Sybil detection accuracy and packet delivery ratio as hardware diversity increases. Similarly, energy consumption and communication overhead exhibit marginal increases. Overall, the framework maintains stable performance, demonstrating effective adaptability, robust FL convergence, and energy-efficient communication in practical heterogeneous WSN deployments.
Figure 20. Comparison of performance evaluation under heterogeneous cluster configuration of the proposed and existing systems.
Figure 21 demonstrates that the proposed FPSViT framework preserves stable federated convergence and efficient resource utilization under heterogeneous WSN conditions. Although increasing node heterogeneity slightly increases local training and aggregation times while reducing remaining energy and network lifetime, the convergence stability remains above 97.8% and the successful model update rate exceeds 97.6%, confirming the framework’s scalability, robustness, and reliable operation in practical heterogeneous sensor networks.
Figure 21. Comparison of convergence and resource utilization under heterogeneous cluster configuration of the proposed and existing systems.
Table 6 shows ten separate experimental runs that were used to assess statistical significance. For every evaluation metric, the mean, standard deviation, and 95% confidence intervals were calculated. Due to the small number of experimental repetitions, Student’s t-distribution was used to determine confidence intervals. Furthermore, a paired two-tailed t-test was used to evaluate the hypothesis against the strongest baseline. Statistically significant improvements were indicated by all obtained p-values being less than 0.001. The suggested FPSViT framework’s stability and repeatability are further demonstrated by the small confidence intervals.
Table 6. Performance under different pruning strategies.
The lightweight deployment experiments demonstrate that structured pruning and quantization significantly reduce model size, memory usage, inference latency, and energy consumption while maintaining high Sybil detection accuracy (Table 6 and Table 7). Among the evaluated methods, INT8 quantization achieves the greatest resource savings, whereas 20% structured pruning provides the best trade-off between computational efficiency and detection performance, confirming the suitability of FPSViT for resource-constrained edge-enabled WSN deployments.
Table 7. Performance under different quantization strategies.
The proposed framework was evaluated over 10 independent experimental runs to assess statistical reliability (Table 8). The results exhibit low standard deviations and small 95% confidence interval margins, indicating stable and consistent performance. Moreover, all p-values are below 0.001, confirming that the observed improvements are statistically significant and unlikely to have occurred by chance, thereby validating the robustness and reproducibility of the proposed framework.
Table 8. Statistical significance analysis of the proposed framework.
The scalability analysis demonstrates that the proposed FPSViT framework maintains robust performance even as the network size increases from 20 to 200 nodes, as shown in Figure 22, Figure 23 and Figure 24. While all methods experience a slight reduction in detection accuracy and packet delivery ratio with increasing network density due to higher communication complexity and routing contention, FPSViT consistently outperforms the competing methods. These results demonstrate that the FL architecture effectively distributes computation, the PSViT preserves robust feature learning under large-scale deployments, and the energy-aware routing mechanism minimizes transmission costs. Overall, the proposed framework exhibits excellent scalability, making it suitable for practical large-scale IoT, MANET, and WSN deployments.
Figure 22. Scalability analysis under different network sizes.
Figure 23. Scalability comparison of energy consumption.
Figure 24. Packet delivery ratio under large-scale networks.
Figure 25 demonstrates the robustness of the proposed FPSViT framework against adversarial privacy attacks in federated learning. FPSViT achieves the lowest model inversion success rate (6.8%) and poisoning attack success rate (4.5%), while attaining a 98.12% privacy preservation score and 97.86% secure aggregation robustness. These results confirm enhanced privacy protection, resilient collaborative learning, and strong suitability for secure large-scale MANET–WSN and IoT deployments.
Figure 25. Comparison of performance metrics of proposed and existing systems.

6. Conclusions

The proposed framework effectively addresses the dual challenges of Sybil-resilient routing optimization and energy-efficient communication in WSNs. By integrating FL with the PSViT architecture and GAI, the framework enables secure, distributed model training while preserving node privacy. Experimental evaluation demonstrates that FPS-ViT-GAI achieves the lowest system data leakage rate (2.1%) and the strongest differential privacy guarantee (ε = 0.05), significantly outperforming existing methods. Secure aggregation accuracy reaches 96.5%, indicating reliable global model updates even under adversarial conditions. Error metrics, including MAE, MSE, and RMSE, confirm the framework’s high prediction accuracy, while confusion matrix analysis shows improved detection and classification of malicious nodes, including SA. The layered FL approach, combined with trust evaluation and anomaly isolation mechanisms, ensures rapid convergence, robust attack mitigation, and minimal energy consumption across the network. Overall, FPS-ViT-GAI not only enhances routing efficiency and security, but also optimizes network resource utilization, making it a highly scalable and resilient solution for modern WSN deployments. These results highlight its potential to improve both reliability and sustainability in large-scale, adversary-prone sensor networks.
However, simulated datasets created from NS-3/OMNeT++ communication logs with fictitious Sybil attack injection scenarios were used to assess the suggested FPSViT architecture. The variability, hardware limitations, environmental interference, and communication uncertainties found in actual MANET–WSN installations may not be fully captured by these datasets, despite the fact that they allow controlled evaluation under a variety of network settings. As a result, simulation-based validation should be taken into consideration when interpreting the reported scalability, resilience, and energy-efficiency results. The validation of the framework using actual sensor platforms and field deployments will be the main focus of future development.

Author Contributions

Conceptualization, B.P.K. and. M.R.E.J.; Methodology—B.P.K. and. M.R.E.J. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The data supporting the results of this study are available within the article.

Conflicts of Interest

The authors declare that they have no conflict of interest.

References

  1. Alanazi, R.; Obayya, M.; Alghamdi, A.M.; Nemri, N.; Alshahrani, S.; Alduaiji, N.; Hasanin, T.; Sorour, S. ML-driven routing optimization for energy-efficient 6G-enabled WSNss. Alex. Eng. J. 2025, 129, 877–888. [Google Scholar] [CrossRef] [Scilit]
  2. Yang, J.; Li, W.; Li, C.; Zhang, L.; Liu, L. An energy-efficient and transmission-efficient adaptive routing algorithm using deep reinforcement learning for WSNss. IEEE Internet Things J. 2025, 12, 50414–50426. [Google Scholar] [CrossRef] [Scilit]
  3. Rajput, M.; Yadav, R.N. Machine and DL driven energy efficient clustering in IoT-WSNs: A Review. IEEE Sens. J. 2025, 25, 39371–39385. [Google Scholar] [CrossRef] [Scilit]
  4. Akram, M.; Bazai, S.U.; Ghafoor, M.I.; Akram, S.; Ilyas, Q.M.; Mehmood, A.; Iqbal, S.; Rafique, M.A. EEMLCR: Energy-Efficient ML-based Clustering and Routing for WSNss. IEEE Access 2025, 13, 70849–70871. [Google Scholar] [CrossRef] [Scilit]
  5. Shilpa, R.; Chaithanya, D.J.; Geetha, M.N.; Rajini, S.; Lokesh, C. An Energy-Efficient and Delay-Sensitive Routing for Mobile WSNss Using an Optimized Deep-Learning Network. Int. J. Commun. Syst. 2026, 39, e70374. [Google Scholar] [CrossRef] [Scilit]
  6. Priyadarshi, R.; Kumar, R.R.; Ranjan, R.; Kumar, P.V. AI-based routing algorithms improve energy efficiency, latency, and data reliability in WSNss. Sci. Rep. 2025, 15, 22292. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  7. Senthil, G.A.; Prabha, R.; Renuka Devi, R. Energy efficient multipath routing in IoT-WSNs via hybrid optimization and DL-based energy prediction. Netw. Comput. Neural Syst. 2025, 1–50. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  8. Thakur, S.; Sarkar, N.I.; Yongchareon, S. AI-Driven Energy-Efficient Routing in IoT-Based WSNss: A Comprehensive Review. Sensors 2025, 25, 7408. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  9. Balamurugan, K.; Latchoumi, T.P.; Ezhilarasi, T.P. Wearables to improve efficiency, productivity, and safety of operations. In Smart Manufacturing Technologies for Industry 4.0; CRC Press: Boca Raton, FL, USA, 2022; pp. 75–90. [Google Scholar]
  10. Srivastava, J.; Prakash, J. DL-enabled energy optimization and intrusion detection for WSNss. Opsearch 2025, 62, 368–405. [Google Scholar]
  11. Vijayakumar, S.D.; Praveenkumar, R.; Vanitha, V.; Santhoshini, C.; Poovitha, S.; Jaividhya, E. Deep Q Network for Intelligent Energy Efficient Routing in WSNs. In 2025 7th International Conference on Inventive Material Science and Applications (ICIMA); IEEE: New York, NY, USA, 2025; pp. 579–585. [Google Scholar]
  12. Karthikeyan, M.; Manimegalai, D.; Rajagopal, K. Optimizing energy efficiency in WSNss: Dynamic routing with capuchin search algorithm. Multimed. Tools Appl. 2025, 84, 15453–15477. [Google Scholar]
  13. Jayaram, K.; Satyanarayana, H.T. Energy-Efficient IoT Network Routing Model Based on Multi-Layer Clustering and DL. J. Eur. Des. Systèmes Autom. 2025, 58. [Google Scholar] [CrossRef] [Scilit]
  14. Shekar, K.; Reddy, N.R.; Arvind, S.; Kumar, T.S.; Kodukula, S.; Varahagiri, G. Implementation of novel learning based energy efficient routing protocols in WSNss for internet of things use cases. Discov. Comput. 2025, 28, 190. [Google Scholar] [CrossRef] [Scilit]
  15. Nelavalli, S.; RammohanReddy, D.; Neelima, G.; Rao, S.S. Balancing energy efficiency with robust security in WSNss using deep reinforcement Learning-Enhanced particle swarm optimization. Telecommun. Radio Eng. 2025, 84. [Google Scholar] [CrossRef] [Scilit]
  16. Mohammad, H. Implementation of deep belief neural network on energy efficient Routing Algorithm in WSN. Int. J. Electron. Telecommun. 2025, 71, 309–315. [Google Scholar] [CrossRef] [Scilit]
  17. Hussain, Q.; Noor, A.S.M.; Qureshi, M.M.; Li, J.; Rahman, A.U.; Bakry, A.; Mahmood, T.; Rehman, A. Reinforcement learning based route optimization model to enhance energy efficiency in internet of vehicles. Sci. Rep. 2025, 15, 3113. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  18. Priya, D.; Valaboju, S.; Rashid, S.Z. Energy-Efficient Routing Protocols in WSNss a Comprehensive Survey and Future Directions. In ITM Web of Conferences; EDP Sciences: Les Ulis, France, 2025; Volume 76, p. 03007. [Google Scholar]
  19. Nagalingayya, M.; Mathpati, B.S. Deep Reinforcement Learning-Driven Cooperative Routing for Energy Efficiency in Wireless Multimedia Sensor Networks. Int. J. Commun. Syst. 2025, 38, e70225. [Google Scholar] [CrossRef] [Scilit]
  20. Chakravarthy, R.A.; Sureshkumar, C.; Arun, M.; Bhuvaneswari, M. AI-Driven Energy-Efficient Data Aggregation and Routing Protocol Modeling to Maximize Network Lifetime in WSNss. NDT 2025, 3, 22. [Google Scholar] [CrossRef] [Scilit]
  21. Tan, N.D.; Nguyen, V.H. ML meets IoT: Developing an energy-efficient WSN routing protocol for enhanced network longevity. Wirel. Netw. 2025, 31, 3127–3147. [Google Scholar] [CrossRef] [Scilit]
  22. Latchoumi, T.P.; Parthiban, L.; Raja, K.; Balamurugan, K.; Parthiban, R. Secured Smart Manufacturing Systems Using Blockchain Technology for Industry 4.0. In Integrating Blockchain and Artificial Intelligence for Industry 4.0 Innovations; Springer International Publishing: Cham, Switzerland, 2023; pp. 281–294. [Google Scholar]
  23. Tawfeek, M.A.; Alrashdi, I.; Alruwaili, M.; Jamel, L.; Elhady, G.F.; Elwahsh, H. Improving energy efficiency and routing reliability in WSNss using modified ant colony optimization. EURASIP J. Wirel. Commun. Netw. 2025, 2025, 22. [Google Scholar] [CrossRef] [Scilit]
  24. Adu-Manu, K.S.; Amoako, E.; Engmann, F. Advancements in ML-Enhanced Green WSNss: A Comprehensive Survey on Energy Efficiency, Network Performance, and Future Directions. J. Sens. 2025, 2025, 5242517. [Google Scholar] [CrossRef] [Scilit]
  25. Zing, Y.; Zhao, N. Routing revolution: Strategic applications of meta-heuristic AI in WSNss—A comprehensive survey. Multimed. Tools Appl. 2025, 84, 44605–44646. [Google Scholar] [CrossRef] [Scilit]
  26. Latchoumi, T.P.; Parthiban, L.; Balamurugan, K.; Raja, K.; Vijayaraj, J.; Parthiban, R. A framework for low energy application devices using blockchain-enabled IoT in WSNs. In Integrating Blockchain and Artificial Intelligence for Industry 4.0 Innovations; Springer International Publishing: Cham, Switzerland, 2023; pp. 121–132. [Google Scholar]
  27. Chen, W.; He, L.; Cao, B.; Zhou, P.; Wang, Y.; Wang, H.; Jia, Y. An energy efficient hierarchical routing approach for UWSNs using biology inspired intelligent optimization. Sci. Rep. 2025, 15, 34121. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  28. Sachithanandam, V.; Jessintha, D.; Balaji, V.S.; Manoharan, M. Deep reinforcement learning and enhanced optimization for real-time energy management in WSNss. Sustain. Comput. Inform. Syst. 2025, 45, 101071. [Google Scholar] [CrossRef] [Scilit]
  29. Chilukuri, K.C. Throughput and Energy Efficient Routing using Reinforcement Learning for WSNss. Procedia Comput. Sci. 2025, 259, 1629–1639. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.