jhcknzzm / Federated-Learning-Backdoor

ICML 2022 code for "Neurotoxin: Durable Backdoors in Federated Learning" https://arxiv.org/abs/2206.10341
62 stars 7 forks source link

Which part of the code corresponds to the part marked in red in the pseudo code #11

Closed imomoe233 closed 1 year ago

imomoe233 commented 1 year ago

In which piece of code can I find the specific code corresponding to the following statement and which part of the code corresponds to the part marked in red in the pseudo code in the basic method of the paper?

" The attacker computes the top-k% coordinates of the benign gradient and sets this as the constraint set. For some number of epochs of PGD, the attacker computes a gradient update on the poisoned dataset ˆD and projects that gradient onto the constraint set, that is the bottom-k% coordinates of the observed benign gradient. "

jhcknzzm commented 1 year ago

Our function (grad_mask() function) to calculate Mask is on line 83 of Federated-Learning-Backdoor/FL_Backdoor_NLP/helper.py. The code where we use the calculated Mask is on line 261 of Federated-Learning-Backdoor/FL_Backdoor_NLP/helper.py.

imomoe233 commented 1 year ago

There is no 261 of Federated-Learning-Backdoor/FL_Backdoor_NLP/helper.py . Do you mean line 261 of FL_Backdoor_NLP\train_funcs.py? By the way how about CV to achieve this algorithm in code?I think line 147 of FL_Backdoor_CV/helper.py, right?

jhcknzzm commented 1 year ago

For the NLP task, the function (grad_mask() function) to calculate Mask is on line 83 of Federated-Learning-Backdoor/FL_Backdoor_NLP/helper.py. https://github.com/jhcknzzm/Federated-Learning-Backdoor/blob/63ef33665792a6c7243e577cc23b0e0357d10b96/FL_Backdoor_NLP/helper.py#L83.

For the CV task, you can see the code here: https://github.com/jhcknzzm/Federated-Learning-Backdoor/blob/63ef33665792a6c7243e577cc23b0e0357d10b96/FL_Backdoor_CV/helper.py#L147

imomoe233 commented 1 year ago

Thanks for your time. 顺颂时祺