1. Introduction
Over the past few years, federated learning has become a widely adopted paradigm for distributed, collaborative machine learning, particularly suitable for privacy-sensitive applications [
1,
2,
3,
4,
5]. Originally introduced by Google, federated learning shifts the focus from centralized data processing to on-device computation, enabling devices to exchange only model updates rather than raw sensor data [
6]. In federated learning, devices collaboratively construct a global model by communicating locally computed model updates instead of exchanging raw data, thereby preserving user privacy. This process iteratively improves the global model while keeping raw data local, reducing the need to transmit large amounts of sensor data across the network to the server or base station [
1,
2,
7,
8]. The key characteristics of federated learning include scalability, device and statistical heterogeneity, and data privacy [
1,
9].
The performance of federated learning is often comparable to—and in some cases surpasses—that of traditional centralized machine learning approaches [
7]. Comparable principles have also been observed in graph neural network research [
10,
11,
12,
13], where distributed learning is employed to optimize communication efficiency and maintain data locality. Traditional machine learning approaches require substantial computational power, memory storage, and large training datasets [
2,
14]. Moreover, conventional CPUs or GPUs are generally unavailable in IoT devices and are unsuitable for untethered and battery-powered deployments [
2]. Crucially, most machine learning methods rely on centralized processing, necessitating that both data and models reside in a single location [
1,
14]. Federated learning algorithms enable multiple nodes to collaboratively train a global model in a fully distributed manner without communicating raw data to a central location for processing [
2,
15].
Federated learning has been proposed as an effective solution for distributed information processing in the Internet of Things (IoT). The IoT represents a transformative, ubiquitous paradigm that has been seamlessly integrated into the fabric of everyday life [
16,
17,
18,
19,
20]. Initially, the term IoT was associated with radio frequency identification (RFID) tags [
21]. However, the current IoT paradigm encompasses a diverse range of interconnected devices, including near-field communication (NFC) devices, sensors, actuators, wireless sensor networks (WSNs), and smartphones. IoT devices are now pervasive in daily life and influence decision-making, behavior, and lifestyle [
21]. The application domains of the IoT are vast and continually expanding across various domains and sectors [
21,
22].
This study focuses on WSNs and wireless IoT (WIoT) devices, both of which form important subsets of the broader IoT domain. These devices act as bridges between the physical and digital environments by acquiring sensor data and transmitting it to other IoT nodes or end-users [
16,
17,
18,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32]. Typically constrained by limited processing power, memory capacity, and battery life [
21], WSNs and WIoT devices are often deployed for remote sensing in locations where battery replacement or physical maintenance is impractical or infeasible. In such scenarios, energy efficiency becomes a critical design objective, directly affecting network lifespan and operational reliability [
33,
34].
To ensure reliable operation, IoT applications must optimize processing power, memory storage, and communication overhead to conserve the limited battery energy of the IoT devices [
16]. Sensor data collected from IoT environments require local storage, processing, and communication; however, these processes are constrained by limited device resources [
24]. Furthermore, IoT network communication is often highly dynamic, less reliable, and slower than that of traditional infrastructure, making the assumption of continuous node availability unrealistic in many deployment scenarios [
1]. Beyond device-level challenges, large-scale IoT deployments exert heavy demands on communication networks and end-systems such as base stations and servers.
Technological advances have driven the rise of federated learning-enabled IoT edge computing, offering efficient solutions and innovative applications [
35]. This synergy enables diverse applications: in healthcare, federated learning–IoT integration accelerates patient diagnosis and treatment while preserving data privacy [
36]. Specifically for medical IoT, federated learning enhances both privacy and classification accuracy in applications such as chronic disease prediction [
37,
38]. Furthermore, federated learning is increasingly applied in smart city domains such as traffic management and smart vehicles, where federated learning enables collaborative solutions including an improved recognition of unlabeled traffic signs among vehicles and a more efficient identification of charging stations [
39,
40].
Recent research has explored lightweight and secure distributed learning paradigms that align operational constraints with the approach proposed in this study. For example, the combinatorial optimization graph neural network (CO-GNN) employs graph neural networks (GNNs) to jointly optimize beamforming, power allocation, and intelligent reflecting surface (IRS) phase shifts in non-orthogonal multiple access (NOMA) systems, achieving secure, resource-efficient transmission without explicit channel state information (CSI) estimation [
41]. Similarly, the work in [
42] introduced a safety-optimal, fault-tolerant control method for unknown nonlinear systems with actuator faults and asymmetric input constraints, ensuring both safety and optimality. This approach integrates control barrier functions, neural network-based system identification, and an adaptive critic scheme to guarantee stability and efficiency. Furthermore, the authors in [
43] proposed a collaboration-based node selection (CNS) approach that enhances wireless security by combining relay selection with friendly interference, thereby improving secrecy and reliability through selection combining (SC) and maximal ratio combining (MRC) strategies, with performance validated through both theoretical analysis and simulation.
Despite extensive research on federated learning and the IoT, achieving result model convergence and acceptable accuracy often requires a large number of communication rounds, during which local model updates from active network nodes are communicated throughout the network and aggregated at a central server or base stations. These iterative communication rounds introduce substantial communication overhead and impose significant energy demands on participating nodes. These limitations underscore the need for energy-efficient strategies to improve federated learning performance and the lifetime of the network. Consequently, the implications of communication overhead and energy consumption remain underexplored in the context of resource-constrained IoT environments. The main contributions of this paper are as follows:
Novel Federated Learning Approach: A federated learning approach is proposed, namely the tiny federated nearest neighbors (TFNN) approach, tailored for IoT devices and networks that significantly reduces communication overhead, computational load, and energy conservation—critical considerations in resource-constrained environments.
Single-shot Communication: This study leverages the k-nearest neighbors (k-NN) algorithm to perform collaborative pattern recognition in a single communication round, thereby minimizing communication overhead.
Performance Benchmarking: TFNN is benchmarked with the classical k-NN and federated learning baseline algorithms, demonstrating that TFNN achieves competitive accuracy while requiring only a single communication round, in contrast to the multiple rounds typically needed by conventional federated learning approaches.
The rest of the paper is organized as follows:
Section 2 provides an overview of related work on federated learning and
k-NN.
Section 3 describes the proposed TFNN approach in detail.
Section 4 outlines the evaluation methodology, and
Section 5 presents the simulation results and performance analysis. Finally,
Section 6 concludes the paper by summarizing the key findings, discussing limitations, and proposing future research directions.
3. Tiny Federated Nearest Neighbors
This study proposes a federated learning nearest neighbor–based approach, referred to as TFNN, building upon the work presented in [
55]. TFNN is designed to provide an energy-efficient federated learning solution for the IoT, explicitly addressing the memory, processing, and communication constraints of IoT nodes.
Pseudocode Algorithm 3 outlines the TFNN approach, in which IoT devices collaborate to transform their local inferences into a global event recognition outcome through decision fusion at the server or base station. In this approach, each IoT device stores training patterns locally and applies the k-NN algorithm to classify input test (event) patterns, as described in Algorithm 1.
In TFNN, the server first initializes the network by identifying the participating nodes, denoted as . Each node independently executes a local inference process in parallel by invoking the Node_Update function, where k represents the number of nearest neighbors used in the local k-NN classifier. The parameter P is not transmitted; instead, each node is assumed to access the event pattern directly through local observation. The local prediction from each node is then returned to the server.
Finally, the base station performs global decision fusion by applying majority voting over the class labels received from IoT nodes to produce the final predicted label
for the event pattern
. Let
denote the class label of the
nearest neighbors of
x. The indicator function
outputs 1 if
and 0 otherwise.
where
denotes the number of neighbors labeled as class
c.
Here,
represents the majority class label selected as the final prediction. The winning class is defined as the class receiving the majority of votes (
), as defined in Formulas (
4) and (
5).
Algorithm 3 Tiny federated nearest neighbors (TFNN) approach. |
- 1:
Define set of active IoT nodes Network Initialization: - 2:
Server/Base Station Executes - 3:
for each node in parallel do - 4:
▹ Local classification via k-NN - 5:
//communication step: each node sends only (a class label) to server - 6:
end for - 7:
▹ Server aggregates classifications via majority voting - 8:
function Node_Update(k) - 9:
▹ Perform location classification only - 10:
return to server
|
This federated learning design ensures that raw data is never exchanged, thereby preserving privacy and enhancing efficiency. Each node transmits only its winning class label, which the server aggregates through majority voting. This approach provides a lightweight, communication-efficient, and privacy-preserving federated learning mechanism well suited for low-power and resource-constrained IoT environments.
4. Evaluation
Assessing federated learning algorithms for IoT deployments requires evaluating multiple performance factors. In this study, we employ analytical models and simulations to quantify these metrics for TFNN and baseline methods, focusing on their implications for energy consumption, communication overhead, and recognition performance.
4.1. Computational Complexity
In federated learning scenarios—particularly within IoT networks constrained by limited computational and power resources—local computational efficiency is critical. The TFNN approach addresses this challenge by eliminating iterative model training, thereby reducing processing demands. Instead, each IoT node performs lightweight local inference using a k-NN algorithm on a fixed-size pattern dataset.
The local computational cost at each node in TFNN is primarily determined by the
k-NN classification step. For a local prototype set
of size
and input feature vectors of dimension
d, each node locally computes the distance between the input event pattern and stored patterns, resulting in a per-pattern complexity of
Compared to machine learning algorithms that require forward passes through large neural networks, this cost is both low and predictable, making TFNN well suited for microcontrollers and IoT-grade processors. Furthermore, TFNN avoids backpropagation, weight storage, and floating-point intensive operations common in many federated learning algorithms. This significantly reduces the memory footprint and energy consumption at each node—an essential advantage for battery-powered and intermittently connected devices. Overall, TFNN provides a favorable trade-off by enabling decentralized intelligence with minimal local computation, making it highly practical for resource-constrained federated edge environments.
4.2. Accuracy Analysis
The classification accuracy of the TFNN approach depends on several interdependent factors, including the number of participating nodes (m) and the number of nearest neighbors (k). At the local level, each node executes a k-NN classifier, with accuracy determined by the quality of its local dataset and the choice of k. While smaller values of k may lead to overfitting or increased sensitivity to noise, larger values generally improve stability but may reduce specificity.
The size and quality of local data
directly affect prediction accuracy, with larger local datasets generally improving
k-NN performance due to better neighborhood coverage. When using
k-nearest samples for classification, the risk of underfitting or overfitting becomes more pronounced. In extreme cases,
k-NN may yield unreliable results if
or become overly sensitive if
. Formula (
7) describes the accuracy trend of
k-NN accordingly:
Consequently, a small k results in low bias and high variance, making the classifier sensitive to noise and prone to misclassifications due to outliers or label noise. In contrast, a large k provides better generalization with high bias and low variance; however, it may overlook minority classes. In general, an effective choice is k ≈, where represents the number of samples at node i.
Moreover, let the local accuracy of the
k-NN classifier at node
i be denoted by
. Then, the local accuracy of the
k-NN classifier at node
i is given by
Under regularity conditions—such as independent and identically distributed samples and the Lipschitz continuity of the conditional distribution—as
, the local accuracy converges to
where
denotes the Bayes-optimal accuracy for the classification problem,
is a constant that depends on the underlying data distribution,
k is the number of nearest neighbors, and
d is the dimensionality of the feature space.
For practical finite datasets, a tight upper bound described in [
44] is given by
where
denotes the expected classification accuracy at node
i,
k is the number of nearest neighbors,
is a constant that depends on the underlying data distribution and class overlap, and
is the accuracy of the Bayes-optimal classifier.
In the TFNN approach, the final classification is obtained by aggregating local predictions from
m IoT nodes using unweighted majority voting, as described in Formula (
5). Each node
independently predicts a class label
using a local
k-NN classifier, and the server or base stations then computes the global output using the same majority voting rule. The resulting global accuracy depends on the statistical properties of the ensemble decision-making process.
Assuming that each node makes an independent prediction with a probability
p of being correct, the probability that the majority of nodes produce the correct label is given by the binomial cumulative distribution function (CDF):
where
denotes the binomial coefficient,
represent the probability that exactly
i nodes predict correctly, and
represents the probability that the remaining
nodes predict incorrectly.
This reflects the classic ensemble effect: as long as individual nodes perform better than random guessing (), increasing the number of participating IoT nodes improves the global accuracy, enabling the ensemble to outperform any individual node. In the asymptotic case, with IID data and a sufficiently large number of nodes, the performance of TFNN can approach that of a globally trained k-NN model.
4.3. Communication Overhead
Minimizing communication overhead is a critical concern for IoT devices operating on limited battery reserves. Generally, federated learning strategies require multiple exchanges of large iterative model parameters between distributed clients and a coordinating server. TFNN, by contrast, streamlines this process through a single-shot classification approach. Each participating node independently executes a lightweight k-NN classifier on its locally stored data and transmits only the resulting class labels to the central aggregator at the server or base station.
Let m denote the number of participating nodes and C the number of classes. Assuming each prediction is encoded as a one-hot vector of length C or as an integer requiring bits, TFNN incurs negligible downlink cost since the datasets are fixed and locally stored. Unlike conventional federated learning, the server does not broadcast global model updates back to the nodes.
In addition to abstract communication complexity, practical physical costs such as radio transmission energy, propagation distance, and receiver wake-up durations must also be considered. Each IoT node transmits a scalar index
, requiring
bits, or a one-hot vector of length
C, requiring
C bits. Thus, the total uplink communication costs for
m nodes is given by
If
denotes the distance from node
i to the server or base station and
is the path loss exponent, the per-node transmission energy scales as
Aggregating over all nodes yields the total uplink transmission energy:
In duty-cycled networks, transceivers consume a wake-up energy cost (
) in addition to transmission or reception energy. If
denotes the per-bit reception energy, the server’s total reception energy is given by
Including wake-up costs, the per-classification communication energy is expressed as
By communicating only a single scalar class label per IoT node in one communication round, TFNN achieves a substantially lower communication overhead than standard federated learning, making it well suited for low-power, bandwidth-constrained IoT deployments.
4.4. Privacy Considerations
Similar to conventional federated learning methods that exchange model updates, TFNN transmits only a scalar class label from each node for each inference. This substantially reduces the information available to potential eavesdroppers and mitigates risks associated with model inversion or data reconstruction attacks. Raw sensor data or detailed model parameters are never shared across the network. However, in scenarios where the class label space itself may reveal sensitive information (e.g., rare disease diagnosis), even label-only transmission could expose limited contextual details to a malicious observer. In such cases, additional privacy-enhancing techniques—such as label perturbation or differential privacy—can be integrated without significantly affecting TFNN efficiency.
5. Results
The on-board battery energy of IoT devices is predominantly consumed during communication. Therefore, this study focuses on evaluating the communication efficiency and classification accuracy of the TFNN approach by comparing its performance with traditional federated learning and pattern recognition methods, specifically AdaptiveFL, FedProx, SCAFFOLD, FedAvg, and the
k-NN algorithm, respectively. The evaluation of TFNN was conducted using a custom simulator developed in MATLAB 2024b and Python 3.13.3 [
56,
57]. The experiments employed three widely used benchmark datasets—MNIST [
58], CIFAR-10, and CIFAR-100 [
59]—across various experimental setups. The CIFAR-10 dataset contains 60,000 color images of size
pixels across 10 classes, while the CIFAR-100 dataset comprises 100 classes with 600 images per class. MNIST consists of handwritten digits (0–9, 10 classes), where each image comprises
grayscale patterns.
Figure 1 illustrates the classification accuracy of the
k-NN algorithm with different values of
k compared with the proposed TFNN approach, using 100 IoT nodes, and varying the number of IID stored training patterns from 10 to 500 from the MNIST dataset. As the number of stored patterns increases, the accuracy of both methods improves; however, TFNN consistently achieves higher accuracy than
k-NN across all configurations. While
k-NN serves as a simple and interpretable baseline, TFNN leverages lightweight collaborative inference in a federated setting, resulting in substantially improved performance. Notably, TFNN achieves approximately 90% accuracy when the number of stored patterns reaches 500.
Figure 2 compares the single-shot classification accuracy of the proposed TFNN (
) approach with AdaptiveFL, FedProx, SCAFFOLD, and FedAvg in IoT networks ranging from 10 to 100 nodes, with each node storing 500 IID MNIST patterns. The results show that TFNN consistently outperforms all federated learning baselines, achieving approximately 90% accuracy across all network sizes and thereby demonstrating strong communication efficiency—an essential feature for resource-constrained IoT environments.
Figure 3 presents the accuracy of the federated baselines after 200 communication rounds compared with the single-shot TFNN result. While the baselines achieve approximately 92%, this requires nearly 200 additional client–server exchanges beyond TFNN’s one-round operation and yields only about a 2% improvement in accuracy. These results underscore TFNN’s ability to achieve competitive accuracy with orders-of-magnitude lower communication overhead—and, by implication, lower communication energy—in practical IoT deployments.
Table 2,
Table 3 and
Table 4 present the classification accuracy of AdaptiveFL, FedProx, SCAFFOLD, FedAvg, and the proposed TFNN (
) under both IID and Non-IID partitions of the MNIST, CIFAR-10, and CIFAR-100 datasets. The simulations were conducted over 200 communication rounds with network sizes ranging from 10 to 100 IoT nodes, where each node stored 500 patterns.
Whilst using the MNIST dataset, all baseline algorithms achieved accuracies in the range of 92–93% under IID conditions, confirming strong convergence on relatively simple data. TFNN attained accuracy of approximately 80–90%, representing a modest trade-off in accuracy in exchange for an approximately 200-fold reduction in communication energy, as TFNN operates in a single-shot manner.
On the CIFAR-10 dataset, baseline federated learning methods achieved accuracies clustered around 36–39% under IID conditions, whereas TFNN remained consistently lower (≈23–25%). Under non-IID partitions, accuracy remained low for both the baseline federated learning algorithm and TFNN. The CIFAR-100 dataset is, in general, challenging, with all algorithms—including TFNN—achieving only about 10% accuracy or less. The reduced performance of TFNN on CIFAR-10 and CIFAR-100 can be attributed to the higher feature dimensionality and greater class complexity of these datasets.
Overall, the results reveal a clear energy-efficiency and accuracy trade-off. TFNN achieves competitive accuracy while requiring only a single communication round, thereby drastically reducing communication costs and, consequently, energy consumption compared with classical federated learning algorithms. These findings position TFNN as a viable lightweight alternative for resource-constrained IoT and WSN deployments, where communication efficiency is critical and absolute accuracy may be moderately sacrificed. However, the utilization of TFNN needs to take into account the complexity of the event patterns in order to maintain acceptable accuracy.
6. Conclusions
This study proposed TFNN, a lightweight and communication-efficient approach to federated learning tailored for resource-constrained IoT and WSN environments. Unlike conventional federated learning algorithms that require tens to hundreds of communication rounds and the exchange of large model parameter updates, TFNN performs single-shot pattern recognition by transmitting only local class labels from IoT nodes to the server or base station. Consequently, TFNN significantly reduces the energy consumed in communication compared with traditional federated learning while enabling federated pattern recognition in a single communication round.
The simulation results demonstrated that TFNN achieves competitive classification accuracy while reducing communication cost by up to two folds compared with baseline federated learning methods. This makes TFNN particularly promising for battery-powered and bandwidth-constrained IoT deployments, where extending network lifetime is more critical than achieving absolute accuracy.
Future studies will focus on refining and optimizing TFNN, specifically addressing its sensitivity to complex datasets by integrating lightweight feature extraction or prototype-sharing mechanisms. This is expected to enhance TFNN’s ability to capture discriminative representations in high-dimensional data. Furthermore, deploying TFNN in practical IoT environments will allow for an exploration of its full potential across diverse real-world scenarios. Such extensions will further establish TFNN as a scalable and energy-efficient solution for next-generation IoT systems.