-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtalk4-personalization-2.tex
More file actions
300 lines (224 loc) · 10 KB
/
Copy pathtalk4-personalization-2.tex
File metadata and controls
300 lines (224 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
% to copy from the backup section of federated_learning_optim.tex
\begin{document}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\title[Personalization]{Talk 4: Personalization in Federated Learning -- II}
\date{2021-6-10}
% \institute[北京航空航天大学] % Your institution as it will appear on the bottom of every slide, may be shorthand to save space
% {
% 数学科学学院 \\ % Your institution for the title page
% \medskip
% \textit{wenh06@gmail.com} % Your email address
% 北京航空航天大学 \\
% 数学科学学院 \qquad 北京航空航天大学
% }
% \logo{\includegraphics[height=1.5cm]{logo}}
% \logoii{\includegraphics[height=1cm]{logo2}}
% \date{\footnotesize 2021年4月13日} % Date, can be changed to a custom date
\setlength{\belowdisplayskip}{5pt} \setlength{\belowdisplayshortskip}{5pt}
\setlength{\abovedisplayskip}{5pt} \setlength{\abovedisplayshortskip}{5pt}
%------------------------------------------------
\begin{frame}
\titlepage % Print the title page as the first slide
\end{frame}
\begin{frame}
\frametitle{Personalization for FL}
{\bfseries When does one need personalization?}
\vspace{0.2em}
\noindent --- When data across clients are ``enough'' non-IID, which is more realistic.
\pause
\vspace{0.8em}
{\bfseries Means of personalization:}
\begin{itemize}
\item Federated Multi-Task Learning (+ regularization / proximal term), e.g. \cite{smith2017mocha}
\item Model-Agnostic Meta Learning, e.g. \cite{finn2017maml}
\item Local Fine-tuning.
\item etc.
\end{itemize}
\end{frame}
%------------------------------------------------
\section[MAML]{Model-Agnostic Meta Learning}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{Model-Agnostic Meta Learning}
\begin{quote}
``The goal of meta-learning is to train a model on a {\bfseries variety of {\color{red} learning tasks}}, such that it can solve new learning tasks using only a small number of training samples.'' \hfill -- \cite{finn2017maml}
\end{quote}
\vspace{0.6em}
i.e. over a distribution of learning tasks $p(\mathcal{T})$, where
$$\mathcal{T} = \{ \mathcal{L}(\{(x_t,a_t)\}), q(x_1), q(x_{t+1}|x_t, a_t), H \}$$
with
\begin{align*}
& (x_t,a_t): & \text{data points} \\
& \mathcal{L}: & \text{loss function} \\
& q(x_1): & \text{initial distribution} \\
& q(x_{t+1}|x_t, a_t): & \text{transition} \\
& H: & \text{episode length}
\end{align*}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{Model-Agnostic Meta Learning -- Intuition}
\begin{block}{Intuition of MAML}
Some internal representations are more transferrable than others. MAML should encourage the emergence of such general-purpose representations via searching for model parameters that are sensitive to changes in the task.
\end{block}
\begin{figure}
\centering
\includegraphics[keepaspectratio,width=.65\textwidth]{images/maml.png}
\end{figure}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{Model-Agnostic Meta Learning -- Formulation}
Mathematically, MAML can be formulated as a (bi-level?) optimization problem
\begin{align*}
& \text{minimize} \quad \sum\limits_{\mathcal{T}_i\sim p(\mathcal{T})} \mathcal{L}_{\mathcal{T}_i} (f_{\theta_i'}) \\
% & \text{where} \quad \theta_i' = \argmin \{ \mathcal{L}_{\mathcal{T}_i} (f_{\theta}) \}
& \text{where} \quad \theta_i' = \theta - \alpha \nabla_{\theta} \mathcal{L}_{\mathcal{T}_i}(f_{\theta})
\end{align*}
\begin{figure}
\centering
\includegraphics[keepaspectratio,width=.65\textwidth]{images/maml.png}
\end{figure}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{Model-Agnostic Meta Learning -- Algorithm}
\begin{algorithm}[H]
\SetAlgoNoLine
\DontPrintSemicolon
{\bfseries Require:} $p(\mathcal{T})$ distribution over tasks\;
{\bfseries Require:} $\alpha, \beta$ step size hyper-params\;
randomly initialize model params $\theta$\;
\While{not done}{
Sample batch of tasks $\mathcal{T}_i \sim p(\mathcal{T})$\;
\For{all $\mathcal{T}_i$}{
Evaluate $\nabla_{\theta} \mathcal{L}_{\mathcal{T}_i}(f_{\theta})$ w.r.t. $K$ samples\;
Compute adapted parameters with gradient descent $\theta'_i = \theta - \alpha \nabla_{\theta} \mathcal{L}_{\mathcal{T}_i}(f_{\theta})$\;
}
Update \colorbox{pink}{$\theta \leftarrow \theta - \beta \nabla_{\theta} \sum\limits_{\mathcal{T}_i\sim p(\mathcal{T})} \mathcal{L}_{\mathcal{T}_i} (f_{\theta_i'})$} (gradient through gradients, instead of ``naive'' averaging)\;
}
\caption{MAML\cite{finn2017maml}}
\end{algorithm}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{Model-Agnostic Meta Learning -- Applications}
In deep learning, a very commonly used architecture is as follows:
$$\text{input} \to \framebox{CNN (encoder)} ( \to \text{attn}) \to \text{task specific module}$$
tasks can be one or more of
\begin{itemize}
\item classification (global pooling + linear)
\item sequence labelling (linear)
\item segmentation (upsample)
\item object detection
\item etc.
\end{itemize}
or many sub-tasks of the above (current main concern for meta-learning).
MAML forces the feature extractor (or called encoder, etc.) to capture general-purpose internal representations (features).
\end{frame}
%------------------------------------------------
\section[FMTL]{Federated Multi-Task Learning}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{Federated Multi-Task Learning}
\begin{itemize}
\pgfsetfillopacity{0.4}
\item Mixture of global and local \cite{hanzely2020federated}:
$$\text{minimize} \quad \sum\limits_{i=1}^N f_i(x_i) + \dfrac{\lambda}{2} \sum\limits_{i=1}^N \lVert x_i - {\color{red} \overline{x}} \rVert^2$$
\pgfsetfillopacity{1}
\item pFedMe (bi-level) \cite{t2020pfedme} (and similarly EASGD\cite{zhang2015easgd}):
\begin{align*}
& \text{minimize} \quad \sum\limits_{i=1}^N F_i(x), \\
& \text{where} \quad F_i(x) = \min \left\{ f_i(x_i) + \dfrac{\lambda}{2} \lVert x_i - {\color{red} x}\rVert^2 \right\}
\end{align*}
\pgfsetfillopacity{0.4}
\item FedU \cite{dinh2021fedu}:
$$\text{minimize} \quad \sum\limits_{i=1}^N f_i(x_i) + \dfrac{\lambda}{2} \sum\limits_{i=1}^N {\color{red} \sum\limits_{j\in\mathcal{N}_i}} \lVert x_i - {\color{red} x_j} \rVert^2$$
\end{itemize}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{pFedMe -- Formulation}
pFedMe (Personalized Federated Learning with Moreau Envelopes (or proximity operator)) is formulated as the following bi-level optimization problem in \cite{t2020pfedme}
\begin{align*}
& \text{minimize} \quad \sum\limits_{i=1}^N F_i(x), \\
& \text{where} \quad F_i(x) = \min \left\{ f_i(x_i) + \dfrac{\lambda}{2} \lVert x_i - x \rVert^2 \right\}
\end{align*}
which is equivalent to (as in \cite{zhang2015easgd})
\begin{align*}
& \text{minimize} \quad \sum\limits_{i=1}^N \left( f_i(x_i) + \dfrac{\lambda}{2} \lVert x_i - x \rVert^2 \right)
\end{align*}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{pFedMe -- Algorithm}
\begin{algorithm}[H]
\SetAlgoNoLine
\DontPrintSemicolon
{\bfseries Input:} $T,R,S,\lambda,\eta,\beta,x^0$\;
\For{$t = 0,\cdots,T-1$}{
Server sends $x^t$ to all clients\;
\For{$i = 1,\cdots,N$}{
$x_{i,0}^t = x^t$\;
\For{$r = 0,\cdots, R-1$}{
Sample a fresh mini-batch $\mathcal{D}_i$, and find an approximate $x_i(x_{i,r}^t)$ to the problem $\text{min} \{ \ell_i(x_i;\mathcal{D}_i) + \frac{\lambda}{2}\lVert x_i-x_{i,r}^t \rVert^2 \}$\;
Local update $x_{i,r+1}^t = x_{i,r}^t - \eta\lambda(x_{i,r}^t-x_i(x_{i,r}^t))$\;
}
Server uniformly samples a subset of clients $\mathcal{S}^t$, each of which sends the local $x_{i,R}^t$ to the server\;
}
Sever update $x^{t+1} = (1-\beta)x^t + \beta \sum \frac{x_{i,R}^t}{\# \mathcal{S}^t}$
}
\caption{pFedMe\cite{t2020pfedme}}
\end{algorithm}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{pFedMe -- Algorithm}
\begin{block}{pFedMe observations}
\begin{itemize}
\item global model $x$ converges (if converges) to the average of local models, which can be inferred from
$$x^* = \min_{x} \{ \sum\limits_{i=1}^N \left( f_i(x_i) + \dfrac{\lambda}{2} \lVert x_i - x \rVert^2 \right) \} = \frac{1}{N} \sum\limits_{i=1}^N x_i$$
\item local updates are not ``totally local'', i.e. the loop $r = 0, \cdots, R$ computes the ``global objective'' $\min\{F_i(x)\}$ locally, to reduce communication.
\end{itemize}
\end{block}
\end{frame}
%------------------------------------------------
% Page 15
\begin{frame}
\frametitle{EASGD and ADMM}
pFedMe originates from EASGD \cite{zhang2015easgd}, which reformulate the original distributed EM problem $\displaystyle \min_x \expectation [\ell(x,\xi)]$ as a consensus problem as the following form
\begin{align*}
& \text{minimize} \quad \sum\limits_{i=1}^N \left( f_i(x_i) + \dfrac{\lambda}{2} \lVert x_i - x \rVert^2 \right)
\end{align*}
More usually, it is formulated as a minimax (primal-dual) problem to be solved with ADMM
$$\max_{y_i}\min_{x_i,x} \sum_{i=1}^N \left( f_i(x_i) + \dfrac{\lambda}{2} \lVert x_i - x \rVert^2 - \langle y_i, x_i-x \rangle \right)$$
Authors of \cite{zhang2015easgd} claims that EASGD is more stable than ADMM, which however has to be checked!
\end{frame}
%------------------------------------------------
% Page 15
% \begin{frame}
% \frametitle{EASGD and ADMM}
% TODO: collect discussions on relations of EASGD and pFedMe, and moreover FedU
% \end{frame}
%------------------------------------------------
% Page 15
\begin{frame}[allowframebreaks]
\frametitle{References}
{\footnotesize
\bibliographystyle{ieeetr}
\bibliography{references}
}
\end{frame}
%------------------------------------------------
\end{document}