NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Approximating Lipschitz continuous functions with GroupSort neural networks

Ugo Tanielian, Gérard Biau

Introduction

In safety-critical machine learning and generative modeling (such as Wasserstein GANs), it is often necessary to enforce a Lipschitz constraint on neural networks. A function is $L$-Lipschitz if its output changes by at most $L$ times the change in its input. While this constraint ensures stability and robustness against adversarial attacks, standard ReLU-based architectures suffer from a significant loss in expressive power when their weights are constrained to satisfy such limits. For instance, a weight-constrained ReLU network cannot represent a simple absolute value function.

This paper explores GroupSort neural networks as a powerful alternative. By replacing the standard ReLU activation with a sorting-based mechanism, these networks maintain high expressivity even under strict Lipschitz constraints.

The GroupSort Architecture

The core innovation is the GroupSort activation function. Instead of applying a threshold like ReLU, GroupSort partitions the input into groups of size $k$ and sorts the elements within each group in descending order.

To ensure the entire network remains 1-Lipschitz, the authors constrain the weights (specifically, the 2-norm of rows or columns is $\le 1$). Because sorting is a sequence of max and min operations—which are themselves 1-Lipschitz—the resulting architecture naturally preserves the gradient norm. This prevents the "gradient dying" problem often seen in constrained ReLU networks.

Theoretical Foundations and the "Grouping Size" Lever

A primary contribution of this work is the proof that GroupSort networks are universal approximators for Lipschitz continuous functions. Specifically, the authors demonstrate that a GroupSort network with a grouping size of $k=2$ can represent any Lipschitz continuous piecewise linear (PWL) function.

Furthermore, the authors identify the grouping size $k$ as a critical hyperparameter for controlling expressive power. They prove that by increasing $k$ proportionally to $1/\epsilon$ (where $\epsilon$ is the target error), any Lipschitz function can be approximated using a network of constant depth (depth 3), regardless of the required precision.

The impact of grouping size on approximation quality. Increasing the grouping size significantly reduces the uniform norm error and increases the number of linear regions, enhancing the network's capacity.

Empirical Results

The theoretical findings are supported by several synthetic experiments, including 1D regression and Wasserstein distance estimation.

Depth and Approximation

Experiments on piecewise linear reconstruction show that increasing network depth significantly improves approximation quality. As shown in the figures below, deeper networks achieve lower uniform norm errors and maintain a Lipschitz constant closer to the theoretical limit of 1, whereas shallower networks struggle to capture complex oscillations.

Approximation performance and Lipschitz constant stability as a function of network depth. Deeper networks (high q) provide tighter fits to target functions while preserving the gradient norm.

Robustness to Noise

In noisy environments, the inherent Lipschitz constraint of GroupSort networks acts as a natural regularizer. In a sine-wave regression task, GroupSort networks outperformed unconstrained ReLU networks by avoiding overfitting. While the ReLU networks produced erratic outputs with high Lipschitz constants (up to 2.7), the GroupSort models remained stable and achieved lower overall error.

Wasserstein Distance Estimation

In tasks simulating WGAN discriminators, deeper GroupSort networks (depth 5) provided a much tighter approximation of the 1-Wasserstein distance between Gaussian mixtures compared to shallower architectures, demonstrating their utility in practical generative modeling scenarios.

Conclusion and Future Work

GroupSort neural networks provide a mathematically rigorous and empirically robust framework for Lipschitz-constrained learning. While they offer superior expressivity and gradient preservation compared to ReLU, they introduce higher computational costs due to the sorting operation. Future research is needed to mitigate the curse of dimensionality in high-dimensional settings and to evaluate these architectures on large-scale datasets like ImageNet.

Summary updated

BibTeX
@inproceedings{tanielian2021approximating,
  author = {Ugo Tanielian and Gérard Biau},
  title = {{Approximating Lipschitz continuous functions with GroupSort neural networks}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2021},
}
Figure