Privacy-Preserving Byzantine-Robust Federated Learning via Blockchain Systems论文笔记

Privacy-Preserving Byzantine-Robust Federated Learning via Blockchain Systems

总述:本文提出了一种PBFL的方案,可以用来验证用户上传的梯度信息(主要使用到的是余弦相似性),过滤恶意用户的梯度;并且可以防止服务器的单点故障,利用区块链使得协议的执行更加的透明。

本文的主要贡献:因为之前使用的同态加密方案存在低效的问题(具体而言其一次只能加密单字节或者很少的信息量),因此本文考察了各种加密方案之后选择了CKKS作为加密方案(其可以同时对多个浮点数进行加密,使得更高效的加密操作)。并且,要求用户和两个服务器在执行协议之前,将自己的deposit存入区块链,在执行诚实操作后再领取,可以利用激励机制保证服务器正确执行聚合操作。

本文可以改进的地方:仅提供了半诚实敌手下的安全,可以拓展为恶意敌手下的安全性。

核心技术:余弦相似度计算,我们通过人工的方式首先获取一个干净的数据集,通过该数据集计算得到一个干净的梯度信息 g i 0 g^0_i gi0,通过利用其来对其他梯度进行筛选来获得在合理范围内的梯度信息,如图Fig4所示。
特别的,恶意用户提交的信息有可能不会进行过归一化处理,这样可以保证其有更高的权重在影响梯度方面,因此我们需要首先过滤掉这些信息。其次,恶意梯度信息在很大程度上与我们的干净梯度信息 g i 0 g^0_i gi0是相反的,因此其余弦相似度计算出来的结果为负数,这些梯度也应该进行过滤。

余弦相似度示意图

协议流程:

1) 本地计算阶段

a)本地训练,该阶段在用户本地执行,主要为了获取用户的梯度信息。

本地计算阶段

b)归一化
c)加密阶段:本文主要使用的是CKKS同态加密对信息进行加密操作
d)模型更新阶段:用户收到服务器的聚合模型,利用聚合模型对本地梯度信息进行更新。

模型更新

2)归一化判断:由服务器来验证用户是否执行了归一化的操作,对未执行操作的用户进行剔除。

!归一化判断

3)模型聚合阶段

a)两方计算:主要目标计算 ⟦ g ~ i 0 ⟧ p k v {\llbracket {\tilde g_i^0} \rrbracket _{p{k_v}}} [[g~i0]]pkv以及用户提交的 ⟦ g ~ i j ⟧ p k v {\llbracket {\tilde g_i^j} \rrbracket _{p{k_v}}} [[g~ij]]pkv的余弦相似度,具体来说计算如下公式:

⟦ c s i j ⟧ p k v = ⟦ g ~ i 0 ⟧ p k v ⊙ ⟦ g ~ i j ⟧ p k v = ⟦ p 1 q 1 + p 2 q 2 + ⋯ + p n ∗ q n ∗ ⟧ p k v .  s.t.,  ∥ g ~ i 0 ∥ = ∥ g ~ i j ∥ = 1. \begin{aligned}\llbracket c s_i^j \rrbracket p k_v & =\llbracket \widetilde{\mathbf{g}}_i^0 \rrbracket p k_v \odot \llbracket \widetilde{\mathbf{g}}_i^j \rrbracket p k_v \\& =\llbracket p_1 q_1+p_2 q_2+\cdots+p_{n^*} q_{n^*} \rrbracket p k_v . \\\text { s.t., }\left\|\widetilde{\mathbf{g}}_i^0\right\| & =\left\|\widetilde{\mathbf{g}}_i^j\right\|=1 .\end{aligned} [[csij]]pkv s.t.,  g i0 =[[g i0]]pkv[[g ij]]pkv=[[p1q1+p2q2++pnqn]]pkv.= g ij =1.

计算得到的结果我们需要经过ReLU层进行过滤,即 S i j = Re ⁡ L U ( c s i j ) S_i^j = \operatorname{Re} LU(cs_i^j) Sij=ReLU(csij),ReLU的删选原则是,对于复数的相似度信息,将其权重设为0,正数的相似度信息,权重为其对应的大小,即ReLU函数如下所示:

ReLU ⁡ ( x ) = { x .  if  x > 0 0.  if  x ≤ 0 \operatorname{ReLU}(x)= \begin{cases}x . & \text { if } x>0 \\ 0 . & \text { if } x \leq 0\end{cases} ReLU(x)={x.0. if x>0 if x0

所以我们需要首先解决的一个问题是,如何设计一种同态的比较最大值的协议,如下所示:

获取最大值参数

指的注意的是,我们的余弦相似度的输出结果是[-1,1],而我们的比较协议(来自《Numerical method for comparison on homomorphically encrypted numbers》)要求的范围是[0,1]因此我们需要先进行处理,使其范围满足我们算法的定义,具体而言如下所示:

Re ⁡ L U ′ ( ⟦ c s i j ⟧ ) = { 1 2 ( ⟦ c s i j ⟧ + ⟦ 1 ⟧ ) .  if  1 2 ( ⟦ c s i j ⟧ + ⟦ 1 ⟧ ) > ⟦ 1 2 ⟧ ⟦ 1 / 2 ⟧ .  if  1 2 ( ⟦ c s i j ⟧ + ⟦ 1 ⟧ ) ≤ ⟦ 1 2 ⟧ \operatorname{Re} L U^{\prime}\left(\llbracket c s_i^j \rrbracket\right)= \begin{cases}\frac{1}{2}\left(\llbracket c s_i^j \rrbracket+\llbracket 1 \rrbracket\right) . & \text { if } \frac{1}{2}\left(\llbracket c s_i^j \rrbracket+\llbracket 1 \rrbracket\right)>\llbracket \frac{1}{2} \rrbracket \\ \llbracket 1 / 2 \rrbracket . & \text { if } \frac{1}{2}\left(\llbracket c s_i^j \rrbracket+\llbracket 1 \rrbracket\right) \leq \llbracket \frac{1}{2} \rrbracket\end{cases} ReLU([[csij]])= 21([[csij]]+[[1]]).[[1/2]]. if 21([[csij]]+[[1]])>[[21]] if 21([[csij]]+[[1]])[[21]]

相关的算法可以简述如下:

获取参数

b)聚合操作:服务器进行密文的聚合

⟦ g ~ i ⟧ p k x = 1  sum  ∑ j = 1 ∣ C ∣ ⟦ S i j ⟧ p k x ′ ⋅ ⟦ g ~ i j ⟧ p k x = 1  sum  ∑ j = 1 ∣ C ∣ Re ⁡ L U ( ⟦ g ~ i 0 ⟧ p k x ⊙ ⟦ g ~ i j ⟧ p k x ) ⋅ ⟦ g ~ i j ⟧ p k x . \begin{aligned}\llbracket \widetilde{\mathbf{g}}_i \rrbracket_{p k_x} & =\frac{1}{\text { sum }} \sum_{j=1}^{|\mathcal{C}|} \llbracket \mathcal{S}_i^j \rrbracket_{p k_x}^{\prime} \cdot \llbracket \widetilde{\mathbf{g}}_i^j \rrbracket_{p k_x} \\& =\frac{1}{\text { sum }} \sum_{j=1}^{|\mathcal{C}|} \operatorname{Re} L U\left(\llbracket \widetilde{\mathbf{g}}_i^0 \rrbracket_{p k_x} \odot \llbracket \widetilde{\mathbf{g}}_i^j \rrbracket_{p k_x}\right) \cdot \llbracket \widetilde{\mathbf{g}}_i^j \rrbracket_{p k_x} .\end{aligned} [[g i]]pkx= sum 1j=1C[[Sij]]pkx[[g ij]]pkx= sum 1j=1CReLU([[g i0]]pkx[[g ij]]pkx)[[g ij]]pkx.
PBFL主协议流程

  • 22
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Privacy-preserving machine learning is becoming increasingly important in today's world where data privacy is a major concern. Federated learning and secure aggregation are two techniques that can be used to achieve privacy-preserving machine learning. Federated learning is a technique where the machine learning model is trained on data that is distributed across multiple devices or servers. In this technique, the model is sent to the devices or servers, and the devices or servers perform the training locally on their own data. The trained model updates are then sent back to a central server, where they are aggregated to create a new version of the model. The key advantage of federated learning is that the data remains on the devices or servers, which helps to protect the privacy of the data. Secure aggregation is a technique that can be used to protect the privacy of the model updates that are sent to the central server. In this technique, the updates are encrypted before they are sent to the central server. The central server then performs the aggregation operation on the encrypted updates, and the result is sent back to the devices or servers. The devices or servers can then decrypt the result to obtain the updated model. By combining federated learning and secure aggregation, it is possible to achieve privacy-preserving machine learning. This approach allows for the training of machine learning models on sensitive data while protecting the privacy of the data and the model updates.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值