Factorized Gradients for Scalable Highly-expressive Parametric Diffeomorphisms

Amit Aflalo, Eran Treister, Chaim Baskin, Oren Freifeld

TL;DR

Researchers have developed FG-CPAB, a new mathematical formulation that speeds up complex 3D image warping (diffeomorphisms) by up to four orders of magnitude. By decoupling the physics of the warp from the underlying parameters, they’ve made high-resolution, topology-preserving deformations practical for real-world medical imaging and deep learning for the first time.

What Problem Does This Paper Address?

In fields like medical imaging and computer vision, we often need to "warp" one image to match another—a process called registration. To ensure these warps are physically realistic (no tearing or folding), we use diffeomorphisms.

A popular way to do this is using CPAB (Continuous Piecewise-Affine Based) transformations. CPAB divides a 2D or 3D space into a grid of cells (like triangles or tetrahedra) and defines a velocity field within each. While CPAB is mathematically elegant and compact, it has a massive scaling problem: as you make the grid finer to capture more detail, the math becomes prohibitively slow and memory-intensive. Specifically, the gradient computation (needed for training) couples the number of points, the time steps of the warp, and the number of parameters together in a way that chokes even the most powerful GPUs.

Methods

The authors introduce FG-CPAB, which stands for "Factorized-Gradient CPAB." Their core innovation is a mathematical "factorization" that separates the trajectory integration (the "warping" part) from the parameter-space projection (the "learning" part).

  • Gradient Factorization: Instead of tracking how every single parameter affects every point at every step of the warp, they accumulate "cell-local geometric moments." These are low-dimensional statistics that are independent of the total number of parameters. The final gradients are then recovered in a single, efficient step at the end.
  • Complexity Reduction: This shifts the computational cost from a multiplicative $O(dTN)$ to an additive $O(TN + dC)$, where $d$ is the parameter count, $T$ is time steps, $N$ is points, and $C$ is the number of cells.
  • Segmented Checkpointing: To save memory, they don't store the entire warp trajectory. Instead, they store "checkpoints" and re-calculate small segments on the fly during the backward pass.
  • Sparse Basis Formulation: They exploit the fact that each cell in the grid only depends on its immediate neighbors, allowing them to use sparse matrix math to further slash memory usage.

Datasets

The authors evaluated FG-CPAB across several benchmarks:

  • IXI Brain MRI Dataset: A standard benchmark for 3D medical image registration involving 576 MRI volumes.
  • Synthetic 2D/3D "Blob" Benchmarks: Used to test optimization stability and raw computational scaling.
  • Reaction-Diffusion PDE Data: Used to test the method's effectiveness as a "geometry code" for neural operator learning (modeling physical systems).

Key Insights and Ideas

  • Decoupling is the "Aha!" Moment: By realizing that the "physics" of the warp within a cell can be summarized without knowing the global parameters, they removed the primary bottleneck that has held CPAB back for a decade.
  • Implicit Regularization: Because CPAB uses a structured grid rather than per-pixel parameters, it acts as a natural "smoother." This helps it converge to better solutions faster than "dense" methods, which often produce messy, unrealistic warps.
  • Composition for Complexity: While a single CPAB warp uses a "stationary" velocity field (the wind blows the same way the whole time), the authors show that "stacking" multiple CPAB warps allows them to model highly complex, non-stationary movements, like two objects crossing paths.
Performance scaling comparison in 2D. Note how the standard implementation (red) fails at higher resolutions, while FG-CPAB (blue) remains efficient.

Key Results

The performance gains are staggering, particularly in the gradient computation phase:

  • Speedup: In 2D, FG-CPAB is up to 10,463× faster at computing gradients than the previous standard implementation (libcpab). In 3D, it achieves a 4,477× speedup.
  • Memory Efficiency: It uses over 500× less peak GPU memory in 2D and 180× less in 3D.
  • Registration Accuracy: On the IXI brain dataset, FG-CPAB achieved a Dice score (a measure of overlap) of 0.760 in just 5 seconds per volume pair, outperforming many complex deep-learning models that require hours of pre-training.
Qualitative comparison showing that CPAB (center) achieves much lower error than a dense SVF baseline (right) under the same optimization budget.

Limitations and Future Work

  • The Curse of Dimensionality: While the method scales beautifully in 2D and 3D, the number of cells still grows exponentially with the spatial dimension. Applying this to 4D or higher-dimensional data would require new tricks, like "separable" or "low-rank" velocity fields.
  • Stationary Fields: A single CPAB transformation is still limited by its stationary nature. While composition (stacking) solves this, it adds more parameters to manage.
  • Future Directions: The authors suggest that this efficient "geometry code" could be a powerful new primitive for generative modeling (like Dalle-3 but for 3D shapes) and large-scale physical simulations.

Summary updated

Abstract

Diffeomorphisms provide a flexible, topology-preserving mathematical tool for modeling complex spatial or temporal deformations and are used in various scientific fields. However, making these deformations simultaneously highly expressive and computationally efficient remains challenging. Continuous Piecewise-Affine Based (CPAB) transformations (Freifeld et al., ICCV 2015; IEEE TPAMI 2017) offer an attractive solution by parameterizing a family of diffeomorphisms via continuous velocity fields that are piecewise affine with respect to a chosen tessellation of the domain. Importantly, $d=\dim(θ)$, the dimension of the parameter vector $θ$, depends on the fineness of the tessellation rather than on the data resolution. Despite this compact parameterization, CPAB optimization has long been hindered by the tight coupling between trajectory integration and gradient computation with respect to $θ$. We introduce FG-CPAB, a factorized-gradient formulation for scalable CPAB transformations. By separating integration from parameter-space projection, our method reduces gradient computation complexity from $\mathcal{O}(dTN)$ to $\mathcal{O}(TN+dC)$, where $T$ is the number of integration steps, $N$ is the number of transformed points, and $C$ is the number of tessellation cells. This reformulation yields speedups of up to four orders of magnitude (e.g., $\approx 10^4\times$ in 2D), substantial memory savings (e.g., $\approx 500\times$ reduction in peak GPU memory usage in 2D), and dramatically higher expressiveness. This makes fine-tessellation CPAB practical in 2D and 3D for the first time, enabling highly expressive parametric diffeomorphisms.
BibTeX
@inproceedings{aflalo2026factorized,
  author = {Amit Aflalo and Eran Treister and Chaim Baskin and Oren Freifeld},
  title = {{Factorized Gradients for Scalable Highly-expressive Parametric Diffeomorphisms}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=tTrgBMBN77},
}
Figure