SlideShare a Scribd company logo
1 of 28
联邦学习维度坍缩的理解与缓解
汇报人: XXX
2023年12月27日
汇报提纲
一.背景介绍
二.相关工作
三.维度坍缩
四.FedDecorr
五.实验验证
六.总结展望
一、背景介绍
背景介绍
 研究问题
数据利用量与可用量的增大 ,带来了工业界和学术界对于数据
隐私的担忧。因此出现了联邦学习——一种分散的训练范例,可以
在不共享数据的情况下跨客户端进行协作训练。
联邦学习一个主要挑战是:
客户端之间本地训练数据分布的潜在差异,称为数据异质问题。
这种差异会导致客户的局部最优和期望的全局最优之间的激烈分歧,
从而可能导致全局模型的性能严重退化。
本文考虑在标
签分布异质
背景介绍
 当前工作
之前试图解决这一挑战的工作主要关注以下思路,其集中考虑模型参数:
1. 本地训练;
2. 全局聚合。
然而,这些方法由于过度参数化通常
会导致过高的计算负担或高通信成本 。
相 比 之 下 , 本 文 关 注 模 型 的 表 征
空 间 , 并 研 究 数 据 异 质 性 的 影 响 。
背景介绍
 本文贡献
本文围绕全局模型的维度坍缩展开:
1. 通过实验证明了数据异质性对全局模型的维度崩溃有着重要影响。
2. 发现了导致全局模型维度崩溃的两个潜在原因:
本地模型的维度崩溃;总体聚合操作对本地模型参数的影响。
3. 在理论上解释了数据异质性和维度崩溃之间的动态关系。
4. 提出了一种名为FedDecorr的新方法,通过在本地训练过程中
添加一种新的正则化项来减轻维度崩溃现象,并在各种数据异质
性设置下实现了一致的改进。
二、相关工作
相关工作 联邦学习
联邦 学习的最初算法是 FedAvg ,在
原文中就讨论过数据异质问题。其后工作
有模型参数改进、个性化模型、垂直联邦
学习。本文关注水平联邦学习。
模型融合
模型融合研究如何更好地合并不同的
模型并提升性能。其与联邦学习相比,有
训练数据相同和不同之别,访问可能与不
能之别。
维度坍缩
维度坍缩定义为:模型输出表征偏向
驻留在低位空间(流形)而非完整空间。
其在度量学习、自监督学习、类增量学习
中有研究。此处用于研究联邦学习数据异
质性和总体聚合。
梯度流_动力学
梯度流动力学的引入可在ℓ2 损失下分
析线性神经网络动力学,找到并优化低秩
解的更深层网络。本文关注交叉熵损失的
联邦学习并且侧重分析数据异质性而非数
据增强或网络深度。
特征去相关
特征去相关在多处有应用,如防止自
监督学习模式崩溃、提升泛化性、改进类
增量学习等。多用正则化或白化解决,本
文采用更加简单的正则化解决数据异质。
三、维度坍缩
维度坍缩的理论解释
 记号
梯度流_动力学
只考虑了线性神经网络层,而不考虑非线性激活
层。
对于𝐿 + 1 𝐿 ≥ 1 层的神经网络而言,在第𝑡个优
化时间步长时第𝑖层的权重记为𝑊𝑖 𝑡 ,则动力学表示为
𝑊𝑖 𝑡 = −
𝜕
𝜕𝑊𝑖
ℓ 𝑊1 𝑡 , … , 𝑊𝐿+1 𝑡
其中ℓ表示交叉熵损失。
𝑁个训练样本
输入数据维度为𝑑in
总的类别数为𝐶
第𝑖个样本记作𝑋𝑖 ∈ ℝ𝑑in
对应的独热编码标签为𝐲𝑖 ∈ ℝ𝐶
所有样本数据矩阵记作
𝑋 = 𝑋1, … , 𝑋𝑁 ∈ ℝ𝑑in×N
所有样本独热编码训练标签记作
𝐲 = 𝐲1, … , 𝐲𝑁 ∈ ℝ𝐶×N
维度坍缩的理论解释
 记号
整个模型的数据流动分为原始数据 𝑋𝑖 ,到输出表征
𝒛𝑖 𝑡 ∈ ℝ𝑑
,到输出的softmax概率向量𝛾𝑖 𝑡 ∈ ℝ𝐶
,其中
有:
𝛾𝑖(𝑡) = softmax(𝑊𝐿+1(𝑡)𝐳𝑖(𝑡))
= softmax(𝑊𝐿+1(𝑡)𝑊𝐿(𝑡) … 𝑊1(𝑡)𝑋𝑖)
对于整个模型而言,原始数据为
𝑋𝑖 ,设有𝐿 + 1层网络,第𝑡时刻的
前𝐿层模型记作Π 𝑡 ,则表征𝐳𝑖 𝑡 为
𝐳𝑖 𝑡 = 𝑊𝐿 𝑡 ⋯ 𝑊1 𝑡 𝑋𝑖
并且定义了𝜇𝑐 =
𝑁𝑐
𝑁
,𝑁𝑐表示第𝑐类的数据样本数量。定义𝐞𝑐
= 0, … , 0,1,0, … , 0 ,其中只有第𝑐个
变量为1,其余为0,则对于第𝑐类数据而言的平均输出和平均数据为𝛾𝑐 𝑡 =
1
𝑁𝑐
𝑖=1
𝑁
𝛾𝑖 𝑡 𝟏 𝐲𝑖 =
数据异质性的维度坍缩
 观察方法
数据异质性
标 签 异 质 的 不 同 数 据 异 质
性,由狄利克雷分布DirK 𝛼 决
定(𝛼越大越偏向数据同质,可
看 做 同 质 性 ) , 或 由 之 前 研 究
的 各 客 户 端 拥 有 类 别 数 确 定
(每个类别数越多越同质)。
模型的奇异值分解
首先获得所有数据𝐱𝑖 在模型上的平均表征。获得此模
型所有数据表征𝐳𝑖 ∀𝑖 ∈ 1, 𝑁 并取平均𝐳𝑖 =
1
𝑁 𝑖=1
𝑁
𝐳𝑖 。
再 获 得 模 型 奇 异 值 。 对 协 方 差 矩 阵 Σ =
1
N 𝑖=1
𝑁 (𝐳𝑖 −
数据异质性的维度坍缩
 模型观察方法
可以看见,随着数据异质性程度的增加,全
局和本地模型的更多的奇异值趋向于零。
这一观察结果表明,更强的数据异质性会导
致全局与本地模型出现更严重的维度坍缩。
不同数据异质性下的全局模型log奇异值
不同数据异质性下的本地模型log奇异值
此处使用奇异值分解来观察在不同数据异质
性下,全局模型与本地模型在所有数据上输
出的表征的奇异值。
数据异质性的维度坍缩
 本地模型与全局模型的比较
不同数据异质性下的本地模型与全局模型的奇异值差异
可 以 看 见 , R值 随 着 𝛼 的 减 小 而 增 大 , 所 以
数据异质性的增强会导致模型的维度坍缩。
𝑅 =
1
𝐾
𝑘=1
𝐾
lo g
𝜆𝑘
𝑙
𝜆𝑘
g
𝐾 是奇异值的总数,𝜆𝑘
𝑙
和𝜆𝑘
𝑔
分别是本地模型和
全局模型曲线的第𝑘个奇异值。
较小的R表示两个曲线之间的差距较小。
梯度流动力学分析
 假设条件
前𝐿层的权重矩阵的乘积表示为Π 𝑡 = 𝑖=𝐿
1
𝑊𝑖 𝑡 ,并分析Π(𝑡)的奇异值的行为。
假设条件1
初始权重矩阵满足:
∀𝑖 ∈ 1, 𝐿 − 1 → 𝑊𝑖+1
⊤
0 𝑊𝑖+1 0 = 𝑊𝑖
⊤
0 𝑊𝑖 0
假设条件2
任意时刻𝑡满足:
𝐮𝑘 𝑡 ⊤𝐯L+1,k′ t = 𝟏 k = k′
其中𝐮𝑘 𝑡 为Π 𝑡 的第𝑘个左奇异向量, 𝐯L+1,k′ t 为𝑊𝐿+1 𝑡 的第𝑘′个右奇异向量。
梯度流动力学分析
 奇异值变化速率
定理1 前述条件满足时,设𝜎𝑘 𝑡 𝑘 ∈ 𝑑 为Π t 的第𝑘大的奇异值,那么有:
𝜎𝑘(𝑡) = 𝑁𝐿 𝜎𝑘(𝑡) 2−
2
𝐿 × (𝜎𝑘(𝑡))
2
𝐿 + 𝑀 𝐮𝐿+1,𝑘(𝑡)
⊤
𝐺(𝑡)𝐯𝑘(𝑡)
其中𝑢𝐿+1,𝑘 𝑡 是𝑊𝐿+1 𝑡 的第𝑘个左奇异向量,𝑣𝑘 𝑡 是Π 𝑡 的第𝑘个右奇异向量,
𝑀是一个常数,𝐺 𝑡 定义为
𝐺(𝑡) =
𝑐=1
𝐶
𝜇𝑐(𝐞𝑐 − 𝛾𝑐(𝑡))𝑋𝑐
⊤
其中的变量如前定义。
梯度流动力学分析
 奇异值变化速率
𝜎𝑘(𝑡) = 𝑁𝐿 𝜎𝑘(𝑡) 2−
2
𝐿 × (𝜎𝑘(𝑡))
2
𝐿 + 𝑀 𝐮𝐿+1,𝑘(𝑡)
⊤
𝐺(𝑡)𝐯𝑘(𝑡)
𝐺(𝑡) =
𝑐=1
𝐶
𝜇𝑐(𝐞𝑐 − 𝛾𝑐(𝑡))𝑋𝑐
⊤
强烈的数据异质性会导致本地客户端的训练数据在全体数据类别数量占比上高
度不平衡,从而导致在某些情况下𝜇𝑐 → 0,因此导致𝐺(𝑡)低秩,从而导致𝜎𝑘(𝑡)只能在
更少数量的𝑘值有足够的大小,从而使得𝜎𝑘 𝑡 的演化速率仅对少部分的𝑘值有效,即
Π 𝑡 只有较少的奇异值在每次训练后会有显著的变化。同时低秩意味着矩阵所能表达
的维度偏低,即维度坍缩。
梯度流动力学分析
 奇异值变化速率
Π 𝑡 的协方差矩阵如下:
Σ(𝑡) =
1
𝑁
𝑖=1
𝑁
𝐳𝑖 𝑡 − 𝐳 𝑡 𝐳𝑖 𝑡 − 𝐳 𝑡
⊤
= Π 𝑡
1
𝑁
𝑖=1
𝑁
𝑋𝑖 − 𝑋 𝑋𝑖 − 𝑋 ⊤ Π(𝑡)⊤
从此协方差矩阵可以看出,Π 𝑡 的低秩会导致对于其协方差矩阵Σ 𝑡 的低秩,从
而模型表征之间的相关性减少,即维度坍缩。
四、FedDecorr
FedDecorr
 奇异值方差降低
可以通过降低奇异值的差异,从而防止矩阵尾部奇异值坍缩为0,公式如下:
𝐿singular 𝑤, 𝑋 =
1
𝑑
𝑖=1
𝑑
𝜆𝑖 −
1
𝑑
𝑗=1
𝑑
𝜆𝑗
2
但这个正则化项需要对所有数据表征进行SVD分解,计算成本过高,需要简化。
进行进行z-score归一化即𝐳𝑖 =
𝐳𝑖−𝐳
𝑉𝑎𝑟 𝐳
,可以得到𝐳𝑖的协方差矩阵等于其相关系数
矩阵,因此可以获得更加方便的正则化项的损失函数。
FedDecorr
 FedDecorr定义
命题1 对于有奇异值 𝜆1, ⋯ , 𝜆𝑑 的𝑑 × 𝑑维相关系数矩阵𝐾,有:
𝑖=1
𝑑
𝜆𝑖 −
1
𝑑
𝑗=1
𝑑
𝜆𝑗
2
= 𝐾 F
2
− 𝑑
其中 𝐾 F为矩阵𝐾的所有元素的平方和再开方。𝐿singular与 𝐾 F
2
的效果相同,而 𝐾 F
有着更高效的计算效率。由此即得到FedDecorr的正则化项定义:
𝐿FedDecorr 𝑤, 𝑋 =
1
𝑑2 𝐾 F
2
其中𝑤是模型参数,𝐾是表征相关矩阵。因此每个本地客户端的总目标改进为:
𝑚𝑖𝑛
𝑤
ℓ(𝑤, 𝑋, 𝐲) + 𝛽𝐿FedDecorr(𝑤, 𝑋)
其中ℓ是常规的交叉熵损失,𝛽为FedDecorr的正则化系数。
五、实验验证
实验验证
 FedDecorr效果
由表可见,无论是在Dirichlet分布
条件下,还是在将M类数据分配到各
个客户端的病态非iid条件下的数据分
区 , 都 有 FedDecorr 对 模 型 精 度
2%~9%的提升。
而 且 在 𝛼 = ∞ 的 同 质 情 况 下 ,
FedDecorr 对 TinyImageNet 依 然 有
2%的改进,说明FedDecorr还能解决
非数据异质带来的维度坍缩。
实验验证
 消融实验
不同𝛽 对模型精度的影响
总目标𝑚𝑖𝑛
𝑤
ℓ(𝑤, 𝑋, 𝐲) + 𝛽𝐿FedDecorr(𝑤, 𝑋)的𝛽 值
对于精度而言并无显著影响,故取𝛽 = 0.1。
不同客户端数量
对模型精度的影响
不同Epoch数
对模型精度的影响
由表可见,越多的
客 户 端 数 量 ,
FedDecorr的模型精
度提升效果反而越好。
由 表 可 见 , 虽 然
FedAvg的模型精度随
Epoch增多而先升后
降 , 但 是 FedDecorr
能持续有效。
实验验证
 方法对比
其 中 FedDecorr 项 应 用 与
FedAvg 上 。 由 表 可 见 ,
FedDecorr对每回合的训练时
间的影响很少。
由表可见,相较于其他区相
关方法,FedDecorr的精度提
升效果最好。
ResNet18 维 度 为 512 ,
ResNet32维度为64。由表可见,
FedDecorr对其他模型依然有
效,而且维度更大的模型的提
升效果比更小的更好。
不同框架的计算效率 不同去相关法的精度提升效果 不同模型的提升效果
六、总结展望
总结
本文通过理论观察和经验
分析,发现数据异质性会导致
模型的维度坍缩。并据此提出
了缓解维度坍缩的FedDecorr
方法,从而改善了异质数据下
的联邦学习。
总结展望
不足
1. 没有研究非线性层在维度
坍缩中是否具有影响;
2. 维度坍缩基于数据输出前
的模型表征,而没有关于
模型自身参数的直接解释;
3. Frobenius范数依然需要计
算整个矩阵参数的平方和。
展望
1. 研究非线性层是否有维度
坍缩的问题;
2. 研究针对模型自身参数进
行对维度坍缩的解释;
3. 研究更加简单有效、更加
具有实际意义的损失函数。
汇报人:XXX
2023年12月27日

More Related Content

Featured

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Understanding and Mitigating Dimensional Collapse in Federated Learning

Editor's Notes

  1. 由此可以解释数据异质性会导致Π 𝑡 偏向更小的秩(即秩与𝛼正相关)。
  2. 一轮训练分钟数