arXiv:2610.34766cs.CVOct 2026

Manuscript Offprint

arXiv:2610.34766

Factorized Gradients for Scalable Highly-expressive Parametric Diffeomorphisms

Amit Aflalo, Eran Treister, Chaim Baskin, Oren Freifeld

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Amit Aflalo 1^{1} Eran Treister 1^{1} Chaim Baskin 2^{2} Oren Freifeld 1^{1}

1^{1}The Stein Faculty of Computer and Information Science, Ben-Gurion University of the Negev, Israel

2^{2}School of Electrical and Computer Engineering, Ben-Gurion University of the Negev, Israel

(a) Forward

Figure

(b) Gradient computation

Tessellation size (Ntess)(N_{\mathrm{tess}})

Tessellation size (Ntess)(N_{\mathrm{tess}})

(c) Memory

Tessellation size (Ntess)(N_{\mathrm{tess}})

Figure 1: Quantitative comparison, in 2D, of performance scaling with tessellation size ( NtessN_{tess}), between the proposed method, called FG-CPAB, and libcpab [10], the standard implementation of CPAB diffeomorphisms [13]. The evaluation was performed on a single RTX A6000 GPU with 125,000 2D points and a batch size of 16. (a) Forward pass latency. (b) Gradient computation latency. (c) Peak GPU memory allocation. In 2D, the domain is partitioned into C=4Ntess2C = 4N_{tess}^2 triangular cells. Notably, the standard implementation does not support Ntess>12N_{tess} > 12, whereas ours scales efficiently.

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 [13, 14] offer an attractive solution by parameterizing a family of diffeomorphisms via continuous velocity fields that are piecewise affine w.r.t. a chosen tessellation of the domain. Importantly, d=dim⁡(θ)d = \dim(\theta), the dimension of the parameter vector θ\theta, 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 w.r.t. θ\theta. 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 O(dTN)\mathcal{O}(dTN) to O(TN+dC)\mathcal{O}(TN + dC), where TT is the number of integration steps, NN is the number of transformed points, and CC is the number of tessellation cells. This reformulation yields speedups of up to four orders of magnitude (e.g., ≈104×\approx 10^4 \times in 2D), substantial memory savings (e.g., ≈500×\approx 500 \times reduction in peak GPU memory usage in 2D), and dramatically higher expressiveness. This makes, for the first time, fine-tessellation CPAB practical in 2D and 3D, enabling highly expressive parametric diffeomorphisms. For code and resources, see our project page.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

1 Introduction

A diffeomorphism is a differentiable invertible function whose inverse is also differentiable. Diffeomorphisms are a natural choice in spatial modeling tasks that require smooth, invertible, and topology-preserving deformations. They are widely used in applications such as registration, spatial alignment, and geometric warping, where folding, tearing, or self-intersection would result in geometrically invalid deformations. The standard way to construct such transformations is via integration of either a stationary velocity field (SVF) [2] or a time-dependent velocity field as in Large Deformation Diffeomorphic Metric Mapping (LDDMM) [4]. However, in practice, such methods often rely on a dense-grid discretization of the spatial domain. As a result, the number of parameters controlling the diffeomorphisms grows directly with the resolution of the domain (e.g., with the number of pixels in 2D). In modern 2D and especially 3D settings, this leads to high memory use, slow optimization, and difficult optimization landscapes.

Continuous Piecewise-Affine Based (CPAB) transformations, introduced by Freifeld et al. [13, 14], offer a compelling alternative. Instead of a dense-grid discretization, this approach tessellates the domain into cells (e.g., triangles in the 2D case) and constrains the velocity field to be a continuous piecewise-affine (CPA) function. A CPAB transformation is, by definition [13], obtained by integrating a CPA velocity field. Under a mild, easily enforced regularity condition, a CPAB transformation is a diffeomorphism 1^{1}. A key point is that the number of parameters controlling a CPAB transformation depends on the tessellation, not the data resolution, thereby decoupling model complexity from data resolution. These transformations provide a compact low-dimensional parameterization while still capturing rich nonlinear deformations and have been used in diverse deep learning settings, including 1D applications such as time-series alignment and trainable activation functions [22, 28, 34, 38, 7, 26, 29, 23, 33], parameter-efficient multi-task fine-tuning [27], and 2D vision and generative modeling tasks [19, 11, 31, 32, 35, 37, 18].

Despite this compact parameterization, CPAB transformations remained hard to scale in practice. The bottleneck lies in computing the loss gradient, ∇θL\nabla_{\theta} \mathcal{L}, which conventionally requires propagating parameter sensitivities through the transformation x↦Φθ(x)x \mapsto \Phi^{\theta}(x). In the standard formulation, sensitivities w.r.t. all d=dim⁡(θ)d = \dim(\theta) parameters are propagated through all TT integration steps for each of the NN spatial points, yielding a backward complexity of O(dTN)\mathcal{O}(dTN). This tight coupling between parameter dimension and trajectory integration makes optimization prohibitively expensive once tessellations become fine or spatial inputs become large. Consequently, existing CPAB implementations are often limited to coarse tessellations, which restricts practical expressiveness. Moreover, even with coarse tessellations in 2D, CPAB optimization is too slow for most practical applications. In 3D, the problem worsens, and scalable CPAB optimization has remained largely out of reach, despite the wide use of diffeomorphisms in this setting [5, 39, 42, 16, 8, 36, 17, 25, 6].

In this paper, we address this bottleneck with FG-CPAB, a factorized-gradient formulation that separates trajectory integration from parameter-space projection. Instead of propagating per-parameter sensitivities during integration, we perform a single adjoint sweep that accumulates low-dimensional cell-wise geometric statistics and recovers all parameter gradients through one projection onto the CPA basis. This reduces the backward complexity from O(dTN)\mathcal{O}(dTN) to O(TN+dC)\mathcal{O}(TN + dC), where C is the number of tessellation cells. We further introduce a sparse basis formulation that reduces memory use and allows the final projection step to fully exploit basis sparsity, thereby realizing the full computational benefit of the factorized gradients in practice.

Combined with optimized GPU kernels, the resulting method makes CPAB practical at scales that were previously inaccessible. For example, in 2D, our implementation achieves up to 75×75\times faster forward passes, 104×10^{4}\times faster backward passes, and over 500×500\times lower peak memory compared with the standard implementation [10]. Such gains enable efficient optimization of fine-tessellation CPAB diffeomorphisms in both 2D and 3D, and make CPAB competitive as a modern primitive for large-scale nonrigid spatial modeling. To summarize, our main contributions are:

• FG-CPAB. We introduce a gradient-factorized backward pass based on discrete-adjoint moment accumulation. Unlike standard adjoint methods, which still carry parameter dependence through

1^{1}CPAB transformations are homeomorphisms and even bi-Lipschitz functions (hence also almost-everywhere differentiable with an almost-everywhere differentiable inverse). Typically, but technically not always, they are also diffeomorphisms. For the sufficient regularity condition ensuring that a CPAB transformation is a diffeomorphism, see [1].

the backward integration, our method exploits the CPA basis structure to accumulate parameter-independent cell-wise moments and recover gradients only in a final sparse projection step.

• An efficient implementation. We combine factorized gradients, optimized GPU kernels, and a sparse basis construction to achieve large runtime and memory gains in practice.

• Scalable diffeomorphic optimization in 2D and 3D. We demonstrate that the resulting formulation makes fine-tessellation CPAB practical for spatial modeling and competitive with other diffeomorphic primitives in both 2D and 3D.

References (37)