Skip to content

Commit 7066c87

Browse files
update chap 4
1 parent eac379b commit 7066c87

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

‎lectures/Chapter4/lr_mup.ipynb‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,33 @@
55
"id": "583a9274",
66
"metadata": {},
77
"source": [
8-
"# Practical concerns on training stability\n",
8+
"# Practical concerns on large-scale training\n",
99
"\n",
1010
"So far we have witnessed quite some modern optimizers, are we ready to go ahead and apply them directly on training extreme large models? The answer is no. For example, we still don't know how to choose learning rate, how to make it efficient on multiple (sometimes hundred or thousands of) GPUs, etc. In this section we briefly discuss several techniques popular in practice. We will not be able to provide all techincal details but will introduce related concepts and references for further readings.\n",
1111
"\n",
1212
"## lr scheduler\n",
1313
"\n",
14+
"Let's begin with the first topic: how to choose the most important hyperparameter, namely the learning rate. Let's take a look at the AdamW algorithm again.\n",
15+
"\n",
16+
"````{prf:algorithm} AdamW\n",
17+
":label: alg:adamw_again\n",
18+
"\n",
19+
"- **Input**: initial point $\\vw^0$, stepsize sequence $\\{ \\eta_t \\}_{t \\geq 0}$, max. no. of iterations $T$, momentum parameter $(\\beta_1,\\beta_2)$, weight decay parameter $\\lambda$.\n",
20+
"\n",
21+
"- For $t=0,1,2,..., T-1$,\n",
22+
"```{math}\n",
23+
"\\begin{split}\n",
24+
"\\xi_{i_{j,t}} &\\sim {\\cal D} \\text{ (draw i.i.d. samples)} \\\\\n",
25+
"\\vg^t &\\leftarrow \\frac{1}{B}\\sum_{j=1}^{B}\\nabla \\ell(\\vw^t, \\xi_{i_{j,t}}) \\\\\n",
26+
"\\vm^t &\\leftarrow \\beta_1\\vm^{t-1} + (1-\\beta_1)\\vg^t \\\\\n",
27+
"\\vv^t &\\leftarrow \\beta_2\\vv^{t-1} + (1-\\beta_2)\\vg^t\\odot \\vg^t \\\\\n",
28+
"\\hat{\\vm}^t &\\gets \\frac{\\vm^t}{1-\\beta_1^t},\\ \\hat{\\vv}^t \\gets \\frac{\\vm^t}{1-\\beta_2^t} \\\\\n",
29+
"\\vw^{t+1} &\\leftarrow \\vw^{t} - \\eta_t \\frac{\\hat{\\vm}^t}{\\sqrt{\\hat{\\vv}^t}+\\epsilon} - \\eta_t\\lambda \\vw^{t}\n",
30+
"\\end{split}\n",
31+
"```\n",
32+
"- **Output**: last iterate $\\vw^T$, or the solution sequence $\\{ \\vw^t \\}_{t=1}^T$.\n",
33+
"````\n",
34+
"\n",
1435
"Constant schedule\n",
1536
"\n",
1637
"Linear and Cosine decay\n",

0 commit comments

Comments
 (0)