·ML Systems & Privacy·3 min read

Privacy-Preserving Federated Learning in Hospital Networks: Mitigating Gradient Inversion Attacks

Sharing raw parameter gradients in multi-hospital federated learning does not guarantee patient privacy: optimization-based gradient inversion can reconstruct diagnostic chest X-rays and volumetric slices. We derive tight Rényi Differential Privacy (RDP) guarantees with adaptive gradient clipping.

The Illusion of Privacy in Vanilla Federated Averaging#

Federated Learning (FL) enables multiple clinical institutions to collaboratively train a shared diagnostic model without centralizing protected health information (PHI). However, transmitting raw parameter gradients ∇θL(fθ(xi),yi)\nabla_\theta \mathcal{L}(f_\theta(x_i), y_i) leaks high-dimensional information about the underlying patient scan xix_i.

x∗=arg⁡min⁡x^(1−⟨∇θL(x^,y^),∇θL(x,y)⟩∥∇θL(x^,y^)∥2 ∥∇θL(x,y)∥2)+αTV RTV(x^)x^* = \arg\min_{\hat{x}} \left( 1 - \frac{\langle \nabla_\theta \mathcal{L}(\hat{x}, \hat{y}), \nabla_\theta \mathcal{L}(x, y) \rangle}{\|\nabla_\theta \mathcal{L}(\hat{x}, \hat{y})\|_2 \, \|\nabla_\theta \mathcal{L}(x, y)\|_2} \right) + \alpha_{\text{TV}} \, \mathcal{R}_{\text{TV}}(\hat{x})
Eq. (2)
Gradient inversion optimization objective matching cosine direction of observed clinical gradients under a Total Variation image prior.

Differentially Private Stochastic Gradient Descent (DP-SGD)#

To bound reconstruction risk mathematically, each hospital node clips per-example gradients to a maximum ℓ2\ell_2 norm CC before adding isotropic Gaussian noise scaled to σC\sigma C:

src/privacy/dp_federated_step.py
python
import torch

def clip_and_noise_per_sample_gradients(
    per_sample_grads: torch.Tensor,
    max_grad_norm: float = 1.0,
    noise_multiplier: float = 1.15,
) -> torch.Tensor:
    # Compute per-patient L2 norm across flattened parameter dimension
    grad_norms = per_sample_grads.flatten(1).norm(p=2, dim=1, keepdim=True)
    clip_factor = torch.clamp(max_grad_norm / (grad_norms + 1e-6), max=1.0)

    # Bound sensitivity of each individual patient record
    clipped = per_sample_grads * clip_factor.view(-1, *([1] * (per_sample_grads.ndim - 1)))
    aggregated = clipped.sum(dim=0)

    noise = torch.randn_like(aggregated) * (noise_multiplier * max_grad_norm)
    return (aggregated + noise) / per_sample_grads.size(0)
Per-sample L2 sensitivity bounding and Gaussian mechanism injection prior to federated aggregation.