Multi-Task Learning as Multi-Objective Optimization 阅读笔记


通常multi-task learning的优化目标是多个任务的线性组合,但这只在这多个任务是不竞争的情况下是有效的。为了解决这个问题,文章将multi-task learning当做multi-objective optimization来处理,以寻找帕累托最优解(Pareto optimal solution)。作者使用gradient-based multi-objective optimization来优化multi-objective optimization问题。另外考虑到在参数量大和任务个数多的情况下直接优化复杂度很高,于是作者提出优化一个上界,并证明在现实情况中,优化这个上界可以得到帕累托最优解。

Multi-Task Learning(MTL)

假设有一组任务 Y t t ∈ [ T ] {\mathcal Y^t }_{t\in[T]} Ytt[T],以及独立同分布的数据 { x i , y i 1 , … , y i T } i ∈ [ N ] \{x_i,y_i^1,\ldots,y_i^T\}_{i\in[N]} {xi,yi1,,yiT}i[N],其中 y i t y_i^t yit是第 i i i个数据点的第 t t t个任务的标签。考虑预测函数 f t ( x ; θ s h , θ t ) : X → Y t f^t(x;\theta^{sh},\theta^t):\mathcal X \to \mathcal Y^t ft(x;θsh,θt):XYt,其中 θ s h \theta^{sh} θsh是不同任务共享的参数, θ t \theta^{t} θt是任务 t t t独立的参数。定义任务 t t t的损失函数 L t ( ⋅ , ⋅ ) : Y t × Y t → R + \mathcal L^t(\cdot, \cdot):\mathcal Y^t \times \mathcal Y^t\to \mathbb R^+ Lt(,):Yt×YtR+
大多数MTL任务优化下面的经验损失,也就是多个任务的线性组合:
min ⁡ θ s h , θ i , i = 1 , … , T ∑ t = 1 T c t L t ^ ( θ s h , θ t ) (1) \min_{\theta^{sh}, \theta^i,i=1,\ldots,T} \sum_{t=1}^T c^t \hat{\mathcal L^t}(\theta^{sh}, \theta^{t})\tag{1} θsh,θi,i=1,,Tmint=1TctLt^(θsh,θt)(1) c t c^t ct是任务的系数, L t ( θ s h , θ t ) ^ \hat{\mathcal L^t(\theta^{sh}, \theta^{t})} Lt(θsh,θt)^是经验损失,定义为对样本求平均 1 N ∑ i L ( f t ( x i ; θ s h , θ t ) , y i t ) \frac{1}{N}\sum_i\mathcal L(f^t(x_i;\theta^{sh},\theta^t),y_i^t) N1iL(ft(xi;θsh,θt),yit)

Multi-Objective Optimization(MOO)

MTL可以表示成MOO,也就是优化一组相互竞争的目标。MOO的目标函数是
min ⁡ θ s h , θ i , i = 1 , … , T L ( θ s h , θ 1 , … , θ T ) = min ⁡ θ s h , θ i , i = 1 , … , T ( L t ^ ( θ s h , θ 1 ) , … , L t ^ ( θ s h , θ T ) ) ⊤ \min_{\theta^{sh}, \theta^i,i=1,\ldots,T}L(\theta^{sh},\theta^1,\ldots,\theta^T)=\min_{\theta^{sh}, \theta^i,i=1,\ldots,T} (\hat{\mathcal L^t}(\theta^{sh}, \theta^{1}),\ldots,\hat{\mathcal L^t}(\theta^{sh}, \theta^{T}))^\top θsh,θi,i=1,,TminL(θsh,θ1,,θT)=θsh,θi,i=1,,Tmin(Lt^(θsh,θ1),,Lt^(θsh,θT))注意MOO和上面公式(1)不同,MOO的目标不是scalar,而是vector。MOO的目标是求帕累托最优解。MTL的帕累托最优定义如下:
在这里插入图片描述

Multiple Gradient Descent Algorithm

对于上面的问题,帕累托最优解存在的必要条件是:
在这里插入图片描述
满足上面条件的点称为Pareto stationary point。
考虑下面的问题
在这里插入图片描述
可以证明上面问题的解如果使得函数值为零,则 ∑ t = 1 T α t ∇ θ s h L t ^ ( θ s h , θ t ) \sum_{t=1}^T\alpha^t \nabla_{\theta^{sh}}\hat{\mathcal L^t}(\theta^{sh}, \theta^{t}) t=1TαtθshLt^(θsh,θt)是Pareto stationary point,否则 ∑ t = 1 T α t ∇ θ s h L t ^ ( θ s h , θ t ) \sum_{t=1}^T\alpha^t \nabla_{\theta^{sh}}\hat{\mathcal L^t}(\theta^{sh}, \theta^{t}) t=1TαtθshLt^(θsh,θt)就是提升所有任务的下降方向。
类似单目标优化(Single-Objective Optimization)的梯度下降法,MOO可以用Multiple Gradient Descent Algorithm(MGDA)求解。

优化算法

针对MTL任务的MOO形式的优化算法如下图algorithm2所示。先在任务独立的参数 θ t \theta^{t} θt上做梯度下降,再用问题(3)的解在共享的参数 θ s h \theta^{sh} θsh上做梯度下降,对应1-5行。
在这里插入图片描述

现在的问题主要在公式(3)的求解上。公式(3)是带约束的优化问题,等同于在输入点构成的凸包(convex hull)上找一个最小范数的点。这个问题被广泛的研究过,他们假设输入点很多,点的维度很低。但在MTL的问题中,输入点是任务数,往往很少,点的维度是共享的参数数,数量很大。因此,作者提出了新的优化方法,利用Frank-Wolfe algorithm。

Frank-Wolfe algorithm是针对带约束的凸优化问题的一种一阶优化算法。类似梯度下降算法是一个迭代优化的算法。简单来说,在每次迭代中,先求寻找优化的方向,再寻找优化的步长。Wiki上Frank-Wolfe algorithm的算法流程如下:

在这里插入图片描述
公式(3)的优化目标可以写作 α ⊤ M α \mathbf \alpha^\top \mathbf M \mathbf \alpha αMα M \mathbf M M是对称矩阵。
根据向量的求导公式 https://en.wikipedia.org/wiki/Matrix_calculus
∂ α ⊤ M α ∂ α = 2 α ⊤ M \frac{\partial \mathbf \alpha^\top \mathbf M \mathbf \alpha}{\partial \mathbf \alpha} = 2\mathbf \alpha^\top \mathbf M ααMα=2αM
可以看到Algorithm2的第10行在寻找梯度最大的坐标轴方向。第11行在寻找优化的步长。

其中在每次迭代中寻找优化的步长的优化算法如下图algorithm1所示。
在这里插入图片描述
Figure1是对Algorithm1的可视化解释。寻找 θ \theta θ θ ‾ \overline \theta θ组成的凸包中模最小的点。
在这里插入图片描述

针对Encoder-Decoder情况的进一步优化

注意到algorithm2需要对每个任务计算 ∇ θ s h L ^ ( θ s h , θ t ) \nabla_{\theta^{sh}} \hat{\mathcal L}(\theta^{sh},\theta^t) θshL^(θsh,θt),也就需要对共享参数做T次反向传播。这导致一个前向传播后需要T次反向传播。作者提出算法优化上界,使得一次前向传播只需要一次反向传播。
这需要对模型的结构做一定的假设。假设模型有下面的结构:
在这里插入图片描述
也就是先经过共享参数的函数 g g g,再通过各个任务相关的函数 f t f^t ft。定义 Z = ( z 1 , … , z N ) Z=(z_1,\ldots,z_N) Z=(z1,,zN),其中 z i = g ( x i ; θ s h ) z_i=g(x_i;\theta^{sh}) zi=g(xi;θsh)。使用链式法则可以得到
在这里插入图片描述
使用上界替换,并去掉常数项 ∥ ∂ Z ∂ θ s h ∥ \|\frac{\partial \mathbf Z}{\partial \mathbf \theta^{sh}}\| θshZ,公式(3)变为MGDA-UB (Multiple Gradient Descent Algorithm – Upper Bound)
在这里插入图片描述
MGDA-UB的基本形式和公式(3)是一样的,所以依然可以用algorithm2求解,只需要将对共享参数的导数,改为对中间表示 z \mathbf z z的导数。MGDA需要对每个任务计算 ∇ θ s h L ^ ( θ s h , θ t ) \nabla_{\theta^{sh}} \hat{\mathcal L}(\theta^{sh},\theta^t) θshL^(θsh,θt),而MGDA-UB只需要计算 ∇ z L ^ ( θ s h , θ t ) \nabla_{\mathbf z} \hat{\mathcal L}(\theta^{sh},\theta^t) zL^(θsh,θt),这部分虽然也要计算T次,但是本来在优化 θ t \theta^{t} θt的过程中就要对每个任务分别计算,MGDA-UB使得对每个任务分别计算梯度到中间层就结束了。虽然algorithm2的第5行依然需要对共享参数的求导,但这可以通过先把各个任务的损失加权求和,再进行一次反传求导。

虽然MGDA-UB是原问题的近似,但作者证明,在温和的假设下,可以得到帕累托最优解:
在这里插入图片描述

思考

虽然作者将multi-task learning当做multi-objective optimization来处理,没有显示定义各个任务的权重 c t c^t ct,但在求解multi-objective optimization的过程中,实际上还是对每个任务有一个权重 α t \alpha^t αt,并在训练迭代的过程中动态调整了每个任务的权重。

一些论文中遇到的名词

inductive bias

https://en.wikipedia.org/wiki/Inductive_bias
对于训练样本,就是做拟合,但是未见样本怎么去预测呢?需要一定的假设条件。
对未见样本做预测时使用的假设条件。比如SVM中,最大化margin;KNN中,假设特征空间中近邻的样本有相同的类别。

Pareto optimal

https://en.wikipedia.org/wiki/Pareto_efficiency
帕累托最优所指的情况要求有多个优化目标,指的是不能在不损失其他目标的情况下优化一个目标。

Frank-Wolfe algorithm

https://en.wikipedia.org/wiki/Frank%E2%80%93Wolfe_algorithm
一阶迭代优化算法,优化带约束的凸函数。
收敛速度sublinear。

  • 20
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 13
    评论
Multi-objective evolutionary federated learning (MEFL) is a machine learning approach that combines the principles of multi-objective optimization and federated learning. Multi-objective optimization is a technique that aims to optimize multiple objectives simultaneously, while federated learning is a decentralized machine learning approach that allows multiple devices to train a model collaboratively without sharing their data. MEFL is designed to overcome the limitations of traditional federated learning approaches, which often suffer from issues related to privacy, communication, and scalability. By using multi-objective optimization, MEFL can optimize the performance of the federated learning algorithm while also addressing these issues. MEFL works by dividing the optimization problem into multiple objectives, such as minimizing the loss function, reducing communication costs, and preserving privacy. A genetic algorithm is then used to optimize these objectives simultaneously, producing a set of Pareto-optimal solutions that represent the trade-offs between the different objectives. These Pareto-optimal solutions can then be used to select the best model for deployment, depending on the specific requirements of the application. MEFL has been shown to be effective in a wide range of applications, including image classification, natural language processing, and speech recognition. Overall, MEFL represents a promising approach to federated learning that can improve the privacy, communication, and scalability of the algorithm while also optimizing its performance.
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值