SPEAR++: Scaling Gradient Inversion via Sparsely-Used Dictionary Learning

Alexander Bakarsky, Dimitar I. Dimitrov, Maximilian Baader, Martin Vechev

TL;DR

SPEAR++ drastically scales exact gradient inversion attacks in Federated Learning by framing data recovery as a Sparsely-Used Dictionary Learning problem. By replacing exponential-time combinatorial submatrix sampling with efficient non-convex optimization on a sphere, it successfully breaches batch sizes 10x larger than previous exact attacks while remaining robust to common privacy defenses.

What Problem Does This Paper Address?

Federated Learning (FL) is designed to preserve privacy by keeping training data localized on client devices; clients only share model updates (gradients) with a central server. However, Gradient Inversion Attacks (GIAs) have revealed that an adversary can often reconstruct private user data directly from these shared gradients.

Most state-of-the-art GIAs rely on heuristic optimization, which only yields approximate data reconstructions and lacks formal theoretical guarantees. Recently, an attack called SPEAR proved that exact data recovery is theoretically possible for linear layers utilizing ReLU activations. Unfortunately, SPEAR's practical utility was severely bottlenecked: it relied on a randomized submatrix sampling procedure that scaled exponentially with the client's batch size ($b$), making it computationally intractable for realistic deployment settings. SPEAR++ addresses this critical scalability flaw.

Methods

The authors reframe the search for the data-restoring "disaggregation matrix" $Q$ as a Dictionary Learning problem, leveraging the natural 50% sparsity induced by ReLU activations in the gradient space. Instead of solving an NP-hard $\ell_0$ minimization via combinatorial sampling, SPEAR++ optimizes a continuous surrogate loss over an $\ell_2$ hypersphere.

The authors evaluate multiple surrogate losses, including a smooth LogCosh function ($h_\mu$) and a sparsity-promoting $\ell_1$ loss. To find the local minima representing candidate columns of $Q$, they employ first-order optimization techniques on the sphere, specifically Riemannian Adam (RAdam) and Projected Gradient Descent (PGD).

For smooth surrogates that yield approximate directions, they introduce a scalable "Rounding via Sampling" procedure (Algorithm 1) to snap the results back to exact solutions. Finally, they apply a two-stage greedy filtering process based on a "sparsity matching score" to eliminate false positives and accurately reconstruct the client's private input matrix.

Datasets

The method is evaluated using the standard CIFAR-10 image dataset. The authors simulate a federated environment (FedSGD and FedAvg) using fully-connected ReLU-activated neural networks with three hidden layers of varying widths ($m = 200, 1000, 4000$).

Key Insights and Ideas

  • Optimization Over Combinatorics: The core breakthrough is realizing that the combinatorial bottleneck of exact gradient inversion can be bypassed entirely. Framing the problem as dictionary learning transforms an exponential search into a polynomial-time non-convex optimization problem.
  • The Superiority of $\ell_1$ on the Sphere: While smooth surrogates like LogCosh are common, the non-differentiable $\ell_1$ loss optimized via subgradient descent yields superior experimental performance. Crucially, its local minima coincide exactly with true $\ell_0$ minima, completely eliminating the need for an extra rounding step.
  • The $m/b$ Boundary: The optimization landscape is dictated by the ratio between the network layer width ($m$) and the batch size ($b$). As $b$ increases relative to $m$, the landscape becomes more hostile, introducing spurious local minima that define a practical upper bound for successful data recovery.

Key Results

  • 10x Scaling Breakthrough: SPEAR++ successfully reconstructs batches up to $b = 210$ on a network width of $m = 4000$. In comparison, the original SPEAR algorithm becomes prohibitively slow at a batch size of just $b = 24$.
  • Polynomial Runtime: The attack demonstrates a polynomial runtime relationship with respect to batch size $b$, fundamentally shifting the threat model of exact GIAs.
  • Defense Robustness: The attack effectively bypasses common privacy defenses. It achieves a 88% reconstruction accuracy on gradients defended with Differential Privacy (DP-SGD) noise ($\sigma = 1e-6, b = 150$) and a 92% accuracy against FedAvg aggregation after 15 local epochs ($b = 150$).
  • High-Fidelity Reconstruction: As shown in Figure 1, the reconstructed images are pixel-perfect and visually indistinguishable from the ground truth.
Figure 1: All car images from a successfully reconstructed batch of size b = 210 from CIFAR10 on network with width m = 4000, reconstructed using SPEAR++ with ℓ1 loss and RAdam (top) compared to the ground truth (bottom). As seen, the reconstructions are indistinguishable from the original images by humans.

Limitations and Future Work

  • Width-to-Batch Constraints: The attack's success is strictly bounded by the network width $m$. If a client's batch size exceeds the geometric capacity of the layer width, the optimization landscape degrades, causing the attack to fail.
  • Optimizer Anomalies: Although Riemannian Adam generally outperforms PGD across most configurations (see Table 2), PGD surprisingly yielded higher accuracy at the absolute largest tested batch size ($b = 210, m = 4000$). The authors leave the theoretical investigation of this phenomenon, alongside scaling the attack with more initializations, to future work.
Table 2: Comparison between reconstructions with the ℓ1 loss and different optimizers.

Summary updated

BibTeX
@misc{bakarsky2025spear,
  author = {Alexander Bakarsky and Dimitar I. Dimitrov and Maximilian Baader and Martin Vechev},
  title = {{SPEAR++: Scaling Gradient Inversion via Sparsely-Used Dictionary Learning}},
  year = {2025},
  eprint = {2510.24200},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.24200},
}
Figure