From charlesreid1

Adversarial Crypto Neural Network

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

License

Obligatory license info:

# Copyright 2016 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

Some info about the network:

  • There are actually 3 neural networks involved: Alice, Bob, and Eve
  • Alice takes inputs in_m (message), in_k (key) and outputs the ciphertext
  • Bob takes inputs in_k (key), ciphertext and attempts to output the plaintext
  • Even takes input ciphertext (no key) and also attempts to output the plaintext

The file starts with imports/declarations to be compatible with Python 3:

# TensorFlow Python 3 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import signal
import sys
from six.moves import xrange  # pylint: disable=redefined-builtin
import tensorflow as tf

Input Argument Flags and Parameters

Hyperparameter flags can be set on the command line:

flags = tf.app.flags
flags.DEFINE_float('learning_rate', 0.0008, 'Constant learning rate')
flags.DEFINE_integer('batch_size', 4096, 'Batch size')
FLAGS = flags.FLAGS

The FLAGS stuff does not seem to be defined anywhere in the documentation, so the usage is not clear here. But, as an author on TF project states here, it is intended to make demos more convenient, and essentially wraps argparse.

Also see TensorFlow/Command Line Args.

More parameter definitions follow:

# Input and output configuration.
TEXT_SIZE = 16
KEY_SIZE = 16

# Training parameters.
ITERS_PER_ACTOR = 1
EVE_MULTIPLIER = 2  # Train Eve 2x for every step of Alice/Bob
# Train until either max loops or Alice/Bob "good enough":
MAX_TRAINING_LOOPS = 850000
BOB_LOSS_THRESH = 0.02  # Exit when Bob loss < 0.02 and Eve > 7.7 bits
EVE_LOSS_THRESH = 7.7

# Logging and evaluation.
PRINT_EVERY = 200  # In training, log every 200 steps.
EVE_EXTRA_ROUNDS = 2000  # At end, train eve a bit more.
RETRAIN_EVE_ITERS = 10000  # Retrain eve up to ITERS*LOOPS times.
RETRAIN_EVE_LOOPS = 25  # With an evaluation each loop
NUMBER_OF_EVE_RESETS = 5  # And do this up to 5 times with a fresh eve.
# Use EVAL_BATCHES samples each time we check accuracy.
EVAL_BATCHES = 1


Batch of Random Booleans

This is a method to define an array of random booleans - this is used to create the message that Alice encrypts, and to define the key that Alice and Bob use to decrypt the message. This is mentioned below, where it is used.


AdversarialCrypto Class

The Adversarial Crypto class defines the set of three neural networks used to do the adversarial network. As part of the training and evaluation process train_and_evaluate(), an instance of this class is created and passed to the evaluation function doeval() in the main body of the code.

What does this class do?

  • Creates the three networks for Alice, Bob, and Eve
  • Creates connections from Alice to Bob and Alice to Eve to pass the correct info to the correct networks
  • Defines the loss function for Eve and for Bob
  • Defines the optimizers that the networks should use
  • Manages the state of each network (i.e., allows you to reset the Eve network)
class AdversarialCrypto(object):
    """Primary model implementation class for Adversarial Neural Crypto.
    This class contains the code for the model itself,
    and when created, plumbs the pathways from Alice to Bob and
    Eve, creates the optimizers and loss functions, etc.
    
    Attributes:
        eve_loss:  Eve's loss function.
        bob_loss:  Bob's loss function.  Different units from eve_loss.
        eve_optimizer:  A tf op that runs Eve's optimizer.
        bob_optimizer:  A tf op that runs Bob's optimizer.
        bob_reconstruction_loss:  Bob's message reconstruction loss,
          which is comparable to eve_loss.
        reset_eve_vars:  Execute this op to completely reset Eve.
    """

What does the constructor do?

  • The constructor creates the Alice, Bob, and Eve model by calling the model() method with the right parameters
  • Creates the optimizer for Bob and for Eve
  • Sets up the loss function for Eve, based on tf.reduce_sum() and optimizer.minimize()
  • Sets up the loss function for Bob, based on tf.reduce_sum()
  def __init__(self):
    in_m, in_k = self.get_message_and_key()
    encrypted = self.model('alice', in_m, in_k)
    decrypted = self.model('bob', encrypted, in_k)
    eve_out = self.model('eve', encrypted, None)

    self.reset_eve_vars = tf.group(
        *[w.initializer for w in tf.get_collection('eve')])

    optimizer = tf.train.AdamOptimizer(learning_rate=FLAGS.learning_rate)

Note that the optimizer is prefixed with tf.train(), meaning the optimizer is part of the training process. When the TensorFlow computation graph is constructed, we call the run() function on it, and we must pass an argument that is a quantity to calculate. If we pass it a training quantity like tf.train.AdamOptimizer(), the graph will perform training. If we pass it a tensor on the graph, it will just run the graph as-is (no adjustment/training) and return the value of that tensor.

We'll see that in a little bit.

    # Eve's goal is to decrypt the entire message:
    eve_bits_wrong = tf.reduce_sum(
        tf.abs((eve_out + 1.0) / 2.0 - (in_m + 1.0) / 2.0), [1])
    self.eve_loss = tf.reduce_sum(eve_bits_wrong)
    self.eve_optimizer = optimizer.minimize(
        self.eve_loss, var_list=tf.get_collection('eve'))

    # Alice and Bob want to be accurate...
    self.bob_bits_wrong = tf.reduce_sum(
        tf.abs((decrypted + 1.0) / 2.0 - (in_m + 1.0) / 2.0), [1])
    # ... and to not let Eve do better than guessing.
    self.bob_reconstruction_loss = tf.reduce_sum(self.bob_bits_wrong)
    bob_eve_error_deviation = tf.abs(float(TEXT_SIZE) / 2.0 - eve_bits_wrong)
    # 7-9 bits wrong is OK too, so we squish the error function a bit.
    # Without doing this, we often tend to hang out at 0.25 / 7.5 error,
    # and it seems bad to have continued, high communication error.
    bob_eve_loss = tf.reduce_sum(
        tf.square(bob_eve_error_deviation) / (TEXT_SIZE / 2)**2)

    # Rescale the losses to [0, 1] per example and combine.
    self.bob_loss = (self.bob_reconstruction_loss / TEXT_SIZE + bob_eve_loss)

    self.bob_optimizer = optimizer.minimize(
        self.bob_loss,
        var_list=(tf.get_collection('alice') + tf.get_collection('bob')))

AdversarialCrypto Class - Creation of Neural Network Model

Now, the actual creation of the models for Alice, Bob, and Eve happens in the call to model(). What happens with the method header?

  • We pass in the name of the graph component ('alice', 'bob', or 'eve') to add new model components to
  • We pass in the input message (either the plain text, to Alice, or the ciphertext, to Bob and Eve)
  • We pass in the key (optional); if no key is passed in, the input to the neural network is just the message

Here's the model method definition:

  def model(self, collection, message, key=None):
    """The model for Alice, Bob, and Eve.  If key=None, the first FC layer
    takes only the message as inputs.  Otherwise, it uses both the key
    and the message.
    Args:
      collection:  The graph keys collection to add new vars to.
      message:  The input message to process.
      key:  The input key (if any) to use.
    """

    if key is not None:
      combined_message = tf.concat(axis=1, values=[message, key])
    else:
      combined_message = message

If we pass in both a message and a key, we concatenate the inputs using tf.concat(). Otherwise, the only input is the message.

The next step is to call tf.contrib.framework.arg_scope(). The documentation for this function will loop over each TensorFlow model graph passed to it, and add a @add_arg_scope decorator to it.

In other words, every time we have a fully_connected layer and a conv2d layer, we set them up to be on the specified graph (Alice, Bob, or Eve):

    # Ensure that all variables created are in the specified collection.
    with tf.contrib.framework.arg_scope(
        [tf.contrib.layers.fully_connected, tf.contrib.layers.conv2d],
        variables_collections=[collection]):

Next, we create a fully connected neural network layer. We pass in the message (and optionally the key), give the layer a size (the text length, and optionally the key length), we initialize the bias of the fully-connected layer as all-zero, and do not set an activation function:

    fc = tf.contrib.layers.fully_connected(
          combined_message,
          TEXT_SIZE + KEY_SIZE,
          biases_initializer=tf.constant_initializer(0.0),
          activation_fn=None)

Next, we assemble the layers of the neural network model.

The model architecture we use is:

(Fully Connected) -> (Conv2D) -> (Conv2D) -> (Conv2D) -> (Squeeze)

This performs a sequence of 1D convolutions (expands the message out, and squeezes it back down).

     fc = tf.contrib.layers.fully_connected(
          combined_message,
          TEXT_SIZE + KEY_SIZE,
          biases_initializer=tf.constant_initializer(0.0),
          activation_fn=None)

      # Perform a sequence of 1D convolutions (by expanding the message out to 2D
      # and then squeezing it back down).
      fc = tf.expand_dims(fc, 2)
      # 2,1 -> 1,2
      conv = tf.contrib.layers.conv2d(
          fc, 2, 2, 2, 'SAME', activation_fn=tf.nn.sigmoid)
      # 1,2 -> 1, 2
      conv = tf.contrib.layers.conv2d(
          conv, 2, 1, 1, 'SAME', activation_fn=tf.nn.sigmoid)
      # 1,2 -> 1, 1
      conv = tf.contrib.layers.conv2d(
          conv, 1, 1, 1, 'SAME', activation_fn=tf.nn.tanh)
      conv = tf.squeeze(conv, 2)
      return conv

AdversarialCrypto Class - Creation of Message and Key

In the constructor, the input message and key are generated using a get_message_and_key() method, which in turn calls a batch_of_random_bools() method. This is not complicated, it just constructs a vector of booleans.

Here is the method in the AdversarialCrypto class:

  def get_message_and_key(self):
    """Generate random pseudo-boolean key and message values."""

    batch_size = tf.placeholder_with_default(FLAGS.batch_size, shape=[])

    in_m = batch_of_random_bools(batch_size, TEXT_SIZE)
    in_k = batch_of_random_bools(batch_size, KEY_SIZE)
    return in_m, in_k

and the batch_of_random_bools method that it calls:

def batch_of_random_bools(batch_size, n):
    """Return a batch of random "boolean" numbers.
    Args:
      batch_size:  Batch size dimension of returned tensor.
      n:  number of entries per batch.
    Returns:
      A [batch_size, n] tensor of "boolean" numbers, where each number is
      preresented as -1 or 1.
    """
    
    as_int = tf.random_uniform(
        [batch_size, n], minval=0, maxval=2, dtype=tf.int32)
    expanded_range = (as_int * 2) - 1
    return tf.cast(expanded_range, tf.float32)

This creates a random uniform tensor of 1s and -1s. Here's a quick interactive iPython session to illustrate:

In [1]: import tensorflow as tf

In [2]: tf.InteractiveSession()
2017-10-26 00:24:11.694267: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-26 00:24:11.694303: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-10-26 00:24:11.694313: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-10-26 00:24:11.694321: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Out[2]: <tensorflow.python.client.session.InteractiveSession at 0x11462bba8>

In [3]: as_int = tf.random_uniform([10,2], minval=0, maxval=2, dtype=tf.int32)

In [4]: as_int.eval()
Out[4]:
array([[0, 0],
       [1, 1],
       [0, 0],
       [0, 1],
       [1, 0],
       [0, 0],
       [0, 1],
       [1, 1],
       [0, 0],
       [1, 0]], dtype=int32)

In [5]: expanded_range = (as_int*2)-1

In [6]: expanded_range.eval()
Out[6]:
array([[-1,  1],
       [ 1,  1],
       [-1,  1],
       [ 1, -1],
       [ 1,  1],
       [-1,  1],
       [ 1, -1],
       [-1, -1],
       [-1, -1],
       [ 1, -1]], dtype=int32)


Do Evaluation Method

We now come to the definition of the function doeval() . This function evaluates how good the cryptosystem the Alice/Bob/Eve networks have created are at minimizing Eve's ability to decrypt the message with the ciphertext only and maximizing Bob's ability to decrypt the message with a ciphertext and key.

This method evaluates only, and does not train. It runs the networks on a batch of n messages, computes the percentage of bits lost by Bob and Eve, prints the percentages, and returns them. These values are used to determine when to stop training the networks.

The method header takes a few arguments:

  • The TensorFlow session
  • The AdversarialCrypto class instance
  • The number of iterations that should be run
  • The iteration count to write to the log
def doeval(s, ac, n, itercount):
    """
    Evaluate the current network on n batches of random examples.
    Args:
        s:  The current TensorFlow session
        ac: an instance of the AdversarialCrypto class
        n:  The number of iterations to run.
        itercount: Iteration count label for logging.
    Returns:
        Bob and Eve's loss, as a percent of bits incorrect.
    """

The main role of the doeval function is to run the neural network, and compute the losses that result. The TensorFlow session variable s will contain all three neural networks on its graph, so we can just call s.run() without needing to specify all three graphs.

Link to Session class documentation: https://www.tensorflow.org/api_docs/python/tf/Session

Link to Session.run documentation: https://www.tensorflow.org/api_docs/python/tf/Session#run

The run method is passed a list of loss functions owned by the AdversarialCrypto class - these were the sums of incorrect bits defined above (self.bob_reconstruction_loss = tf.reduce_sum(self.bob_bits_wrong)).

The reduce_sum function simply sums tensor components along a particular axis, thus reducing the dimensionality of the tensor. In this case we are summing the incorrect bits along the "axis" of the message.

Link to reduce_sum documentation: https://www.tensorflow.org/api_docs/python/tf/reduce_sum

When we call s.run(), we can pass a single graph element, or an arbitrarily nested collection containing graph elements at the leaves. The graph element can be an operation, a tensor, a tensor handle, or a string naming a tensor or operation in the graph; in this case, we pass a list of two tf.reduce_sum operations.

Because the s.run() method is passed two values, it will return two values - the corresponding values returned from the two operations. Thus, the variable bl contains the result of the tf.reduce_sum call for Bob's network (the number of incorrect bits from Bob's network), while el contains the result of the tf.reduce_sum call for Eve's network.

    bob_loss_accum = 0
    eve_loss_accum = 0
    for _ in xrange(n):
        bl, el = s.run([ac.bob_reconstruction_loss, ac.eve_loss])
        bob_loss_accum += bl
        eve_loss_accum += el

These error values are set to zero for each batch, and are accumulated across the batch.

At the end of the batch of runs, the loss percentages are computed and returned.

    bob_loss_percent = bob_loss_accum / (n * FLAGS.batch_size)
    eve_loss_percent = eve_loss_accum / (n * FLAGS.batch_size)
    print('%d %.2f %.2f' % (itercount, bob_loss_percent, eve_loss_percent))
    sys.stdout.flush()
    return bob_loss_percent, eve_loss_percent

Training Methods

There are two training methods:

  • train_until_thresh() - trains the network for a specified number of training loops. This method quits early and returns true if the loss function targets are achieved. Otherwise it returns false.
  • train_and_evaluate() - trains the network, then trains Eve for extra rounds. Also resets Eve a specified number of times, giving Eve the chance to re-train and alternative ways to break Alice and Bob's cryptosystem.

Train Until Threshold Reached

The train_until_thresh() method takes a session and an AdversarialCrypto object. It runs for a specified maximum number of training loops. Within each training loop, it trains Bob's network, then trains Eve's network:

def train_until_thresh(s, ac):
  for j in xrange(MAX_TRAINING_LOOPS):
    for _ in xrange(ITERS_PER_ACTOR):
      s.run(ac.bob_optimizer)
    for _ in xrange(ITERS_PER_ACTOR * EVE_MULTIPLIER):
      s.run(ac.eve_optimizer)

It is important to note here that bob_optimizer and eve_optimizer are both calling minimize() on the same AdamOptimizer object, but passing different loss functions to it. From above, the optimizer was defined as:

optimizer = tf.train.AdamOptimizer(learning_rate=FLAGS.learning_rate)

and bob_optimizer calls optimizer.minimize() on the sum of incorrect bits from Bob's network, while eve_optimizer calls optimizer.minimize() on the sum of incorrect bits from Eve's network.

Next, every M steps, the evaluation method is called. This prints progress, but also checks if the target losses have been achieved. If they have, the network returns true, ending the training early.

    if j % PRINT_EVERY == 0:
      bob_avg_loss, eve_avg_loss = doeval(s, ac, EVAL_BATCHES, j)
      if (bob_avg_loss < BOB_LOSS_THRESH and eve_avg_loss > EVE_LOSS_THRESH):
        print('Target losses achieved.')
        return True
  return False

Train and Evaluate

The train and evaluate method creates the graph and starts a TensorFlow session. It runs the graph with the global variables initializer.

def train_and_evaluate():
  """Run the full training and evaluation loop."""

  ac = AdversarialCrypto()
  init = tf.global_variables_initializer()

  with tf.Session() as s:
    s.run(init)
    print('# Batch size: ', FLAGS.batch_size)
    print('# Iter Bob_Recon_Error Eve_Recon_Error')

The next if statement takes a very long time, because it steps into the train until threshold is reached function defined above, which can take up to 30 minutes. If the target threshold is never reached, it skips the extra rounds of training for the Eve network. Otherwise, it continues to train Eve for a specified number of rounds (2,000 extra iterations) to give it an extra edge, and evaluates the cryptosystem.

    if train_until_thresh(s, ac):
      for _ in xrange(EVE_EXTRA_ROUNDS):
        s.run(ac.eve_optimizer)
      print('Loss after eve extra training:')
      doeval(s, ac, EVAL_BATCHES * 2, 0)

It then goes through a phase of Eve "resets", in which it re-initializes the Eve network and retrains it for a specified number of loops, to see if there is a global approach to breaking the cryptosystem that the previous trained Eve network was missing because it was trying to locally optimize. Here, the session's run() method is called with reset_eve_vars passed in; this is similar to the call to run() above in which the initializer was passed in, except it only initializes variables that are part of the Eve graph. From the AdversarialCrypto constructor:

    self.reset_eve_vars = tf.group(*[w.initializer for w in tf.get_collection('eve')])

Once the Eve variables are reset, the network is re-trained using the Eve optimizer for the specified number of batches, and the cryptosystem is evaluated:

      for _ in xrange(NUMBER_OF_EVE_RESETS):
        print('Resetting Eve')
        s.run(ac.reset_eve_vars)
        eve_counter = 0
        for _ in xrange(RETRAIN_EVE_LOOPS):
          for _ in xrange(RETRAIN_EVE_ITERS):
            eve_counter += 1
            s.run(ac.eve_optimizer)
          doeval(s, ac, EVAL_BATCHES, eve_counter)
        doeval(s, ac, EVAL_BATCHES, eve_counter)

Main Method

The last little bit of the program is the main method wrapper:

def main(unused_argv):
  # Exit more quietly with Ctrl-C.
  signal.signal(signal.SIGINT, signal.SIG_DFL)
  train_and_evaluate()


if __name__ == '__main__':
  tf.app.run()

Fairly self-explanatory. Signal is a Python module imported as import signal.

Output

# Batch size:  4096
#       Iter	     Bob_Recon_Error	     Eve_Recon_Error
         0	                8.00	                7.99
       200	                7.86	                7.47
       400	                6.88	                6.78
       600	                4.90	                6.39
       800	                3.54	                6.43
      1000	                2.82	                6.64
      1200	                2.09	                6.67
      1400	                1.79	                6.86
      1600	                1.57	                6.88
      1800	                1.06	                6.89
      2000	                0.94	                6.98
      2200	                0.66	                6.90
      2400	                0.36	                6.93
      2600	                0.32	                6.93
      2800	                0.26	                6.98
      3000	                0.22	                7.07
      3200	                0.20	                7.06
      3400	                0.17	                7.17
      3600	                0.15	                7.20
      3800	                0.14	                7.21
      4000	                0.12	                7.29
      4200	                0.11	                7.21
      4400	                0.10	                7.30
      4600	                0.09	                7.29
      4800	                0.08	                7.30
      5000	                0.07	                7.38
      5200	                0.07	                7.31
      5400	                0.07	                7.38
      5600	                0.06	                7.37
      5800	                0.06	                7.45
      6000	                0.05	                7.38
      6200	                0.05	                7.37
      6400	                0.04	                7.47
      6600	                0.04	                7.38
      6800	                0.04	                7.40
      7000	                0.03	                7.42
      7200	                0.03	                7.47
      7400	                0.03	                7.49
      7600	                0.03	                7.50
      7800	                0.03	                7.43
      8000	                0.03	                7.43
      8200	                0.02	                7.45
      8400	                0.02	                7.41
      8600	                0.02	                7.47
      8800	                0.02	                7.51
      9000	                0.02	                7.50
      9200	                0.01	                7.50
      9400	                0.01	                7.54
      9600	                0.01	                7.53
      9800	                0.02	                7.48
     10000	                0.01	                7.52
     10200	                0.01	                7.54
     10400	                0.01	                7.54
     10600	                0.01	                7.52
     10800	                0.01	                7.58
     11000	                0.01	                7.53
     11200	                0.01	                7.54
     11400	                0.01	                7.55
     11600	                0.01	                7.54
     11800	                0.01	                7.54
     12000	                0.01	                7.54
     12200	                0.01	                7.43
     12400	                0.01	                7.52
     12600	                0.01	                7.51
     12800	                0.01	                7.57
     13000	                0.01	                7.56
     13200	                0.01	                7.62
     13400	                0.01	                7.54
     13600	                0.01	                7.49
     13800	                0.01	                7.47
     14000	                0.01	                7.51
     14200	                0.01	                7.46
     14400	                0.01	                7.56
     14600	                0.01	                7.59
     14800	                0.01	                7.53
     15000	                0.01	                7.58
     15200	                0.01	                7.54
     15400	                0.01	                7.46
     15600	                0.01	                7.47
     15800	                0.01	                7.43
     16000	                0.01	                7.44
     16200	                0.01	                7.47
     16400	                0.00	                7.51
     16600	                0.01	                7.51
     16800	                0.01	                7.54
     17000	                0.01	                7.56
     17200	                0.01	                7.58
     17400	                0.01	                7.52
     17600	                0.01	                7.49
     17800	                0.01	                7.45
     18000	                0.01	                7.46
     18200	                0.01	                7.43
     18400	                0.01	                7.49
     18600	                0.01	                7.46
     18800	                0.01	                7.50
     19000	                0.01	                7.52
     19200	                0.00	                7.56
     19400	                0.01	                7.58
     19600	                0.01	                7.58
     19800	                0.00	                7.54
     20000	                0.00	                7.52
     20200	                0.00	                7.56
     20400	                0.00	                7.53
     20600	                0.01	                7.53
     20800	                0.01	                7.55
     21000	                0.00	                7.53
     21200	                0.01	                7.48
     21400	                0.01	                7.55
     21600	                0.00	                7.54
     21800	                0.00	                7.56
     22000	                0.00	                7.58
     22200	                0.00	                7.55
     22400	                0.00	                7.56
     22600	                0.00	                7.26
     22800	                0.00	                7.58
     23000	                0.00	                7.61
     23200	                0.00	                7.69
     23400	                0.00	                7.59
     23600	                0.00	                7.64
     23800	                0.00	                7.53
     24000	                0.01	                7.53
     24200	                0.00	                7.62
     24400	                0.00	                7.43
     24600	                0.00	                7.61
     24800	                0.00	                7.68
     25000	                0.00	                7.65
     25200	                0.00	                7.62
     25400	                0.00	                7.61
     25600	                0.00	                7.67
     25800	                0.00	                7.67
     26000	                0.00	                7.63
     26200	                0.00	                7.61
     26400	                0.00	                7.68
     26600	                0.00	                7.66
     26800	                0.00	                7.65
     27000	                0.01	                7.33
     27200	                0.00	                7.65
     27400	                0.00	                7.61
     27600	                0.01	                7.53
     27800	                0.01	                7.67
     28000	                0.00	                7.66
     28200	                0.01	                7.60
     28400	                0.00	                7.69
     28600	                0.00	                7.59
     28800	                0.01	                7.61
     29000	                0.01	                7.56
     29200	                0.01	                7.54
     29400	                0.01	                7.52
     29600	                0.00	                7.09
     29800	                0.01	                7.53
     30000	                0.01	                7.57
     30200	                0.01	                7.58
     30400	                0.01	                7.42
     30600	                0.01	                7.44
     30800	                0.01	                7.49
     31000	                0.01	                7.55
     31200	                0.01	                7.52
     31400	                0.01	                7.48
     31600	                0.01	                7.54
     31800	                0.00	                7.53
     32000	                0.01	                7.23
     32200	                0.01	                7.49
     32400	                0.00	                7.56
     32600	                0.00	                7.61
     32800	                0.00	                7.57
     33000	                0.00	                7.60
     33200	                0.01	                7.57
     33400	                0.00	                7.56
     33600	                0.01	                7.56
     33800	                0.00	                7.61
     34000	                0.00	                7.54
     34200	                0.00	                7.59
     34400	                0.00	                7.59
     34600	                0.00	                7.58
     34800	                0.00	                7.63
     35000	                0.00	                7.41
     35200	                0.01	                7.59
     35400	                0.01	                7.63
     35600	                0.01	                7.60
     35800	                0.00	                7.58
     36000	                0.01	                7.54
     36200	                0.00	                7.54
     36400	                0.00	                7.53
     36600	                0.00	                7.58
     36800	                0.00	                7.50
     37000	                0.00	                7.51
     37200	                0.00	                7.59
     37400	                0.00	                7.57
     37600	                0.00	                7.56
     37800	                0.00	                7.60
     38000	                0.00	                7.49
     38200	                0.00	                7.36
     38400	                0.01	                7.45
     38600	                0.01	                7.41
     38800	                0.01	                7.47
     39000	                0.01	                7.45
     39200	                0.01	                7.49
     39400	                0.01	                7.51
     39600	                0.01	                7.55
     39800	                0.00	                7.52
     40000	                0.01	                7.48
     40200	                0.00	                7.50
     40400	                0.01	                7.51
     40600	                0.01	                7.49
     40800	                0.01	                7.44
     41000	                0.00	                7.52
     41200	                0.00	                7.52
     41400	                0.01	                7.57
     41600	                0.00	                7.62
     41800	                0.00	                7.62
     42000	                0.01	                7.55
     42200	                0.00	                7.44
     42400	                0.00	                7.55
     42600	                0.00	                7.60
     42800	                0.00	                7.60
     43000	                0.01	                7.53
     43200	                0.01	                7.54
     43400	                0.01	                7.58
     43600	                0.00	                7.13
     43800	                0.00	                7.44
     44000	                0.00	                7.54
     44200	                0.00	                7.56
     44400	                0.00	                7.52
     44600	                0.00	                7.55
     44800	                0.00	                7.53
     45000	                0.00	                7.55
     45200	                0.00	                7.55
     45400	                0.00	                7.58
     45600	                0.00	                7.52
     45800	                0.00	                7.52
     46000	                0.00	                7.51
     46200	                0.00	                7.62
     46400	                0.00	                7.58
     46600	                0.00	                7.63
     46800	                0.00	                7.67
     47000	                0.00	                7.40
     47200	                0.00	                7.61
     47400	                0.01	                7.54
     47600	                0.01	                7.59
     47800	                0.00	                7.60
     48000	                0.00	                7.54
     48200	                0.01	                7.51
     48400	                0.01	                7.56
     48600	                0.01	                7.51
     48800	                0.01	                7.55
     49000	                0.01	                7.46
     49200	                0.01	                7.56
     49400	                0.00	                7.35
     49600	                0.01	                7.50
     49800	                0.01	                7.58
     50000	                0.00	                7.49
     50200	                0.00	                7.50
     50400	                0.01	                7.49
     50600	                0.01	                7.55
     50800	                0.01	                7.53
     51000	                0.01	                7.53
     51200	                0.01	                7.48
     51400	                0.00	                7.47
     51600	                0.00	                7.48
     51800	                0.00	                7.59
     52000	                0.01	                7.62
     52200	                0.00	                7.70
     52400	                0.00	                7.60
     52600	                0.01	                7.57
     52800	                0.01	                7.59
     53000	                0.01	                7.14
     53200	                0.00	                7.43
     53400	                0.00	                7.65
     53600	                0.00	                7.73
Target losses achieved.
Loss after eve extra training:
         0	                0.00	                7.39
Resetting Eve
     10000	                0.01	                6.74
     20000	                0.00	                6.57
     30000	                0.00	                6.56
     40000	                0.00	                6.57
     50000	                0.00	                6.55
     60000	                0.00	                6.61
     70000	                0.00	                6.58
     80000	                0.00	                6.54
     90000	                0.00	                6.57
    100000	                0.00	                6.61
    110000	                0.00	                6.57
    120000	                0.00	                6.56
    130000	                0.00	                6.60
    140000	                0.00	                6.54
    150000	                0.00	                6.53
    160000	                0.00	                6.61
    170000	                0.00	                6.58
    180000	                0.00	                6.56
    190000	                0.00	                6.58
    200000	                0.00	                6.55
    210000	                0.00	                6.54
    220000	                0.00	                6.58
    230000	                0.00	                6.54
    240000	                0.01	                6.55
    250000	                0.00	                6.55
    250000	                0.00	                6.57
Resetting Eve
     10000	                0.00	                6.81
     20000	                0.00	                6.68
     30000	                0.00	                6.63
     40000	                0.00	                6.67
     50000	                0.00	                6.67
     60000	                0.00	                6.62
     70000	                0.00	                6.65
     80000	                0.00	                6.58
     90000	                0.00	                6.66
    100000	                0.00	                6.66
    110000	                0.01	                6.62
    120000	                0.00	                6.64
    130000	                0.00	                6.60
    140000	                0.00	                6.65
    150000	                0.00	                6.63
    160000	                0.00	                6.60
    170000	                0.00	                6.63
    180000	                0.00	                6.59
    190000	                0.00	                6.66
    200000	                0.00	                6.64
    210000	                0.00	                6.60
    220000	                0.01	                6.61
    230000	                0.00	                6.62
    240000	                0.00	                6.64
    250000	                0.00	                6.60
    250000	                0.00	                6.65
Resetting Eve
     10000	                0.00	                7.18
     20000	                0.00	                6.70
     30000	                0.01	                6.68
     40000	                0.00	                6.61
     50000	                0.00	                6.64
     60000	                0.00	                6.64
     70000	                0.00	                6.59
     80000	                0.00	                6.67
     90000	                0.00	                6.62
    100000	                0.01	                6.62
    110000	                0.00	                6.62
    120000	                0.00	                6.65
    130000	                0.00	                6.67
    140000	                0.00	                6.67
    150000	                0.00	                6.66
    160000	                0.00	                6.66
    170000	                0.00	                6.67
    180000	                0.00	                6.69
    190000	                0.00	                6.64
    200000	                0.00	                6.66
    210000	                0.01	                6.65
    220000	                0.00	                6.69
    230000	                0.00	                6.66
    240000	                0.00	                6.68
    250000	                0.01	                6.72
    250000	                0.00	                6.66
Resetting Eve
     10000	                0.00	                6.94
     20000	                0.00	                6.61
     30000	                0.01	                6.63
     40000	                0.00	                6.63
     50000	                0.01	                6.61
     60000	                0.00	                6.58
     70000	                0.00	                6.62
     80000	                0.00	                6.62
     90000	                0.01	                6.56
    100000	                0.00	                6.61
    110000	                0.00	                6.59
    120000	                0.00	                6.63
    130000	                0.00	                6.65
    140000	                0.00	                6.55
    150000	                0.00	                6.57
    160000	                0.01	                6.60
    170000	                0.01	                6.61
    180000	                0.00	                6.64
    190000	                0.00	                6.62
    200000	                0.00	                6.62
    210000	                0.00	                6.60
    220000	                0.00	                6.60
    230000	                0.00	                6.66
    240000	                0.01	                6.59
    250000	                0.01	                6.59
    250000	                0.00	                6.61
Resetting Eve
     10000	                0.00	                7.05
     20000	                0.00	                6.61
     30000	                0.01	                6.63
     40000	                0.00	                6.64
     50000	                0.00	                6.60
     60000	                0.00	                6.61
     70000	                0.00	                6.58
     80000	                0.00	                6.55
     90000	                0.01	                6.59
    100000	                0.01	                6.59
    110000	                0.00	                6.58
    120000	                0.00	                6.62
    130000	                0.01	                6.56
    140000	                0.00	                6.56
    150000	                0.00	                6.59
    160000	                0.00	                6.63
    170000	                0.00	                6.61
    180000	                0.00	                6.61
    190000	                0.00	                6.59
    200000	                0.00	                6.61
    210000	                0.00	                6.60
    220000	                0.00	                6.62
    230000	                0.00	                6.64
    240000	                0.00	                6.58
    250000	                0.00	                6.57
    250000	                0.01	                6.59

Flags