$\mathcal{P}$Torch: Narrowing the Gap Between Projection and Gradient-Based Learning

Jeff Cyuzuzo Jambé, Jan Quan, Panagiotis PatrinosNeurIPS 2026

TL;DR

Almost all of modern deep learning relies on backpropagation and gradient descent, risking "paradigm lock-in" where alternative, non-differentiable learning methods get left behind. This paper introduces $\mathcal{P}$Torch, a framework that reframes neural network training as a geometric feasibility problem—without computing global gradients—by cleverly hijacking PyTorch's native autograd engine. It slashes memory overhead, makes gradient-free training competitive with Adam on shallow networks, and uncovers the mathematical reason why these methods still struggle with deep architectures.

What Problem Does This Paper Address?

Backpropagation is the undisputed engine of deep learning, but it demands two strict conditions: every component in your network must have a tractable gradient, and signals must propagate sequentially via the chain rule.

Projection-based learning (PBL) offers a fascinating, gradient-free escape hatch. Instead of minimizing a global loss function, PBL treats a neural network as a web of interlocking mathematical constraints. Each layer's output must equal a specific transformation of its inputs, and the network's boundaries must match the training data. Training becomes a geometric feasibility problem: finding a point in high-dimensional space where all these constraint sets intersect. You solve this locally at each layer by asking, "What is the minimal adjustment to my weights, inputs, and outputs needed to satisfy my layer's constraint?"—an operation called a projection.

While mathematically elegant, PBL has struggled to gain traction due to three major bottlenecks:

  1. Massive memory bloat: Existing PBL methods duplicate weight and activation variables across batches and output blocks to make projections tractable, forcing consensus among copies later. This blows up memory.
  2. Poor software integration: Previous PBL setups don't map cleanly onto modern deep learning compilers and libraries like PyTorch.
  3. Subpar optimization: Even on simple, shallow networks, PBL falls short of standard optimizers like SGD and Adam, and its performance degrades rapidly as networks get deeper.

Methods

The authors build $\mathcal{P}$Torch by redesigning how projections are computed, stored, and updated:

  • Hijacking autograd via Cyclic Projections: Instead of grouping constraints into two giant sets (as prior Douglas–Rachford methods do), $\mathcal{P}$Torch uses cyclic projections, projecting onto individual layer constraints sequentially from output to input. For any variable $x$ and constraint set $C$, moving to the projection $\Pi_C(x)$ is algebraically identical to subtracting the projection residual: $x - (x - \Pi_C(x))$. By writing this local residual directly into PyTorch's .grad attribute during a backward graph traversal, a standard SGD step with a learning rate of 1 executes exact cyclic projections natively inside PyTorch!
  • Fused Projections: To eliminate memory bloat in linear and convolutional (bilinear) layers, the authors derive a mathematical shortcut. Rather than explicitly materializing a massive 3D tensor of duplicated weights for every sample in a batch, they reduce the local Euclidean ($\ell_2$) projection to solving for two scalar coefficients per sample/row via Newton's method. They fuse the projection and the cross-batch averaging (consensus) step into compact matrix multiplications.
  • Nonlinear Relaxation: Because Euclidean projection residuals act like local incremental gradients, $\mathcal{P}$Torch feeds weight residuals directly into battle-tested first-order optimizers like Adam or Muon instead of taking naive unit steps, while relaxing strict output interpolation using a proximal loss step.
The base PTorch algorithm combining fused projections, hidden-state updates, and optimizer-driven nonlinear relaxation.
  • $\ell_\infty$ and Hybrid Geometries: Inspired by Adam's theoretical ties to the $\ell_\infty$ norm, the authors derive a fast, sort-free Newton solver for $\ell_\infty$ projections. Because $\ell_\infty$ projections can't be memory-fused like $\ell_2$ projections, $\mathcal{P}$Torch supports a hybrid mode: memory-lean $\ell_2$ layers for the network backbone, and high-accuracy $\ell_\infty$ layers for the classification head.

Datasets

The authors evaluate $\mathcal{P}$Torch on standard image classification benchmarks—MNIST and CIFAR-10—alongside a synthetic identity-mapping task ($f(x) = x$ on 32-dimensional i.i.d. Gaussian inputs) designed to isolate how learning signals behave across network depth. No new datasets are introduced.

Key Insights and Ideas

  • PBL is secretly incremental gradient descent (in $\ell_2$): The realization that a Euclidean projection residual $x - \Pi_C(x)$ is the exact gradient of the squared distance to constraint set $C$ bridges two worlds. It explains why plugging Adam or Muon into a "gradient-free" projection framework works so remarkably well, and lets PBL piggyback on decades of PyTorch engineering.
  • The "Vanishing Target" Theorem: Why does PBL fail on deep networks? The authors prove a projection-based cousin of the famous vanishing-gradient problem. In Euclidean space, as the target adjustment signal propagates backward through Lipschitz-continuous layers (like ReLU or linear layers), it strictly contracts at every step by at least a factor of $\frac{L_i}{\sqrt{1 + L_i^2}} < 1$. This causes exponential signal decay with depth. Crucially, standard ResNet-style skip connections don't fix this—adding a residual path increases the Lipschitz constant $L_i$ by at most 1, leaving the fraction strictly less than 1!

Key Results

  • Competitive on Shallow Nets: On a 1-hidden-layer ReLU MLP (1024 units), $\mathcal{P}$Torch and $\mathcal{P}$Torch ($\ell_\infty$) match or surpass standard gradient-based PyTorch (trained with Adam) on both MNIST (~97–98% validation accuracy) and CIFAR-10 (~50%+ validation accuracy), substantially outperforming the prior JAX-based PBL library, PJAX.
  • Massive Memory Savings: On convolutional networks, $\mathcal{P}$Torch's fused projections drastically cut peak memory compared to PJAX—using 17x less memory on small $3\times3$ (16-filter) conv layers, scaling up to 101x less memory on $9\times9$ (128-filter) layers, and continuing to run on $11\times11$ (256-filter) layers where PJAX crashes out of memory on an 80 GB GPU.
  • Empirical Proof of Vanishing Targets: On the Gaussian identity task, the target signal magnitude decays exponentially, hitting machine precision ($10^{-10}$) just three layers back from the output. Consequently, on 8-layer MLPs and an 8-layer ResNet-inspired CNN on CIFAR-10, $\mathcal{P}$Torch trails significantly behind standard backpropagation (~30–35% vs. ~50% on the deep MLP; ~55% vs. ~78% on ResNet-8).

Limitations and Future Work

The elephant in the room is depth: until the vanishing-target problem is solved, PBL cannot scale to deep modern architectures. As the authors note, PBL awaits its own equivalents of He initialization, batch normalization, or effective skip connections. Furthermore, $\mathcal{P}$Torch's sequential graph traversal trades away the layer-wise parallelization that originally motivated some PBL research. Finally, the memory-saving fused projections only work for Euclidean cyclic projections—extending them to $\ell_\infty$ geometries, Douglas–Rachford splitting, and broader layer architectures remains an open challenge.

Summary updated

Abstract

Projection-based learning offers a gradient-free alternative to the conventional gradient-based approach, but the paradigm suffers from high memory costs, poor scaling with depth, and limited integration with modern deep learning infrastructure. We introduce $\mathcal{P}$Torch, a projection-based framework built directly on top of Torch's \texttt{autograd} engine that improves performance through fused projections and nonlinear relaxation, reducing the memory cost and making projection-based learning competitive with gradient-based baselines on shallow networks for MNIST and CIFAR-10. Lastly, we prove a vanishing-target theorem showing a layer-wise learning signal decays with depth, providing a projection-based analog of the vanishing-gradient problem and clarifying one of the central barriers to scaling these methods. $\mathcal{P}$Torch is available at https://github.com/cyuzuzo-j/PTorch.
BibTeX
@inproceedings{jambe2026mathcal,
  author = {Jeff Cyuzuzo Jambé and Jan Quan and Panagiotis Patrinos},
  title = {{$\textbackslash\{\}mathcal\{P\}$Torch: Narrowing the Gap Between Projection and Gradient-Based Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=Kb0emfT0QB},
}
Figure