Abstract
The pervasive growth of the Internet of Things (IoT) necessitates efficient communication technologies, among which Long Range Wide Area Network (LoRaWAN) is prominent due to its long-range, low-power characteristics. A significant challenge in dense LoRaWAN deployments is the efficient management of resources, particularly Spreading Factor (SF) allocation. In this paper, we propose a machine learning-based approach for optimal SF allocation to enhance network performance. We developed a simulation-driven framework utilizing the ns-3 simulator to generate a comprehensive dataset mapping network conditions, including RSSI, SNR, device coordinates, and distance to the gateway, to optimal SF assignments determined through an energy-aware optimization process. An XGBoost model was trained on this dataset to predict the optimal SF based on real-time network parameters. Our methodology focuses on balancing packet delivery ratio and energy consumption. The performance evaluation demonstrates that the trained XGBoost model effectively classifies optimal SFs, exhibiting strong diagonal dominance in the confusion matrix and achieving competitive accuracy with efficient computational characteristics, making it suitable for resource-constrained LoRaWAN environments.
1 Introduction
The rapid expansion of the Internet of Things (IoT) paradigm has underscored the critical need for communication technologies that can support a vast array of devices over extensive geographical areas while ensuring minimal power consumption . Among the contenders in the Low-Power Wide-Area Network (LPWAN) landscape, LoRaWAN (Long Range Wide Area Network) has emerged as a de facto standard, offering a compelling balance of range, battery life, and deployment cost for a multitude of applications Mekki et al. (2019); . Operating primarily in the sub-GHz ISM (Industrial, Scientific, and Medical) bands, such as 868 MHz in Europe and 915 MHz in North America, LoRaWAN facilitates data transmission at rates varying from 0.3 Kbps up to 50 Kbps, catering to diverse IoT use cases ranging from smart city deployments and environmental monitoring to industrial automation and precision agriculture , Singh et al. (2020), Rehman et al. (2025); Ullah et al. (2025).
The architectural framework of a LoRaWAN network, illustrated in Figure 1, is inherently designed for scalability and efficiency. It consists of several key entities. At the periphery are the End Devices (EDs), which are typically sensor-equipped, battery-operated units responsible for data acquisition and transmission using the LoRa physical layer modulation. These devices communicate wirelessly with Gateways (GWs), which act as transparent bridges, relaying messages between EDs and a central Network Server (NS). A single GW can service thousands of EDs spread across several kilometers. The NS is the intelligent core of the network, responsible for de-duplicating messages, performing security checks, managing the network MAC layer, and routing application data to respective Application Servers (ASs).
FIGURE 1
To accommodate varying application requirements for latency and power consumption, LoRaWAN defines three distinct classes of ED operation . Class devices offer the lowest power consumption by implementing an ALOHA-style communication protocol: an ED can transmit data uplink at any time, after which it opens two short receive windows for potential downlink acknowledgments or commands. This asynchronous nature makes Class ideal for sensor applications where energy efficiency is paramount. Class devices augment Class functionality by opening extra, scheduled receive windows at fixed time intervals, beacon-synchronized with the GW. This allows for more predictable downlink latency, suitable for applications requiring periodic server-initiated commands, albeit with a moderate increase in power draw. Finally, Class devices maintain nearly continuously open receive windows, only closing them during transmission. While this provides the lowest downlink latency, it comes at the cost of significantly higher energy consumption, making Class suitable for mains-powered actuators or applications where responsiveness is more critical than battery life.
A cornerstone of LoRaWAN’s operational efficiency is the Adaptive Data Rate (ADR) mechanism. The ADR is designed to dynamically optimize the radio parameters of EDs, specifically the Spreading Factor (SF) and Transmission Power (TP), to maximize both network capacity and the battery life of individual devices Marini et al. (2021); Semtech (2019b); . In its conventional form, the NS instructs EDs to adjust their settings based on historical link quality indicators, typically the Signal-to-Noise Ratio (SNR) of recent uplinks ; Moysiadis et al. (2021). While beneficial, the standard ADR algorithm often exhibits suboptimal performance in dynamic or complex radio environments (; ; ). It can be slow to converge, may lead to unnecessary retransmissions if parameters are chosen too aggressively, or conversely, may operate too conservatively, wasting energy and spectrum Park et al. (2020); ; Semtech (2019a); . For instance, the reliance on the SNR of the last 20 packets might not always capture the nuances of fluctuating channel conditions, potentially leading to SF and TP assignments that result in packet loss . This inherent challenge motivates the exploration of more intelligent and adaptive mechanisms. Consequently, this paper introduces XGBoost-driven adaptive adaptive data rate (XG-ADR) approach, engineered to intelligently allocate optimal SFs to EDs by leveraging insights derived from trained models reflecting real-world network dynamics.
1.1 Contribution of the paper
The contribution of this paper is as follows.
1. We design XG-ADR that can learn optimal SF strategies based on underlying network conditions and requirements to solve the SF allocation issue.
2. The ML model is trained on a one-time dataset generated in the ns-3 simulator, considering the propagation environment, device positions, distance between GW and ED, and successful SF. After the training, the pre-trained model has been utilized at the NS for optimal SF allocation to EDs during network simulations.
3. During the simulation-based deployment scenario using ns-3, the proposed XG-ADR could allocate the best SF to EDs, thereby enhancing the packet delivery ratio, energy consumption, and convergence period.
1.2 Structure of paper
Section 2 presents an in-depth review of the existing AI-based solutions regarding resource management in LoRaWAN. Section 3 elaborates on the dataset collection, discusses the required features, and highlights the best suitable ML methods for resource allocation concerning the features. Section 4 presents the proposed XG-ADR working. Section 5 presents a detailed discussion of experiments and results analysis, whereas Section 7 provides concluding remarks.
2 Literature review
The pursuit of enhanced efficiency and reliability in LoRaWAN networks has increasingly led researchers to explore the application of Artificial Intelligence (AI), particularly Machine Learning (ML) and Deep Learning (DL) techniques, for sophisticated resource management. These intelligent approaches offer promising alternatives to traditional algorithmic solutions, especially in optimizing critical parameters such as SF assignment, Transmission Power (TP) control, and overall network performance. This review synthesizes recent advancements where AI methodologies have been pivotal in addressing LoRaWAN’s operational challenges.
One significant area of focus has been the dynamic allocation of radio resources. Reinforcement Learning (RL) has shown considerable aptitude in this domain. For instance, the work by introduced a mixed multi-armed bandit strategy for SF allocation, demonstrating tangible gains in Packet Delivery Ratio (PDR) and energy conservation within simulated single-gateway LoRaWAN deployments. Their model, tested with 100 end devices under EU-868 MHz regulations, highlighted the potential of RL for optimizing static networks. Expanding on RL’s capabilities, proposed a score table-based RL algorithm. This method not only adapted to network conditions but also achieved a notable 24%–27% reduction in energy consumption compared to conventional ADR schemes, with its lightweight nature confirmed through Matlab simulations, suggesting good prospects for real-world implementation.
Supervised learning techniques have also been effectively employed, especially for classification tasks that can inform resource allocation strategies. A notable example is the Support Vector Machine (SVM) classifier developed by Vangelista et al. (2023), which successfully differentiated between mobile and static end devices using a minimal set of training data. While this study focused on device mobility classification, it laid the groundwork for future integration with ADR mechanisms that could adapt to device mobility profiles. In the realm of more complex pattern recognition, deep learning models have demonstrated superior performance. utilized a Gated Recurrent Unit (GRU) network for device classification, achieving an impressive 96% accuracy. Their ns-3 simulations, involving 500 nodes, further validated the model’s efficacy, yielding a 98% PDR in networks of moderate density, showcasing DL’s strength in handling larger-scale scenarios.
Hybrid models, which synergize the strengths of different AI techniques, are also gaining traction due to their potential to address multifaceted optimization problems. Research by Minhaj et al. (2023) exemplified this by integrating RL for SF assignment with another ML model for TP control. Their findings indicated that such a combined approach could outperform solutions relying on a single AI methodology, offering a more holistic optimization of network resources. Furthermore, the concept of data fusion is being explored to enrich the information available for ML models. developed an augmented sensing method that combined LoRaWAN signal metrics (like RSSI and SNR) with data from external environmental sensors. This fusion approach led to a 17% reduction in estimation errors for certain parameters compared to methods relying solely on LoRaWAN’s intrinsic data, underscoring the benefit of incorporating diverse data sources for improved decision-making.
The integration of AI into LoRaWAN networks addressed the challenge of resource allocation under dynamic conditions, particularly for mobile IoT applications. Traditional Adaptive Data Rate (ADR) mechanisms, including Blind ADR (BADR), struggled with energy efficiency and adaptability in mobile scenarios. To overcome these limitations, recent studies proposed hybrid AI-driven solutions combining TinyML and deep learning. One approach introduced a hybrid CNN-LSTM model on the network server for predicting optimal SF and transmission power (TP), while deploying lightweight TinyML models on edge devices for autonomous parameter adjustment in disconnected scenarios. This method improved the packet success ratio (PSR) and energy efficiency but faced computational constraints when deploying complex models on resource-limited devices. Another study proposed Contextual Aware Enhanced ADR (CA-ADR) , which used a rule-augmented hybrid CNN-LSTM model trained on contextual data to optimize SF allocation. While CA-ADR demonstrated gains in energy efficiency and PSR, its reliance on pre-trained models limited adaptability to unseen network conditions. Both solutions advanced LoRaWAN resource allocation but highlighted trade-offs between computational overhead and real-time adaptability.
The authors in investigated the integration of LoRa with distributed machine learning (ML) to enhance network connectivity in intelligent transportation systems (ITS). The authors proposed a framework that optimized resource allocation and energy efficiency, leveraging LoRa’s long-range capabilities and ML’s adaptability. Their approach demonstrated improvements in network reliability and sustainability, addressing key challenges in green ITS. The study highlighted the potential of hybrid LoRa-ML systems for scalable and energy-efficient IoT deployments in transportation.
The authors proposed a non-destructive adaptive data rate (ND-ADR) scheme for LoRaWAN IoT networks in . Unlike conventional ADR methods, ND-ADR dynamically adjusted data rates without disrupting ongoing transmissions, improving packet delivery ratios and spectral efficiency. The authors validated their approach through simulations, showing superior performance in dense IoT environments compared to static ADR.
The authors introduced a hybrid adaptive data rate (HADR) mechanism for LoRaWAN, catering to both static and mobile IoT devices in . By dynamically selecting between ADR and blind ADR (BADR) based on device mobility, HADR achieved a 20% higher packet success ratio than BADR. The study addressed a critical limitation of traditional LoRaWAN resource allocation, offering a unified solution for heterogeneous IoT applications.
Table 1 provides a consolidated overview of the surveyed AI-driven approaches, detailing their specific methodologies, evaluation environments, and key performance improvements. The collective evidence from these studies strongly suggests that AI and ML techniques offer substantial advantages over traditional LoRaWAN optimization methods. Deep learning models, in particular, excel in complex classification and prediction tasks, while reinforcement learning offers robust solutions for dynamic and adaptive resource allocation. However, the challenge of developing lightweight, yet highly accurate, ML models that can operate efficiently at the network server or even closer to the edge remains an active area of research, paving the way for solutions like the one proposed in this paper.
TABLE 1
| Reference | Method | Application | Key improvement |
|---|---|---|---|
| MIX-MAB RL | SF allocation | 22% PDR increase | |
| STEP RL | SF allocation | 26% energy reduction | |
| Minhaj et al. (2023) | Hybrid ML/RL | SF/TP control | Combined optimization |
| Augmented sensing | Soil monitoring | 1.53% RMSE | |
| Vangelista et al. (2023) | SVM | Device classification | 94% accuracy |
| GRU network | SF classification | 98% PDR | |
| DNN | Mobile SF allocation | 82% accuracy | |
| TinyML and CNN-LSTM | SF | 85% PDR. | |
| CNN-LSTM | SF | 87% PDR. |
Summary of machine learning approaches in LoRaWAN optimization.
3 Data acquisition and preprocessing framework
This work develops a simulation-driven methodology for generating labeled LoRaWAN datasets that map network conditions (RSSI, SNR, X and Y coordinates, and distance between ED and GW) to optimal SF assignments. The framework systematically transforms raw physical-layer measurements into machine-learning-ready tuples , where each optimal SF is derived from empirical packet success rates across 6,000 transmissions per device (1000 EDs 6 SFs) .
3.1 Simulator selection and validation
The foundation of our study relies on selecting an appropriate simulation platform that accurately models LoRaWAN network behavior. Existing literature reveals limited options for open-source LoRaWAN simulators Sartori (2023), Zorbas et al. (2021), . We evaluated available solutions using a weighted scoring metric, using Equation 1.where quantifies community adoption (weight ), measures protocol layer implementation completeness , and represents validation accuracy against real-world data . The selected simulator Magrin et al. (2017a) achieved , demonstrating superior performance in our comparative analysis.
We selected ns-3 as the simulation platform because it provides an open-source, validated LoRaWAN module Magrin et al. (2017b) that supports detailed modeling of path loss, fading, and collision dynamics. Compared with other simulators such as LoRaSim , ns-3 offers more comprehensive PHY/MAC-layer implementations and closer alignment with LoRaWAN specifications, making it a reproducible foundation for dataset generation.
3.2 Network topology modeling
The simulation environment in models a typical LoRaWAN deployment scenario with end devices randomly distributed around a central gateway. The spatial distribution follows a uniform random pattern within a circular coverage area.where in Equation 2, km defines the maximum communication range. This configuration represents a dense urban deployment scenario where devices are unevenly distributed but concentrated around the gateway location.
3.3 Channel propagation characteristics
Accurate modeling of wireless channel effects is crucial for generating realistic simulation data. The approach incorporates both large-scale path loss and small-scale fading components. The log-distance path loss model with environmental correction factors of the signal attenuation between transmitter and receiver is captured using Equation 3.
The first term represents free-space path loss, where is the carrier frequency (868 MHz in EU bands) and is the speed of light. The environmental factor varies between 2.0 (free space) and 3.5 (urban areas). The additional term accounts for vegetation and building obstructions.
Furthermore, real-world deployments experience signal variations due to terrain and obstacles. We model this as a spatially correlated Gaussian random field in Equation 4.where represents the correlation distance (typically 50–100 m in urban environments) and are normally distributed random variables. This approach captures the spatial continuity of shadowing effects observed in actual deployments.
3.4 Signal quality metrics
The received signal strength at the GW combines multiple physical layer effects, as shown in Equation 5.where is the transmission power (typically 14 dBm for EU regulations) and the co-channel interference term represents interference from devices using the same SF, derived from Magrin et al. (2017b); . The co-channel interference quantifies the aggregate power from simultaneous transmissions using the same SF. The co-channel interference term can be computed using Equation 6.where denotes the set of all active devices transmitting with the target SF, is an indicator function evaluating to 1 when two packets overlap temporally, further computed in Equation 7.where denotes the airtime of packet (SF-dependent). The received power follows the path loss model in Equation 5. This formulation captures the LoRa capture effect, where a packet survives interference if for threshold (typically 6 dB for LoRa Magrin et al. (2017b)).
The model (i.e., Equation 7) captures the capture effect in LoRaWAN, where a packet survives interference if its power exceeds the sum of interfering signals by the capture threshold (typically 1–6 dB). The cumulative interference calculation is performed for all co-SF transmissions within the same channel during each packet’s airtime.
The signal-to-noise ratio (SNR) calculation incorporates both thermal noise and interference effects, as illustrated in Equation 8:where represents thermal noise power and accounts for receiver hardware limitations.
3.5 Transmission protocol simulation
Figure 2 illustrates the dataset collection and labeling procedure employed to determine the optimal SF allocation in LoRaWAN networks. The process involves a single ED transmitting uplink messages sequentially using all available SFs (SF7–SF12) to the GW, which forwards the packets to the NS. The NS records the packet reception status (success or failure) for each SF and aggregates this data to label the optimal SF for each device location based on energy efficiency and reliability metrics. For instance, if transmissions using SF7–SF9 fail while SF10–SF12 succeed, the lowest successful SF (SF10) is selected as the optimal choice to minimize energy consumption while ensuring reliable communication. This empirical approach, which accounts for real-world conditions such as distance, mobility, and interference, generates the labeled dataset used to train the XG-ADR. The resulting model dynamically predicts optimal SFs during deployment, addressing the limitations of traditional ADR mechanisms by leveraging machine learning for adaptive resource allocation in dynamic LoRaWAN environments.
FIGURE 2
Each ED performs transmission attempts with SF7 to SF12, as illustrated in Equation 9 and Figure 2
3.6 Optimal SF selection algorithm
The core of our labeling process involves determining the most efficient SF for each device location, computed in Equation 11:where represents all available SFs. The energy consumption model accounts for transmission parameters, computed in Equation 12:with calculated from LoRa modulation properties and estimated from historical delivery rates.
The Algorithm 1 implements an energy-aware optimization process to determine the optimal SF for each end-device. It begins by analyzing historical transmission data to compute the packet success probability for each SF value (Lines 3-5). For each candidate SF, the algorithm calculates the expected energy consumption using three key components: the device’s transmit power , the LoRa-specific airtime which grows exponentially with SF (Line 7), and the estimated number of retransmissions derived from the success probability (Line 8). The core decision metric (Line 10) balances reliability against energy costs by taking the ratio of unreliability to energy expenditure . This formulation inherently penalizes both high-SF options (due to their long airtimes) and low-SF choices (with poor reliability). The algorithm selects the SF minimizing this cost function (Line 13), defaulting to SF12 when no successful transmissions are recorded (Lines 14-15), ensuring baseline connectivity. The computational complexity scales linearly with both the SF range size and the historical data size , making it efficient for practical deployment in resource-constrained LoRaWAN networks.
The adopted energy model accounts for transmit power, airtime, and retransmissions, consistent with prior ns-3 based studies
Algorithm 1. XGBoost-based adaptive data rate (XG-ADR).

4 Proposed methodology
We utilize XGBoost due to its strong performance with structured numerical data
The XGBoost model operates on a structured input space where each feature vector contains six groups of signal metrics (RSSI, SNR, and positional coordinates) corresponding to SF7 through SF12. The labels are derived through an energy-aware optimization process that balances packet delivery ratios against transmission energy consumption for each SF. The model architecture comprises an ensemble of regression trees , where each tree partitions the 24-dimensional feature space through axis-aligned splits subject to maximum depth and minimum child weight constraints.
During training, the algorithm minimizes a regularized objective function that combines multi-class log loss with and regularization terms on the leaf weights . The optimization proceeds through additive training with second-order Taylor approximations, where at each iteration , the algorithm computes first-order gradients and second-order Hessians to guide tree construction. The implementation leverages histogram-based approximation for efficient split finding, processing feature values in 256-bin histograms to reduce computational complexity from to where is the number of training instances.
Feature importance is quantified through gain statistics , measuring the relative contribution of each feature to loss reduction across all trees. The DMatrix data structure optimizes memory layout for both training and inference, while built-in handling of missing values directs instances along default paths learned during training. The implementation automatically manages categorical feature grouping through one-hot encoding and employs instance weighting to counteract class imbalance in the labeled dataset. Early stopping with a patience window of 20 rounds monitors validation loss to prevent overfitting, terminating training when no improvement is observed beyond the tolerance threshold .
5 Performance evaluation-offline mode
The XGBoost-based Adaptive Data Rate (XG-ADR) framework implements a gradient boosted decision tree ensemble for optimal SF selection in LoRaWAN networks. This section details the computational environment and hyperparameter configuration that underpin the performance evaluation presented in subsequent sections. The implementation leverages XGBoost’s efficient histogram-based tree construction with regularization techniques to prevent overfitting while maintaining real-time inference capabilities.
5.1 Training parameters
The model was trained under the technical specifications shown in Table 2. The hardware configuration provided sustained throughput of 1.2 million instances per second during training, with peak memory utilization of 8.4 GB. The M2 unified memory architecture eliminated GPU-CPU data transfer bottlenecks, though the implementation defaulted to CPU computation due to XGBoost’s current lack of Metal backend support. Training convergence was monitored through a 10% held-out validation set, with model checkpoints saved at minimum validation loss intervals.
TABLE 2
| Parameter | Value |
|---|---|
| Hardware Platform | Apple M2 (12-core CPU, 16 GB RAM) |
| Operating System | macOS Ventura 13.5 |
| Python Environment | Python 3.9.16 with XGBoost 1.7.3 |
| Training Epochs | 150 (early stopped at 135) |
| Learning Rate | 0.1 |
| Maximum Tree Depth | 6 |
| Minimum Child Weight | 0.3 |
| L2 Regularization | 1.0 |
| Subsample Ratio | 0.8 |
| Column Sample Ratio | 0.9 |
| Early Stopping Patience | 20 rounds |
| Evaluation Metric | Multi-class Log Loss (mlogloss) |
Training configuration specifications.
5.2 Training history analysis
The training history visualization in Figure 3 presents two critical metrics across the 150 training rounds. The Figures 3a presents the multi-class log loss evolution, where both training and validation curves exhibit exponential decay in the initial phase (rounds 0–20), followed by asymptotic convergence. The final training loss demonstrates superior optimization compared to the validation loss , indicating mild overfitting despite the employed early stopping mechanism. On the other hand, the Figures 3b shows the classification accuracy , revealing a characteristic learning curve, where validation accuracy plateaus at after 100 rounds while training accuracy reaches . The persistent generalization gap suggests potential benefits from increased regularization or dropout techniques. Both curves exhibit smoothness without local oscillations, confirming the appropriateness of the selected learning rate and batch normalization strategy.
FIGURE 3

Training dynamics: (a) loss, and (b) classification accuracy.
5.3 Confusion matrix interpretation
The normalized confusion matrix in Figure 4 exhibits strong diagonal dominance with particularly robust performance for SF7 and SF8 . The off-diagonal elements reveal a characteristic adjacency pattern where misclassifications primarily occur between consecutive SFs, computed using Equation 13:
FIGURE 4

Normalized confusion matrix showing classification probabilities between true (rows) and predicted (columns) SFs.
This manifests most prominently in the SF8SF9 and SF9SF10 misclassifications, reflecting the continuous nature of LoRa signal quality metrics. The matrix shows degraded performance at higher SFs, with SF12 exhibiting misclassification as SF11, attributable to the compressed SNR operating range in low-SNR regimes.
Although SF11 and SF12 exhibit higher misclassification rates, these errors are predominantly adjacent (e.g., SF12 SF11). Such adjacency errors are less harmful, as both SFs are robust in low-SNR conditions. Additionally, our framework defaults to SF12 in the rare case of no successful transmissions, ensuring baseline connectivity. Thus, while classification at extreme SFs remains challenging, the reliability impact on overall PDR is limited.
5.4 Optimization dynamics
The validation loss trajectory, as depicted in Figure 5, exhibits characteristic convex optimization behavior that can be decomposed into three distinct operational phases. The initial convergence phase (Rounds 0–40) demonstrates steep gradient descent with a loss reduction rate of , indicating rapid initial learning. This transitions into a refinement phase (Rounds 40–100) where quadratic convergence dominates, evidenced by progressively smaller updates to the model parameters. The final termination phase (Rounds 100–115) achieves stable convergence with minimal validation loss .
FIGURE 5

Validation loss progression showing early stopping at round 135 (dashed vertical line) with optimal model at round 115 (star marker). Shaded region indicates the early stopping patience window.
5.5 ML models performance
Table 3 presents a comprehensive evaluation of ML models for LoRaWAN SF classification. The results demonstrate significant variation in model effectiveness, with tree-based methods consistently outperforming linear approaches. Notably, XGBoost achieves competitive accuracy (80.45%) while maintaining efficient training times (0.7 s) and moderate memory requirements (1.46 MB). The superior performance of ensemble methods over traditional classifiers (e.g., 61% higher accuracy than Logistic Regression) confirms their suitability for processing complex signal patterns in IoT networks. Our selection of XGBoost is motivated by four key factors: (1) the training time of 0.7 s represents a 42 speedup compared to Gradient Boosting (29.69s), crucial for rapid model deployment, (2) with a 1.46 MB memory footprint, XGBoost remains deployable on resource-constrained LoRaWAN EDs, (3) and built-in L2 penalty prevents overfitting on limited training samples.
TABLE 3
| ML model | Accuracy | Precision | Recall | F1 | Train time (s) | Model size (MB) |
|---|---|---|---|---|---|---|
| AdaBoost | 0.3940 | 0.4158 | 0.3940 | 0.3495 | 2.07 | 0.07 |
| Logistic Regression | 0.5373 | 0.4879 | 0.5373 | 0.5043 | 0.38 | 0.02 |
| Gaussian Naive Bayes | 0.4828 | 0.5620 | 0.4828 | 0.4939 | 0.04 | 0.03 |
| LDA | 0.5112 | 0.4981 | 0.5112 | 0.4867 | 0.02 | 0.04 |
| XGBoost | 0.8045 | 0.8049 | 0.8045 | 0.8036 | 0.70 | 1.46 |
Comparison of ML model performance.
The combination of these characteristics makes XGBoost particularly suitable for real-world LoRaWAN implementations where computational resources are constrained yet accurate SF classification remains critical.
XGBoost was chosen for ns-3 simulation after preliminary benchmarking against other ML models (3), where it offered the best trade-off between accuracy (80.45%)) and training efficiency (0.7 s). These characteristics make it particularly suitable for LoRaWAN end devices, where computational resources are constrained.
6 Performance evaluation-online mode using NS-3
This study presents a comprehensive performance evaluation of end devices configured in confirmed data mode within a single-gateway LoRaWAN network architecture.
To ensure a fair comparison, we evaluated XG-ADR against conventional ADR, BADR, AI-ERA
6.1 Simulation setting and application
The network deployment under consideration features a circular coverage area with a radius of five km, representing a typical urban or semi-urban IoT deployment scenario. To accurately model industrial asset monitoring applications, the simulation implements a sophisticated two-dimensional random mobility algorithm. In this model, each mobile device undergoes directional changes after completing linear movement segments of precisely 200 m, with velocity parameters constrained within the range of 1.0–2.0 m per second. This mobility approach aligns with well-established IoT movement paradigms documented in contemporary literature
The experimental framework mandates that each participating device generates and transmits exactly six confirmed uplink messages during each hourly interval throughout a complete 24-h operational cycle. This transmission pattern reflects realistic industrial monitoring requirements where periodic status updates are essential. To guarantee the statistical validity and robustness of the obtained results, the simulation executes ten independent experimental trials under identical configuration parameters, and report averaged performance metrics. The reported performance metrics represent arithmetic means calculated across all trial iterations, thereby minimizing the impact of random variations and ensuring data reliability.
The experimental methodology encompasses two distinct deployment scenarios: stationary and mobile configurations. For static device evaluations, the simulation distributes between 100 and 1000 end devices following a uniform spatial distribution pattern across the entire coverage area. This density range permits analysis of network behavior under varying load conditions. The mobile scenario implementation incorporates the previously described random mobility model to accurately represent real-world asset tracking applications, including logistics monitoring and equipment location tracking. All experimental configurations strictly adhere to the parameter set specified in Table 4, which has been carefully designed to comply with LoRaWAN regional specifications for European frequency allocations.
TABLE 4
| Parameter | Value |
|---|---|
| Maximum Transmission Attempts | 8 (comprising 1 initial attempt plus 7 retries) |
| Device Velocity Range | 1.0–2.0 m per second |
| Path Update Condition | Upon traversing 200 m linear segments |
| Regulatory Frequency Band | European 868 MHz ISM band |
| Designated Operational Channels | 868.1 MHz, 868.3 MHz, and 868.5 MHz |
| Initial Physical Layer Configuration | SF 12 with 14 dBm transmission power |
Comprehensive network simulation parameters.
Furthermore, the simulation framework incorporates advanced channel modeling techniques to account for multipath propagation effects and varying environmental conditions. The path loss model considers both urban and suburban propagation characteristics, with additional parameters for shadow fading and interference scenarios. Each device implements adaptive data rate algorithms in accordance with LoRaWAN specifications, allowing for dynamic adjustment of SF based on prevailing channel conditions. The confirmation mechanism for uplink messages follows the standard LoRaWAN acknowledgment protocol, with strict timing constraints for downlink windows.
All experiments were conducted in a single-GW setup, which allows us to directly assess SF allocation behavior without confounding effects from inter-gateway coordination. While this represents a common deployment scenario, we acknowledge that multi-GW architectures introduce additional challenges (e.g., interference coordination, joint ADR control), which we identify as an important direction for future work.
6.2 Experimental results
The experimental results illustrated in Figure 6 provide a comprehensive comparative analysis of PDR performance across multiple SF allocation algorithms in a simulated LoRaWAN network under mobility conditions. The evaluation encompasses five distinct methodologies: the proposed XG-ADR algorithm, the AI-ERA technique
FIGURE 6

Comparative PDR performance of XG-ADR, AI-ERA
The performance metrics reveal several critical insights regarding algorithmic efficacy in mobile LoRaWAN deployments. The proposed XG-ADR method demonstrates superior PDR maintenance across all tested network densities, exhibiting consistent performance advantages throughout the operational range. This performance superiority stems from XG-ADR’s advanced gradient-boosted decision tree framework, which dynamically optimizes SF selection based on real-time channel conditions and mobility patterns. At lower network densities (200-400 EDs), XG-ADR maintains PDR levels above 0.95, while even at maximum tested density (1000 EDs), it sustains a PDR above 0.85, demonstrating remarkable resilience to network congestion.
AI-ERA
The conventional ADR mechanism shows predictable performance degradation with increasing network density, with particularly poor scalability in high-density configurations. This limitation stems from its static parameter configurations that cannot adequately adapt to rapidly changing channel conditions in mobile environments. BADR performs most poorly among the evaluated methods due to its lack of channel state awareness, demonstrating the critical importance of environmental adaptation in mobile LoRaWAN deployments.
All algorithms exhibit expected performance degradation with increasing network density due to rising collision probability and interference effects. However, the rate of degradation varies significantly between methods. XG-ADR maintains the most stable performance curve, with only minimal reduction in PDR across the tested density range. This resilience underscores XG-ADR’s superior capability in managing radio resource contention in dense mobile deployments compared to both conventional approaches and other machine learning-based alternatives.
The performance evaluation of the proposed XG-ADR algorithm regarding Packet Delivery Ratio (PDR) for static deployments appears in Figure 7, with comparative analysis against AI-ERA
FIGURE 7

Comparative PDR performance of XG-ADR, AI-ERA
The experimental data reveals a clear performance hierarchy among the evaluated methods. XG-ADR achieves the highest PDR values through its gradient-boosted decision tree framework, followed by AI-ERA with its neural network-based optimization. The TF algorithm
This comparative study highlights XG-ADR’s effectiveness in optimizing SF allocation for static LoRaWAN deployments. The algorithm’s intelligent adaptation to network conditions provides significant reliability improvements over both conventional methods and competing machine learning approaches like AI-ERA
The energy consumption profile of the proposed XG-ADR algorithm appears in Figure 8 for mobile scenarios, compared with AI-ERA
FIGURE 8

Mobile deployment energy efficiency: XG-ADR maintains consistent low consumption across all network sizes, outperforming AI-ERA, TF, and conventional methods.
The comparative analysis reveals a consistent performance ranking where XG-ADR achieves optimal energy efficiency through its adaptive transmission parameter optimization. AI-ERA
These findings highlight XG-ADR’s effectiveness in minimizing energy expenditure for mobile LoRaWAN deployments. The algorithm’s efficient resource allocation strategy offers substantial advantages for battery-constrained IoT devices, improving network sustainability while maintaining communication reliability.
The energy efficiency analysis of the proposed XG-ADR algorithm for static deployments appears in Figure 9, with comparative evaluation against AI-ERA
FIGURE 9

Static deployment energy efficiency: XG-ADR maintains consistent low consumption across all network sizes, outperforming AI-ERA, TF, and conventional methods.
The experimental data reveals a clear efficiency hierarchy among the evaluated algorithms. XG-ADR achieves optimal energy conservation through its intelligent parameter adaptation, followed by AI-ERA
7 Conclusion
This study has demonstrated the effectiveness of the XGBoost-driven adaptive data rate (XG-ADR) approach in optimizing both energy efficiency and packet delivery performance for LoRaWAN networks across diverse deployment scenarios. The proposed method consistently outperformed conventional ADR, BADR, and contemporary machine learning alternatives (AI-ERA, TF) in comprehensive simulations, achieving superior packet delivery ratios while maintaining significantly lower energy consumption levels (0.2J–1.8J for static and 0.4J–2.8J for mobile scenarios). The proposed XG-ADR framework proved particularly adept at adapting to varying network densities and mobility conditions, with its computational efficiency making it suitable for resource-constrained IoT environments. These results validate that machine learning-enhanced resource allocation strategies can substantially improve LoRaWAN network sustainability and reliability compared to traditional approaches. A limitation of the proposed XG-ADR is that deployment feasibility on real hardware has not been empirically validated. While our simulation results indicate that the proposed model is lightweight, actual device-level constraints such as memory availability, CPU performance, and battery behavior were not tested. We identify this as an avenue for future work, where XG-ADR will be implemented and benchmarked on representative low-power IoT hardware to assess its practical deployment cost.
Statements
Data availability statement
The dataset used in this paper is available at https://github.com/afarhad/AI-ERA/tree/main.
Author contributions
FN: Writing – original draft. MA: Methodology, Writing – review and editing. MTI: Supervision, Writing – review and editing. HH: Writing – review and editing. NA: Writing – review and editing. ML: Funding acquisition, Writing – review and editing.
Funding
The author(s) declare that financial support was received for the research and/or publication of this article. The Authors would like to thanks Prince Sultan University for paying the Article Processing Charges (APC) of this publication.
Conflict of interest
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
Generative AI statement
The author(s) declare that no Generative AI was used in the creation of this manuscript.
Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.
Correction note
This article has been corrected with minor changes. These changes do not impact the scientific content of the article.
Publisher’s note
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.
References
1
AnwarK.RahmanT.ZebA.KhanI.ZareeiM.Vargas-RosalesC. (2021). Rm-adr: resource management adaptive data rate for mobile application in lorawan. Sensors21, 7980. 10.3390/s21237980
2
AziziF.TeymuriB.AslaniR.RastiM.TolvanenyJ.NardelliP. H. J. (2022). “Mix-mab: reinforcement learning-based resource allocation algorithm for lorawan,” in 2022 IEEE 95th Vehicular Technology Conference: (VTC2022-Spring), Helsinki, Finland, 19-22 June 2022, 1–6. 10.1109/VTC2022-Spring54318.2022.9860807
3
BenkahlaN.TounsiH.Ye-QiongS.FrikhaM. (2019). “Enhanced adr for lorawan networks with mobility,” in 2019 15th International Wireless Communications and Mobile Computing Conference (IWCMC), Tangier, Morocco, 24-28 June (IEEE), 1–6.
4
BertoccoM.ParrinoS.PeruzziG.PozzebonA. (2023). Estimating volumetric water content in soil for iout contexts by exploiting rssi-based augmented sensors via machine learning. Sensors23, 2033. 10.3390/s23042033
5
ButtA. U. R.SabaT.KhanI.MahmoodT.KhanA. R.SinghS. K.et al (2025). Proactive and data-centric internet of things-based fog computing architecture for effective policing in smart cities. Comput. Electr. Eng.123, 110030. 10.1016/j.compeleceng.2024.110030
6
ChenT.GuestrinC. (2016). “Xgboost: a scalable tree boosting system,” in Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, 785–794. 10.1145/2939672.2939785
7
ChenM.MokdadL.Ben-OthmanJ.FourneauJ.-M. (2023). Dynamic parameter allocation with reinforcement learning for lorawan. IEEE Internet Things J.10, 10250–10265. 10.1109/JIOT.2023.3239301
8
Da SilvaJ. C.FlorD. d. L.de Sousa JuniorV. A.BezerraN. S.de MedeirosA. A. (2021). A survey of lorawan simulation tools in ns-3. J. Commun. Inf. Syst.36, 17–30. 10.14209/jcis.2021.2
9
ETSI (2018). System reference document (srdoc); technical characteristics for low power wide area networks and chirp spread spectrum (Lpwan-css) operating in the uhf spectrum below 1 ghz. etsi Tr.103 526 v1 (1.1). Available online at: https://www.etsi.org/deliver/etsi_tr/103500_103599/103526/01.01.01_60/tr_103526v010101p.pdf.
10
FarhadA.PyunJ.-Y. (2022). Hadr: a hybrid adaptive data rate in lorawan for internet of things. ICT Express8, 283–289. 10.1016/j.icte.2021.12.013
11
FarhadA.PyunJ.-Y. (2023a). Ai-era: artificial intelligence-empowered resource allocation for lora-enabled iot applications. IEEE Trans. Industrial Inf.19, 11640–11652. 10.1109/TII.2023.3248074
12
FarhadA.PyunJ.-Y. (2023b). Lorawan meets ml: a survey on enhancing performance with machine learning. Sensors23, 6851. 10.3390/s23156851
13
FarhadA.KimD.-H.PyunJ.-Y. (2019a). “Scalability of lorawan in an urban environment: a simulation study,” in 2019 Eleventh International Conference on Ubiquitous and Future Networks (ICUFN) (IEEE), 677–681.
14
FarhadA.KimD.-H.SthapitP.PyunJ.-Y. (2019b). “Interference-aware spreading factor assignment scheme for the massive lorawan network,” in International Conference on Electronics, Information, and Communication (ICEIC), Auckland, New Zealand, 06 May 2019 (IEEE), 1–2.
15
FarhadA.KimD. H.KimB. H.MohammedA. F. Y.PyunJ. Y. (2020a). Mobility-aware resource assignment to iot applications in long-range wide area networks. IEEE Access8, 186111–186124. 10.1109/ACCESS.2020.3029575
16
FarhadA.KimD.-H.KwonD.PyunJ.-Y. (2020b). “An improved adaptive data rate for lorawan networks,” in 2020 IEEE international conference on consumer electronics-Asia (ICCE-Asia) (IEEE), 1–4.
17
FarhadA.KimD.-H.PyunJ.-Y. (2020c). Resource allocation to massive internet of things in lorawans. Sensors20, 2645–20. 10.3390/s20092645
18
FarhadA.KimD.-H.SubediS.PyunJ.-Y. (2020d). Enhanced lorawan adaptive data rate for mobile internet of things devices. Sensors20, 6466. 10.3390/s20226466
19
FarhadA.KimD.-H.YoonJ.-S.PyunJ.-Y. (2021a). “Feasibility study of the lorawan blind adaptive data rate,” in Twelfth International Conference on Ubiquitous and Future Networks (ICUFN) (Korea: Jeju Island), 67–69. 10.1109/ICUFN49451.2021.9528716
20
FarhadA.KimD.-H.YoonJ.-S.PyunJ.-Y. (2021b). “Feasibility study of the lorawan blind adaptive data rate,” in 2021 Twelfth International Conference on Ubiquitous and Future Networks (ICUFN) (IEEE), 67–69.
21
FarhadA.KimD.-H.PyunJ.-Y. (2022a). R-ARM: retransmission-assisted resource management in LoRaWAN for the internet of things. IEEE Internet Things J.9, 7347–7361. 10.1109/JIOT.2021.3111167
22
FarhadA.KimD.-H.YoonJ.-S.PyunJ.-Y. (2022b). “Deep learning-based channel adaptive resource allocation in lorawan,” in 2022 International Conference on Electronics, Information, and Communication (ICEIC), Jeju, Korea, 06-09 February 2022, 1–5. 10.1109/ICEIC54506.2022.9748580
23
GomezC.VerasJ. C.VidalR.CasalsL.ParadellsJ. (2019). A sigfox energy consumption model. Sensors19, 681. 10.3390/s19030681
24
GSMA-3GPP (2016). 3gpp low power wide area technologies
25
JavadiS.RezaeeB.NabaviS. S.GadringerM. E.BöschW. (2025). Machine learning-driven approaches for advanced microwave filter design. Electronics14, 367. 10.3390/electronics14020367
26
KhanM. A. A.MaH.FarhadA.MujeebA.MiraniI. K.HamzaM. (2024). When lora meets distributed machine learning to optimize the network connectivity for green and intelligent transportation system. Green Energy Intelligent Transp.3, 100204. 10.1016/j.geits.2024.100204
27
LodhiM. A.WangL.FarhadA. (2022). Nd-adr: nondestructive adaptive data rate for lorawan internet of things. Int. J. Commun. Syst.35, e5136. 10.1002/dac.5136
28
LodhiM. A.SunX.MahmoodK.LodhiA.ParkY.HussainM. (2025a). Ai-enhanced resource allocation for lpwan-based lorawan:a hybrid tinyml and deep learning approach. IEEE Internet Things J., 1–1doi. 10.1109/JIOT.2025.3568445
29
LodhiM. A.WangL.FarhadA.QureshiK. I.ChenJ.MahmoodK.et al (2025b). A contextual aware enhanced lorawan adaptive data rate for Mobile iot applications. Comput. Commun.232, 108042. 10.1016/j.comcom.2024.108042
30
MagrinD.CentenaroM.VangelistaL. (2017a). “Performance evaluation of lora networks in a smart city scenario,” in 2017 IEEE International Conference on Communications (ICC), Paris, France, 21-25 May 2017, 1–7. 10.1109/ICC.2017.7996384
31
MagrinD.CentenaroM.VangelistaL. (2017b). “Performance evaluation of lora networks in a smart city scenario,” in IEEE International Conference on communications (ICC), Paris, France, 21-25 May 2017 (IEEE), 1–7.
32
MariniR.CerroniW.BurattiC. (2021). A novel collision-aware adaptive data rate algorithm for lorawan networks. IEEE Internet Things J.8, 2670–2680. 10.1109/JIOT.2020.3020189
33
MekkiK.BajicE.ChaxelF.MeyerF. (2019). A comparative study of lpwan technologies for large-scale iot deployment. ICT express5, 1–7. 10.1016/j.icte.2017.12.005
34
MinhajS. U.MahmoodA.AbedinS. F.HassanS. A.BhattiM. T.AliS. H.et al (2023). Intelligent resource allocation in lorawan using machine learning techniques. IEEE Access11, 10092–10106. 10.1109/ACCESS.2023.3240308
35
MoysiadisV.LagkasT.ArgyriouV.SarigiannidisA.MoscholiosI. D.SarigiannidisP. (2021). Extending adr mechanism for lora enabled mobile end-devices. Simul. Model. Pract. Theory113, 102388. 10.1016/j.simpat.2021.102388
36
ParkJ.ParkK.BaeH.KimC.-k. (2020). Earn: enhanced adr with coding rate adaptation in lorawan. IEEE Internet Things J.7, 11873–11883. 10.1109/jiot.2020.3005881
37
RehmanA.HaseebK.SabaT.JeonG.Al-OtaibiS. (2025). Multi-layer secured edge-ai enabled model for consumer health systems. IEEE Trans. Consumer Electron.71, 4596–4603. 10.1109/tce.2025.3555957
38
SartoriA. (2023). Lorasim: a lora simulator. Available online at: https://github.com/AlexSartori/LoRaSim (Accessed on May 03, 2023).
39
Semtech (2019a). Lorawan mobile applications: blind adr. Available online at: https://lora-developers.semtech.com/documentation/tech-papers-and-guides/blind-adr/(Accessed on May 31, 2023).
40
Semtech (2019b). Understanding the lora adaptive data rate
41
SinghR. K.PuluckulP. P.BerkvensR.WeynM. (2020). Energy consumption analysis of lpwan technologies and lifetime estimation for iot application. Sensors20, 4794. 10.3390/s20174794
42
UllahA.KhanS. H.UllahI.MahmoodT.NawazishS.AliZ.et al (2025). Toward sustainable smart cities: applications, challenges, and future directions. Int. J. Data Sci. Anal., 1–21. 10.1007/s41060-025-00856-2
43
VangelistaL.CalabreseI.CattapanA. (2023). Mobility classification of lorawan nodes using machine learning at network level. Sensors23, 1806. 10.3390/s23041806
44
ZorbasD.CaillouetC.Abdelfadeel HassanK.PeschD. (2021). Optimal data collection time in lora networks—a time-slotted approach. Sensors21, 1193. 10.3390/s21041193
Summary
Keywords
LORA, LoRaWAN, internet of things (IoT), machine learning (ML), resource management, spreading factor (SF), transmission power (TP)
Citation
Nisar F, Amin M, Touseef Irshad M, Hadi HJ, Ahmad N and Ladan M (2025) XGBoost-driven adaptive spreading factor allocation for energy-efficient LoRaWAN networks. Front. Commun. Netw. 6:1665262. doi: 10.3389/frcmn.2025.1665262
Received
13 July 2025
Accepted
01 September 2025
Published
16 October 2025
Corrected
03 November 2025
Volume
6 - 2025
Edited by
Oluwakayode Onireti, University of Glasgow, United Kingdom
Reviewed by
Muhammad Ali Lodhi, Yangzhou University, China
Arshad Farhad, Bahria University, Pakistan
Pandiyanathan Murugesan, KLEF Deemed to be University, India
Updates

Check for updates
Copyright
© 2025 Nisar, Amin, Touseef Irshad, Hadi, Ahmad and Ladan.
This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.
*Correspondence: Farhan Nisar, Farhansnisar@yahoo.com
Disclaimer
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.