TensorFlow/Adversarial: Difference between revisions
From charlesreid1
| Line 37: | Line 37: | ||
* Define a method that evaluates the networks as-is and prints the percent losses | * Define a method that evaluates the networks as-is and prints the percent losses | ||
* Define a method that trains the network for a specified number of iterations, stopping early if the network reaches its target losses | * Define a method that trains the network for a specified number of iterations, stopping early if the network reaches its target losses | ||
* Define a method that calls the training function (above), then re-trains Eve several more times | * Define a method that calls the training function (above), then re-trains Eve several more times from scratch | ||
==Adversarial Text== | ==Adversarial Text== | ||
Revision as of 17:39, 26 October 2017
Adversarial Neural Networks
Adversarial neural networks use an architecture consisting of two separate neural networks - one network attempts to learn how to accomplish a task, and another network attempts to differentiate between the output of the first network and the "real" output.
TensorFlow Adversarial Examples
Adversarial Crypto
This adversarial crypto neural network attempts to learn how to protect communications using the adversarial architecture.
Paper: "Learning to Protect Communications with Adversarial Neural Cryptography"
Link to paper: https://arxiv.org/abs/1610.06918
Link to code: https://github.com/tensorflow/models/tree/master/research/adversarial_crypto
Part of the tensorflow models repository (https://github.com/tensorflow/models/tree/master/research).
Running
To train the network:
$ python train_eval.py
The approach used by the training is to train the "defender" network (representing the Alice-Bob channel) until it is sufficiently well-trained, then reset the "attacker" network (representing the eavesdropper Eve) from scratch to give the eavesdropper multiple opportunities to find weaknesses in the cryptosystem.
The Model
We'll step through the code line-by-line. Here's the link to the code: https://github.com/tensorflow/models/blob/master/research/adversarial_crypto/train_eval.py
Full model walkthrough is on the TensorFlow/Adversarial Crypto page.
The rundown is:
- Create an AdversarialCrypto class that holds a training optimizer object for the Bob and Alice networks
- Define a method that evaluates the networks as-is and prints the percent losses
- Define a method that trains the network for a specified number of iterations, stopping early if the network reaches its target losses
- Define a method that calls the training function (above), then re-trains Eve several more times from scratch