University of Hamburg · Research project · 2025 — 2026
federated nicheformer
For this comparison, I split mouse brain spatial data by anatomy: dorsal, mid, and ventral. Each client held data from a different region, rather than a uniform slice of the same pool. The unevenness was deliberate.
I was fine-tuning Nicheformer to classify 24 cell types and comparing three ways of training it: pooling the data centrally, training across clients without sharing samples, and training each client on its own. Spatial transcriptomics labs cannot always pool their raw single-cell data, so the centralized setup isn't always an option, even when it gives the best result.
The anatomical split made the federated setup non-IID. It put the comparison in a setting where the clients didn't all have the same distribution of data. I used Python and PyTorch for the fine-tuning and held out one replicate for evaluation.
Close on accuracy, but not the same
My federated run reached 92.76% accuracy, compared with 94.45% for centralized training. The local clients averaged much lower. Training together closed most of that gap without sharing the underlying samples.
But accuracy was only part of the comparison. The federated run had lower macro-F1 than the centralized baseline, and it involved heavier training logistics. The two accuracy figures alone don't tell the whole story.
The code and write-ups are on GitHub (opens in a new tab), including the comparison between the training setups.