Skip to main content

Stochastic data-free robustness preserving neural network pruning

Project description

PAODING-DL: A Stochastic Data-free Robustness-preserving Neural Network Pruning Solution

Our python package performs pruning progressively and evaluate robustness automatically. The code is written and tested through Microsoft VS Code.

The execution environment of the experiments is summarised as follows:

  • Tensorflow 2.3.0 (Anaconda, tensorflow-gpu version)
  • Python 3.8
  • Ubuntu 20.04 LTS

Instructions

The name of Paoding-DL originates from an ancient Taoism story recorded in book "Zhuang Zi" that was published in 3rd century BC, under the title "Essentials for Nurturing Life" of the "Inner Chapters". "Paoding" is the name of a chief with excellent skill in butchering and cooking.

paoding architecture

Our tool is implemented as a trilogy, containing three API components: Pruner, Sampler and Evaluator.

paoding pruner

The first component, Pruner, servers as the centre of Paoding-DL. Users import model, perform pruning and evaluation, and then save the pruned model through this components. Four methods plus the initiator function are provided in Pruner class.

paoding sampler

The second key element is the Sampler, which manages the sampling strategy (sampling mode and corresponding parameters that to be used to guide pruning) and handles hidden unit pruning operations in an iterative way. Three methods are offered in this class, including one setter, one getter and the method called "nominate" to perform sampling and pruning actions.

paoding evaluator

The third component is the Evaluator. The evaluator is used to assess the robustness of the pruned model against adversarial perturbation. Besides the evaluation methods, several setter and getter functions are provided to fine grain the evaluation configuration. The adversarial method supported in current release is the FGSM (Fast gradient sign method), and more types of attack approaches will be implemented and supported in future release.

Testing and Quick Demo

You may run the test cases given in the package to quicky go through the pruning process. The class "test_prunner" will firstly train a few sample models, then perform pruning in different modes, followed by robustness evaluation for selected pruned models. The entire demonstration may spend more than 10 minutes to finish, depending on the computation power of the machine. Some screenshots below depicts the testing process.

model training

model pruning

model evaluation

Acknowledgment

The implementation of convolutional layer pruning is inspired by Keras-surgeon under MIT License (https://github.com/BenWhetton/keras-surgeon).

The author would also thank GitHub and PyPI for the free hosting service provided.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paoding-dl-1.0.0.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paoding_dl-1.0.0-py2.py3-none-any.whl (68.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file paoding-dl-1.0.0.tar.gz.

File metadata

  • Download URL: paoding-dl-1.0.0.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for paoding-dl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6b2420e689e3fc66f0f0547a213598e3481d3b0d57453c6cea9eb667aab70477
MD5 710df49a7e014980a75ba5bedd59d374
BLAKE2b-256 1d4ba99861a7300c81c2eb82f7f548543797678ecd6776c8416b43fc0f23cc39

See more details on using hashes here.

File details

Details for the file paoding_dl-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: paoding_dl-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 68.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for paoding_dl-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8d2783db40180fde91c1471e20321239aef7fc685b69ef6d401bf623988bab04
MD5 1bbe18c9b689814f54391bf9a37fea60
BLAKE2b-256 60d5aa3dc322c4c94434fb4f2d58ccc78a6f2c073974281c5934d52ec0b8ec27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page