Flow: Per-instance Personalized Federated Learning

Kunjal Panchal, Sunav Choudhary, Nisarg Parikh, Lijun Zhang, Hui Guan

The Challenge of Data Heterogeneity in Federated Learning

Federated Learning (FL) allows thousands of edge devices to collaboratively train a "global model" without sharing their private, raw data. However, because every user’s data is statistically different (heterogeneous or "non-IID"), a one-size-fits-all global model often performs poorly across the board.

To address this, researchers typically "personalize" models by fine-tuning the global model for each client. Yet, this introduces a major "personalization gap":

  1. Personalization can hurt: Up to 31% of clients can actually experience lower accuracy with a personalized model than with the baseline global model.
  2. Static limitations: Even a generally "good" personalized model might fail on specific data instances that the global model would have handled correctly (affecting up to 11% of instances).

The core issue is that existing personalization techniques operate on a per-client basis (one static model per user). The authors of this paper propose moving the needle to per-instance personalization.

The Flow Framework

To bridge this gap, the authors introduce Flow, a novel FL framework that utilizes a dynamic routing module to decide—on the fly, for every single data point—whether to use specialized local parameters or generalizable global parameters.

Flow maintains three distinct components on the client side:

  • Global Parameters ($w_g$): Shared across all clients to capture general, overarching patterns.
  • Local Parameters ($w_\ell$): Fine-tuned specifically for the client’s unique local data.
  • Routing Module ($\psi_g$): A lightweight policy network that dictates the flow of data.
Flow Architecture Diagram

Dynamic Routing Mechanism

During a training round, a client splits its data. One half is used to fine-tune the local parameters, while the second half trains the Routing Module. For every layer of the neural network, the Routing Module calculates the probability that a specific data instance should pass through the global layer versus the local layer.

During training, Flow uses "soft" routing (a weighted average of both paths) to ensure smooth gradient updates. For inference, it switches to "hard" routing—picking just one path—to keep computational costs low. A key innovation is a regularization term that encourages the model to use global parameters whenever possible. This prevents the local model from overfitting and helps the global model continue learning from diverse data.

Experimental Setup

The authors evaluated Flow on five heterogeneous benchmarks across both vision and language domains:

  • Language: Stackoverflow (next-word prediction) and Shakespeare (next-character prediction).
  • Vision: EMNIST (62-class image classification) and partitioned versions of CIFAR-10 and CIFAR-100.
  • Heterogeneity: For the CIFAR datasets, Dirichlet distributions were used to artificially create varying levels of data imbalance among clients, effectively simulating real-world non-IID conditions.

Key Results and Insights

Flow consistently outperformed state-of-the-art (SOTA) personalization methods, including APFL, Ditto, and KNN-Per.

Accuracy Results Table
  • Accuracy Boost: As shown in the results, Flow achieved 1.11%–3.46% higher generalized accuracy (for new clients) and 1.33%–4.58% higher personalized accuracy (for existing clients) over the best-performing baselines.
  • Client Success Rate: On the Stackoverflow dataset, 92.74% of clients saw better results with Flow’s personalization compared to the global model, whereas other SOTA methods hovered around a 70-80% success rate.
  • Reduced Misclassifications: Flow successfully reduced the number of instances that were "correctly handled by global but failed by personalized" from ~8% in baseline methods to just ~1-2%.
  • Improving the Global Model: Surprisingly, by allowing "outlier" data to be handled by local parameters, the global model actually becomes more stable and generalizable. It is no longer forced to skew its weights to accommodate every single local anomaly.

Ultimately, Flow employs a "Best of Both Worlds" strategy. It recognizes that a single user might have some "standard" data (best handled by the global model) and some "weird" data (best handled by local fine-tuning). By routing per-instance, it avoids forcing a compromise.

Limitations and Future Work

While highly effective, the authors note a few areas for future exploration:

  • Black-Box Routing: It remains difficult to perfectly correlate why the router picks a specific path for a specific instance, as the true underlying data distributions are unknown.
  • Privacy Analysis: While FL is inherently more private, the impact of dynamic routing on advanced privacy attacks (like gradient leakage) requires further investigation.
  • Complexity: Although inference is efficient, maintaining two sets of weights (global and local) increases the storage footprint on edge devices, though this overhead is comparable to other competitive personalization methods.

Summary updated

BibTeX
@inproceedings{panchal2023flow,
  author = {Kunjal Panchal and Sunav Choudhary and Nisarg Parikh and Lijun Zhang and Hui Guan},
  title = {{Flow: Per-instance Personalized Federated Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=BI031mw7iS},
}
Figure