FedDyMem: Efficient Federated Learning with Dynamic Memory and Memory-Reduce for Unsupervised Image Anomaly Detection

Silin Chen, Kangjian Di, Yichu Xu, Han-Jia Ye, Wenhan Luo, Ningmu Zou · OpenReview

Abstract

Unsupervised image anomaly detection (UAD) is critical for industrial and medical applications but faces significant challenges in federated learning (FL) environments due to data privacy concerns and distribution biases. Traditional FL methods struggle with the limited class diversity of one-class classification and the skewness of intra-class features across different clients. This article proposes FedDyMem, an efficient federated learning method that facilitates knowledge sharing through a client's dynamic memory bank instead of model parameters. By utilizing a memory generator and a novel "Memory-Reduce" method based on weighted averages, FedDyMem significantly decreases communication overhead while enhancing privacy. Experiments across six diverse industrial and medical datasets demonstrate that FedDyMem achieves state-of-the-art performance in both anomaly detection and localization.

The Challenge: Anomaly Detection in Federated Settings

Unsupervised Image Anomaly Detection (UAD) typically relies on learning a robust representation of "normal" data to identify outliers. In a Federated Learning context, where data remains decentralized to protect privacy, three primary obstacles arise:

  1. Intra-class Distribution Bias: Normal samples vary significantly between clients (e.g., different product models or imaging hardware), leading to skewed feature distributions.
  2. One-Class Limitations: Standard FL algorithms are designed for multi-class problems. In UAD, each client often only possesses "normal" samples, making it difficult to establish a global decision boundary.
  3. Communication and Privacy Risks: Sharing high-dimensional model weights is bandwidth-intensive and vulnerable to gradient inversion attacks that can reconstruct sensitive raw images.
Overview of the FedDyMem framework addressing intra-class distribution bias and the one-class classification challenge in federated UAD.

The FedDyMem Approach

FedDyMem shifts the federated paradigm from parameter aggregation to dynamic memory sharing. Instead of syncing neural network weights, clients share a compressed representation of their local "normal" feature space.

Workflow and Architecture

The framework consists of a local training phase and a server-side aggregation phase:

  • Local Memory Generation: Each client employs a trainable memory generator and a metric loss to align local features into a high-quality, continuous representation of normalcy.
  • Memory-Reduce: To ensure communication efficiency, a weighted average-based reduction method compresses the local memory bank into a fixed, compact size. This process also acts as a privacy filter by reducing the mutual information between the shared features and the original data.
  • Global Aggregation: The server collects these reduced banks and uses K-means clustering to synthesize a "Global Memory Bank." This global knowledge is then redistributed to clients to refine their local anomaly detection capabilities.
Detailed training and testing workflow of FedDyMem, illustrating the interaction between local clients (memory generation/reduction) and the central server (K-means aggregation).

Experimental Results

The researchers evaluated FedDyMem against eight baseline methods (including FedAvg and FedProx) across 11 public datasets combined into six heterogeneous categories, such as Mixed-PCB-AD and Mixed-Brain-AD.

  • Superior Accuracy: On the MVTec dataset, FedDyMem achieved a 99.24% Image-AUROC, significantly outperforming standard FedAvg (~80%).
  • Precise Localization: The method excels at pixel-level detection, reaching 98.97% Pixel-AUROC on the MPDD dataset.
  • Efficiency and Privacy: The communication payload was reduced to 5.62MB per round—roughly half that of parameter-based methods. Furthermore, adversarial tests showed that FedDyMem is highly resilient to reconstruction attacks, yielding only uninterpretable blurs compared to the recognizable images recovered from traditional FL gradients.

Conclusion

FedDyMem demonstrates that for one-class tasks like anomaly detection, sharing feature distributions via dynamic memory is more effective, efficient, and private than sharing model parameters. By addressing intra-class bias and communication bottlenecks, it provides a robust framework for privacy-preserving quality control and medical diagnostics. Future work aims to extend this framework to architecture-agnostic settings, allowing collaboration between clients using heterogeneous model backbones.

Summary updated

Abstract

Unsupervised image anomaly detection (UAD) has become a critical process in industrial and medical applications, but it faces growing challenges due to increasing concerns over data privacy. The limited class diversity inherent to one-class classification tasks, combined with distribution biases caused by variations in products across and within clients, poses significant challenges for preserving data privacy with federated UAD. Thus, this article proposes an efficient federated learning method with dynamic memory and memory-reduce for unsupervised image anomaly detection, called FedDyMem. Considering all client data belongs to a single class (i.e., normal sample) in UAD and the distribution of intra-class features demonstrates significant skewness, FedDyMem facilitates knowledge sharing between the client and server through the client's dynamic memory bank instead of model parameters. In the local clients, a memory generator and a metric loss are employed to improve the consistency of the feature distribution for normal samples, leveraging the local model to update the memory bank dynamically. For efficient communication, a memory-reduce method based on weighted averages is proposed to significantly decrease the scale of memory banks. On the server, global memory is constructed and distributed to individual clients through k-means aggregation. Experiments conducted on six industrial and medical datasets, comprising a mixture of six products or health screening types derived from eleven public datasets, demonstrate the effectiveness of FedDyMem.
BibTeX
@misc{chen2025feddymem,
  author = {Silin Chen and Kangjian Di and Yichu Xu and Han-Jia Ye and Wenhan Luo and Ningmu Zou},
  title = {{FedDyMem: Efficient Federated Learning with Dynamic Memory and Memory-Reduce for Unsupervised Image Anomaly Detection}},
  year = {2025},
  eprint = {2502.21012},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.21012},
}
Figure