GithubHelp home page GithubHelp logo

muskanmahajan37 / cryptanalytic-model-extraction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google-research/cryptanalytic-model-extraction

0.0 0.0 0.0 44 KB

License: Apache License 2.0

Python 100.00%

cryptanalytic-model-extraction's Introduction

CRYPTANALYTIC EXTRACTION OF NEURAL NETWORK MODELS

This repository contains an implementation of the model extraction attack in our CRYPTO'20 paper

Cryptanalytic Extraction of Neural Network Models
https://arxiv.org/abs/2003.04884
Nicholas Carlini, Matthew Jagielski, Ilya Mironov


INSTALLING

To get started you will need to install some dependencies. It should suffice to run

> pip install numpy scipy jax jaxlib matplotlib networkx

Sometimes JaX (or, more correctly, XLA) puts up a fight during the install,
but if the above works then everything should run properly.


EXTRACTING EXAMPLE MODELS

First, generate a model that we will extract by running

> python3 train_models.py 10-15-15-1 42

and then extract it with

> python3 extract.py 10-15-15-1 42

this should be quick to extract and then check the quality of this extraction with

> python3 check_solution_svd.py 10-15-15-1

or if you have MILP solver installed you can run

> python3 check_solution_milp.py 10-15-15-1

and then running the solver on /tmp/test.mod

By default, the code is set up so that it won't cheat and look at the weights of the
actual neural network we're extracting (and will throw ugly errors if we try).
Some logging looks better if we're allowed to cheat though (e.g., to catch errors
earlier in the process).

To enable this, set CHEATING=True in src/global_vars.py.


EXTRACTING YOUR OWN MODELS

The code can currently extract only fully-connected neural networks.

To extract a model, save it as a numpy array in the format [weights, biases]. For
example, a 20-10-1 network could be saved to models/UID_20-10-1.npy
[[np.random.normal(size=(20,10)), np.random.normal(size=(10, 1))], [np.zeros((10,)), np.zeros((1,))]]

and then run

> python extract.py UID 20-10-1


CITING THIS WORK

If you find this code useful you can cite

@article{carlini2020cryptanalytic,
  title={Cryptanalytic Extraction of Neural Network Models},
  author={Carlini, Nicholas and Jagielski, Matthew and Mironov, Ilya},
  booktitle={Annual International Cryptology Conference},
  year={2020}
}

cryptanalytic-model-extraction's People

Contributors

carlini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.