This repository is the codes for paper "ECLipsE: Efficient Compositional Lipschitz Constant Estimation for Deep Neural Networks" (NeurIPS 2024 paper), providing efficient and tight Lipschitz Estimate for feedforword neural networks (FNNs). ECLipsE.m and ECLipsE_Fast.m are functions for the two algorithms proposed and we can obtain the estimates for the Lipschitz constants (strict and tight upper bound), time used, and the trivial Lipschitz upper bound by directly calling the functions with weights of FNNs. The weights should be in the format of W1,W2,..., etc. and the biases are not needed for our methods. The activation functions for the FNNs need to be slope-restricted in [0,1], which is satisfied by most activation functions.
pip install eclipse-nn- Update the version in
pyproject.toml. - Build distributions:
python -m build- Upload to PyPI:
python -m twine upload dist/*- Create a matching GitHub release/tag.
To reproduce the experiments in paper, we first generate / train FNNs as
- For randomly generated neural networks, run generate_random_weights.py with corresponding depths and widths for FNNs. The weights of FNNs will be stored under datasets/random.
- For neural networks trained on mnist dataset, run training_MNIST.py. The weights of FNNs will be stored under datasets/MNIST.
All the results can be obtained through Lip_estimates.m.
The code under folder ECLipsE_Gen_Local_matlab contains the code for algorithms series ECLipsE-Gen-Local. The algorithms give efficient, scalable and tight local Lipschitz estimates for deep FNN. Paper is accepted to TMLR in 2026.03, and is available at https://arxiv.org/abs/2510.05261.
We also provide implementation in python under the "python" folder for all the algorithms. Users can directly install the package through
pip install eclipse-nn.