Skip to main content

DiffAbs

DiffAbs is a PyTorch implementation of multiple abstract domains that can be used in certifying or reasoning neural networks. Implemented purely using PyTorch, it is differentiable and supports GPU by default, thus amenable for safety/robustness driven training on abstract domains.

Currently, the following abstract domains are implemented:

Domain notes

DeepPoly ReLU heuristics:

  • A variant of the original DeepPoly domain is implemented where the ReLU approximation is not heuristically choosing between two choices (either picking y = x or y = 0 as the new upper bound). Right now it is fixed to choosing y = 0, because there was Galois connection violation observed if this heuristic is enabled. Basically, it is observed in experiment that a smaller abstraction may unexpectedly incur larger safety distance than its containing larger abstraction.

Supported systems

Although it is currently tested on Mac OS X 10.15 and Ubuntu 16.04 with Python 3.7 and PyTorch 1.5, it should generalize to other platforms and older PyTorch (perhaps ≥ v1.0) smoothly.

However, Python ≤ 3.6 may be incompatible. Because type annotations are specified everywhere and the type annotation of self class is only supported by __future__.annotations in Python 3.7. If using Python 3.6, this needs to use 'type string' instead.

Installation

In your virtual environment, either install directly from this repository by

git clone git@github.com:XuankangLin/DiffAbs.git
cd DiffAbs
pip install -e .

or directly install from PyPI:

pip install diffabs

Testing

Test cases for individual abstract domains are under the tests/ directory and can be run using command

pytest

Note that torchvision is needed to run the tests for conv/maxpool layers.

License

The project is available open source under the terms of MIT License.

Release files for diffabs 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diffabs 0.1
File Size Uploaded
diffabs-0.1.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diffabs 0.1
File Interpreter ABI Platform
diffabs-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 44.7 kB

Release files / diffabs-0.1.tar.gz

Download URL diffabs-0.1.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fd79b15f9a7f6f03f87ce11067f7336f06332b8fcb5adc08a2c03088f633db5e
BLAKE2b-256 checksum
How to use checksums
b0f16754e60584e730009e6b64a7b68daae3e85200777fbc45ecbac3135f789f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

Release files / diffabs-0.1-py3-none-any.whl

Download URL diffabs-0.1-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
618ebb1cd43514ab3efe88aa2a56e70500a969c39bbc4d92327ce8990ad95132
BLAKE2b-256 checksum
How to use checksums
4331aac9c2e5904864d9c3b0d44af21f3476f4e054c205dc47e4ac1b72a2fc00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page