hanglearning/VBFL

About VBFL code

IceCouldSword opened this issue · 3 comments

hi @hanglearning , thank you very much for the code you provided.
I want to know when to aggregate parameters in federated learning to update the global model in vbfl after the verifier has verified all transactions and added valid transactions to the queue? I would appreciate it if you could tell me the specific location of parameter aggregation in the code!
My English is not very good, looking forward to your answer.

Hi @IceCouldSword, thank you for your interest in our project!

No, the global model aggregation happens after the block has been added by a device to its own chain. The block records the validator votes of the corresponding local models, and a device only selects those local models that are voted positively by most validators (in this code, that's over 50% of validators) to do model aggregation. One of the main purposes of blockchain here is to protect the voting results and prove the authenticity of local models, so the aggregation happens at the end of a round, namely, after a block is mined and added.

The aggregation happens in Device.py line 612 self.global_update(finally_used_local_params), and global_update() is defined at line 814.

Sorry for the messy code! Please let me know if this makes sense. 我也可以用中文交流。

非常感谢你的解答@hanglearning,我已经理解了VBFL中如何进行全局聚合。
你的代码注释很清晰,非常有助于我理解其他部分,再次感谢你提供代码并给我解答!

不客气!如果还有其他问题我们保持交流。祝好运!