3. Differentially Private Federated Learning A Client-level Perspective

文章探讨了联邦学习在面临差分攻击时的脆弱性,并提出了client-level差分隐私算法。通过使用高斯机制和动态调整的dp-preserving机制,能够在保护用户数据隐私的同时,确保模型的训练效果。文章还分析了模型训练过程中通信成本、方差和更新规模对模型精度的影响,特别是在标签拟合和数据拟合阶段的不同表现。
摘要由CSDN通过智能技术生成

总结:(内容不多,收获较少)
1. 学习参考链接

1. 第一篇文献笔记

2. 第二篇文献笔记

2. 每文三问
  • 文章在解决什么问题?

    传统的联邦学习容易受到差分攻击,这种攻击可能来自联邦优化过程中的任何一方。在这种攻击中,通过分析分布式模型,客户端在训练期间的贡献以及本地数据集的信息可能被暴露。

  • 用了什么方法?
    提出 client-level DP 的一个算法

  • 效果如何?

    只要有足够多的参与者,仅以很小的模型代价即可实现 client-level 的差分隐私。

3. 知识点索引

章节1

  • 介绍 机器学习+差分隐私 的目的
  • 介绍 example-level privacy 和 user-level privacy 各自保护的对象

章节2.2

  • 介绍高斯机制
  • 讨论 δ (失败概率) 的阈值问题 == 讨论查询函数f 查询时 δ 的阈值问题

章节3

  • 通过 scaled version 确定敏感度上界 S

  • moments accountant 的功能 - 评估 δ 、跟踪 privacy loss

  • 讨论 模型训练时 δ 的阈值问题 == 模型训练的终止条件

  • 选择 合适的 S (clipping bound) 裁剪边界

  • 影响 σ选择 的两个因素 (失真率r 的上界、参与训练客户端数量的下界)

  • 方差 $ V_c $ 的作用

章节5

  • 选择一个模型的标准

  • “通信成本” 的定义

  • 动态调整 dp-preserving 机制。( r = σ t 2 / m t r=\sigma_t^2/m_t r=σt2/mt σ t \sigma_t σt 是方差, m t m_t mt 是随机抽样client子集中client的个数)

    1. 早期通信阶段
    r固定,σ 和 m 均减小时,模型精度几乎没有变化,模型损失减小。从而在隐私预算耗尽之前,可进行更多次的通信。
    
    2. 后期通信阶段
    较大的 m 才能获得准确性。
    
  • 对比标签拟合阶段和数据拟合阶段中的 V c V_c Vc U c U_c Uc 的变化含义。( V c V_c Vc :方差、 U c U_c Uc :更新规模)

在这里插入图片描述

标签拟合阶段:
客户端的更新是相似的,所以Vc较低;
对随机初始化的权重进行了大的更新,所以Uc很大。

数据拟合阶段:
每个客户端都在优化自己本地数据集,所以Vc上升;
本地的最优状态与全局模型很接近,所以Uc急剧缩小。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
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
发出的红包

打赏作者

Dataer__

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值