# 联邦学习

**联邦学习**（Federated learning，FL）是一种分布式机器学习方法，它在众多拥有数据的客户端（如手机、医院或机构）之间训练一个共享模型，方式是交换模型更新而非原始训练数据。每个客户端在本地用自己的数据训练模型，只将得到的更新发送给协调服务器，服务器将更新聚合为新的全局模型；训练数据始终不离开其来源地<sup>[1](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)</sup>。该方法由谷歌的H. Brendan McMahan、Daniel Ramage及其同事在2017年的论文《Communication-Efficient Learning of Deep Networks from Decentralized Data》中命名并形式化<sup>[1](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)</sup>。

| 关键事实 | 详情 |
|---|---|
| 核心机制 | 客户端在本地数据上计算对全局模型的更新；只传输更新，服务器对其求平均（联邦平均，FedAvg）<sup>[1](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)</sup> |
| 通信收益 | 与同步随机梯度下降相比，FedAvg将所需通信轮次减少了10至100倍<sup>[2](https://research.google/pubs/communication-efficient-learning-of-deep-networks-from-decentralized-data/)</sup> |
| 首次部署 | 谷歌于2017年4月宣布将联邦学习用于Gboard查询建议，训练数据保留在设备上<sup>[3](https://research.google/blog/federated-learning-collaborative-machine-learning-without-centralized-training-data/)</sup> |
| 主要统计挑战 | 客户端间的非独立同分布（非IID）数据会降低模型性能，并相对于集中式训练减慢收敛<sup>[4](https://www.sciencedirect.com/science/article/pii/S0925231221013254)</sup> |
| 主要隐私隐患 | 模型更新可能泄露训练数据；梯度反演攻击可从共享梯度中重建客户端数据<sup>[5](https://papers.neurips.cc/paper_files/paper/2019/hash/60a6c4002cc7b29142def8871531281a-Abstract.html)</sup> |
| 标准防御 | 安全聚合、同态加密、可信执行环境和差分隐私<sup>[6](https://www.nist.gov/blogs/cybersecurity-insights/protecting-model-updates-privacy-preserving-federated-learning)</sup> |
| 医疗成果 | 一个在20个机构间训练的联邦COVID-19模型，在预测24小时和72小时氧需求方面达到0.92以上的AUC<sup>[7](https://doi.org/10.1038/s41591-021-01506-3)</sup> |

## 工作原理

在标准架构中，一个中央服务器协调一个松散的客户端联邦。服务器分发当前的全局模型，每个客户端在自己的本地数据上执行若干轮训练，服务器对得到的模型更新求平均以形成下一个全局模型。此循环重复，直到模型达到所需性能<sup>[6](https://www.nist.gov/blogs/cybersecurity-insights/protecting-model-updates-privacy-preserving-federated-learning)</sup>。该平均算法——联邦平均（FedAvg）——将每个客户端上的本地随机梯度下降与服务器端的模型平均相结合，其实验显示对该场景中特有的不平衡和非IID数据分布具有鲁棒性<sup>[1](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)</sup>。

该设计在拓扑结构上不同于经典的分布式学习：联邦学习通常使用星型网络，中央服务器与每个客户端相连，而分布式学习仅将客户端连接到某些其他客户端，没有中心点<sup>[8](https://pmc.ncbi.nlm.nih.gov/articles/PMC11928227/)</sup>。通信是主要约束，因为高度迭代的优化通常需要低延迟、高吞吐地访问训练数据，而在联邦学习中这些数据位于连接受限的设备上<sup>[1](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)</sup><sup> • </sup><sup>[3](https://research.google/blog/federated-learning-collaborative-machine-learning-without-centralized-training-data/)</sup>。

## 起源与首批应用

2017年McMahan的论文将基于去中心化移动设备数据的训练确定为一个研究方向，提出了FedAvg，并在五种模型架构和四个数据集上进行了评估<sup>[1](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)</sup><sup> • </sup><sup>[2](https://research.google/pubs/communication-efficient-learning-of-deep-networks-from-decentralized-data/)</sup>。其动机示例是数据隐私敏感或相对于模型较大的移动用例：用于键盘预测的语言模型（输入的文本是自标注的），以及用于照片排序的图像模型（标签来自自然用户交互）<sup>[1](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)</sup>。

谷歌2017年4月的博客文章描述了部署路径：手机下载当前模型，利用设备上的数据改进它，并通过加密通信发送一个小而聚焦的更新，该更新与其他用户的更新求平均；任何单个更新都不会存储在云端<sup>[3](https://research.google/blog/federated-learning-collaborative-machine-learning-without-centralized-training-data/)</sup>。同一篇文章介绍了[安全聚合](https://www.edgepedia.org/zh/secure-aggregation)协议，它使用密码学使得在数百或数千用户参与时，服务器只能解密平均更新，而在求平均之前无法检查任何单个手机的更新<sup>[3](https://research.google/blog/federated-learning-collaborative-machine-learning-without-centralized-training-data/)</sup>。

## 非IID问题

决定性的统计困难在于，每个客户端上的数据通常不是独立同分布的（非IID）。从相同参数出发的本地模型因本地数据分布的异质性而收敛到不同的模型，且平均后的全局模型与在IID数据上训练的理想模型之间的偏差在训练过程中增大，从而减慢收敛并恶化性能<sup>[4](https://www.sciencedirect.com/science/article/pii/S0925231221013254)</sup>。综述将该问题按横向和纵向划分、按参数和非参数模型进行分类，并编目了补救措施，包括数据共享、客户端选择、个性化和聚合算法的改动<sup>[4](https://www.sciencedirect.com/science/article/pii/S0925231221013254)</sup><sup> • </sup><sup>[9](https://www.sciencedirect.com/science/article/pii/S0167739X22001686)</sup>。非IID数据还影响参与：研究表明它不仅损害模型准确性，还可能损害用户参与联邦过程的意愿<sup>[9](https://www.sciencedirect.com/science/article/pii/S0167739X22001686)</sup>。

除统计异质性外，实际系统还面临模型异质性（客户端模型结构可能不同）以及计算、存储和通信方面的资源异质性<sup>[10](https://www.sciencedirect.com/science/article/pii/S0016003222009346)</sup>。一份2025年的核心挑战综述将异质性、计算开销、通信瓶颈、客户端选择、聚合与优化以及隐私保护列为六大中心问题<sup>[11](https://www.mdpi.com/2073-431x/15/3/155)</sup>。

## 隐私攻击

共享更新而非数据，这本身并不能保护隐私。研究表明，原始训练数据往往可以从模型更新中提取出来。Hitaj及其同事的早期演示训练了第二个AI模型，从数字识别模型的更新中重建训练数据<sup>[12](https://www.nist.gov/blogs/cybersecurity-insights/privacy-attacks-federated-learning)</sup>。NeurIPS 2019的论文《Deep Leakage from Gradients》（作者为Ligeng Zhu、Zhijian Liu和[Song Han](https://www.edgepedia.org/zh/song-han)）表明，私有训练集可以在少数几个梯度步骤内从公开共享的梯度中恢复，对图像实现像素级精确恢复，对文本实现词元级匹配<sup>[5](https://papers.neurips.cc/paper_files/paper/2019/hash/60a6c4002cc7b29142def8871531281a-Abstract.html)</sup>。更广泛地说，梯度反演攻击让窃听者或协议参与者能够从客户端与服务器的通信中部分恢复客户端的私有数据<sup>[13](https://arxiv.org/abs/2112.00059)</sup>。

第二类攻击针对训练完成后的模型，从模型参数中重建训练数据。深度网络尤其容易受到攻击，因为它们在许多情况下似乎会记忆训练数据；已演示的训练数据提取涉及图像生成模型和GPT-2等大型语言模型<sup>[12](https://www.nist.gov/blogs/cybersecurity-insights/privacy-attacks-federated-learning)</sup>。

## 防御

防御分为输入隐私（在训练期间保护模型更新）和输出隐私（控制训练后的模型泄露什么）。

**安全聚合。** 安全聚合协议仅向聚合器揭示模型更新的平均值，同时保护单个更新。一种简单的构造使用加法同态秘密共享：每个参与者将其更新拆分为份额，分发给其他参与者，后者将收到的份额求和并将结果发送给聚合器，聚合器可以将它们组合成原始更新之和，但无法访问任何单个更新<sup>[6](https://www.nist.gov/blogs/cybersecurity-insights/protecting-model-updates-privacy-preserving-federated-learning)</sup>。

**同态加密。** 参与者用共同的公钥加密其更新，聚合器在不解密的情况下将加密更新相加。由于聚合器不得持有秘密密钥，部署通常需要另一个参与者仅解密聚合后的模型，或在参与者之间对密钥进行秘密共享的门限方案<sup>[6](https://www.nist.gov/blogs/cybersecurity-insights/protecting-model-updates-privacy-preserving-federated-learning)</sup>。

**可信执行环境。** 诸如英特尔软件防护扩展（SGX）之类的安全飞地让程序在加密数据上计算而不向CPU所有者泄露数据，避免了昂贵的密码学开销，但安全性随后取决于CPU制造商的可信度<sup>[6](https://www.nist.gov/blogs/cybersecurity-insights/protecting-model-updates-privacy-preserving-federated-learning)</sup>。

**差分隐私。** 对于输出隐私，差分隐私被描述为最全面的方法，并被英美PETs奖挑战赛中的许多解决方案所采用<sup>[12](https://www.nist.gov/blogs/cybersecurity-insights/privacy-attacks-federated-learning)</sup>。

## 医疗保健中的应用

医疗保健是领先的应用领域，因为患者数据受法律保护，不能离开持有它们的机构<sup>[8](https://pmc.ncbi.nlm.nih.gov/articles/PMC11928227/)</sup>。在2020年《Scientific Reports》的一项研究中，10个机构间的联邦学习产生的模型达到了集中式数据所实现质量的99%，作者发现，通过保护数据隐私的协作增加数据访问对模型质量的益处，大于协作方法引入的误差<sup>[14](https://www.nature.com/articles/s41598-020-69250-1)</sup>。

EXAM模型使用联邦学习在来自全球20个机构的数据上训练，从生命体征、实验室数据和胸部X光片预测有症状COVID-19患者的未来氧需求。它在预测急诊就诊后24小时和72小时的结果方面，平均AUC高于0.92，参与站点平均AUC提高16%，与单站点训练的模型相比泛化能力平均提高38%<sup>[7](https://doi.org/10.1038/s41591-021-01506-3)</sup>。综述文献将医疗联邦学习应用分为医学影像、疾病预测、电子健康记录分析和药物发现，并将数据异质性、通信效率低下、安全风险和模型收敛列为反复出现的挑战<sup>[15](https://www.sciencedirect.com/science/article/pii/S0045790626002673)</sup>。

## 标准化与开放问题

IEEE标准3187-2024于2024年12月19日发布，为可信联邦机器学习框架提供了指南，涉及隐私、安全、性能和效率之间的权衡、生命周期监督和可解释性<sup>[16](https://standards.ieee.org/ieee/3187/10959/)</sup>。综述指出，针对非IID数据的一些补救措施（如数据共享和知识蒸馏）本身会增加隐私暴露的风险，且尚无定量指标能衡量它们造成的隐私泄露程度<sup>[4](https://www.sciencedirect.com/science/article/pii/S0925231221013254)</sup>。比较集中式和去中心化联邦学习的理论工作已证明，在一般光滑非凸目标上，集中式联邦学习比去中心化泛化得更好，且去中心化方法需要特定的网络拓扑以避免随着训练规模增长而出现性能崩溃<sup>[17](https://pubmed.ncbi.nlm.nih.gov/41442306/)</sup>。

## References

1. [H. B. McMahan et al. (2017). Communication-Efficient Learning of Deep Networks from Decentralized Data. AISTATS.](https://proceedings.mlr.press/v54/mcmahan17a/mcmahan17a.pdf)
2. [Communication-Efficient Learning of Deep Networks from Decentralized Data, Google Research](https://research.google/pubs/communication-efficient-learning-of-deep-networks-from-decentralized-data/)
3. [Federated Learning: Collaborative Machine Learning without Centralized Training Data, Google Research Blog (April 6, 2017)](https://research.google/blog/federated-learning-collaborative-machine-learning-without-centralized-training-data/)
4. [Federated learning on non-IID data: A survey, Neurocomputing 465 (2021)](https://www.sciencedirect.com/science/article/pii/S0925231221013254)
5. [L. Zhu, Z. Liu, S. Han (2019). Deep Leakage from Gradients. NeurIPS 32.](https://papers.neurips.cc/paper_files/paper/2019/hash/60a6c4002cc7b29142def8871531281a-Abstract.html)
6. [Protecting Model Updates in Privacy-Preserving Federated Learning, NIST Cybersecurity Insights (March 21, 2024)](https://www.nist.gov/blogs/cybersecurity-insights/protecting-model-updates-privacy-preserving-federated-learning)
7. [Federated learning for predicting clinical outcomes in patients with COVID-19, Nature Medicine 27 (2021)](https://doi.org/10.1038/s41591-021-01506-3)
8. [A comprehensive experimental comparison between federated and centralized learning, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC11928227/)
9. [A state-of-the-art survey on solving non-IID data in Federated Learning, Future Generation Computer Systems 135 (2022)](https://www.sciencedirect.com/science/article/pii/S0167739X22001686)
10. [Towards efficient communications in federated learning: A contemporary survey, Computer Communications](https://www.sciencedirect.com/science/article/pii/S0016003222009346)
11. [Federated Learning: A Survey of Core Challenges, Current Methods, and Opportunities, MDPI Computers (2025)](https://www.mdpi.com/2073-431x/15/3/155)
12. [Privacy Attacks in Federated Learning, NIST Cybersecurity Insights (January 24, 2024)](https://www.nist.gov/blogs/cybersecurity-insights/privacy-attacks-federated-learning)
13. [Evaluating Gradient Inversion Attacks and Defenses in Federated Learning, arXiv](https://arxiv.org/abs/2112.00059)
14. [Federated learning in medicine: facilitating multi-institutional collaborations without sharing patient data, Scientific Reports 10 (2020)](https://www.nature.com/articles/s41598-020-69250-1)
15. [A survey: Federated learning in healthcare, Computers and Electrical Engineering 135 (2026)](https://www.sciencedirect.com/science/article/pii/S0045790626002673)
16. [IEEE 3187-2024: IEEE Guide for Framework for Trustworthy Federated Machine Learning](https://standards.ieee.org/ieee/3187/10959/)
17. [Toward Understanding Generalization and Stability Gaps Between Centralized and Decentralized Federated Learning, IEEE TPAMI](https://pubmed.ncbi.nlm.nih.gov/41442306/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Ensemble, boosting, and transfer methods › Stacking and model combination

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/federated-learning

English original: https://www.edgepedia.org/federated-learning
