FL-trafficNet: a hybrid federated transformer-GNN framework with dual attention for smart routing in IoV and VANET environments Authors: Pallati Narsimhulu, Rashmi Sahay Published: 2026 ABSTRACT AbstractOne of the major problems smart cities face is how to efficiently route traffic, especially when connected vehicles and sensors produce a very large amount of real, time data. This heavy traffic load results in delays, inefficient routing, and excessive processing of central units. Hence, this article presents FL-TrafficNet, a hybrid routing framework that enhances traffic management in the Internet of Vehicles (IoV) and Vehicular Ad Hoc Networks (VANETs) scenarios. FL-TrafficNet combines Transformer models, and Graph Neural Networks (GNNs) to capture not only the time-dependent traffic variation but also the layout of the road network. A dual-attention component enables the model to pinpoint the most significant features in both spatial and temporal domains. To avoid uploading all the raw data to the cloud, the solution employs Federated Learning (FL), whereby vehicles and roadside units (RSUs), train their models on the spot and only share the resultant updates. This ensures data confidentiality and significantly reduces the network traffic. A reinforcement component embedded in the model dynamically makes path decisions by analyzing real-time traffic updates and feedback. The model works continuously by learning from nearby changes in traffic, weather, or road status. Simulation results show that FL-TrafficNet reduces errors in prediction (Mean Absolute Error (MAE): 1.95, Root Mean Squared Error (RMSE): 2.87, Mean Absolute Percentage Error (MAPE): 3.12), improves data privacy (97.8% privacy score), and increases traffic delivery rate (TDR) to 38.4%, a clear improvement over existing recent methods. These results make it suitable for real-time, privacy-aware routing in urban traffic networks.Keywords: Federated learning, GNNs, Transformer models, Spatio-temporal attention, Intelligent traffic routingSubject terms: Engineering, Mathematics and computing Introduction Smart city traffic systems use many connected devices like vehicles, sensors, and RSUs that share large amounts of data every second. This constant flow of live traffic information creates possibilities for smarter routing in VANETs and IoV-based road networks. Existing routing methods1–25 that follow fixed maps or slow-updating models struggle to keep up with sudden changes on the vehicle traffic (Ref. Figure 1). For busy city roads, there is a need for routing that can understand both time-based traffic trends and the links between moving vehicles, routes, and signal systems. Conceptual pipeline for smart routing in IoV/VANET environments. FL-TrafficNet is built to work with real-time traffic updates and shifting road conditions using a smart mix of learning models. It brings together GNNs and Transformer encoders to understand traffic patterns in both space and time. GNNs analyze the connectivity of roads, vehicles, and signals in a traffic network, whereas Transformers identify the useful patterns in traffic over different time scales. To protect the privacy of personal data and also minimize the transfer of large data over networks, FL-TrafficNet adopts FL. This technique enables local edge devices and RSUs to perform model training on the respective raw data. Thus, without exchanging it, only updated learning patterns are sent to a central server. The model is assisted by a dual attention system in focusing its attention on the most significant aspects of traffic data, even if it is complex or unclear. A reinforcement unit uses real-time feedback to re-route dynamically. Thus, continuously adjusting the routes based on what’s going on at the roads. Challenges in real-time routing for vanets and iov traffic systems Traffic systems in smart cities come with multiple challenges. Data Privacy: The vehicle location data is quite a private matter. If raw data is shared over public networks, it might reveal personal travel habits. Data Privacy: The vehicle location data is quite a private matter. If raw data is shared over public networks, it might reveal personal travel habits. Scalability: The routing system should be capable of processing data from various sources and large geographical areas, especially when the city is expanding. Scalability: The routing system should be capable of processing data from various sources and large geographical areas, especially when the city is expanding. Real-time Adaptation: Traffic scenarios may vary drastically in a very short time owing to weather, roadblocks, or unexpected congestion. Real-time Adaptation: Traffic scenarios may vary drastically in a very short time owing to weather, roadblocks, or unexpected congestion. Irregular Data Patterns: Data coming from the IoV and VANET can sometimes be lacking, unevenly sampled, or noisy. Irregular Data Patterns: Data coming from the IoV and VANET can sometimes be lacking, unevenly sampled, or noisy. Network Constraints: To transmit raw data to central servers leads to delays, overloads, and the network might even fail if the traffic is very heavy. Network Constraints: To transmit raw data to central servers leads to delays, overloads, and the network might even fail if the traffic is very heavy. Multi-modal Learning: It’s quite challenging to model the spatial and temporal patterns of data when different segments of a dataset exhibit different characteristics. Multi-modal Learning: It’s quite challenging to model the spatial and temporal patterns of data when different segments of a dataset exhibit different characteristics. Novelty and motivation Vehicles in VANET and IoV supported networks rely on routing updates from their surroundings to help them avoid slow routes and reach their destination on time. Some of the current solutions either cannot detect deeper traffic patterns or they are too focused on the central servers, which poses privacy issues and results in server congestion. Basically, if the systems do not have efficient tools to analyze spatial and temporal traffic trends along with privacy preservation techniques, these systems remain ineffective. A system which can learn locally from the traffic at each location, has instant reaction to changes, and is capable of providing route guidance in a decentralized manner in real-time is highly desirable. Despite the growing interest in hybrid intelligent transportation models that combine Fl, GNN, and transformer architectures, existing approaches largely treat these components in a loosely coupled manner without achieving a unified optimization strategy. In particular, existing studies often lack an integrated mechanism that simultaneously captures spatial dependencies, temporal dynamics, and adaptive decision-making in a privacy-preserving distributed environment. To address these limitations, we propose FL-TrafficNet, a unified framework that tightly integrates FL with GNN and Transformer models for efficient spatiotemporal traffic modeling. Unlike conventional approaches, the proposed framework enables joint optimization across distributed clients, ensuring collaborative model learning while preserving data privacy at edge nodes such as RSUs. In continution, FL-TrafficNet incorporates a reinforcement learning (RL)-based adaptive routing mechanism, which dynamically adjusts traffic signal control policies based on real-time traffic conditions. This additional decision-making layer distinguishes the proposed model from existing hybrid architectures by enabling adaptive and context-aware traffic management. As a result, the framework not only improves prediction accuracy but also enhances traffic signal decision-making efficiency in intelligent transportation systems (ITS). Figure 2 represents the FL-TrafficNet architecture designed to address real-time traffic routing in smart cities. At the core lies the smart routing engine that obtains inputs from GNNs and Transformer encoders. GNNs interpret the relationships among vehicles, roads, and traffic signals, whereas Transformers are responsible for capturing temporal traffic variations. In order to keep raw data local, the training takes place on devices near a traffic scene, and useful patterns are communicated to a main server. This kind of architecture allows for saving bandwidth and maintaining data privacy. A dual attention layer focuses on the most relevant traffic signs and behavior, thus supporting the system in making better predictions. Besides that, a reinforcement block enhances the output by learning from real-time conditions and updating routing decisions according to the situation on the road. Internal System Operations of FL-TrafficNet. Problem statement Smart city roads are loaded with data from various sources such as cars, signals, cameras, and sensors. This data can be used to anticipate traffic jams, detect the problems at an early stage, and facilitate the route selection. However, much of this data is either not utilized or stored in separate systems. Through incorporating smart learning models like Transformers and GNNs within a federated framework, traffic data of multiple locations can be analyzed without the need to share the raw data. This strategy not only ensures the accuracy but also the rapidity of traffic control. The goal is to employ a routing technique that is efficient in real-life situations, flexible to changes, and compliant with data privacy and communication requirements of the future smart cities. The major research contributions are: We propose FL-TrafficNet, a novel unified framework that integrates FL, GNN, and Transformer architectures for spatiotemporal traffic analysis in ITS. We propose FL-TrafficNet, a novel unified framework that integrates FL, GNN, and Transformer architectures for spatiotemporal traffic analysis in ITS. We develop a joint optimization strategy that enables collaborative learning across distributed clients (e.g., RSUs) while preserving data privacy, addressing key limitations of centralized traffic prediction models. We develop a joint optimization strategy that enables collaborative learning across distributed clients (e.g., RSUs) while preserving data privacy, addressing key limitations of centralized traffic prediction models. We incorporate a RL-based adaptive routing mechanism that dynamically interacts with the learned spatiotemporal features to optimize traffic signal control decisions. We incorporate a RL-based adaptive routing mechanism that dynamically interacts with the learned spatiotemporal features to optimize traffic signal control decisions. We design a hybrid feature extraction pipeline that effectively captures spatial dependencies using GNN and temporal dynamics using Transformer models, improving overall prediction performance. We design a hybrid feature extraction pipeline that effectively captures spatial dependencies using GNN and temporal dynamics using Transformer models, improving overall prediction performance. FL-TrafficNet is a combination of various modern techniques integrated into a single system that fits the traffic requirements of the present day. It basically demonstrates the strength of deep learning (DL), graph modeling, and privacy-aware training in the creation of a robust and practical tool for the predictive routing in IoV and VANET applications. The rest of the paper is organized as follows, Section Literature review performs a detailed review of the existing literature. Section Proposed methodology explains the architecture and methodology of the proposed model. Section Results and discussion evaluates the results by benchmarking the proposed model against existing solutions and demonstrating its effectiveness. Section Conclusion and future scope wraps up the paper and gives the potential future directions for improving the protocol and widening its applications. Literature review Traffic systems have been incredibly dynamic and large-data operations in the recent days. Researchers have been working on advanced prediction, routing, and optimization models that utilize spatio-temporal data, FL, and smart edge computing to cater to the increasing needs of intelligent transport networks. This paper highlights the main points of the recent studies in this area. Graph-based models have become a favorite for dealing with spatio, temporal patterns. Deep attention layers were used in an attention network designed by Remmouche et al.1 for long-term forecasting only. On one hand, there is the high precision and high computation cost. To deal with extremely precise trends in traffic data and its granularity. Ju et al.2 introduced COOL, which integrated spatial and temporal learning through GNNs. The model was very successful; however, it demanded a large amount of data and a very careful adjustment of parameters. Song et al.3 made a model for mobile edge computing in vehicular networks to lower the latency by moving the calculation nearer the vehicles although privacy was not well protected in that case. Privacy-preserving approaches are increasingly essential in traffic systems, particularly when handling sensitive mobility data. Feng and Qian4 came up with PPSTSL, a method that combines FL and split processing. It allowed them to protect the privacy of their raw data. However, the training time was compromised. Following this idea, Huang et al.5 looked into FL with local spatio-temporal data, thus improving privacy of location and reducing network load. But different local datasets sometimes caused the model performance to be inconsistent. Zhu et al.6 enhanced further by adding blockchain to FL which made the resultant model more trustworthy and communication-efficient. However, the blockchain part made the framework heavier. Adaptive learning methods in distributed environments have been the subject of various investigations. A framework by Yaqub et al.7 enabled asynchronous updates in federated environments with the use of GNNs. Such an update scheme allowed for flexible training delays across devices but the model was less accurate under sparse updates. Al-Huthaifi et al.8 integrated graph differential equations with the FL concept in their FedGODE model, which reflected data flows continuously, yet the system was susceptible to noisy inputs. Piccialli et al.9 introduced the GRAPHITE generative model that treated traffic forecasting as a task of generating the next states. Their approach was able to cope with the scenarios of high complexity; however, it was a difficult task to understand the model’s decisions. Lightweight and real-time models mostly concentrate on fast routing changes. Gupta and Lee10 came up with a congestion prediction model that was effective for urban areas with limited infrastructure, thus performing well in less complex road networks. Ma et al.11 incorporated real-time visual data with deep Q-learning (DQL) for adaptive routing based on video feeds. Even though model enhanced the performance, depended on the quality of the videos and the stability of the connections. Bairi et al.12 presented a VANET-based signal control system that prioritized emergency vehicles, which was quite effective, but it needed the deployment of many sensors. On the side of secured routing, Akilan et al.13 developed a VANET-based traffic management system with optimized path selection and security features. The model was not very successful during low vehicle density scenarios. Khan et al.14 proposed RADAR, a rapid route discovery algorithm for SDN-based IoV systems. Their approach increased the speed of route discovery but failed to be robust in a dynamic traffic environment. Ji et al.15 employed blockchain smart contracts for transparent routing decisions, which increased the complexity and slowed down the updates. Spatio-temporal learning has been used with RL techniques as well. Jamal et al.16 proposed QV2X combining GNNs and RL for real-time traffic adaptation. The method need a large-trained dataset but managed to deliver the results dynamically. Gonzalez-Cancelas et al.17 saw the benefits of IoV and blockchain for traffic management in port terminals, thereby improving the local logistics. However, scaling remained a challenge. Ajaz et al.18 conceived CLORP using lion optimization and clustering for route selection, which was great under normal circumstances but tough to handle frequent speed changes. Devarajan et al.19 solved rerouting and load balancing issues by utilizing FL combined blockchain for traffic management and task offloading support. Blockchain brought trust but was at the cost of longer processing time. Balamurugan et al.20 developed a forecasting framework that performed with minimal error under normal scenarios but was not quick enough to respond to abrupt changes. Yang et al.21 used whale optimization for multi-vehicle routing; thus enabling vehicle-to-vehicle cooperation. However, the model’s trustworthiness was affected by the unstable traffic flows. Lastly, Liu et al.22 devised a multipath routing model that made use of real, time traffic information to allocate vehicle loads efficiently. However, network instability caused the reduction of the effectiveness of the model during disruptions23–25. Literature gaps While recent studies have explored combinations of FL, GNN, and Transformer models in ITS, most of these approaches focus on partial integration or independent optimization of components. In contrast, the proposed FL-TrafficNet framework introduces a tightly coupled architecture that unifies these paradigms within a single learning framework. Moreover, existing works generally do not incorporate adaptive decision-making mechanisms such as RL in conjunction with federated optimization. The integration of RL in FL-TrafficNet enables dynamic routing and traffic signal control, thereby extending beyond static prediction tasks. Therefore, the proposed approach advances the current state-of-the-art by providing a comprehensive solution that combines distributed learning, spatiotemporal modeling, and adaptive control within a privacy-preserving environment. Table 1 delivers a comprehensive summary of the traffic forecasting and routing models. Conventional methods such as graph attention networks or typical GNNs mostly aimed for learning accuracy but had the drawbacks of high communication costs and low privacy protection. Federated and blockchain-based approaches raised privacy to a higher level but were slower and occasionally more difficult to scale. VANET-based and SDN-driven solutions were capable of handling real-time operations but had issues with adaptability to dynamic road scenarios. The proposed framework integrates transformers, GNNs, and RL with dual attention and spatio-temporal encoding. The collaboration offers excellent performance, keeps data private, makes more rapid decisions, and lessens the need for sending large quantities of data. It is very flexible with changing traffic conditions and produces better route recommendations even in crowded road situations. Table 1Comparative analysis of literature and proposed work.WorkMethodologyPrivacy supportReal-time capabilityCommunication overheadRouting intelligenceAdaptabilityRemmouche et al.Graph attention networkLowModerateHighMediumLowJu et al.Conjoint ST-GNNLowModerateMediumMediumMediumSong et al.Edge + GNN (5G/6G)LowHighLowMediumMediumFeng and QianFL + split learningHighLowMediumLowMediumHuang et al.Federated ST networkHighMediumLowMediumLowZhu et al.Blockchain + FLHighLowLowHighMediumYaqub et al.Async FL + GNNMediumHighMediumMediumMediumAl-Huthaifi et al.GODE + FLHighMediumMediumMediumLowPiccialli et al.Generative prediction ModelLowMediumMediumHighMediumGupta and LeeCongestion predictionLowHighLowLowLowMa et al.Deep Q + RSU videoLowHighHighMediumLowBairi et al.VANET signal controlMediumHighMediumMediumMediumAkilan et al.VANET secure routingMediumMediumMediumMediumLowKhan et al.SDN-based discoveryLowHighLowMediumLowJi et al.ML + smart contractsMediumMediumMediumHighLowJamal et al.STGNN + RLMediumHighMediumHighHighGonzalez-Cancelas et al.Blockchain for portsHighMediumLowMediumLowAjaz et al.CLORP (lion opt.)MediumMediumMediumMediumLowDevarajan et al.FL + blockchainHighMediumLowHighMediumBalamurugan et al.Cohesive modelLowMediumMediumMediumLowYang et al.Whale opt. path planLowMediumMediumHighMediumLiu et al.Multi-path vehicular MgmtLowHighLowMediumMediumProposedTransformer + GNN + dual attention + RLHighHighLowHighHigh Comparative analysis of literature and proposed work. Proposed methodology FL-TrafficNet is a smart routing system designed to address traffic problems in rapidly growing cities. The system combines Transformer models, GNNs, and FL to provide fast and accurate routing suggestions, particularly when the traffic conditions are dynamic. The existing methods2,4–6,8,10,12,14,16,17,20,22 that depend on central servers often face issues with data privacy and system overloads. In order to accomplish that, FL-TrafficNet utilizes the method of sharing the learning among local traffic points such as RSUs and vehicles to ensure that sensitive data remains close to the source. The system put forward aims at differentiating the time-based and space-based traffic changes in an ever-evolving network environment. Time-based traffic describes the way the communication or mobility pattern changes with time, whereas space-based traffic depicts the physical network structure and spatial relationships between nodes. Considering both time and space makes the model capable of taking routing decisions more accurately as it gets the changes in traffic behavior and the fixed or moving device positions simultaneously. The model tackles time-based traffic variations through transformer layers that trace patterns in time. For example, rapidly changing traffic load situations such as emergencies or network congestions. On the other hand, the model employs GNN layers for spatial comprehension. These layers examine the node location, the closeness of the nodes, and the flow of data between them. Such a spatial perspective is helpful in determining the optimal route concerning the node location, energy level, and link condition. A dual-attention system is employed to prioritize the most essential features that vary from case-to-case. For example, in a densely packed high traffic or when the layout of the nodes is very significant, spatial-attention would be the main one. While temporal attention would be the main feature when the traffic is changing rapidly. This trade-off between time and space makes the system versatile and precise even if the network is unstable or unpredictable. Such a model results in better route choices which, reduces the waiting time, conserves energy, and elevates the rate of successful delivery in IoT environments. Instead of one location receiving all the traffic data, each traffic device creates its own mini model. These gadgets send only the learning updates to a hub, which makes the whole system light and secure. It also facilitates situations where the network connection is not very stable. Devices can come in their own time because the system accommodates the updates by which it is not necessary for all to happen simultaneously. In order to make routing more flexible and aware of the context, a RL module has been integrated into the system. This module reacts to the road situation dynamics and the vehicle movements to improve routing decision, making. After making each decision, the module evaluates the result like the speed of message delivery or the energy consumption and revises its policy accordingly. Eventually, this study enables the system to pick routes that adapt well to both immediate traffic changes and vehicle flow patterns over time. RL-based adaptive routing policy To enable dynamic and adaptive traffic signal control, we incorporate a RL module within the proposed FL-TrafficNet framework. Specifically, we adopt a Deep Q-Network (DQN) algorithm due to its effectiveness in handling high-dimensional state spaces and discrete action settings in traffic control applications. RL formulation The traffic signal control problem is formulated as a Markov Decision Process (MDP) defined by the tuple , where denotes the state space, represents the action space, is the state transition probability, is the reward function, and γ is the discount factor. State Space: The state at time step t is constructed using the fused spatiotemporal features obtained from the GNN and Transformer modules: where f(· ) denotes the feature fusion function. The state representation includes traffic density, queue length, vehicle speed, and signal phase information. Action Space: The action space consists of possible traffic signal control decisions, such as: Switching traffic signal phases Switching traffic signal phases Extending or reducing signal duration Extending or reducing signal duration Each action corresponds to a specific control operation applied at an intersection or RSU. Reward Function: The reward function is designed to optimize traffic flow efficiency by minimizing congestion: where α and β are weighting factors that balance queue length and delay minimization. DQN Learning The DQN approximates the optimal action-value function Q(s, a) using a neural network parameterized by θ: The network is trained by minimizing the temporal difference (TD) loss: where represents the target network parameters. Integration with FL Framework The RL module operates in conjunction with the FL framework to enable decentralized and privacy-preserving optimization. Each edge client (e.g., RSU) locally trains its RL agent using locally observed traffic data and extracted features. The interaction is defined as follows: The GNN and Transformer modules extract spatial and temporal features from local traffic data. The GNN and Transformer modules extract spatial and temporal features from local traffic data. These features are fused to form the state representation for the RL agent. These features are fused to form the state representation for the RL agent. The RL agent learns an optimal routing and signal control policy based on local observations. The RL agent learns an optimal routing and signal control policy based on local observations. Model updates (e.g., network weights) are periodically shared with the central server using federated averaging (FedAvg) without transmitting raw data. Model updates (e.g., network weights) are periodically shared with the central server using federated averaging (FedAvg) without transmitting raw data. Policy interaction with feature extraction modules The RL-based routing policy directly leverages the high-level representations generated by the GNN and Transformer modules. Specifically: The GNN captures spatial correlations among intersections and RSUs. The GNN captures spatial correlations among intersections and RSUs. The Transformer captures temporal traffic patterns and trends. The Transformer captures temporal traffic patterns and trends. The fused features provide a comprehensive state representation, enabling the RL agent to make context-aware decisions. The fused features provide a comprehensive state representation, enabling the RL agent to make context-aware decisions. This integrated approach allows the proposed framework to achieve adaptive, data-driven traffic control while maintaining scalability and privacy in distributed environments. Consequently, vehicle message delivery is effective, energy consumption is reduces severely, and the system’s robustness is significantly improved in constantly changing traffic and mobility networks. Moreover, FL-TrafficNet enhances its safety and intelligence functions for traffic flow by efficiently combining traffic modeling, private learning, and real-time updates. It is a perfect match for smart cities where quickness, correctness, and data security are required equally. The system also has the capability of scaling easily by the addition of new traffic units. Figure 3 shows the layout of FL-TrafficNet that integrates various smart learning techniques for handling real-time traffic routing. Initially, the spatio-temporal traffic data is gathered which denotes the traffic flow over time and space (Ref. Figure 4). This data is initially provided to Transformer encoders, which mainly focus on extracting time, related features; when the traffic is heavy or there is a recurring jam. Subsequently, the output is fed to a dual-attention mechanism that creates a balance by giving importance to time or location-based features. Thus, the system can make a decision about what information is most relevant at that time. Workflow of proposed model. Intermediate operations for smart routing. Spatio-temporal data is also fed to the FL unit comprising traffic units and edge devices such as RSUs or in-vehicle systems. These units locally train the models by using their own data and they send their model updates the actual data to a central aggregator. The aggregator receiving all the updates combines them to create a global model without revealing anyone’s location or travel history. This model once trained, can be used to suggest routes which are continuously updated by a reinforcement unit. This segment of the system utilizes the road’s live feedback, for instance, changes in traffic or user preferences, to enhance its routing logic. The new suggestions are then passed to the routing recommendation engine, thus gradually making the model more intelligent. The diagram’s flow depicts a cycle of learning, decision-making, and continuous feedback that is running the system efficient and adaptive in smart traffic environments. Table 2 shows the acronyms utilized in this research. Table 2List of Acronyms Used.AcronymDefinitionMAEMean absolute errorRMSERoot mean squared errorMAPEMean absolute percentage errorTDRTravel delay reductionCOCommunication overheadPSPrivacy scoreGNNGraph neural networkFLFederated learningRLReinforcement learningTraffic data with spatial and temporal propertiesFinal embedded features after combining spatial and temporal patternsTemporal features extracted by the TransformerSpatial features extracted by the GNN, Attention-weighted features from time and space dimensionsπRouting policy that guides traffic decisionsrReward signal that improves future routing choicesθParameters of the global machine learning model List of Acronyms Used. Spatio-temporal encoding and dual-attention learning Algorithm 1 is a process for processing traffic data such that it enables making routing decisions more accurately. This technique utilizes Transformer encoders, GNNs, and a dual-attention mechanism which effectively picks the most valuable parts of the data to thoroughly extract spatial and temporal features of traffic data. Input to the method is a traffic dataset denoted as containing vehicle movements’ timestamps and locations. Thus, it becomes instrumental in analyzing traffic flows at particular times and places. Firstly, the temporal component of the traffic data gets extracted via a Transformer model. It results in depicting the time-series of the traffic network status, e.g., identifying the city rush hour, or recurring congestion at a specific place.” Further, a road traffic graph is constructed where the nodes and edges represent roads/junctions and their connectivity, respectively. This graph is denoted as G = (V, E). A GNN is used to study this graph and find , which gives a better idea of how different locations affect each other in terms of traffic. Then, two attention functions– and –are applied. One picks out the most important time-based patterns, while the other selects key location-based ones. These results are combined into one traffic view called by merging and . This final output, , gives a clearer picture of ongoing traffic and is ready to be used by other components in the system to guide vehicles more efficiently. Federated model training across edge devices Algorithm 2 describes the process of training a shared global model using local data available at edge nodes such as vehicles or roadside devices. The goal is to build a powerful model without transferring raw data. Each edge node uses its own traffic dataset and trains the model locally. The global model is updated using only the parameters from these local models. Initially, the model parameter is set; it is kept on a central server. The training procedure is divided into several communication rounds that are identified by the variable r. During each round: Each client i that is a participant in the training, e.g., a traffic device or a vehicular unit, get first downloads from the central server the latest model . Each client i that is a participant in the training, e.g., a traffic device or a vehicular unit, get first downloads from the central server the latest model . Train the model on their respective local data . After training, the model parameters of the client are updated to . Train the model on their respective local data . After training, the model parameters of the client are updated to . The client sends the updated parameter to the server. No information about the original data is transferred; only the changes to the parameters are shared. When all the clients’ updates have been received, the server carries out the weighted averaging of these models. This is a procedure where the server looks at the size of each client’s dataset and it decides to what extent that client’s update should influence the new global model.Then there is a more data a client has, the higher is the weight of its model in the aggregation. The new global model is given by: Eq. 5 fairly weighs each client according to the amount of traffic data processed from that location. Training is done by several rounds, and after each round, the model gets more accurate as more updates and new data come in from the edge. When these rounds are over, the server retains a global model, , which can be sent back to the clients or used for making traffic route predictions. This method supports better decision-making in traffic systems while keeping travel records private and reducing the pressure on the communication network. Transformer-guided reinforcement routing unit Algorithm 3 makes route decisions better by using feedback from live traffic. The routing starts with useful features picked by a Transformer model. As the vehicle moves, the system checks how the trip is going–looking at travel time, road crowding, or driver input–and uses that to guide future paths. At the beginning, the routing unit works with three things: traffic features , the current traffic state s, and a reward value r that shows if the chosen route was good. These features come from earlier steps that study both space and time in traffic flow. Using this, the policy π is created to help choose what step to take next based on the current view of traffic. The system is aware of the traffic condition that may include the vehicle’s location in every repeating cycle, how many others are near, or if the road is blocked. Given this, the policy chooses an action such as selecting a route or changing the direction. The system is rewarded for that action, which could be a shorter delay or smoother drive. It updates the traffic state to , the new state after the action has been taken. The policy π is adjusted with the new feedback so that it can make better decisions next time. The loop of observing , selecting , receiving , and learning from it is repeated until the end of the trip. At the end, the revised policy π is given back, this time capable of making even better decisions during the next trips. This incremental way of handling things allows the system to adapt more effectively to real-time road situations. Transformer-based temporal modeling To effectively capture temporal dependencies in traffic flow data, we employ a Transformer-based architecture. The Transformer model is configured with L encoder layers, each consisting of multi-head self-attention and position-wise feed-forward networks. Given an input sequence , where T denotes the sequence length, the input is first projected into a d-dimensional embedding space: where is the embedding matrix. To retain temporal order information, positional encoding is added to the embeddings: where represents the positional encoding matrix. Each Transformer encoder layer applies multi-head self-attention: The multi-head attention mechanism is defined as: where H denotes the number of attention heads. In our implementation, the Transformer is configured with: Number of encoder layers: L = 4 Number of encoder layers: L = 4 Number of attention heads: H = 8 Number of attention heads: H = 8 Embedding dimension: d = 128 Embedding dimension: d = 128 Feed-forward network dimension: Feed-forward network dimension: The output of the final encoder layer provides temporally enriched feature representations for downstream processing. GNN for spatial dependency modeling To model spatial relationships among traffic nodes (e.g., intersections or RSUs), we employ a GNN architecture. The traffic network is represented as a graph , where denotes the set of nodes and represents the edges. The graph structure is encoded using an adjacency matrix , where N is the number of nodes. Node features are represented as , where F denotes the number of input features per node (e.g., traffic density, speed, queue length). We adopt a Graph Convolutional Network (GCN) for spatial feature extraction. The layer-wise propagation rule is defined as: where: is the adjacency matrix with self-loops, is the adjacency matrix with self-loops, is the degree matrix of , is the degree matrix of , is the feature representation at layer l, is the feature representation at layer l, is the trainable weight matrix, is the trainable weight matrix, is a nonlinear activation function (e.g., ReLU). is a nonlinear activation function (e.g., ReLU). The initial node representation is given by: The GNN consists of K graph convolution layers, where K=3 in our implementation. The output of the final layer captures spatial dependencies among traffic nodes and is passed to the fusion module. Spatiotemporal feature fusion The outputs from the Transformer and GNN modules are fused to obtain a unified spatiotemporal representation: This fused representation is subsequently used for traffic prediction and decision-making within the FL framework. Advantages of proposed method FL-TrafficNet provides a ste of improvements to help smart traffic systems better tackle the ever-increasing complexity. It manages traffic flow, privacy, and routing speed in a way that meets the real-time requirements of smart cities. The following benefits reveal the strengths of the framework. To protect personal travel patterns and locations, the system shares model updates instead of raw traffic or location data. To protect personal travel patterns and locations, the system shares model updates instead of raw traffic or location data. The dual-attention unit, which extracts the most relevant information from both the spatial and temporal aspects, thereby enabling better decisions in real-time. The dual-attention unit, which extracts the most relevant information from both the spatial and temporal aspects, thereby enabling better decisions in real-time. The model route changes are informed by real-time feedback such as congestion, roadblocks, or sudden traffic changes. The model route changes are informed by real-time feedback such as congestion, roadblocks, or sudden traffic changes. Sending only small model updates allows for low communication that is also suitable for edge environments with limited bandwidth. Sending only small model updates allows for low communication that is also suitable for edge environments with limited bandwidth. Transformer and GNN-based feature processing help to make accurate predictions even in extremely fluctuating traffic situations. Transformer and GNN-based feature processing help to make accurate predictions even in extremely fluctuating traffic situations. The system architecture permits more vehicles or traffic nodes to be added to the framework without changing its core functions. The system architecture permits more vehicles or traffic nodes to be added to the framework without changing its core functions. By leveraging RL and utilizing driver feedback and traffic signals, the system continuously improves itself. By leveraging RL and utilizing driver feedback and traffic signals, the system continuously improves itself. Limitations of proposed method There are several aspects in which the FL, TrafficNet model could be improved. Some of the issues are computational, coordination, wise, or in the interaction with the real world. The Transformer and GNN parts take up a lot of resources which might not be suitable for all low-power edge devices. The Transformer and GNN parts take up a lot of resources which might not be suitable for all low-power edge devices. As each node updates at its own time, temporarily the model versions at different points might not be synchronized. As each node updates at its own time, temporarily the model versions at different points might not be synchronized. In areas with fewer sensor or vehicle presence, the system may struggle to obtain sufficient data to generate accurate route recommendations. In areas with fewer sensor or vehicle presence, the system may struggle to obtain sufficient data to generate accurate route recommendations. Setting up traffic graphs, preparing federated training protocols, and establishing model syncing rules may require time. Setting up traffic graphs, preparing federated training protocols, and establishing model syncing rules may require time. If the communication links between edge devices or RSUs are weak or unstable, the performance may deteriorate. If the communication links between edge devices or RSUs are weak or unstable, the performance may deteriorate. If driver or environment feedback is unreliable, the reinforcement module is likely to make incorrect modifications. If driver or environment feedback is unreliable, the reinforcement module is likely to make incorrect modifications. Results and discussion This section presents the testing setup of the FL-TrafficNet framework. Various Python tools and ML libraries were utilized to build the simulation. The model training and testing phases took place on a high-end computer system. Moreover, the models performance was evaluated using both real and synthetic traffic datasets. Simulation Setup The simulation took place on a machine with an Intel Core i9 processor, 64 GB RAM, and an NVIDIA RTX 3090 GPU. Python 3.9 was the main platform for the development. PyTorch and Deep Graph Library (DGL) were the tools to create the main learning modules. For FL, the Flower framework was chosen. Flower is a versatile framework that enables distributed ML on various devices or data centers without the need to share raw data26. It is an approach to collaborate in model training while data remains at its source location. RL functionalities have been created with the help of the Stable-Baselines3 library. The datasets selected for the evaluation of the performance are METR-LA27, PeMSD728, and TaxiBJ29. These datasets offer various traffic and mobility data which are very suitable for realistic testing. Table 3 shows the system setup used to simulate and train the proposed and existing models. Table 3Simulation setup settings.ParameterSettingProcessorIntel Core i9RAM64 GBGPUNVIDIA RTX 3090Software LanguagePython 3.9LibrariesPyTorch, DGL, Flower, Stable-Baselines3Traffic datasetsMETR-LA27, PeMSD728, TaxiBJ29FL frameworkFlowerRL frameworkStable-Baselines3Number of federated clients20 RSUsCommunication rounds100Local training epochs5 per roundTraining epochs (global)200Batch size64Learning rate0.001OptimizerAdamTrain/test split80% / 20%Data preprocessingNormalization, Missing value imputation Simulation setup settings. Evaluation metrics To measure the performance of the proposed system, the following metrics were used: MAE: MAE shows the average difference between the actual value and the predicted value across N samples. Each error is taken as an absolute value, so the direction of the error does not matter. This metric helps in understanding how much prediction typically deviates from real traffic data. MAE: MAE shows the average difference between the actual value and the predicted value across N samples. Each error is taken as an absolute value, so the direction of the error does not matter. This metric helps in understanding how much prediction typically deviates from real traffic data. RMSE: RMSE measures the square root of the average of squared errors between and over N samples. Larger errors contribute more due to squaring. This is useful when large deviations from real values need more attention. RMSE: RMSE measures the square root of the average of squared errors between and over N samples. Larger errors contribute more due to squaring. This is useful when large deviations from real values need more attention. MAPE: MAPE gives the average prediction error as a percentage of actual values. is the true value and is the predicted value. This makes it easier to understand how big the error is in relative terms across different scales. MAPE: MAPE gives the average prediction error as a percentage of actual values. is the true value and is the predicted value. This makes it easier to understand how big the error is in relative terms across different scales. TDR: TDR compares the average travel time using a basic method () with the travel time using the proposed model (). The result is expressed as a percentage. This metric helps in showing how much delay has been reduced using the intelligent routing system. TDR: TDR compares the average travel time using a basic method () with the travel time using the proposed model (). The result is expressed as a percentage. This metric helps in showing how much delay has been reduced using the intelligent routing system. Communication Overhead (CO): CO represents the amount of communication () required during each training round (). It helps in understanding the data load shared between edge devices and the central unit during learning. Communication Overhead (CO): CO represents the amount of communication () required during each training round (). It helps in understanding the data load shared between edge devices and the central unit during learning. Privacy Score (PS): PS shows the percentage of data () that remains on the local device out of the total available data (). A higher score means less data is shared externally, which supports stronger privacy protection. Privacy Score (PS): PS shows the percentage of data () that remains on the local device out of the total available data (). A higher score means less data is shared externally, which supports stronger privacy protection. Result analysis Table 4 presents the performance of different models in simulation experiments. Among the models, FL-TrafficNet gained the lowest error values for MAE, RMSE, and MAPE, hence, the traffic predicting accuracy was superior. Furthermore, the model attained the highest TDR at 38.4%, other models producing significantly lower TDR values. Due to the federated setup, CO remained low, and PS went as high as 97.8% since there was no exchange of raw data. Table 4Performance comparison of FL-TrafficNet vs. existing models.ModelMAERMSEMAPETDR (%)COPS (%)FL-TrafficNet (Proposed)1.952.873.1238.412.597.8Remmouche et al.2.323.114.5224.135.60.0Ju et al.2.253.054.3625.430.10.0Song et al.2.303.104.6023.536.00.0Feng and Qian2.122.974.0128.919.489.2Zhu et al.2.143.004.0527.622.091.3Yaqub et al.2.183.034.2026.224.390.4Al-Huthaifi et al.2.102.953.9829.720.191.7 Performance comparison of FL-TrafficNet vs. existing models. Figure 5 displays the comparison results of the FL-TrafficNet model with other models. FL-TrafficNet achieves the lowest error value for MAE, RMSE, and MAPE, which clearly indicates higher traffic prediction accuracy. The value of TDR is very much higher, thus, the ability of the model to select real-time faster routes is proven through the experiment. Performance analysis of proposed vs. existing. These results are a combined effect of a well thought out hybrid framework. The Transformer encoder captures time-based traffic patterns, while the GNN layers learn spatial connections across roads and vehicles. The dual-attention unit gives focus to important features depending on the situation. FL allows each traffic node to train locally without sharing raw data, which keeps the communication low and data secure. A Transformer-guided reinforcement unit adjusts routing decisions using live feedback, making the system responsive in changing traffic conditions. Each of these components contributes directly to the improved accuracy, efficiency, and privacy shown across the sub-graphs. Table 5 presents the ablation study of the proposed FL-TrafficNet framework by evaluating the impact of removing key components. The results show that excluding the Transformer and GNN increases prediction errors (MAE, RMSE, MAPE), highlighting their importance in spatio-temporal feature extraction. Removing the RL module significantly reduces TDR, confirming its role in adaptive decision-making. The absence of FL increases communication overhead and reduces privacy score, demonstrating its effectiveness in distributed and privacy-preserving optimization. The full FL-TrafficNet model achieves the best performance across all metrics, validating the necessity of integrating all components. Table 5Ablation study of FL-TrafficNet components.ConfigurationMAERMSEMAPETDR (%)COPS (%)Without transformer2.082.983.8532.112.597.8Without GNN2.123.023.9130.812.597.8Without RL2.052.943.4029.512.597.8Without FL2.203.084.0531.228.765.3FL-TrafficNet (Full Model)1.952.873.1238.412.597.8 Ablation study of FL-TrafficNet components. Table 6 shows the percentage improvement of FL-TrafficNet over other methods. The highest gains are observed in prediction accuracy, particularly in MAPE, where improvements reach over 30%. The travel delay reduction also benefits from this approach due to dynamic routing and real-time learning. The combination of transformer-guided reinforcement, dual-attention encoding, and federated model training contributes to the improved accuracy, responsiveness, and privacy of the routing system. Table 6Percentage gain of FL-TrafficNet over existing models.ModelMAE Gain (%)RMSE Gain (%)MAPE Gain (%)TDR Gain (%)Remmouche et al.15.97.730.914.3Ju et al.13.36.328.413.0Song et al.15.27.432.214.9Feng and Qian8.03.422.29.5Zhu et al.8.94.323.010.8Yaqub et al.10.65.325.712.2 Percentage gain of FL-TrafficNet over existing models. Figure 6 presents the percentage gains of FL-TrafficNet over existing models across four key performance metrics: MAE, RMSE, MAPE, and TDR. The graphs are shown as individual subplots for better clarity. In the MAE subplot, FL-TrafficNet shows the highest gain of 15.9% against Remmouche et al., while maintaining consistent improvements over others. For RMSE, the gain reaches up to 7.7%, again topping with Remmouche et al. The MAPE subplot shows the strongest results, with FL-TrafficNet achieving a 32.2% gain compared to Song et al. In terms of TDR, the framework records a gain of up to 14.9%, indicating better decision-making in dynamic conditions. These improvements come from the combined impact of dual-attention learning, federated training at the edge, and a real-time adaptive reinforcement mechanism, all contributing to faster, more accurate, and privacy-aware routing in complex traffic scenarios. Performance gain analysis of proposed vs. existing. Table 7 outlines the time complexity for FL-TrafficNet and recent models. The proposed model exhibits a computational complexity of , where T is the temporal sequence length, d is the embedding dimension, represents the number of graph edges, and corresponds to the state-action space of the reinforcement learning module. The Transformer component contributes quadratic complexity due to the self-attention mechanism, while the GNN captures spatial dependencies through edge-based message passing. The RL module adds additional computational cost associated with policy evaluation and optimization. Compared to Remmouche et al. or Ju et al., where attention or dense relational modeling dominates computational growth, FL-TrafficNet integrates these components in a unified framework while maintaining efficient feature reuse. Models like Zhu et al. and Yaqub et al. introduce additional overhead due to blockchain integration or delayed synchronization factors (B, D), whereas FL-TrafficNet balances these costs through structured learning and modular design. As a result, the framework achieves scalable inference while leveraging rich spatio-temporal and decision-making capabilities. Table 7Time complexity comparison of proposed and existing models.ModelTime complexityRemarksRemmouche et al.GAT-based, no edge-level compressionJu et al.Relational graph modeling increases quadratic growthSong et al.MEC processing and sorting overheadFeng and QianBasic split learning, fewer GNN layersZhu et al.Added blockchain blocks (B) increase linear overheadYaqub et al.Delayed sync affects convergence delay DAl-Huthaifi et al.Graph ODE model with recursive solvingFL-TrafficNet (Proposed)Dual-attention GNN + Transformer with RL integration Time complexity comparison of proposed and existing models. Computational complexity and edge deployment feasibility The proposed FL-TrafficNet framework integrates multiple advanced components, including Transformer, GNN, and RL, which collectively improve prediction accuracy and adaptability. However, such integration introduces additional computational overhead, particularly in resource-constrained edge environments such as RSUs. Therefore, a detailed analysis of computational complexity and deployment feasibility is essential. Computational Complexity Analysis: The overall complexity of the proposed framework is influenced by its constituent modules. The Transformer component has a complexity of due to the self-attention mechanism, where T is the sequence length and d is the embedding dimension. The GNN module introduces a complexity of , where represents the number of edges in the traffic graph. The RL module, based on DQN, adds a complexity proportional to for state-action evaluation. While these components increase computational demand compared to traditional models, the use of FL distributes the training process across multiple clients, thereby reducing the burden on a centralized system. Edge Deployment Feasibility: To ensure suitability for deployment on resource-constrained edge devices, several optimization strategies are incorporated: Model Compression: Techniques such as weight pruning and quantization are employed to reduce model size and inference latency. Model Compression: Techniques such as weight pruning and quantization are employed to reduce model size and inference latency. Adaptive Federated Updates: Communication efficiency is improved by reducing update frequency and transmitting only significant model updates. Adaptive Federated Updates: Communication efficiency is improved by reducing update frequency and transmitting only significant model updates. Lightweight Architectures: Simplified Transformer layers and reduced GNN depth are considered to lower computational overhead. Lightweight Architectures: Simplified Transformer layers and reduced GNN depth are considered to lower computational overhead. Energy Efficiency: Efficient training schedules and local update mechanisms help conserve energy in edge devices with limited battery capacity. Energy Efficiency: Efficient training schedules and local update mechanisms help conserve energy in edge devices with limited battery capacity. Comparative Analysis: Table 8 presents a comparative analysis of computational complexity and edge suitability across existing approaches and the proposed FL-TrafficNet framework. Table 8Comparative computational complexity and edge deployment suitability.MethodModel componentsComplexity LevelEdge suitabilityRemmouche et al.GNN-basedMediumModerateJu et al.Transformer-basedHighLimitedSong et al.GNN + RLHighModerateFeng and QianDL-basedMediumModerateZhu et al.FL-basedMediumHighYaqub et al.RL-basedMediumModerateAl-Huthaifi et al.Hybrid DLHighLimitedFL-TrafficNet (Proposed)FL + GNN + Transformer + RLHigh (Optimized)High Comparative computational complexity and edge deployment suitability. Compared to existing methods, FL-TrafficNet introduces higher computational complexity due to its hybrid architecture. However, through FL and optimization strategies, the framework effectively balances performance and efficiency. Unlike centralized high-complexity models, the proposed approach distributes computation and incorporates edge-aware optimizations, making it more suitable for real-world deployment in intelligent transportation systems. Conclusion and future scope This paper introduces a hybrid intelligent routing framework named FL-TrafficNet, built for smart traffic networks. The system integrates Transformer encoders, GNNs, and FL to effectively handle spatio-temporal traffic data and provide fast, privacy-aware routing decisions. The dual-attention mechanism enables the model to capture the most relevant spatial and temporal patterns, while the FL paradigm ensures that traffic nodes perform local model training and share only updated weights, thereby preserving data privacy and reducing communication overhead. The RL module leverages real-time vehicle feedback to support adaptive decision-making under dynamic traffic conditions. The framework has been evaluated in a simulation-based environment, demonstrating significant improvements in delay reduction, prediction accuracy, and responsiveness to sudden traffic pattern changes. While the current study focuses on simulation-based validation, real-world deployment aspects are considered as part of future work. In this context, FL-TrafficNet can be extended to IoV scenarios, where large-scale interactions among vehicles, RSUs, and heterogeneous devices introduce challenges such as dynamic mobility, intermittent connectivity, and resource constraints. The framework can be further enhanced through the incorporation of digital twin platforms for large-scale urban simulations, including emerging transportation domains such as drone and waterway systems. Additionally, FL can be strengthened with advanced privacy-preserving techniques such as differential privacy and homomorphic encryption to improve trust among participating entities. To support deployment on low-power devices, adaptive model pruning, lightweight architectures, and energy-efficient update strategies can be explored. Finally, validating the framework across multiple real-world traffic systems and cities will further establish its robustness, scalability, and practical applicability in next-generation ITS. Acknowledgements I would like to express my sincere gratitude to Symbiosis Institute of Technology, Hyderabad Campus, Symbiosis International (Deemed University), Pune, India, for their valuable support and contribution toward the successful execution of the test case analysis conducted as part of this research. Their timely assistance and access to infrastructure played a key role in helping me validate and assess various aspects of the proposed methodology. Author contributions Conceptualization: P.N.; Methodology: P.N.; Formal analysis and data curation: P.N., and R.S.; Writing–original draft preparation: P.N.; Writing–review and editing: P.N., and R.S.; Supervision: R.S.; All authors have read and agreed to the published version of the manuscript. Funding Open access funding provided by Symbiosis International (Deemed University). No funding. Data availability The datasets used in this study are publicly available and can be accessed as follows: the METR-LA dataset27 is available at https://github.com/liyaguang/DCRNN, the PeMSD7 dataset28 can be accessed at https://github.com/SohelRana-aiub-Pro/Traffic-Forecasting-Graph-Neural-Networks-LSTM; https://github.com/cruiseresearchgroup/Traffic-Prediction/blob/master/README.md, and the TaxiBJ dataset29 is available at https://github.com/TolicWang/DeepST. These datasets provide diverse traffic and mobility data that support the realistic evaluation of the proposed approach. Declarations Comprting Interests The authors declare no conflict of interest. Consent to Participate Not Applicable. Consent to Publish Not Applicable. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Data Availability Statement The datasets used in this study are publicly available and can be accessed as follows: the METR-LA dataset27 is available at https://github.com/liyaguang/DCRNN, the PeMSD7 dataset28 can be accessed at https://github.com/SohelRana-aiub-Pro/Traffic-Forecasting-Graph-Neural-Networks-LSTM; https://github.com/cruiseresearchgroup/Traffic-Prediction/blob/master/README.md, and the TaxiBJ dataset29 is available at https://github.com/TolicWang/DeepST. These datasets provide diverse traffic and mobility data that support the realistic evaluation of the proposed approach.