## 4 Algorithms
### Edge Node Aggregation and Adaptation  
In collaborative learning frameworks, edge nodes serve as intermediaries between a multitude of resource-constrained IoT devices and a central server, aggregating locally trained model updates to produce a refined global model. The asynchronous aggregation algorithm (Algorithm 2) leverages both historical context and current observations to stabilize learning despite heterogeneous and intermittent device participation. More specifically, the algorithm employs weighted averaging, wherein the new aggregated model \(w_{e}^{(t)}\) is composed of a portion of the previously aggregated model \(w_{e}^{(t-1)}\) and the current round's model updates \(w_{i}\) received from a subset of devices \(i\in A_{t}\). The weight \(\alpha\) governs the influence of the prior model state, allowing the system to maintain continuity and mitigate abrupt changes. Conversely, the weight \(\beta\) determines the relative impact of newly arrived device updates, enabling the algorithm to incorporate fresh information and adapt promptly to evolving conditions. These mechanisms help counteract the irregularities inherent in asynchronous settings, such as devices that upload updates at different times, varying data quality, or fluctuating connectivity conditions. By normalizing the final aggregation result with \(\alpha+\beta|A_{t}|\), the algorithm ensures a consistent reference scale, enhancing the stability and interpretability of the combined model. Apart from the aggregation of model parameters, the algorithm integrates adaptive control strategies to sustain an optimal balance between update frequency and model quality. The sliding window variable \(w_{window}^{(t)}\) is maintained to adjust the timing and breadth of aggregations based on the discrepancy between the desired and actual device participation rates, \(p_{desired}\) and \(p_{actual}\). This adjustment allows the edge node to dynamically adjust the aggregation interval, improving responsiveness to system changes and preventing inefficiencies such as excessive communication costs from too frequent aggregations or outdated models from infrequent ones. Additionally, a quality score \(q_{e}\) is iteratively updated to track the reliability of received updates over time. Parameters like \(\gamma\) are employed to implement exponential smoothing, assigning appropriate emphasis to recent measurements versus historical performance, therefore enhancing the system's ability to detect persistent trends or anomalies in device behavior. ```
1:Input: Encrypted models \(\{c_{i}\mid i\in A_{t}\}\), previous model \(w_{e}^{(t-1)}\), feedback \(v_{e}\)
2:Output: Aggregated model \(w_{e}^{(t)}\), metadata
3: Decrypt \(w_{i}=\text{Decrypt}(c_{i}),\forall i\in A_{t}\)
4:\(w_{e}^{(t)}\leftarrow\alpha w_{e}^{(t-1)}\)
5:for each \(i\in A_{t}\)do
6:\(w_{e}^{(t)}\gets w_{e}^{(t)}+\beta w_{i}\)
7:endfor
8:\(w_{e}^{(t)}\leftarrow\frac{w_{e}^{(t)}}{\alpha+\beta|A_{t}|}\)
9:\(w_{window}^{(t+1)}\gets w_{window}^{(t)}+\alpha(p_{desired}-p_{ actual})\)
10:\(q_{e}^{(t)}\leftarrow\gamma q_{e}^{(t-1)}+(1-\gamma)q_{current}\)
11: Send encrypted update and metadata \([w_{i}^{(t)},p_{e}^{(t)},q_{e}^{(t)}]\) to central server
```  
**Algorithm 2** Asynchronous Aggregation and Adaptation at Edge Node  
From a computational complexity perspective, the dominant costs of asynchronous aggregation at the edge node arise from the cryptographic operations and the vectorized arithmetic. The decryption of each encrypted model \(c_{i}\) typically takes a time proportional to the model size, denoted as \(O(L)\) for models with \(L\) parameters. Accumulating and normalizing updates from \(|A_{t}|\) devices adds another \(O(|A_{t}|L)\) complexity, as each parameter of each participating device model must be combined. Space complexity remains \(O(L)\) for storing models and metadata, as the algorithm keeps track of a limited set of parameters and aggregated statistics rather than the entire historical sequence of updates.