Skip to content

Conversation

lwsong
Copy link
Contributor

@lwsong lwsong commented Oct 21, 2020

Following our recent paper https://arxiv.org/pdf/2003.10595.pdf, I implement the code to run membership inference attacks by setting a threshold value on the prediction entropy value.
Compared to THRESHOLD_ATTACK, THRESHOLD_ENTROPY_ATTACK leverages the entropy value instead of the loss value.

@google-cla google-cla bot added the cla: yes cla: yes label Oct 21, 2020
Copy link
Contributor

@CdavM CdavM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks Liwei! I left 2 comments


@property
def is_trained_attack(self):
"""Returns whether this type of attack requires training a model."""
return self != AttackType.THRESHOLD_ATTACK
return (self != AttackType.THRESHOLD_ATTACK) & (self != AttackType.THRESHOLD_ENTROPY_ATTACK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use words instead, i.e. self != AttackType.THRESHOLD_ATTACK and self != AttackType.THRESHOLD_ENTROPY_ATTACK

Copy link
Contributor Author

@lwsong lwsong Oct 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@@ -96,6 +96,19 @@ def _run_threshold_attack(attack_input: AttackInputData):
attack_type=AttackType.THRESHOLD_ATTACK,
roc_curve=roc_curve)

def _run_threshold_entropy_attack(attack_input: AttackInputData):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an end-to-end test for this to membership_inference_attack_test.py? Something like the "test_run_attack_threshold_calculates_correct_auc" test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case is added!

@lwsong
Copy link
Contributor Author

lwsong commented Oct 23, 2020

Looks good, thanks Liwei! I left 2 comments

I have fixed these issues, please take another look, thanks.

Copy link
Contributor

@CdavM CdavM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@copybara-service copybara-service bot merged commit 67f7f35 into tensorflow:master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants