cleverhans-lab / cleverhans

An adversarial example library for constructing attacks, building defenses, and benchmarking both
MIT License
6.2k stars 1.39k forks source link

Substitue training optimizes for both BlackBox variables and Substitute variables #400

Closed VigneshSrinivasan10 closed 6 years ago

VigneshSrinivasan10 commented 6 years ago

Hi,

Thanks for the great repository.

In the tutorial code mnist_blackbox.py, The blackbox is first prepared and then a substitute is trained using a subset of the test samples. When the subsitute is trained with the function model_train,

https://github.com/tensorflow/cleverhans/blob/6b065c4507f50e2545c009f75e82678f92353163/cleverhans_tutorials/mnist_blackbox.py#L150

I notice that at this line,

https://github.com/tensorflow/cleverhans/blob/6b065c4507f50e2545c009f75e82678f92353163/cleverhans/utils_tf.py#L117

the optimizer minimizes the loss. Since there is no var_list defined, it considers the variables of both the Blackbox and Substitute models.

I would suggest adding another parameter to train_params - tvars which contains the variables list to optimize for.

Best,

npapernot commented 6 years ago

Thanks for flagging the issue. If you're able to put together a PR, feel free to assign me as a reviewer.

VigneshSrinivasan10 commented 6 years ago

Thanks for the quick response.

I will be happy to place a PR - but unfortunately I am on time crunch - so perhaps, I can do it next month.

goodfeli commented 6 years ago

I've added a get_params method to Model and a var_list argument to model_train that could be use to fix this issue. Those features are in this open PR: https://github.com/tensorflow/cleverhans/pull/398