Differentially Private Federated Learning With an Adaptive Noise Mechanism

文章探讨了在联邦学习中,通过自适应噪声机制来解决LDP-FL中模型参数异质性导致的精度问题。作者提出的方法根据模型参数大小动态添加噪声,有效减轻了噪声对模型准确性的影响,实现在高隐私保护下保持较高模型精度。实验结果显示,这种方法在不同参数条件下表现出良好的性能和鲁棒性。
摘要由CSDN通过智能技术生成

一、研究背景

1.1联邦学习的保护机制

在联邦学习机制中,用户会因为共享模型参数而导致隐私泄露。实现隐私保护的FL(PPFL)的一种方法是利用同态加密(HE)来加密客户端的局部模型参数,并允许参数服务器在密文上执行FL聚合。HE-based PPFL协议确实保护了客户的隐私,但一个问题是HE通常引入了巨大的计算开销,这在FL中是不切实际的。另一种方法是使用数据掩码,在这些方案中,客户端向上传输的模型参数添加掩码值,其中掩码值通常包括成对的掩码以确保在聚合结果中的消除,以及自掩码以防止意外泄露客户的隐私。这种方案的问题是它们导致了巨大的通信开销。一种流行的方法是使用差分隐私对联邦学习进行保护,在本文中,作者只使用本地差分隐私联邦学习(LDP-FL)来保护隐私。

1.2LDP-FL的误差分析

在以往的LDP-FL中,由于不同模型参数之间存在异质性,当服务器分配给用户的隐私预算大于用户所需要的隐私预算时,用户的隐私信息得不到保护,模型的准确性或上升。当服务器分配给用户的隐私预算小于用户所需要的隐私预算时,用户的隐私信息得到保护,但模型的准确性下降。所以,LDP-FL会因为不同模型参数之间存在异质性而导致模型精度下降,因此,我们亟需一种方法来解决LDP-FL的问题。

1.3作者的解决方法

自适应噪声机制:根据模型参数的大小添加变化的噪声。因为灵敏度是DP中确定噪声大小的关键概念,所以自适应噪声机制的关键是对灵敏度进行紧密估计。步骤如下:
1)客户端使用上一次FL聚合得到的全局模型参数和本地历史梯度来计算逐个模型参数的阈值,并使用该阈值来截断上传的参数;
2)然后他们可以根据其定义来估计灵敏度;
3)之后,每个客户端根据估计的灵敏度和隐私预算向本地模型参数添加适当的噪声并上传它们;
4)然后参数服务器使用收集到的扰动模型参数来执行聚合
概述图:
在这里插入图片描述

二、内容分析

2.1整体流程

在这里插入图片描述

2.2客户更新算法

在这里插入图片描述

2.3灵敏度的估计

在这里插入图片描述

三、实验分析

3.1性能评估

在这里插入图片描述
当 ε 等于 0.5 时,模型准确度分别为 87.58%(SGD)、90.45%(Momentum)、94.98%(Adam)和 96.85%(RMSPROP)。这表明作者提出的方案可以在高隐私保护级别(即 ε = 0.5)下实现满意的模型准确度。当 ε 等于 2.0 时,四种优化器的模型准确度曲线在第 20 轮后收敛。当 ε 等于 8.0 时,获得的模型的准确度约为 97%。这些结果表明作者提出的自适应噪声机制确实有效地减轻了添加到模型中的噪声所造成的损害
在这里插入图片描述
当 ε 等于 0.5 时(图 a),与没有添加任何噪声的模型相比,准确度损失分别为 SGD 3.29%、Momentum 2.38%、Adam 1.71% 和 RMSPROP 0.39%。对于 FMNIST,当 ε 等于 1.0 时(图 b),模型的准确度损失分别为 SGD 3.8%、Momentum 3.46%、Adam 1.97% 和 RMSPROP 1.67%。对于 CIFAR-10,当 ε 等于 2.0 时(图 c),模型的准确度损失分别为 SGD 3.17%、Momentum 2.96%、Adam 1.51% 和 RMSPROP 1.03%。表明作者提出的方案可以在高水平的隐私保护下实现较高的模型准确度,从而表明了作者提出的方案在隐私保护和模型准确度之间取得了良好的平衡。图d是作者的方法与其他DP-FL方法的对比。

3.2不同参数的影响

在这里插入图片描述
图a:对于 SGD,50 个和 700 个参与的客户端之间的模型准确性差异仅为 2.98%,对于 Momentum 为 2.81%,对于 Adam 为 2.90%,对于 RMSPROP 为 2.78%。即使客户端数量在一定范围内增长,作者提出的方案仍然可以有效地减轻噪声对模型准确性的影响。
图b:模型准确性在噪声水平为 26 时最高。当 σ0 等于 30 时,模型仍然表现良好:与 σ0 = 26 时相比,SGD 的模型准确性下降了 1.7%, Momentum下降了 1.04%,Adam 下降了 0.94%,RMSPROP 下降了 2.09%。这表明作者提出的方案所容忍的噪声水平很高。
图c:当参与客户端比例大于0.6时,模型准确性已经达到了相对满意的水平(SGD 为 86.67%, Momentum为 88.08%,Adam 为 91.05%,RMSPROP 为 92.21%)。因此,即使存在客户端退出,作者的方案仍然能够很好地运行。
图d:β 越小,截断的模型参数越多,因此对模型准确性的负面影响会更大。β 越大,丢弃的模型参数部分就越少。图 5(d) 显示了随着 β 的变化结果。我们观察到当 β 介于 1.0 和 1.2 之间时,模型准确性达到最高点。

总结

1.作者提出的方案要求客户端根据估计的灵敏度将不同尺度的噪声添加到局部模型的不同参数中。它减轻了 DP 导致模型精度的退化,从而在更高的隐私保护级别实现更小的模型精度损失。

2.为了在FL中没有数据可见性的情况下更准确地估计灵敏度,作者提出了一种结合局部和全局历史信息的通用方法,以准确估计客户端上传模型参数的灵敏度

R. Xue et al., “Differentially Private Federated Learning With an Adaptive Noise Mechanism,” in IEEE Transactions on Information Forensics and Security, vol. 19, pp. 74-87, 2024, doi: 10.1109/TIFS.2023.3318944. keywords: {Sensitivity;Privacy;Adaptation models;Servers;Computational modeling;Differential privacy;Data models;Federated learning;differential privacy;adaptive noise},

Here is the completed code for Differentially Private Stochastic Gradient Descent, including per-example clipping and adding Gaussian noise as well as privacy budget composition: ```python import numpy as np from scipy import optimize from scipy.stats import norm import math def per_example_clipping(grad, clip_factor): """ Clip the gradient per example with a given clip factor. """ return np.clip(grad, -clip_factor, clip_factor) def add_gaussian_noise(grad, sigma): """ Add Gaussian noise to the gradient with a given standard deviation. """ return grad + np.random.normal(0, sigma, grad.shape) def get_epsilon(epoch, delta, sigma, sensitivity, batch_size, training_nums): """ Compute epsilon with basic composition from given epoch, delta, sigma, sensitivity, batch_size and the number of training set. """ steps = math.ceil(training_nums / batch_size) * epoch epsilon = sigma * math.sqrt(2 * math.log(1.25 / delta)) / sensitivity return epsilon * steps def dp_sgd(X, y, epochs, batch_size, clip_factor, sigma, delta): n, d = X.shape w = np.zeros(d) for epoch in range(epochs): for i in range(0, n, batch_size): X_batch = X[i:i+batch_size] y_batch = y[i:i+batch_size] grad = np.mean(X_batch * (sigmoid(X_batch.dot(w)) - y_batch).reshape(-1, 1), axis=0) clipped_grad = per_example_clipping(grad, clip_factor) noise_grad = add_gaussian_noise(clipped_grad, sigma) w -= noise_grad epsilon = get_epsilon(epoch+1, delta, sigma, clip_factor/batch_size, batch_size, n) print("Epoch {}: Epsilon = {}".format(epoch+1, epsilon)) return w ``` The `per_example_clipping` function clips the gradient per example with a given clip factor. The `add_gaussian_noise` function adds Gaussian noise to the gradient with a given standard deviation. The `get_epsilon` function computes epsilon with basic composition from given epoch, delta, sigma, sensitivity, batch_size and the number of training set. The `dp_sgd` function performs Differentially Private Stochastic Gradient Descent. For each epoch, it loops over the training set in batches and computes the gradient of the loss function using the sigmoid function. It then clips the gradient per example, adds Gaussian noise to the clipped gradient, and updates the weight vector. Finally, it computes the privacy budget using the `get_epsilon` function and prints it out. Note that the `get_epsilon` function uses basic composition to compute the privacy budget. It calculates the total number of steps based on the number of epochs and the batch size, and then uses the formula for epsilon with basic composition to compute the privacy budget for each epoch. It is worth noting that basic composition may not provide the tightest bound on privacy, and using the Moments Accountant method may provide a tighter bound.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值