Commit da5fd39d by 单韦乔

合并分支 'shanweiqiao' 到 'caorunzhe'

15.2和15.3文字(还需修改)

查看合并请求 !513
parents 76491b8b a82d5858
......@@ -4,21 +4,21 @@
\node [anchor=north,rectangle, inner sep=0mm,minimum height=1.2em,minimum width=2em,rounded corners=5pt,thick] (n1) at (0, 0) {编码端};
\node [anchor=west,rectangle, inner sep=0mm,minimum height=1.2em,minimum width=0em,rounded corners=5pt,thick] (n2) at ([xshift=3.5em,yshift=-0.5em]n1.east) {$z_0$};
\node [anchor=west,rectangle, inner sep=0mm,minimum height=1.2em,minimum width=0em,rounded corners=5pt,thick] (n2) at ([xshift=3.5em,yshift=-0.5em]n1.east) {$\mathbi{X}$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n3) at ([xshift=3.5em,yshift=0em]n2.east) {$z_1$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n3) at ([xshift=3.5em,yshift=0em]n2.east) {$\mathbi{x}_1$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n4) at ([xshift=3.5em,yshift=0em]n3.east) {$z_2$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n4) at ([xshift=3.5em,yshift=0em]n3.east) {$\mathbi{x}_2$};
\node [anchor=west,rectangle, inner sep=0mm,minimum height=1.2em,minimum width=1em,rounded corners=5pt,thick] (n6) at ([xshift=1.5em,yshift=0em]n4.east) {$\ldots$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n5) at ([xshift=3.5em,yshift=0em]n6.east) {$z_{l}$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n5) at ([xshift=3.5em,yshift=0em]n6.east) {$\mathbi{x}_l$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n7) at ([xshift=1.5em,yshift=0em]n5.east) {$z_{l+1}$};
\node [anchor=west,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=3em,fill=orange!20,rounded corners=5pt,thick] (n7) at ([xshift=1.5em,yshift=0em]n5.east) {$\mathbi{x}_{l+1}$};
\node [anchor=north,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=15em,fill=teal!17,rounded corners=5pt,thick] (n8) at ([xshift=0em,yshift=-3em]n4.south) {层正则化};
\node [anchor=north,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=15em,fill=purple!17,rounded corners=5pt,thick] (n9) at ([xshift=0em,yshift=-1em]n8.south) {$L_0\ \quad L_1\ \quad L_2\quad \ldots \quad\ L_l$};
\node [anchor=north,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=15em,fill=purple!17,rounded corners=5pt,thick] (n9) at ([xshift=0em,yshift=-1em]n8.south) {$\mathbi{X}\ \quad \mathbi{h}_1\ \quad \mathbi{h}_2\quad \ldots \quad\ \mathbi{h}_l$};
\node [anchor=north,rectangle,draw, inner sep=0mm,minimum height=1.2em,minimum width=15em,fill=teal!17,rounded corners=5pt,thick] (n10) at ([xshift=0em,yshift=-2em]n9.south) {权重累加};
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}[scale=0.6]
\tikzstyle{every node}=[scale=0.6]
\tikzstyle{cell} = [draw,circle,inner sep=0pt,minimum size=1.4em]
\tikzstyle{point} = [circle,fill=white,minimum size=0.46em,inner sep=0pt]
\tikzstyle{point_line} = [-,white,line width=1.4pt]
\tikzstyle{cell_line} = [-,thick]
\tikzstyle{background} = [rounded corners=4pt,minimum width=44em,fill=gray!20]
%figure 1
\node[inner sep=0pt,minimum size=4em,fill=black,rounded corners=6pt] (n1) at (-1.6em,0) {};
\node[circle,fill=white,minimum size=2em] at (-1.6em,0){};
\node[circle,fill=black,minimum size=1.4em] (n2) at (1.8em,0){};
\draw[line width=4pt,-] ([xshift=-0.1em]n1.east) -- ([xshift=0.1em]n2.west);
\draw[line width=4pt,-, out=-45,in=45] ([xshift=0.2em,yshift=1em]n2.east) to ([xshift=0.2em,yshift=-1em]n2.east);
\draw[line width=4pt,-, out=-45,in=45] ([xshift=0.8em,yshift=1.4em]n2.east) to ([xshift=0.8em,yshift=-1.4em]n2.east);
\draw[line width=4pt,-, out=-45,in=45] ([xshift=1.4em,yshift=1.8em]n2.east) to ([xshift=1.4em,yshift=-1.8em]n2.east);
%figure 2
\node[inner sep=0pt,minimum size=6em,fill=black,rounded corners=6pt] (n3) at (14em,0) {};
\node[inner sep=0pt,minimum size=5em,fill=white,rounded corners=8pt] (n4) at (14em,0) {};
\node[inner sep=0pt,minimum size=4.4em,fill=black,rounded corners=6pt] (n5) at (14em,0) {};
\node[point] (dot1) at (12.7em,-1em){};
\node[point] (dot2) at (12.8em,1.2em){};
\node[point] (dot3) at (14.8em,-0.9em){};
\node[point] (dot4) at (15.2em,-0.2em){};
\node[point] (dot5) at (13.5em,0.3em){};
\node[point] (dot6) at (14em,0.8em){};
\draw[point_line] ([yshift=-1em]dot1.south) -- ([yshift=0.1em]dot1.south);
\draw[point_line] ([yshift=-1.1em,xshift=-1.6em]dot3.south) -- ([yshift=-0.5em,xshift=-1.6em]dot3.south)-- ([yshift=-0.5em]dot3.south) -- ([yshift=0.1em]dot3.south);
\draw[point_line] ([xshift=-0.1em]dot4.east) -- ([xshift=1em]dot4.east);
\draw[point_line] ([xshift=-1em,yshift=-1.3em]dot2.south) -- ([yshift=-1.3em]dot2.south) -- ([yshift=0.1em]dot2.south);
\draw[point_line] ([xshift=-0.1em]dot5.east) -- ([xshift=0.9em]dot5.east) --([xshift=0.9em,yshift=0.8em]dot5.east) -- ([xshift=2.6em,yshift=0.8em]dot5.east);
\draw[point_line] ([yshift=-0.1em]dot6.north) -- ([yshift=0.6em]dot6.north) -- ([yshift=0.6em,xshift=1em]dot6.north) -- ([yshift=1.2em,xshift=1em]dot6.north);
\foreach \x in {1,2,3,4}{
\node[fill=black,inner sep=0pt,minimum width=1.2em,minimum height=0.6em] at (17.8em,-3em+1.2em*\x){};
\node[inner sep=0pt,circle,minimum size=0.6em,fill=black] at (18.4em,-3em+1.2em*\x){};}
\foreach \x in {1,2,3,4}{
\node[fill=black,inner sep=0pt,minimum width=1.2em,minimum height=0.6em] at (10.2em,-3em+1.2em*\x){};
\node[inner sep=0pt,circle,minimum size=0.6em,fill=black] at (9.6em,-3em+1.2em*\x){};}
\foreach \x in {1,2,3,4}{
\node[fill=black,inner sep=0pt,minimum width=0.6em,minimum height=1.2em] at (10.9em+1.2em*\x,3.8em){};
\node[inner sep=0pt,circle,minimum size=0.6em,fill=black] at (10.9em+1.2em*\x,4.2em){};}
\foreach \x in {1,2,3,4}{
\node[fill=black,inner sep=0pt,minimum width=0.6em,minimum height=1.2em] at (10.9em+1.2em*\x,-3.8em){};
\node[inner sep=0pt,circle,minimum size=0.6em,fill=black] at (10.9em+1.2em*\x,-4.2em){};}
%figure 3
\node[circle,line width=2pt,minimum size=3.8em,draw,fill=white] (f1) at (26em,0){};
\node[circle,line width=2pt,minimum size=1em,draw,fill=white] (c1) at (26em,0){};
\node[circle,line width=2pt,minimum size=3.8em,draw,fill=white] (f2)at (30.4em,0){};
\node[circle,line width=2pt,minimum size=1em,draw,fill=white] (c2) at (30.4em,0){};
\draw[line width=2pt,out=90,in=90] ([xshift=0.1em]c1.180) to ([xshift=0.1em]f1.180);
\draw[line width=2pt,out=45,in=45] ([xshift=0.1em,yshift=-0.1em]c1.135) to ([xshift=0.1em,yshift=-0.1em]f1.135);
\draw[line width=2pt,out=0,in=0] ([yshift=-0.1em]c1.90) to ([yshift=-0.1em]f1.90);
\draw[line width=2pt,out=-45,in=-45] ([xshift=-0.1em,yshift=-0.1em]c1.45) to ([xshift=-0.1em,yshift=-0.1em]f1.45);
\draw[line width=2pt,out=-90,in=-90] ([xshift=-0.1em]c1.0) to ([xshift=-0.1em]f1.0);
\draw[line width=2pt,out=-135,in=-135] ([xshift=-0.1em,yshift=0.1em]c1.-45) to ([xshift=-0.1em,yshift=0.1em]f1.-45);
\draw[line width=2pt,out=-180,in=-180] ([yshift=0.1em]c1.-90) to ([yshift=0.1em]f1.-90);
\draw[line width=2pt,out=-225,in=-225] ([xshift=0.1em,yshift=0.1em]c1.-135) to ([xshift=0.1em,yshift=0.1em]f1.-135);
\draw[line width=2pt,out=90,in=90] ([xshift=0.1em]c2.180) to ([xshift=0.1em]f2.180);
\draw[line width=2pt,out=45,in=45] ([xshift=0.1em,yshift=-0.1em]c2.135) to ([xshift=0.1em,yshift=-0.1em]f2.135);
\draw[line width=2pt,out=0,in=0] ([yshift=-0.1em]c2.90) to ([yshift=-0.1em]f2.90);
\draw[line width=2pt,out=-45,in=-45] ([xshift=-0.1em,yshift=-0.1em]c2.45) to ([xshift=-0.1em,yshift=-0.1em]f2.45);
\draw[line width=2pt,out=-90,in=-90] ([xshift=-0.1em]c2.0) to ([xshift=-0.1em]f2.0);
\draw[line width=2pt,out=-135,in=-135] ([xshift=-0.1em,yshift=0.1em]c2.-45) to ([xshift=-0.1em,yshift=0.1em]f2.-45);
\draw[line width=2pt,out=-180,in=-180] ([yshift=0.1em]c2.-90) to ([yshift=0.1em]f2.-90);
\draw[line width=2pt,out=-225,in=-225] ([xshift=0.1em,yshift=0.1em]c2.-135) to ([xshift=0.1em,yshift=0.1em]f2.-135);
\draw[line width=2pt,-] (22.8em,2.6em) -- (23.4em,2.6em) -- (23.4em,-3em);
\draw[line width=2pt,-] (23.4em,1.6em) -- (23em,1.6em) -- (23em,0.8em) -- (23.4em,0.8em);
\draw[line width=2pt,-] (23.4em,0.4em) -- (23em,0.4em) -- (23em,-2em) -- (23.4em,-2em);
\draw[line width=2pt,-] (23.4em,2em) -- (24.4em,2em) -- (25em,2.6em) -- (30.4em,2.6em);
\draw[line width=2pt,-] (23.4em,-2.5em) -- (30.8em,-2.5em);
\draw[line width=2pt,-] (25em,-2.5em) -- (25em,-3em) -- (26em,-3em) -- (26em,-2.5em);
\draw[line width=2pt,-] (26.5em,-2.5em) -- (26.5em,-3em) -- (29.4em, -3em) -- (29.4em,-2.5em) ;
\draw[line width=2pt,-,out=0,in=120] (30.4em,2.6em) to (32.8em,1em);
\draw[line width=2pt,-,out=0,in=-70] (30.8em,-2.5em) to (33.2em,1em);
\draw[line width=2pt,-] (32.8em,1em) to (33.2em,1em);
\draw[line width=2pt,-] (27.4em,2.6em) -- (28.4em,1.6em) -- (29.6em,1.6em);
\node[] at (0em,4.6em) {\huge\bfnew{Different Hardware}};
\node[] at (6.4em,22em) {\huge\bfnew{SubTransformers(Weight-Sharing)}};
\node[] at (-0.4em,37.6em) {\huge\bfnew{SuperTransformer}};
\node[] at (0.4em,-6.2em) {\huge\bfnew{IOT}};
\node[] at (14em,-6.2em) {\huge\bfnew{CPU}};
\node[] at (28em,-6.2em) {\huge\bfnew{GPU}};
\begin{pgfonlayer}{background}
{
\draw[line width=3pt,-] (23.4em,-1.6em) -- (28.2em,-1.6em) -- (28.6em,-2.5em);
\node[background,minimum height=14em] (bg1) at (13.4em,-0.8em){};
\node[background,minimum height=11.4em] (bg2) at (13.4em,17.8em){};
\node[background,minimum height=10em] (bg3) at (13.4em,34em){};
\draw[thick,out=45,in=-45,-latex] (bg1.north east) to (bg2.north east);
}
\end{pgfonlayer}
\node[cell,fill=red!60] (c1_1) at (-1.5em,18.5em){};
\node[cell,fill=red!60] (c1_2) at (1.5em,18.5em){};
\node[cell,fill=ublue!60] (c1_3) at (-1.5em,15.5em){};
\node[cell,fill=ublue!60] (c1_4) at (1.5em,15.5em){};
\node[cell,fill=red!60] (c2_1) at (12.5em,20em){};
\node[cell,fill=red!60] (c2_2) at (15.5em,20em){};
\node[cell,fill=ublue!60] (c2_3) at (12.5em,17em){};
\node[cell,fill=ublue!60] (c2_4) at (15.5em,17em){};
\node[cell,fill=orange!60] (c2_5) at (9.5em,14em){};
\node[cell,fill=orange!60] (c2_6) at (12.5em,14em){};
\node[cell,fill=orange!60] (c2_7) at (15.5em,14em){};
\node[cell,fill=orange!60] (c2_8) at (18.5em,14em){};
\node[cell,fill=red!60] (c3_1) at (23.5em,19em){};
\node[cell,fill=red!60] (c3_2) at (26.5em,19em){};
\node[cell,fill=red!60] (c3_3) at (29.5em,19em){};
\node[cell,fill=red!60] (c3_4) at (32.5em,19em){};
\node[cell,fill=ublue!60] (c3_5) at (23.5em,15em){};
\node[cell,fill=ublue!60] (c3_6) at (26.5em,15em){};
\node[cell,fill=ublue!60] (c3_7) at (29.5em,15em){};
\node[cell,fill=ublue!60] (c3_8) at (32.5em,15em){};
\draw[-,thick] (c1_1.-90) -- (c1_3.90);
\draw[-,thick] (c1_1.-45) -- (c1_4.135);
\draw[-,thick] (c1_2.-90) -- (c1_4.90);
\draw[-,thick] (c1_2.-135) -- (c1_3.45);
\draw[-,thick] (c2_1.-90) -- (c2_3.90);
\draw[-,thick] (c2_1.-45) -- (c2_4.135);
\draw[-,thick] (c2_2.-90) -- (c2_4.90);
\draw[-,thick] (c2_2.-135) -- (c2_3.45);
\draw[-,thick] (c2_3.-90) -- (c2_6.90);
\draw[-,thick] (c2_3.-135) -- (c2_5.45);
\draw[-,thick] (c2_3.-45) -- (c2_7.135);
\draw[-,thick] (c2_3.-30) -- (c2_8.150);
\draw[-,thick] (c2_4.-150) -- (c2_5.30);
\draw[-,thick] (c2_4.-135) -- (c2_6.45);
\draw[-,thick] (c2_4.-90) -- (c2_7.90);
\draw[-,thick] (c2_4.-45) -- (c2_8.135);
\draw[-,thick] (c3_1.-90) -- (c3_5.90);
\draw[-,thick] (c3_1.-45) -- (c3_6.135);
\draw[-,thick] (c3_1.-30) -- (c3_7.150);
\draw[-,thick] (c3_1.-15) -- (c3_8.165);
\draw[-,thick] (c3_2.-90) -- (c3_6.90);
\draw[-,thick] (c3_2.-135) -- (c3_5.45);
\draw[-,thick] (c3_2.-45) -- (c3_7.135);
\draw[-,thick] (c3_2.-30) -- (c3_8.150);
\draw[-,thick] (c3_3.-150) -- (c3_5.30);
\draw[-,thick] (c3_3.-135) -- (c3_6.45);
\draw[-,thick] (c3_3.-90) -- (c3_7.90);
\draw[-,thick] (c3_3.-45) -- (c3_8.135);
\draw[-,thick] (c3_4.-165) -- (c3_5.15);
\draw[-,thick] (c3_4.-150) -- (c3_6.30);
\draw[-,thick] (c3_4.-135) -- (c3_7.45);
\draw[-,thick] (c3_4.-90) -- (c3_8.90);
\node[cell,fill=red!60] (c4_1) at (9.5em,37em){};
\node[cell,fill=red!60] (c4_2) at (12.5em,37em){};
\node[cell,fill=red!60] (c4_3) at (15.5em,37em){};
\node[cell,fill=red!60] (c4_4) at (18.5em,37em){};
\node[cell,fill=ublue!60] (c4_5) at (9.5em,34em){};
\node[cell,fill=ublue!60] (c4_6) at (12.5em,34em){};
\node[cell,fill=ublue!60] (c4_7) at (15.5em,34em){};
\node[cell,fill=ublue!60] (c4_8) at (18.5em,34em){};
\node[cell,fill=orange!60] (c4_9) at (9.5em,31em){};
\node[cell,fill=orange!60] (c4_10) at (12.5em,31em){};
\node[cell,fill=orange!60] (c4_11) at (15.5em,31em){};
\node[cell,fill=orange!60] (c4_12) at (18.5em,31em){};
\draw[-,thick] (c4_1.-90) -- (c4_5.90);
\draw[-,thick] (c4_1.-45) -- (c4_6.135);
\draw[-,thick] (c4_1.-30) -- (c4_7.150);
\draw[-,thick] (c4_1.-15) -- (c4_8.165);
\draw[-,thick] (c4_2.-90) -- (c4_6.90);
\draw[-,thick] (c4_2.-135) -- (c4_5.45);
\draw[-,thick] (c4_2.-45) -- (c4_7.135);
\draw[-,thick] (c4_2.-30) -- (c4_8.150);
\draw[-,thick] (c4_3.-150) -- (c4_5.30);
\draw[-,thick] (c4_3.-135) -- (c4_6.45);
\draw[-,thick] (c4_3.-90) -- (c4_7.90);
\draw[-,thick] (c4_3.-45) -- (c4_8.135);
\draw[-,thick] (c4_4.-165) -- (c4_5.15);
\draw[-,thick] (c4_4.-150) -- (c4_6.30);
\draw[-,thick] (c4_4.-135) -- (c4_7.45);
\draw[-,thick] (c4_4.-90) -- (c4_8.90);
\draw[-,thick] (c4_5.-90) -- (c4_9.90);
\draw[-,thick] (c4_5.-45) -- (c4_10.135);
\draw[-,thick] (c4_5.-30) -- (c4_11.150);
\draw[-,thick] (c4_5.-15) -- (c4_12.165);
\draw[-,thick] (c4_6.-90) -- (c4_10.90);
\draw[-,thick] (c4_6.-135) -- (c4_9.45);
\draw[-,thick] (c4_6.-45) -- (c4_11.135);
\draw[-,thick] (c4_6.-30) -- (c4_12.150);
\draw[-,thick] (c4_7.-150) -- (c4_9.30);
\draw[-,thick] (c4_7.-135) -- (c4_10.45);
\draw[-,thick] (c4_7.-90) -- (c4_11.90);
\draw[-,thick] (c4_7.-45) -- (c4_12.135);
\draw[-,thick] (c4_8.-165) -- (c4_9.15);
\draw[-,thick] (c4_8.-150) -- (c4_10.30);
\draw[-,thick] (c4_8.-135) -- (c4_11.45);
\draw[-,thick] (c4_8.-90) -- (c4_12.90);
\draw[line width=2pt,-latex] ([xshift=0.5em,yshift=-0.6em]bg3.south) -- ([xshift=0.5em,yshift=0.6em]bg2.north);
\draw[line width=2pt,-latex] ([xshift=-2.5em,yshift=-0.6em]bg3.south) -- ([xshift=-9.5em,yshift=0.6em]bg2.north);
\draw[line width=2pt,-latex] ([xshift=3.5em,yshift=-0.6em]bg3.south) -- ([xshift=9.5em,yshift=0.6em]bg2.north);
\draw[line width=2pt,-latex] (0em, 10.4em) -- (0em, 7em);
\draw[line width=2pt,-latex] (14em, 10.4em) -- (14em, 7em);
\draw[line width=2pt,-latex] (28em, 10.4em) -- (28em, 7em);
\node[align=center] at (0.5em,-9em){\Large\bfnew{TinyML}};
\node[align=center] at (14em,-9em){\Large\bfnew{Deeper}};
\node[align=center] at (28em,-9em){\Large\bfnew{Wider}};
\node[font=\footnotesize,align=center] at (30em,26em){\Large\bfnew{Evolutionary Search with} \\ \Large\bfnew{Hardware Constraints}};
\node[font=\footnotesize,align=center] at ([yshift=-1em]bg2.south){\Large\bfnew{Specialized Deployment is Efficient}};
\node[font=\footnotesize,align=center] at ([xshift=3em,yshift=5em]bg1.east){\Large\bfnew{Hardware}\\\Large\bfnew{Latency}\\\Large\bfnew{Feedback}};
\node[circle,inner sep=0pt,minimum size=3em,draw,fill=white] (clock) at ([xshift=3.4em,yshift=-2.4em]bg2.east){};
\node[circle,inner sep=0pt,minimum size=0.4em,draw,fill=black] (clock2)at ([xshift=3.4em,yshift=-2.4em]bg2.east){};
\draw[] ([xshift=-0.3em]clock.0) arc (1:180:1.2em);
\draw[fill=black] (clock2.90) -- ([xshift=0.6em,yshift=-0.6em]clock.135) -- (clock2.180) -- (clock2.90);
\end{tikzpicture}
......@@ -5,25 +5,25 @@
\begin{scope}[minimum height = 20pt]
\node [anchor=east] (x1) at (-0.5em, 0) {$x_l$};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (F1) at ([xshift=2em]x1.east){\small{$\mathcal{F}$}};
\node [anchor=east] (x1) at (-0.5em, 0) {$\mathbi{x}_l$};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (F1) at ([xshift=2em]x1.east){\small{$F$}};
\node [anchor=west,circle,draw,minimum size=1em] (n1) at ([xshift=2em]F1.east) {};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (ln1) at ([xshift=2em]n1.east){\small{\textrm{LN}}};
\node [anchor=west] (x2) at ([xshift=2em]ln1.east) {$x_{l+1}$};
\node [anchor=west] (x2) at ([xshift=2em]ln1.east) {$\mathbi{x}_{l+1}$};
\node [anchor=north] (x3) at ([yshift=-5em]x1.south) {$x_l$};
\node [anchor=north] (x3) at ([yshift=-5em]x1.south) {$\mathbi{x}_l$};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (F2) at ([xshift=2em]x3.east){\small{\textrm{LN}}};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (ln2) at ([xshift=2em]F2.east){\small{$\mathcal{F}$}};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (ln2) at ([xshift=2em]F2.east){\small{$F$}};
\node [anchor=west,circle,draw,,minimum size=1em] (n2) at ([xshift=2em]ln2.east){};
\node [anchor=west] (x4) at ([xshift=2em]n2.east) {$x_{l+1}$};
\node [anchor=west] (x4) at ([xshift=2em]n2.east) {$\mathbi{x}_{l+1}$};
\draw[->, line width=1pt] ([xshift=-0.1em]x1.east)--(F1.west);
\draw[->, line width=1pt] ([xshift=-0.1em]F1.east)--(n1.west);
\draw[->, line width=1pt] (n1.east)--node[above]{$y_l$}(ln1.west);
\draw[->, line width=1pt] (n1.east)--node[above]{$\mathbi{y}_l$}(ln1.west);
\draw[->, line width=1pt] ([xshift=-0.1em]ln1.east)--(x2.west);
\draw[->, line width=1pt] ([xshift=-0.1em]x3.east)--(F2.west);
\draw[->, line width=1pt] ([xshift=-0.1em]F2.east)--(ln2.west);
\draw[->, line width=1pt] ([xshift=0.1em]ln2.east)--node[above]{$y_l$}(n2.west);
\draw[->, line width=1pt] ([xshift=0.1em]ln2.east)--node[above]{$\mathbi{y}_l$}(n2.west);
\draw[->, line width=1pt] (n2.east)--(x4.west);
\draw[->,rounded corners,line width=1pt] ([yshift=-0.2em]x1.north) -- ([yshift=1em]x1.north) -- ([yshift=1.4em]n1.north) -- (n1.north);
\draw[->,rounded corners,line width=1pt] ([yshift=-0.2em]x3.north) -- ([yshift=1em]x3.north) -- ([yshift=1.4em]n2.north) -- (n2.north);
......
......@@ -4,22 +4,22 @@
\begin{tikzpicture}
\begin{scope}
\node [anchor=east,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s11) at (-0.5em, 0) {\footnotesize{$\times h$}};
\node [anchor=east,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s11) at (-0.5em, 0) {\footnotesize{$\times l$}};
\node [rectangle,anchor=west,fill=blue!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s12) at ([xshift=1.2em]s11.east) {};
\node [anchor=north,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s21) at ([yshift=-1.2em]s11.south) {\footnotesize{$\times h$}};
\node [anchor=west,fill=orange!20,draw=red,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em,dashed] (s22) at ([xshift=1.2em]s21.east) {\footnotesize{$\times h$}};
\node [anchor=north,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s21) at ([yshift=-1.2em]s11.south) {\footnotesize{$\times l$}};
\node [anchor=west,fill=orange!20,draw=red,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em,dashed] (s22) at ([xshift=1.2em]s21.east) {\footnotesize{$\times l$}};
\node [anchor=west,fill=blue!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s23) at ([xshift=1.2em]s22.east) {};
\node [anchor=north,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s31) at ([yshift=-1.2em]s21.south) {\footnotesize{$\times h$}};
\node [anchor=west,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s32) at ([xshift=1.2em]s31.east) {\footnotesize{$\times h$}};
\node [anchor=west,fill=orange!20,draw=red,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em,dashed] (s33) at ([xshift=1.2em]s32.east) {\footnotesize{$\times h$}};
\node [anchor=north,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s31) at ([yshift=-1.2em]s21.south) {\footnotesize{$\times l$}};
\node [anchor=west,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s32) at ([xshift=1.2em]s31.east) {\footnotesize{$\times l$}};
\node [anchor=west,fill=orange!20,draw=red,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em,dashed] (s33) at ([xshift=1.2em]s32.east) {\footnotesize{$\times l$}};
\node [anchor=west,fill=blue!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s34) at ([xshift=1.2em]s33.east) {};
\node [anchor=north,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s41) at ([yshift=-1.2em]s31.south) {\footnotesize{$\times h$}};
\node [anchor=west,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s42) at ([xshift=1.2em]s41.east) {\footnotesize{$\times h$}};
\node [anchor=west,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s43) at ([xshift=1.2em]s42.east) {\footnotesize{$\times h$}};
\node [anchor=west,fill=orange!20,draw=red,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em,dashed] (s44) at ([xshift=1.2em]s43.east) {\footnotesize{$\times h$}};
\node [anchor=north,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s41) at ([yshift=-1.2em]s31.south) {\footnotesize{$\times l$}};
\node [anchor=west,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s42) at ([xshift=1.2em]s41.east) {\footnotesize{$\times l$}};
\node [anchor=west,fill=orange!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s43) at ([xshift=1.2em]s42.east) {\footnotesize{$\times l$}};
\node [anchor=west,fill=orange!20,draw=red,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em,dashed] (s44) at ([xshift=1.2em]s43.east) {\footnotesize{$\times l$}};
\node [anchor=west,fill=blue!20,draw,rounded corners=3pt,minimum height=1.6em,minimum width=1.6em] (s45) at ([xshift=1.2em]s44.east) {};
\node [anchor=east] (p1) at ([xshift=-2em]s11.west) {\footnotesize{step 1}};
......
......@@ -5,29 +5,29 @@
\begin{scope}[minimum height = 20pt]
\node [anchor=east] (x1) at (-0.5em, 0) {$x_l$};
\node [anchor=east] (x1) at (-0.5em, 0) {$\mathbi{x}_l$};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (ln1) at ([xshift=1em]x1.east){\small{\textrm{LN}}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f1) at ([xshift=0.6em]ln1.east){\small{$\mathcal{F}$}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f1) at ([xshift=0.6em]ln1.east){\small{$F$}};
\node [anchor=west,circle,draw,,minimum size=1em] (n1) at ([xshift=3em]f1.east){};
\node [anchor=west] (x2) at ([xshift=1em]n1.east) {$x_{l+1}$};
\node [anchor=west] (x2) at ([xshift=1em]n1.east) {$\mathbi{x}_{l+1}$};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (ln12) at ([xshift=1em]x2.east){\small{\textrm{LN}}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f12) at ([xshift=0.6em]ln12.east){\small{$\mathcal{F}$}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f12) at ([xshift=0.6em]ln12.east){\small{$F$}};
\node [anchor=west,circle,draw,,minimum size=1em] (n12) at ([xshift=3em]f12.east){};
\node [anchor=west] (x22) at ([xshift=1em]n12.east) {$x_{l+2}$};
\node [anchor=west] (x22) at ([xshift=1em]n12.east) {$\mathbi{x}_{l+2}$};
\node [anchor=north] (x3) at ([yshift=-5em]x1.south) {$x_l$};
\node [anchor=north] (x3) at ([yshift=-5em]x1.south) {$\mathbi{x}_l$};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (ln2) at ([xshift=1em]x3.east){\small{\textrm{LN}}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f2) at ([xshift=0.6em]ln2.east){\small{$\mathcal{F}$}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f2) at ([xshift=0.6em]ln2.east){\small{$F$}};
\node [anchor=west,minimum size=1em] (p1) at ([xshift=1em]f2.east){};
\node [anchor=north] (m1) at ([yshift=0.6em]p1.south){\tiny{\red{$M=1$}}};
\node [anchor=north] (m1) at ([yshift=0.6em]p1.south){\footnotesize{\red{Mask=1}}};
\node [anchor=west,circle,draw,,minimum size=1em] (n2) at ([xshift=3em]f2.east){};
\node [anchor=west] (x4) at ([xshift=1em]n2.east) {$x_{l+1}$};
\node [anchor=west] (x4) at ([xshift=1em]n2.east) {$\mathbi{x}_{l+1}$};
\node [anchor=west,draw,fill=red!20,inner xsep=5pt,rounded corners=2pt] (ln22) at ([xshift=1em]x4.east){\small{\textrm{LN}}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f22) at ([xshift=0.6em]ln22.east){\small{$\mathcal{F}$}};
\node [anchor=west,draw,fill=green!20,inner xsep=5pt,rounded corners=2pt] (f22) at ([xshift=0.6em]ln22.east){\small{$F$}};
\node [anchor=west,minimum size=1em] (p2) at ([xshift=1em]f22.east){};
\node [anchor=north] (m2) at ([yshift=0.6em]p2.south){\tiny{\red{$M=0$}}};
\node [anchor=north] (m2) at ([yshift=0.6em]p2.south){\footnotesize{\red{Mask=0}}};
\node [anchor=west,circle,draw,,minimum size=1em] (n22) at ([xshift=3em]f22.east){};
\node [anchor=west] (x42) at ([xshift=1em]n22.east) {$x_{l+2}$};
\node [anchor=west] (x42) at ([xshift=1em]n22.east) {$\mathbi{x}_{l+2}$};
\draw[->, line width=1pt] ([xshift=-0.1em]x1.east)--(ln1.west);
\draw[->, line width=1pt] ([xshift=-0.1em]ln1.east)--(f1.west);
......
......@@ -21,17 +21,26 @@
% CHAPTER 15
%----------------------------------------------------------------------------------------
\chapter{面向神经机器翻译的网络结构设计}
\chapter{神经机器翻译结构优化}
%----------------------------------------------------------------------------------------
% NEW SECTION
%----------------------------------------------------------------------------------------
\section{深层网络}
\section{基于自注意力机制的改进}
\parinterval {\chapterthirteen}已经指出:增加神经网络的深度有助于对句子进行更充分的表示、同时增加模型的容量。但是,简单地堆叠很多层Transformer网络并不能带来性能上的提升,反而会面临更加严重的梯度消失/梯度爆炸的问题。这是由于伴随神经网络变深,梯度无法有效地从输出层回传到底层网络,造成网络浅层部分的参数无法得到充分训练\upcite{Wang2019LearningDT,DBLP:conf/cvpr/YuYR18}。针对这些问题,已经有研究者开始尝试进行求解,并取得了很好的效果。比如,设计更有利于深层信息传递的网络连接和恰当的参数初始化方法等\upcite{Bapna2018TrainingDN,Wang2019LearningDT,DBLP:conf/emnlp/ZhangTS19}
%----------------------------------------------------------------------------------------
% NEW SECTION
%----------------------------------------------------------------------------------------
\section{网络连接优化及深层网络建模}
\parinterval 除了对Transformer模型中的局部组件进行改进,改进不同层之间的连接方式也十分重要。常见的做法是融合编码/解码的中间层表示得到更丰富的编码/解码输出\upcite{Wang2018MultilayerRF,Wang2019ExploitingSC,Dou2018ExploitingDR,Dou2019DynamicLA}。同时,可以利用稠密连接等更复杂的层间连接方式来强化或替换残差连接,这类方法在图像识别\upcite{DBLP:journals/corr/HeZRS15,DBLP:conf/cvpr/HuangLMW17}、机器翻译\upcite{Bapna2018TrainingDN,Wang2018MultilayerRF,Dou2018ExploitingDR,WangLearning,Dou2019DynamicLA}
等任务上取得了很好的效果。
\parinterval 与此同时,宽网络(如Transformer-Big)在机器翻译、语言模型等任务上表现十分出色,但伴随而来的是快速增长的参数量与更大的训练代价。同时受限于任务的复杂度与计算设备的算力,进一步探索更宽的网络显然不是特别高效的手段。在本书第十三章已经指出:增加神经网络的深度同样有助于对句子进行更充分的表示、同时增加模型的容量。但是,简单地堆叠很多层Transformer网络并不能带来性能上的提升,反而会面临更加严重的梯度消失/梯度爆炸的问题。这是由于伴随神经网络变深,梯度无法有效地从输出层回传到底层网络,造成网络浅层部分的参数无法得到充分训练\upcite{Bapna2018TrainingDN,WangLearning,DBLP:journals/corr/abs-2002-04745,DBLP:conf/emnlp/LiuLGCH20}。针对这些问题,已经有研究者开始尝试求解,并取得了很好的效果。比如,设计更有利于深层信息传递的网络连接\upcite{Bapna2018TrainingDN,WangLearning,Wei2020MultiscaleCD,DBLP:conf/acl/WuWXTGQLL19,li2020shallow,DBLP:journals/corr/abs-2007-06257}和恰当的参数初始化方法\upcite{huang2020improving,DBLP:conf/emnlp/ZhangTS19,DBLP:conf/acl/XuLGXZ20,DBLP:conf/emnlp/LiuLGCH20}等。
\parinterval 但是,如何设计一个足够“深”的机器翻译模型仍然是业界关注的热点问题之一。此外,伴随着网络的继续变深,将会面临一些新的问题,例如,如何加速深层网络的训练,如何解决深层网络的过拟合问题等。下面将会对以上问题展开讨论。
\parinterval 但是,如何设计一个足够“深”的机器翻译模型仍然是业界关注的热点问题之一。此外,伴随着网络的继续变深,将会面临一些新的问题,例如,如何加速深层网络的训练,如何解决深层网络的过拟合问题等。下面将会对以上问题展开讨论。首先对Transformer模型的内部信息流进行详细的讨论。之后分别从模型结构和参数初始化两个角度求解为什么深层网络难以训练,并介绍相应的解决手段。
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
......@@ -39,7 +48,7 @@
\subsection{Post-Norm vs Pre-Norm}
\parinterval 为了探究为何深层的Transformer模型很难直接训练,首先对Transformer的模型结构进行简单的回顾。以Transformer的编码端为例,在多头自注意力网络和前馈神经网络中间,Transformer模型利用残差连接和层正则化操作来提高信息的传递效率。Transformer模型大致分为图\ref{fig:15-1}中两种结构\ \dash \ 后作方式的残差单元(Post-Norm)和前作方式的残差单元(Pre-Norm)。
\parinterval 为了探究为何深层的Transformer模型很难直接训练,首先对Transformer的模型结构进行简单的回顾(见{\chaptertwelve})。以Transformer的编码端为例,在多头自注意力网络和前馈神经网络中间,Transformer模型利用残差连接\upcite{DBLP:journals/corr/HeZRS15}和层标准化操作\upcite{Ba2016LayerN}来提高信息的传递效率。Transformer模型大致分为图\ref{fig:15-1}中两种结构\ \dash \ 后作方式的残差单元(Post-Norm)和前作方式的残差单元(Pre-Norm)。
%----------------------------------------------
\begin{figure}[htp]
......@@ -50,147 +59,387 @@
\end{figure}
%-------------------------------------------
\parinterval$x_l$$x_{l+1}$表示第$l$子层的输入和输出\footnote[1]{这里沿用Transformer中的定义,每一层(Layer)包含多个子层(Sub-layer)。比如,对于Transformer编码器,每一层包含一个自注意力子层和一个前馈神经网络子层。所有子层都需要进行层归一化和残差连接。}$y_l$表示中间的临时输出;$\textrm{LN}(\cdot)$表示层归一化操作\upcite{Ba2016LayerN},帮助减少子层输出分布的方差。从而让训练变得更稳定;{\red $\mathcal{F}(\cdot)$ (F这种斜体是有什么特殊含义吗)}表示子层所对应的函数,比如前馈神经网络、自注意力网络等。下面分别对Post-Norm和Pre-Norm进行简单的描述。
\parinterval$\mathbi{x}_l$$\mathbi{x}_{l+1}$表示第$l$个子层的输入和输出\footnote[1]{这里沿用Transformer中的定义,每一层(Layer)包含多个子层(Sub-layer)。比如,对于Transformer编码器,每一层包含一个自注意力子层和一个前馈神经网络子层。所有子层都需要进行层归一化和残差连接。}$\mathbi{y}_l$表示中间的临时输出;$\textrm{LN}(\cdot)$表示层归一化操作\upcite{Ba2016LayerN},帮助减少子层输出分布的方差。从而让训练变得更稳定;$F(\cdot)$表示子层所对应的函数,比如前馈神经网络、自注意力网络等。下面分别对Post-Norm和Pre-Norm进行简单的描述。
\begin{itemize}
\vspace{0.5em}
\item Post-Norm:早期的Transformer遵循的是Post-Norm结构\upcite{vaswani2017attention}。也就是层正则化作用于每一子层的输入和输出的残差结果上,如图\ref{fig:15-1}(a)所示。可以表示如下:
\begin{eqnarray}
x_{l+1}=\textrm{LN}(x_l+\mathcal{F}(x_l;\theta_l))
\item Post-Norm:早期的Transformer遵循的是Post-Norm结构\upcite{vaswani2017attention}。也就是层标准化作用于每一子层的输入和输出的残差结果上,如图\ref{fig:15-1}(a)所示。可以表示如下:
\begin{equation}
\mathbi{x}_{l+1}=\textrm{LN}(\mathbi{x}_l+F(\mathbi{x}_l;{\bm \theta_l}))
\label{eq:15-1}
\end{eqnarray}
其中,$\theta_l$是子层$l$的参数。
\end{equation}
\noindent 其中,$\bm \theta_l$是子层$l$的参数。
\vspace{0.5em}
\item Pre-Norm:通过调整层正则化的位置,将其放置于每一子层的输入之前,得到了Pre-Norm结构,如图\ref{eq:15-1}(b)所示。其思想与He等人的思想一致\upcite{DBLP:conf/eccv/HeZRS16},也被广泛应用于最新的Transformer开源系统中\upcite{Vaswani2018Tensor2TensorFN,Ottfairseq,KleinOpenNMT},公式如下:
\begin{eqnarray}
x_{l+1}=x_l+\mathcal{F}(\textrm{LN}(x_l);\theta_l)
\item Pre-Norm:通过调整层标准化的位置,将其放置于每一子层的输入之前,得到了Pre-Norm结构,如图\ref{eq:15-1}(b)所示。其思想与He等人的思想一致\upcite{DBLP:conf/eccv/HeZRS16},也被广泛应用于最新的Transformer开源系统中\upcite{Vaswani2018Tensor2TensorFN,Ottfairseq,KleinOpenNMT},公式如下:
\begin{equation}
\mathbi{x}_{l+1}=\mathbi{x}_l+F(\textrm{LN}(\mathbi{x}_l);{\bm \theta_l})
\label{eq:15-2}
\end{eqnarray}
\end{equation}
\vspace{0.5em}
\end{itemize}
\parinterval 从上述公式可以看到Pre-Norm结构可以通过残差路径将底层网络的输出直接暴露给上层网络;另一方面从反向传播的角度看,使用Pre-Norm结构,顶层的梯度可以更容易地反馈到底层网络。这里以一个含有$L$个子层的结构为例。令$Loss$表示整个神经网络输出上的损失,$x_L$为顶层的输出。对于Post-Norm结构,根据链式法则,损失$Loss$相对于$x_l$的梯度可以表示为:
\begin{eqnarray}
\frac{\partial Loss}{\partial x_l}=\frac{\partial Loss}{\partial x_L} \times \prod_{k=l}^{L-1}\frac{\partial \textrm{LN}(y_k)}{\partial y_k} \times \prod_{k=l}^{L-1}(1+\frac{\partial \mathcal{F}(x_k;\theta_k)}{\partial x_k})
\parinterval 从上述公式可以看到Pre-Norm结构可以通过残差路径将底层网络的输出直接暴露给上层网络;另一方面从反向传播的角度看,使用Pre-Norm结构,顶层的梯度可以更容易地反馈到底层网络。这里以一个含有$N$个子层的结构为例。令$Loss$表示整个神经网络输出上的损失,$\mathbi{x}_N$为顶层的输出。对于Post-Norm结构,根据链式法则,损失$Loss$相对于$\mathbi{x}_l$的梯度可以表示为:
\begin{equation}
\frac{\partial Loss}{\partial \mathbi{x}_l}=\frac{\partial Loss}{\partial \mathbi{x}_N} \times \prod_{k=l}^{N-1}\frac{\partial \textrm{LN}(\mathbi{y}_k)}{\partial \mathbi{y}_k} \times \prod_{k=l}^{N-1}(1+\frac{\partial F(\mathbi{x}_k;{\bm \theta_k})}{\partial \mathbi{x}_k})
\label{eq:15-3}
\end{eqnarray}
其中$\prod_{k=l}^{L-1}\frac{\partial \textrm{LN}(y_k)}{\partial y_k}$表示在反向传播过程中经过层正则化得到的复合函数导数,$\prod_{k=l}^{L-1}(1+\frac{\partial \mathcal{F}(x_k;\theta_k)}{\partial x_k})$代表每个子层间残差连接的导数。
\end{equation}
\parinterval 其中$\prod_{k=l}^{N-1}\frac{\partial \textrm{LN}(\mathbi{y}_k)}{\partial \mathbi{y}_k}$表示在反向传播过程中经过层标准化得到的复合函数导数,$\prod_{k=l}^{N-1}(1+\frac{\partial F(\mathbi{x}_k;{\bm \theta_k})}{\partial \mathbi{x}_k})$代表每个子层间残差连接的导数。
\parinterval 类似的,也能得到Pre-Norm结构的梯度计算结果,如下式所示:
\begin{eqnarray}
\frac{\partial Loss}{\partial x_l}=\frac{\partial Loss}{\partial x_L} \times (1+\sum_{k=l}^{L-1}\frac{\partial \mathcal{F}(\textrm{LN}(x_k);\theta_k)}{\partial x_l})
\begin{equation}
\frac{\partial Loss}{\partial \mathbi{x}_l}=\frac{\partial Loss}{\partial \mathbi{x}_N} \times (1+\sum_{k=l}^{N-1}\frac{\partial F(\textrm{LN}(\mathbi{x}_k);{\bm \theta_k})}{\partial \mathbi{x}_l})
\label{eq:15-4}
\end{eqnarray}
\end{equation}
\parinterval 对比公式\eqref{eq:15-3}和公式\eqref{eq:15-4}可以明显发现Pre-Norm结构直接把顶层的梯度$\frac{\partial Loss}{\partial x_L}$传递给下层,也就是$\frac{\partial Loss}{\partial x_l}$中直接含有$\frac{\partial Loss}{\partial x_L}$的部分。这个性质弱化了梯度计算对模型深度$L$的依赖;而如公式\eqref{eq:15-3}右侧所示,Post-Norm结构会导致一个与$L$相关的多项导数的积,伴随着$L$的增大更容易发生梯度消失和梯度爆炸问题。因此,Pre-Norm结构更适于堆叠多层神经网络的情况。比如,使用Pre-Norm结构可以很轻松的训练一个30层(60个子层)的Transformer编码器网络,并带来可观的BLEU提升。这个结果相当于标准Transformer编码器深度的6倍\upcite{Wang2019LearningDT}。相对的,用Pre-Norm结构训练深网络的时候,训练结果很不稳定,甚至有时候无法完成有效训练。这里把使用Pre-Norm的深层Transformer称为Transformer-Deep。
\parinterval 对比公式\eqref{eq:15-3}和公式\eqref{eq:15-4}可以明显发现Pre-Norm结构直接把顶层的梯度$\frac{\partial Loss}{\partial \mathbi{x}_N}$传递给下层,也就是$\frac{\partial Loss}{\partial \mathbi{x}_l}$中直接含有$\frac{\partial Loss}{\partial \mathbi{x}_N}$的部分。这个性质弱化了梯度计算对模型深度$N$的依赖;而如公式\eqref{eq:15-3}右侧所示,Post-Norm结构会导致一个与$N$相关的多项导数的积,伴随着$N$的增大更容易发生梯度消失和梯度爆炸问题\footnote[2]{类似地,在循环神经网络中当序列过长时,网络同样容易发生梯度消失和梯度爆炸问题。}。因此,Pre-Norm结构更适于堆叠多层神经网络的情况。比如,使用Pre-Norm结构可以很轻松地训练一个30层(60个子层)编码器的Transformer网络,并带来可观的BLEU提升。这个结果相当于标准Transformer编码器深度的6倍\upcite{WangLearning}。相对的,用Pre-Norm结构训练深层网络的时候,训练结果很不稳定,当编码器深度超过12层后很难完成有效训练\upcite{WangLearning},尤其是在低精度设备环境下损失函数出现发散情况。这里把使用Pre-Norm的深层Transformer称为Transformer-Deep。
\parinterval 另一个有趣的发现是,使用深层网络后,训练模型收敛的时间大大缩短。相比于Transformer-Big等宽网络,Transformer-Deep并不需要太大的隐藏层大小就可以取得相当甚至更优的翻译品质。也就是说,Transformer-Deep是一个更“窄”更“深”的网络。这种结构的参数量比Transformer-Big少,系统运行效率更高。表\ref{tab:15-1}对比了不同模型的参数量和训练/推断时间
\parinterval 另一个有趣的发现是,使用深层网络后,网络可以更有效地利用较大的学习率和batch size训练,大幅度缩短了模型达到收敛的时间。相比于Transformer-Big等宽网络,Transformer-Deep并不需要太大的隐藏层维度就可以取得相当甚至更优的翻译品质\upcite{WangLearning}。也就是说,Transformer-Deep是一个更“窄”更“深”的网络。这种结构的参数量比Transformer-Big少,系统运行效率更高
%----------------------------------------------
\begin{table}[htp]
\centering
\caption{不同Transformer结构的训练/推断时间对比(WMT14英德任务)}
\begin{tabular}{l | r r r}
\rule{0pt}{15pt} 系统 & 参数量 & 训练时间 & 推断时间 \\
\hline
\rule{0pt}{15pt} Base & 63M & 4.6h & 19.4s \\
\rule{0pt}{15pt} Big & 210M & 36.1h & 29.3s \\
\rule{0pt}{15pt} DLCL-30 & 137M & 9.8h & 24.6s \\
\end{tabular}
\label{tab:15-1}
\end{table}
%----------------------------------------------
\parinterval 还有一个有趣的发现是,当编码器端使用深层网络之后,解码器端使用更浅的网络依然能够维持相当的翻译品质。这是由于解码器端的计算仍然会有对源语言端信息的加工和抽象,当编码器变深之后,解码器对源语言端的加工不那么重要了,因此可以减少解码网络的深度。这样做的一个直接好处是:可以通过减少解码器的深度加速翻译系统。对于一些延时敏感的场景,这种架构是极具潜力的。
\parinterval 此外研究人员发现当编码器端使用深层网络之后,解码器端使用更浅的网络依然能够维持相当的翻译品质。这是由于解码器端的计算仍然会有对源语言端信息的加工和抽象,当编码器变深之后,解码器对源语言端的加工不那么重要了,因此可以减少解码网络的深度。这样做的一个直接好处是:可以通过减少解码器的深度加速翻译系统。对于一些延时敏感的场景,这种架构是极具潜力的\upcite{DBLP:journals/corr/abs-2006-10369}
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{层聚合}
\subsection{高效信息传递}
\parinterval 尽管使用Pre-Norm结构可以很容易地训练深层Transformer模型,但从信息传递的角度看,Transformer模型中第$l$层的输入仅仅依赖于前一层的输出。虽然残差连接可以跨层传递信息,但是对于很深的网络,整个模型的输入和输出之间仍需要很多次残差连接才能进行有效的传递。为了使上层的网络可以更加方便地访问下层网络的信息,一种方法是直接引入更多的跨层连接。最简单的一种方法是直接将所有层的输出都连接到最上层,达到聚合多层信息的目的\upcite{Bapna2018TrainingDN,Wang2018MultilayerRF,Dou2018ExploitingDR}
\parinterval 另一种更加有效的方式是在网络前向计算的过程中建立当前层与之前层表示之间的关系,例如动态线性聚合网络\upcite{WangLearning}{\small\bfnew{动态层聚合方法}}\upcite{Dou2019DynamicLA}\index{动态层聚合方法}(Dynamic Linear Combination of Layers,DLCL)\index{Dynamic Linear Combination of Layers}。两者共性在于,在每一层的输入中不仅考虑前一层的输出,而是将前面所有层的中间结果(包括词嵌入表示)进行聚合,本质上利用稠密的层间连接提高了网络中信息传递的效率(前向计算和反向梯度计算)。而前者利用线性的层融合手段来保证计算的时效性,主要应用于深层网络任务的训练,理论上等价于常微分方程中的高阶求解方法\upcite{WangLearning}。此外,为了进一步增强上层网络对底层表示的利用,研究人员从多尺度的维度对深层的编码器网络进行分块,并使用GRU网络来捕获不同块之间的联系,得到更高层次的表示。该方法可以看作是对上述动态线性聚合网络的延伸。接下来分别对上述几种改进方法进行展开讨论。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{1. 使用更多的跨层连接}
\parinterval 图15.2描述了引入了更多跨层连接的结构。在网络的前向计算过程中,假设编码端总层数为$N$,当完成编码端$N$层的逐层计算后,通过线性平均、加权平均等机制对网络的中间层表示进行融合,得到蕴含所有层信息的表示\mathbi{g},作为解码段编码-解码注意力机制的输入,与总共有$M$层的解码器共同处理解码信息。{转录时L换成N,15-4也是}
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.4]{./Chapter15/Figures/figure-layer-fusion-method.png}
\caption{层融合方法}
\label{fig:15-2}
\end{figure}
%-------------------------------------------
\parinterval 这里,令$\mathbi{h}_i$是第$i$层编码端的输出,$\mathbi{s}_j^k$是解码器解码第$j$个单词时第$k$层的输出。层融合机制可以大致划分为如下:
\parinterval 尽管使用Pre-Norm结构可以很容易地训练深层Transformer模型,但从信息传递的角度看,Transformer模型中第$n$层的输入仅仅依赖于前一层的输出。虽然残差连接可以将信息跨层传递,但是对于很深的网络,整个模型的输入和输出之间仍需要很多次残差连接才能进行有效的传递。为了使上层的网络可以更加方便地访问下层网络的信息,一种方法是直接引入更多跨层的连接。最简单的一种方法是直接将所有层的输出都连接到最上层,达到聚合多层信息的目的\upcite{Bapna2018TrainingDN,Wang2018MultilayerRF}。另一种更加有效的方式是使用{\small\bfnew{动态线性层聚合方法}}\index{动态线性层聚合方法}(Dynamic Linear Combination of Layers,DLCL)\index{Dynamic Linear Combination of Layers,DLCL}。在每一层的输入中不仅考虑前一层的输出,而是将前面所有层的中间结果(包括词嵌入)进行线性聚合,理论上等价于常微分方程中的高阶求解方法\upcite{Wang2019LearningDT}。以Pre-Norm结构为例,具体做法如下:
\begin{itemize}
\vspace{0.5em}
\item 对于每一层的输出$x_{l+1}$,对其进行层正则化,得到每一层的信息的表示
\begin{eqnarray}
z_{l}=\textrm{LN}(x_{l+1})
\item 线性平均,即平均池化。通过对各层中间表示进行累加之后取平均值。
\begin{equation}
\mathbi{g}=\frac{1}{N}\sum_{l=1}^{N}{\mathbi{h}_l}
\label{eq:15-5}
\end{eqnarray}
注意,$z_0$表示词嵌入层的输出,$z_l(l>0)$表示Transformer网络中最终的各层输出。
\end{equation}
\vspace{0.5em}
\item 定义一个维度为$(L+1)\times(L+1)$的权值矩阵$\vectorn{W}$,矩阵中每一行表示之前各层对当前层计算的贡献度,其中$L$是编码端(或解码端)的层数。令$\vectorn{W}_{l,i}$代表权值矩阵$\vectorn{W}$$l$行第$i$列的权重,则层聚合的输出为$z_i$的线性加权和:
\begin{eqnarray}
g_l=\sum_{i=0}^{l}z_i\times \vectorn{W}_{l,i}
\item 权重平均。在线性平均的基础上,赋予每一个中间层表示相应的权重。权重的值通常采用可学习的参数矩阵$\mathbi{W}$表示,通过反向传播来不断调整每一层的权重比例,通常会略优于线性平均方法。
\begin{equation}
\mathbi{g}=\sum_{l=1}^{N}{\mathbi{W}_l\mathbi{h}_l}
\label{eq:15-6}
\end{equation}
\vspace{0.5em}
\item 前馈神经网络。将之前中间层的表示进行级联,之后利用前馈神经网络得到融合的表示。
\begin{equation}
\mathbi{g}=\textrm{FNN}([\mathbi{h}_1,\mathbi{h}_2,\ldots,\mathbi{h}_N])
\label{eq:15-7}
\end{equation}
\noindent 其中,$[\cdot]$表示级联操作。这种方式对比权重平均具有更复杂的线性运算,同时引入非线性变化增加网络的表示能力。
\vspace{0.5em}
\item 基于多跳的自注意力机制,其结构图如图\ref{fig:15-3}所示。其做法与前馈神经网络类似,首先将不同层的表示拼接成2维的句子级矩阵表示示\footnote[3]{对比1维向量有更强的表示能力\upcite{DBLP:journals/corr/LinFSYXZB17}}。之后利用类似于前馈神经网络的思想将维度为$\mathbb{R}^{d\times N}$的矩阵映射到维度为$\mathbb{R}^{d\times n_{hop}}$的矩阵表示。
\begin{equation}
\mathbi{o}=\sigma ([\mathbi{h}_1,\mathbi{h}_2,\ldots,\mathbi{h}_N]^{T} \cdot \mathbi{W}_1)\mathbi{W}_2
\label{eq:15-8}
\end{equation}
\noindent 其中$\mathbi{W}_1 \in \mathbb{R}^{d\times d_a}$$\mathbi{W}_2 \in \mathbb{R}^{d_a\times n_{hop}}$。之后使用Softmax函数计算不同层在同一维度空间的归一化概率$\mathbi{u}_l$
\begin{equation}
\mathbi{u}_l=\frac{\textrm{exp}(\mathbi{o}_l)}{\sum_i^N{\textrm{exp}(\mathbi{o}_i)}}
\label{eq:15-9}
\end{equation}
\noindent 最后通过向量积操作得到维度为$\mathbb{R}^{d\times n_{hop}}$的稠密表示$\mathbi{v}$。通过单层的前馈神经网络得到最终的融合表示 :
\begin{eqnarray}
\mathbi{v}_n & = & [\mathbi{h}_1,\mathbi{h}_2,\ldots,\mathbi{h}_N]\cdot \mathbi{u}_l \\
\mathbi{g} & = & \textrm{FNN}([\mathbi{v}_1,\mathbi{v}_2,\ldots,\mathbi{v}_N])
\label{eq:15-11}
\end{eqnarray}
$g_l$会作为输入的一部分送入第$l+1$层。其网络的结构如图\ref{fig:15-2}所示
\vspace{0.5em}
\end{itemize}
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.7]{./Chapter15/Figures/figure-layer-fusion-method-2d.png}
\caption{Post-Norm Transformer vs Pre-Norm Transformer}
\label{fig:15-3}
\end{figure}
%-------------------------------------------
\parinterval 上述工作更多应用于浅层的Transformer网络,这种仅在编码端顶部使用融合机制的方法并没有在深层Transformer上得到有效地验证。主要原因是融合机制仅作用于编码端或解码端的顶部,对网络中间层的计算并没有显著提升。因此当网络深度较深时,信息在前向计算和反向更新过程中的传播效率仍然有待提高,但这种“静态”的融合方式也为深层Transformer研究奠定了基础。例如研究人员提出了透明注意力网络\upcite{Bapna2018TrainingDN},即在权重平均的基础上,引入了$(N+1)\times (M+1)$的权重矩阵,其中$N$$M$分别代表编码端与解码端的层数。其核心思想是让解码端中每一层的编码-解码注意力网络接收到的编码端融合表示中对应不同编码层的权重是独立的,而不是共享相同的融合表示,如图\ref{fig:15-4}所示。此外二维的权重矩阵对比一维矩阵具有更强的学习能力,实验表明在英德数据集上获得了与宽网络(Transformer-Big)相当的翻译性能。
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.4]{./Chapter15/Figures/figure-transparent-attention-mechanism.png}
\caption{透明注意力机制}
\label{fig:15-4}
\end{figure}
%-------------------------------------------
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{2. 动态层融合}
\parinterval 那如何进一步提高信息的传递效率?对比层融合方法,本节介绍的动态层融合可以更充分利用之前层的信息,其网络连接更加稠密,表示能力更强\upcite{Bapna2018TrainingDN,WangLearning,Wei2020MultiscaleCD,DBLP:conf/acl/WuWXTGQLL19,li2020shallow,DBLP:journals/corr/abs-2007-06257}。以基于Pre-Norm结构的DLCL网络中编码器为例,具体做法如下:
\begin{itemize}
\vspace{0.5em}
\item 对于每一层的输出$\mathbi{x}_{l}$,对其进行层标准化,得到每一层的信息的表示
\begin{equation}
\mathbi{h}_l=\textrm{LN}(\mathbi{x}_{l})
\label{eq:15-12}
\end{equation}
注意,$\mathbi{h}_0$表示词嵌入层的输出,$\mathbi{h}_l(l>0)$表示Transformer网络中最终的各层输出。
\vspace{0.5em}
\item 定义一个维度为$(N+1)\times (M+1)$的权值矩阵$\mathbi{W}$,矩阵中每一行表示之前各层对当前层计算的贡献度,其中$L$是编码端(或解码端)的层数。令$\mathbi{W}_{l,i}$代表权值矩阵$\mathbi{W}$$l$行第$i$列的权重,则层聚合的输出为$\mathbi{h}_i$的线性加权和:
\begin{equation}
\mathbi{g}_l=\sum_{i=0}^{l}\mathbi{h}_i\times \mathbi{W}_{l,i}
\label{eq:15-13}
\end{equation}
$\mathbi{g}_l$会作为输入的一部分送入第$l+1$层。其网络的结构如图\ref{fig:15-2}所示
\vspace{0.5em}
\end{itemize}
%---------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter15/Figures/figure-dynamic-linear-aggregation-network-structure}
\caption{动态线性层聚合网络结构图}
\label{fig:15-2}
\caption{线性层聚合网络}
\label{fig:15-5}
\end{figure}
%-------------------------------------------
\parinterval 可以看到,权值矩阵$\mathbi{W}$是一个下三角矩阵。开始时,对矩阵参数的每行进行平均初始化,即初始化矩阵$\mathbi{W}_0$的每一行各个位置的值为$1/\lambda , \lambda \in (1,2,3 \cdots l+1)$。伴随着神经网络的训练,网络通过反向传播算法来不断更新$\mathbi{W}$中每一行不同位置权重的大小。
\parinterval 动态线性层聚合的一个好处是,系统可以自动学习不同层对当前层的贡献度。在实验中也发现,离当前层更近的部分贡献度(权重)会更大,如图\ref{fig:15-6}所示,在每一行中颜色越深代表对当前层的贡献度越大,这也是符合直觉的。
\parinterval 对比上述介绍的动态层线性聚合方法,研究人员利用更为复杂的胶囊网络\upcite{Dou2019DynamicLA},树状层次结构\upcite{Dou2018ExploitingDR}作为层间的融合方式,动态地计算每一层网络的输入。然而,研究人员发现进一步增加模型编码端的深度并不能取得更优的翻译性能。因此如何进一步突破神经网络深度的限制是值得关注的研究方向,类似的话题在图像处理领域也激起了广泛的讨论\upcite{DBLP:conf/nips/SrivastavaGS15,DBLP:conf/icml/BalduzziFLLMM17,DBLP:conf/icml/Allen-ZhuLS19,DBLP:conf/icml/DuLL0Z19}
%---------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.4]{./Chapter15/Figures/figure-weight-visualization-of-convergence-DLCL-network.png}
\caption{对收敛的DLCL网络进行权重的可视化\upcite{WangLearning}}
\label{fig:15-6}
\end{figure}
%-------------------------------------------
\parinterval 可以看到,权值矩阵$\vectorn{W}$是一个下三角矩阵。开始时,对矩阵参数的每行进行平均初始化,即初始化矩阵$\vectorn{W}_0$的每一行各个位置的值为$1/M,M \in (1,2,3 \cdots L+1)$。 伴随着神经网络的训练,网络通过反向传播算法来不断更新$\vectorn{W}$中每一行不同位置权重的大小。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{3. 多尺度协同网络}
\parinterval 沿着动态线性层聚合思路(DLCL),研究者进一步提出了{\small\bfnew{多尺度协同框架}}\index{多尺度协同框架}(Multiscale Collaborative Framework)\index{Multiscale Collaborative Framework}进一步强化深层网络的表示能力该框架大致可以概括为两方面:
\parinterval 动态线性层聚合的一个好处是,系统可以自动学习不同层对当前层的贡献度。在实验中也发现,离当前层更近的部分贡献度(权重)会更大,这也是符合直觉的。
\begin{itemize}
\vspace{0.5em}
\item 采用组间协同机制。将连续的多个编码层或解码层组成块,保证编码端和解码端具有相同的块数\footnote[4]{例如,一个36层的深层网络包含6个编码块和6个解码块,其中每连续的6层编码层网络组成一个编码块,每一层解码层都是一个单独的解码块。}其核心思想是解码端能够利用对应的编码块输出作为注意力网络的Key和Value进行跨语言间映射,进而达到对编码端不同层次信息的利用。同时,在一定程度上缩短了信息传递的路径,让编码端底层网络的参数接收更丰富的梯度信息,进而达到更优的收敛状态。
\vspace{0.5em}
\item 上下文协同机制。单独使用组间协同机制来缩短信息传递的路径并不能带来显著地性能提升,尤其是当网络变得极深时,组间的堆叠无法有效地建模层间的长期依赖。为了改善这个问题,可以采用GRU网络来提取不同层之间的上下文信息,等价于在不同时间步根据对应编码块的输出来更新GRU的隐层状态。提取到的上下文信息,即{\red $g$(再确认一下上标)}也被作为输入分别送入编码端与解码端,利用注意力网络进行特征融合。之后采用门控机制的思想将得到的上下文表示与对应的编码/解码的自注意力输出融合。
\vspace{0.5em}
\end{itemize}
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{深层模型的训练加速}
\subsection{面向深层模型的参数初始化策略}
\parinterval 网络的学习不仅仅依赖于精心设计的网络结构,合适的初始化策略同样十分重要。例如Transformer中参数矩阵采用了Xavier初始化方式根据其输入维度和输出维度来控制均匀分布的边界\upcite{pmlr-v9-glorot10a}。该初始化可以保证各层的激活函数的输出和状态梯度在传播过程中方差的一致性,即同时考虑正向传播和反向传播的输入输出的方差相同;同样针对不同的激活函数应该采取合适的初始化方式来更好的发挥复杂网络的优势。例如更适用于ReLu激活函数的Kaiming初始化方式\upcite{DBLP:conf/iccv/HeZRS15},其核心思想同样是保证方差一致性。
\parinterval 目前的Transformer模型初始化方式已经是精心设计过的,但该类初始化更适合于浅层网络,在深层Transformer网络训练时表现不佳\upcite{pmlr-v9-glorot10a}。近期,研究人员针对深层网络的参数初始化问题进行了广泛的探索。下面分别对比分析几个最近提出的初始化策略。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{1. 基于深度缩放的初始化策略}
\parinterval 为什么Transformer现有初始化策略无法满足训练深层网络?这是由于伴随着网络层数的加深,输入的特征要经过很多的线性及非线性变换,受网络中激活函数导数值域范围和连乘操作的影响,常常会带来梯度爆炸或梯度消失的问题。其根本理由是过深堆叠网络无法保证梯度在回传过程中的方差一致性,尽管在目前深层模型中所采用的很多标准化方式如层标准化、批次标准化等都是从方差一致性的维度来解决此问题,即通过将网络各层输出的取值范围控制在激活函数的梯度敏感区域,从而维持网络中梯度传递的稳定性。
\parinterval 首先说明浅层Transformer模型中是如何维持梯度的方差一致性。Transformer中在初始化线性变换矩阵$\mathbi{W}$的参数时采用了Xavier初始化方法保障网络在不断优化过程中方差的问题,其方式为从一个均匀分布中进行随机采样:
\begin{equation}
\mathbi{W} \in \mathbb{R}^{d_i\times d_o} \sim u(-\gamma,\gamma),\gamma=\sqrt{\frac{6}{d_i\times d_o}}
\label{eq:15-16}
\end{equation}
\noindent 其中$\mathbi{W}$为网络中的参数,$d_i$$d_o$分别为线性变换中输入和输出的纬度,通过这种方式可以维持在前向与反向过程中输入与输出方差的一致性\upcite{DBLP:conf/iccv/HeZRS15}。这是由于在矩阵运算的中,神经元输出$\mathbi{Z}=\sum_{i=1}^n{\mathbi{w}_i \mathbi{x}_i}$$n$是上一层神经元的数量。因此,根据概率统计里的两个随机变量乘积的方差展开式为:
\begin{equation}
\textrm{Var}(\mathbi{w}_i \mathbi{x}_i) = E[\mathbi{w}_i]^2 \textrm{Var}(\mathbi{x}_i) + E[\mathbi{x}_i]^2 \textrm{Var}(\mathbi{w}_i) + \textrm{Var}(\mathbi{w}_i)\textrm{Var}(\mathbi{x}_i)
\label{eq:15-17}
\end{equation}
\parinterval 在大多数情况下,基于各种标准化手段可以维持$E[\mathbi{w}_i]^2$$E[\mathbi{x}_i]^2$等于或者近似为0,因此输出的方差:
\begin{equation}
\textrm{Var}(\mathbi{Z}) = \sum_{i=1}^n{\textrm{Var}(\mathbi{x}_i) \textrm{Var}(\mathbi{w}_i)} = n\textrm{Var}(\mathbi{W})\textrm{Var}(\mathbi{X})
\label{eq:15-18}
\end{equation}
\parinterval 因此当$\textrm{Var}(\mathbi{W})=\frac{1}{n}$时,则可以保证输入和输出空间的分布差异不至于过大。通过计算得到网络正向传播时$\textrm{Var}(\mathbi{W})=\frac{1}{d_i}$,反向传播时$\textrm{Var}(\mathbi{W})=\frac{1}{d_o}$,通过对其取平均值,控制网络参数$\mathbi{W}$的方差为$\frac{2}{d_i+d_o}$,则可以维持在前向与反向过程中输入与输出方差的一致性。由于当参数服从边界为$[a,b]$的均匀分布,其方差为$\frac{{b-a}^2}{12}$,为了达到目标方差值域,在初始化时将边界设为$\sqrt{\frac{6}{d_i+d_o}}$
\parinterval 但是随着网络层数的加深,研究人员发现简单的通过伤初始化得到的参数状态对基于Post-Norm的 Transformer各层输出方差的约束逐渐减弱。当网络堆叠至较深时会发现,模型顶层输出的方差较大,同时反向传播的梯度范数顶层也要大于底层。因此,一个自然的想法是根据网络的深度对不同层的参数矩阵采取不同的初始化方式,进而强化对各层输出方差的约束:
\begin{equation}
\mathbi{W} \in \mathbb{R}^{d_i\times d_o} \sim u(-\gamma \frac{\alpha}{\sqrt{l}},\gamma \frac{\alpha}{\sqrt{l}})
\label{eq:15-19}
\end{equation}
\noindent 其中,$l$为对应的网络层的深度,$\alpha$为预先设定的超参数来控制缩放的比例,通过这种方式降低网络层输出方差,可以将缩减顶层网络输出分布与输入分布之间的差异,减少顶层网络参数的梯度范数。从而缓解由于网络层堆叠过深所带来的梯度消失问题,保证深层网络能够稳定的训练。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{2. 基于Lipschitz的初始化策略}
\parinterval 在前面已经介绍过,在Pre-Norm结构中每一个子层的输出$\mathbi{x}_{l+1}^{pre}=\mathbi{x}_l+\mathbi{y}_l$,其中$\mathbi{x}_l$为当前子层的输入, $\mathbi{y}_l$为经过自注意力层或前馈神经网络层计算后得到的子层输出。在Post-Norm结构中,在残差连接之后还要进行层标准化操作,具体的计算流程为:
\begin{itemize}
\vspace{0.5em}
\item 计算输入的均值:${\bm \mu}=\textrm{mean}(\mathbi{x}_l+\mathbi{y}_l)$
\vspace{0.5em}
\item 计算输入的方差:${\bm \sigma}=\textrm{std}(\mathbi{x}_l+\mathbi{y}_l)$
\vspace{0.5em}
\item 根据均值和方差对输入进行放缩,其中$\mathbi{w}$$\mathbi{b}$为可学习参数,用于进一步调整均值和方差到合适的位置,提高网络的表示能力:
\begin{equation}
\mathbi{x}_{l+1}^{post}=\frac{\mathbi{x}_l+\mathbi{y}_l-{\bm \mu}}{\bm \sigma} \cdot \mathbi{w}+\mathbi{b}
\label{eq:15-20}
\end{equation}
\noindent 将其展开后可得:
\begin{equation}
\mathbi{x}_{l+1}^{post}=\frac{\mathbi{w}}{\bm \sigma} \cdot \mathbi{x}_{l+1}^{pre}-\frac{\mathbi{w}}{\bm \sigma} \cdot {\bm \mu}+\mathbi{b}
\label{eq:15-21}
\end{equation}
\vspace{0.5em}
\end{itemize}
\parinterval 可以看到相比于Pre-Norm的计算方式,基于Post-Norm的Transformer中子层的输出为Pre-Norm形式的$\frac{\mathbi{w}}{\bm \sigma}$倍,当$\frac{\mathbi{w}}{\bm \sigma}<1.0$时,使残差层的输出较小,输入与输出分布之间差异过大,导致深层Transformer系统难以收敛。因此基于Lipschitz 的初始化策略通过维持条件$\frac{\mathbi{w}}{\bm \sigma}>1.0$,保证网络输入与输出范数一致,进而缓解梯度消失的问题\upcite{DBLP:conf/acl/XuLGXZ20}。一般情况下,$\mathbi{w}$可以被初始化为1,因此Lipschitz Initialization最终的约束条件则为:
\begin{equation}
0.0<{\bm \sigma}=\textrm{std}⁡(\mathbi{x}_l+\mathbi{y}_l) \leq 1.0
\label{eq:15-22}
\end{equation}
\parinterval 为了实现这个目标,可以限制$a \leq \mathbi{x}_l+\mathbi{y}_l \leq a + \Delta a$,在经过推导后可以发现,只要$\Delta a \leq 1.0$即可满足此条件。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{3. T-Fixup初始化策略}
\parinterval 另外一种初始化方法是是从网络的结构与优化器的计算方式入手,通过可视化训练过程中参数的范数发现Post-Norm网络在训练前期(Warmup阶段)难以很精确的估计参数的二阶动量,导致训练不稳定问题\upcite{huang2020improving}。其结论也证实了其他研究人员的发现\upcite{WangLearning},即层标准化是导致深层Transformer难以优化的主要矛盾。并强调了Post-Norm方式下Transformer的底层网络,尤其是编码段的词嵌入层严重面临梯度消失问题。导致矛盾的原因在于在不改变层标准化位置的条件下,由于Adam优化器利用滑动平均的方式来估计参数的二阶矩,其方差是无界的。这样在前期模型只能看到受限样本的前提下,其二阶矩很难进行有效的估计。因此反向更新参数时会引起参数的梯度方差过大问题。相较于用Pre-Norm代替Post-Norm结构来训练深层网络,也可以通过去除warmup策略并移除层标准化机制,并针对网络中不同的参数矩阵制定了相应的缩放机制来保证训练的稳定\upcite{huang2020improving}。具体的缩放策略如下:
\begin{itemize}
\vspace{0.5em}
\item 类似标准的Transformer初始化方式,使用Xavier初始化方式来初始化除了词嵌入以外的所有参数矩阵。词嵌入矩阵服从$\mathbb{N}(0,d^{-\frac{1}{2}})${\red (再确认N的形式,下面的也要确认)}的高斯分布,其中$d$代表词嵌入的维度。
\vspace{0.5em}
\item 对编码端中自注意力网络中$\mathbi{W}^V$$\mathbi{W}^o$矩阵以及前馈神经网络中所有参数矩阵进行缩放因子为$0.67\mathbb{N}^{-\frac{1}{4}}$的缩放,其中$\mathbi{W}^o$是注意力操作中的参数矩阵{\red 看下怎么说好(详见12章transformer部分)}
\vspace{0.5em}
\item 对解码端中注意力网络中的$\mathbi{W}^V$$\mathbi{W}^o$以及前馈神经网络中所有参数矩阵进行缩放因子为$(9\mathbb{N})^{-\frac{1}{4}}$的缩放
\vspace{0.5em}
\end{itemize}
\parinterval 这种初始化方法由于没有Warmup策略,学习率会直接从峰值根据参数的更新次数进行退火,大幅度增大了网络收敛的时间。其主要贡献是在不考虑训练代价的前提下,合理的初始化方法可以让浅层的Transformer网络达到更优的翻译性能。如何进一步解决该初始化方法下的模型收敛速度是比较关键的课题
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{4. ADMIN初始化策略}
\parinterval 相比于前人得出深层网络不能充分训练的痛点在于底层网络出现参数消失问题的结论,一些研究人员持不同的看法。他们认为Post-Norm网络在训练过程中过度的依赖残差支路,在训练初期很容易发生参数梯度方差过大的隐患\upcite{DBLP:conf/emnlp/LiuLGCH20}。同时分别从理论和经验性实验验证了底层网络的梯度消失是导致了训练的不稳定的重要因素,但并不是唯一因素。通过对基于Post-Norm的编码器和解码器与基于Pre-Norm的编码器与解码器进行两两组合,作者发现梯度消失的主要故障点在于基于Post-Norm的解码器。而且尽管通过调整网络结构解决梯度消失问题,网络的不稳定训练仍然没有很好地解决。进一步对基于Pre-Norm网络的输入与输出进行分析,研究人员发现其输入与输出之间方差的变换率为$O(\log N)${\red 跟他们确认一下有没有特殊用法,还有N是什么}。为了解决Post-Norm网络结构在训练初期过于依赖残差支路,作者提出了两阶段的初始化方法来间接控制其输入与输出之间的方差在$O(\log N)$内。其子层之间的残差连接如公式\eqref{eq:15-23}所示:
\begin{equation}
\mathbi{x}_{l+1}=\mathbi{x}_l \cdot {\bm \omega_{l+1}} + F_{l+1}(\mathbi{x}_l)
\label{eq:15-23}
\end{equation}
\parinterval 尽管训练这种窄而深的神经网络对比宽网络有更快的收敛速度,但伴随着训练数据的增加,以及模型进一步的加深,神经网络的训练代价成为不可忽视的问题。例如,在几千万甚至上亿的双语平行语料上训练一个48层的Transformer模型需要将近几周的时间能达到收敛\footnote[2]{训练时间的估算是在单台8卡Titan V GPU服务器上得到的}。因此,在保证模型精度不变的前提下如何高效地完成深层网络的训练也是至关重要的。在实践中能够发现,深层网络中相邻层之间具有一定的相似性。因此,一个想法是:能否通过不断复用浅层网络的参数来初始化更深层的网络,渐进式的训练深层网络,避免从头训练整个网络,进而达到加速深层网络训练的目的。
\noindent 其两阶段的初始化方法如下所示:
\begin{itemize}
\vspace{0.5em}
\item Profiling阶段:${\bm \omega_{l+1}} = 1$,只进行网络的前向计算,无需进行网络的梯度计算。在训练样本上计算$F_{l+1}(\mathbi{x}_l)$的方差
\vspace{0.5em}
\item Initialization阶段:通过Profiling阶段得到的$F_{l+1}(\mathbi{x}_l)$的方差来初始化$\bm \omega_{l+1}$
\begin{equation}
{\bm \omega_{l+1}} = \sqrt{\sum_{j<l}\textrm{Var}[F_{l+1}(\mathbi{x}_l)]}
\label{eq:15-24}
\end{equation}
\vspace{0.5em}
\end{itemize}
\parinterval 通过这种方式,研究人员成功训练了深层网络,同时该动态地参数初始化方法不受限于具体的模型结构,方法的稳定性更优。
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{渐进式训练}
\subsection{深层网络的训练加速}
\parinterval 尽管训练这种窄而深的神经网络对比宽网络有更快的收敛速度\upcite{WangLearning},但伴随着训练数据的增加,以及模型进一步的加深,神经网络的训练代价成为不可忽视的问题。例如,在几千万甚至上亿的双语平行语料上训练一个48层的Transformer模型需要将近几周的时间能达到收敛\footnote[5]{训练时间的估算是在单台8卡Titan V GPU服务器上得到的}。因此,在保证模型精度不变的前提下如何高效地完成深层网络的训练也是至关重要的。在实践中能够发现,深层网络中相邻层之间具有一定的相似性。因此,一个想法是:能否通过不断复用浅层网络的参数来初始化更深层的网络,渐进式的训练深层网络,避免从头训练整个网络,进而达到加速深层网络训练的目的。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{1. 渐进式训练}
\parinterval 所谓渐进式训练是指从浅层网络开始,在训练过程中逐渐增加训练的深度。一种比较简单的方法是将网络分为浅层部分和深层部分,之后分别进行训练,最终达到提高模型翻译性能的目的\upcite{DBLP:conf/acl/WuWXTGQLL19}
\parinterval 另一种方式是动态构建深层网络,并尽可能复用浅层网络的训练结果。假设开始的时候模型包含$h$层网络,然后训练这个模型至收敛。之后,直接拷贝这$h$层网络(包括参数),并堆叠出一个$2h$层的模型。之后继续训练,重复这个过程。进行$n$次之后就得到了$n\times h$层的模型。图\ref{fig:15-3}给出了在编码端使用渐进式训练的示意图。
\parinterval 另一种方式是动态构建深层网络,并尽可能复用浅层网络的训练结果。假设开始的时候模型包含$l$层网络,然后训练这个模型至收敛。之后,直接拷贝这$l$层网络(包括参数),并堆叠出一个$2l$层的模型。之后继续训练,重复这个过程。进行$n$次之后就得到了$n\times l$层的模型。图\ref{fig:15-9}给出了在编码端使用渐进式训练的示意图。
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter15/Figures/figure-progressive-training}
\caption{渐进式深层网络训练过程}
\label{fig:15-3}
\label{fig:15-9}
\end{figure}
%-------------------------------------------
\parinterval 渐进式训练的好处在于深层模型并不是从头开始训练。每一次堆叠,都相当于利用“浅”模型给“深”模型提供了一个很好的初始点,这样深层模型的训练会更加容易。
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{分组稠密连接}
\subsubsection{2. 分组稠密连接}
\parinterval 很多研究者已经发现深层网络不同层之间的稠密连接能够很明显地提高信息传递的效率\upcite{Wang2019LearningDT,DBLP:conf/cvpr/HuangLMW17,Dou2018ExploitingDR,DBLP:conf/acl/WuWXTGQLL19}。与此同时,对之前层信息的不断复用有助于得到更好的表示,但随之而来的是网络计算代价过大的问题。由于动态线性层聚合方法(DLCL)在每一次聚合时都需要重新计算之前每一层表示对当前层网络输入的贡献度,因此伴随着编码端整体深度的不断增加,这部分的计算代价变得不可忽略。例如,一个基于动态层聚合的48层Transformer模型的训练时间比不使用动态层聚合慢近1.9倍。同时,缓存中间结果也增加了显存的使用量,尽管使用了FP16计算,每张12G显存的GPU上计算的词也不能超过2048个,这导致训练开销急剧增大。
\parinterval 很多研究者已经发现深层网络不同层之间的稠密连接能够很明显地提高信息传递的效率\upcite{WangLearning,DBLP:conf/cvpr/HuangLMW17,Dou2018ExploitingDR,DBLP:conf/acl/WuWXTGQLL19}。与此同时,对之前层信息的不断复用有助于得到更好的表示,但随之而来的是网络计算代价过大的问题。由于动态线性层聚合方法(DLCL)在每一次聚合时都需要重新计算之前每一层表示对当前层网络输入的贡献度,因此伴随着编码端整体深度的不断增加,这部分的计算代价变得不可忽略。例如,一个基于动态层聚合的48层Transformer模型的训练时间比不使用动态层聚合慢近1.9倍。同时,缓存中间结果也增加了显存的使用量,尽管使用了FP16计算,每张12G显存的GPU上计算的词也不能超过2048个,这导致训练开销急剧增大。
\parinterval 缓解这个问题的一种方法是使用更稀疏的层间连接方式。其核心思想与动态线性层聚合是类似的,不同点在于可以通过调整层之间连接的稠密程度来降低训练代价。比如,可以将每$p$层分为一组,之后动态线性层聚合只在不同组之间进行。这样,通过调节$p$值的大小可以控制网络中连接的稠密程度,作为一种训练代价与翻译性能之间的权衡。显然,标准的Transformer模型\upcite{vaswani2017attention}和DLCL模型\upcite{Wang2019LearningDT}都可以看作是该方法的一种特例。如图\ref{fig:15-4}所示:当$p=1$时,每一个单独的块被看作一个独立的组,这等价于基于动态层聚合的DLCL模型;当$p=\infty$时,这等价于正常的Transformer模型。值得注意的是,如果配合渐进式训练。在分组稠密连接中可以设置$p=h$
\parinterval 缓解这个问题的一种方法是使用更稀疏的层间连接方式。其核心思想与动态线性层聚合是类似的,不同点在于可以通过调整层之间连接的稠密程度来降低训练代价。比如,可以将每$p$层分为一组,之后动态线性层聚合只在不同组之间进行。这样,通过调节$p$值的大小可以控制网络中连接的稠密程度,作为一种训练代价与翻译性能之间的权衡。显然,标准的Transformer模型\upcite{vaswani2017attention}和DLCL模型\upcite{WangLearning}都可以看作是该方法的一种特例。如图\ref{fig:15-10}所示:当$p=1$时,每一个单独的块被看作一个独立的组,这等价于基于动态层聚合的DLCL模型;当$p=\infty$时,这等价于正常的Transformer模型。值得注意的是,如果配合渐进式训练。在分组稠密连接中可以设置$p=h$
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter15/Figures/figure-sparse-connections-between-different-groups}
\caption{不同组之间的稀疏连接}
\label{fig:15-4}
\label{fig:15-10}
\end{figure}
%-------------------------------------------
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{学习率重置策略}
\subsubsection{3. 学习率重置}
\parinterval 尽管渐进式训练策略与分组稠密连接结构可以加速深层网络的训练,但使用传统的学习率衰减策略会导致堆叠深层模型时的学习率较小,因此模型无法快速地达到收敛状态,同时也影响最终的模型性能。
......@@ -201,7 +450,7 @@ $g_l$会作为输入的一部分送入第$l+1$层。其网络的结构如图\ref
\centering
\input{./Chapter15/Figures/figure-learning-rate}
\caption{学习率重置vs从头训练的学习率曲线}
\label{fig:15-5}
\label{fig:15-11}
\end{figure}
%-------------------------------------------
......@@ -209,18 +458,19 @@ $g_l$会作为输入的一部分送入第$l+1$层。其网络的结构如图\ref
\begin{itemize}
\vspace{0.5em}
\item 在训练的初期,模型先经历一个学习率预热的过程:
\begin{eqnarray}
\begin{equation}
lr=d_{model}^{-0.5}\cdot step\_num \cdot warmup\_steps^{-0.5}
\label{eq:15-7}
\end{eqnarray}
这里,$step\_num$表示参数更新的次数,$warmup\_step$表示预热的更次次数,$d_{model}^{-0.5}$表示Transformer模型隐层大小,$lr$是学习率。
\label{eq:15-25}
\end{equation}
\noindent 这里,$step\_num$表示参数更新的次数,$warmup\_step$表示预热的更次次数,$d_{model}^{-0.5}$表示Transformer模型隐层大小,$lr$是学习率。
\vspace{0.5em}
\item 在之后的迭代训练过程中,每当进行新的迭代,学习率都会重置到峰值,之后进行相应的衰减:
\begin{eqnarray}
\begin{equation}
lr=d_{model}^{-0.5}\cdot step\_num^{-0.5}
\label{eq:15-8}
\end{eqnarray}
这里$step\_num$代表学习率重置后更新的步数。
\label{eq:15-26}
\end{equation}
\noindent 这里$step\_num$代表学习率重置后更新的步数。
\vspace{0.5em}
\end{itemize}
\parinterval 综合使用渐进式训练、分组稠密连接、学习率重置策略可以在保证翻译品质不变的前提下,缩减近40\%的训练时间(40层编码器)。同时,加速比伴随着模型的加深与数据集的增大会进一步地扩大。
......@@ -229,65 +479,342 @@ lr=d_{model}^{-0.5}\cdot step\_num^{-0.5}
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{深层模型的鲁棒性训练}
\subsection{深层网络的鲁棒性训练}
\parinterval 伴随着网络的加深,还会面临另外一个比较严峻的问题\ \dash \ 过拟合。由于参数量的增大,深层网络的输入与输出分布之间的差异也会越来越大,然而不同子层之间的{\small\bfnew{相互适应}}\index{相互适应}(Co-adaptation)\index{Co-adaptation}也会更加的明显,导致任意子层网络对其他子层的依赖过大。这对于训练阶段是有帮助的,因为不同子层可以协同工作从而更好地拟合训练数据。然而这种方式也降低了模型的泛化能力,即深层网络更容易陷入过拟合问题。
\parinterval 通常,可以使用Dropout手段用来缓解过拟合问题(见{\chapterthirteen})。不幸的是,尽管目前Transformer模型使用了多种Dropout手段(如Residual Dropout、Attention Dropout、 ReLU Dropout等),过拟合问题在深层网络中仍然存在。从图\ref{fig:15-6}中可以看到,深层网络对比浅层网络在训练集和校验集的困惑度上都有显著的优势,然而网络在训练一段时间后出现校验集困惑度上涨的现象,说明模型已经过拟合于训练数据。
\parinterval 通常,可以使用Dropout手段用来缓解过拟合问题(见{\chapterthirteen})。不幸的是,尽管目前Transformer模型使用了多种Dropout手段(如Residual Dropout、Attention Dropout、 ReLU Dropout等),过拟合问题在深层网络中仍然存在。从图\ref{fig:15-12}中可以看到,深层网络对比浅层网络在训练集和校验集的困惑度上都有显著的优势,然而网络在训练一段时间后出现校验集困惑度上涨的现象,说明模型已经过拟合于训练数据。
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter15/Figures/figure-wmt16}
\caption{浅层网络(左)与深层网络(右)在WMT16英德的校验集与训练集的困惑度}
\label{fig:15-6}
\label{fig:15-12}
\end{figure}
%-------------------------------------------
\parinterval{\chapterthirteen}提到的Layer Dropout方法可以有效地缓解这个问题。以编码端为例, Layer Dropout的过程可以被描述为:在训练过程中,对自注意力子层或前馈神经网络子层进行随机丢弃,以减少不同子层之间的相互适应。这里选择Pre-Norm结构作为基础架构,它可以被描述为:
\begin{eqnarray}
x_{l+1}=\mathcal{F}(\textrm{LN}(x_l))+x_l
\label{eq:15-9}
\end{eqnarray}
其中$\textrm{LN}( \cdot )$表示层正则化函数, $\mathcal{F}( \cdot )$表示自注意力机制或者前馈神经网络,$x_l$表示第$l$个子层的输出。之后,使用一个掩码$M$(值为0或1)来控制每一子层是正常计算还是丢弃。于是,该子层的计算公式可以被重写为:
\begin{eqnarray}
x_{l+1}=M \cdot \mathcal{F}(\textrm{LN}(x_l))+x_l
\label{eq:15-10}
\end{eqnarray}
$M=0$代表该子层被丢弃,而$M=1$代表正常进行当前子层的计算。图\ref{fig:15-7}展示了这个方法与标准Pre-Norm结构之间的区别。
\begin{equation}
x_{l+1}=F(\textrm{LN}(\mathbi{x}_l)) + \mathbi{x}_l
\label{eq:15-27}
\end{equation}
\noindent 其中$\textrm{LN}( \cdot )$表示层标准化函数, $F( \cdot )$表示自注意力机制或者前馈神经网络,$\mathbi{x}_l$表示第$l$个子层的输出。之后,使用一个掩码$\textrm{Mask}$(值为0或1)来控制每一子层是正常计算还是丢弃。于是,该子层的计算公式可以被重写为:
\begin{equation}
\mathbi{x}_{l+1}=\textrm{Mask} \cdot F(\textrm{LN}(\mathbi{x}_l))+\mathbi{x}_l
\label{eq:15-28}
\end{equation}
\noindent $\textrm{Mask}=0$代表该子层被丢弃,而$\textrm{Mask}=1$代表正常进行当前子层的计算。图\ref{fig:15-13}展示了这个方法与标准Pre-Norm结构之间的区别。
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter15/Figures/figure-sublayer-skip}
\caption{标准的Pre-Norm结构与基于随机跳跃子层的Pre-Norm结构}
\label{fig:15-7}
\label{fig:15-13}
\end{figure}
%-------------------------------------------
\parinterval 除此之外,有研究者已经发现残差网络中底层的子网络通过对输入进行抽象得到的表示对最终的输出有很大的影响,上层网络通过对底层网络得到的表示不断修正来拟合训练目标\upcite{DBLP:journals/corr/GreffSS16}。该结论同样适用于Transformer模型,比如,在训练中,残差支路以及底层的梯度范数通常比较大,这也间接表明底层网络在整个优化的过程中需要更大的更新。考虑到这个因素,在设计每一个子层被丢弃的概率时可以采用自底向上线性增大的策略,保证底层的网络相比于顶层更容易保留下来。这里用$L$来代表编码端块的个数,$l$代表当前的子层的编号,那么$M$可以通过以下的方式得到:
\parinterval 除此之外,有研究者已经发现残差网络中底层的子网络通过对输入进行抽象得到的表示对最终的输出有很大的影响,上层网络通过对底层网络得到的表示不断修正来拟合训练目标\upcite{DBLP:journals/corr/GreffSS16}。该结论同样适用于Transformer模型,比如,在训练中,残差支路以及底层的梯度范数通常比较大,这也间接表明底层网络在整个优化的过程中需要更大的更新。考虑到这个因素,在设计每一个子层被丢弃的概率时可以采用自底向上线性增大的策略,保证底层的网络相比于顶层更容易保留下来。
%----------------------------------------------------------------------------------------
% NEW SECTION
%----------------------------------------------------------------------------------------
\section{基于结构搜索的翻译模型优化}
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{神经网络结构搜索}
\parinterval 目前为止,对模型的很多改良都来自于研究人员自身的经验及灵感。从某种意义上说,很多时候,模型结构的优化依赖于研究人员对任务的理解以及自身的想象力,同时所设计出的模型结构还需要在对应任务上进行实验。优秀的模型往往需要很长时间的探索与验证。因此,人们希望在无需过多外部干预的情况下,让计算机自动地找到最适用于当前任务的神经网络模型结构,这种方法被称作{\small\bfnew{神经架构搜索}}\index{神经架构搜索}(Neural Architecture Search)\index{Neural Architecture Search},在神经网络模型中有时也被称作{\small\bfnew{神经网络结构搜索}}\index{神经网络结构搜索}{\small\bfnew{网络结构搜索}}\index{网络结构搜索}\upcite{DBLP:conf/iclr/ZophL17,DBLP:conf/cvpr/ZophVSL18,Real2019AgingEF}
\parinterval 网络结构搜索属于{\small\bfnew{自动机器学习}}\index{自动机器学习}(Automated Machine Learning)\index{Automated Machine Learning}的范畴,其目的在于根据对应任务上的数据找到最合适的模型结构。在这个过程中,模型结构就像传统神经网络中的模型参数一样自动地被学习出来。以机器翻译任务为例,通过网络结构搜索的方法能够在Transformer模型的基础上对神经网络结构进行自动优化,找到更适用于机器翻译任务的模型结构。图\ref{fig:15-14}(a) 给出传统人工设计的Transformer模型编码器中若干层的结构,图\ref{fig:15-14}(b) 给出该结构经过进化算法优化后的编码器中相应的结构\upcite{DBLP:conf/icml/SoLL19}。可以看到,网络结构搜索系统得到的模型中,出现了与传统人工设计的Transformer结构不同的跨层连接,同时还搜索到了全新的多分支网络结构,而这种结构是人工不易设计出来的。
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.1]{./Chapter15/Figures/figure-encoder-structure-of-transformer-model-optimized-by-nas.jpg}
\caption{传统Transformer以及通过网络结构搜索方法优化后的Transformer模型编码器结构}
\label{fig:15-14}
\end{figure}
%-------------------------------------------
\parinterval 那么网络结构搜索究竟是一种什么样的技术呢?实际上,人类一直希望能够更加自动化地、更加快速地解决自己所遇到的问题。而机器学习也是为了达到这个目的所产生的技术。如图\ref{fig:15-15}所示,机器学习方法可以看做是一个黑盒模型,这个模型能够根据人类所提供输入自动给出所期望的输出,这里的输入和输出既可以是图像信息,也可以是自然语言领域中的文字。在传统机器学习方法中,研究者需要设计大量的特征来描述待解决的问题,即“特征工程”。在深度学习时代,神经网络模型可以进行特征的抽取和学习,但是随之而来的是需要人工设计神经网络结构,这项工作仍然十分繁重。因此一些科研人员开始思考,能否将模型结构设计的工作也交由机器自动完成?深度学习方法中模型参数能够通过梯度下降等方式进行自动优化,那么模型结构是否可以也看做是一种特殊的模型参数,使用搜索算法自动地根据不同任务的数据自动找到最适用于当前任务的模型结构?
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.6]{./Chapter15/Figures/figure-evolution-and-change-of-ml-methods.jpg}
\caption{机器学习方法的演化与变迁}
\label{fig:15-15}
\end{figure}
%-------------------------------------------
\parinterval 于是,就有了网络结构搜索这个研究方向。早在上世纪八十年代,研究人员就已经在论文中使用进化算法对神经网络结构进行了设计\upcite{DBLP:conf/icga/MillerTH89},之后也有很多研究人员沿着该思路继续对基于进化算法的结构搜索进行了探索\upcite{mandischer1993representation,koza1991genetic,DBLP:conf/ijcnn/Dodd90,DBLP:conf/nips/HarpSG89,DBLP:journals/compsys/Kitano90,DBLP:conf/icec/SantosD94}。近些年,随着深度学习技术的发展,神经网络结构搜索这个方向也重新走入更多人的视线中,受到了来自计算机视觉、自然语言处理多个领域的关注与应用。
\parinterval 虽然目前网络结构搜索的技术尚且处于相对初级的阶段,不过在近些年该方向已经在很多任务中崭露头角。例如,在WMT19国际机器翻译比赛中有参赛单位使用了基于梯度的结构搜索方法对翻译模型进行改进\upcite{DBLP:conf/nips/LuoTQCL18}。此外,在语言建模等任务中也有结构搜索的大量应用,取得了很好的结果\upcite{DBLP:conf/icml/PhamGZLD18,DBLP:conf/iclr/LiuSY19,DBLP:conf/acl/LiHZXJXZLL20,DBLP:conf/emnlp/JiangHXZZ19}。下面将对结构搜索的基本方法和其在机器翻译中的应用进行介绍。
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{结构搜索的基本方法}
\parinterval 对于网络结构搜索而言,其目标在于通过数据驱动的方式对自动地找到最适用于指定任务的模型结构。以机器翻译这类有监督任务为例,对于给定的具有$K$个训练样本的训练集合$\{(\mathbi{x}_{1},\mathbi{y}_{1}),\ldots,(\mathbi{x}_{n},\mathbi{y}_{n})\}$(其中$\mathbi{x}_{i}$表示的是第$i$个样本的输入数据,$\mathbi{y}_{i}$表示该样本的目标标签值),那么网络结构搜索的过程可以被建模根据数据找到最佳模型结构$\hat{a}$的过程,如下所示:
\begin{equation}
\hat{a} = \arg\max_{a}\sum_{i=1}^{n}{\funp{P}(\mathbi{y}_{i}|\mathbi{x}_{i};a)}
\label{eq:15-29}
\end{equation}
\noindent 公式中$\funp{P}(\mathbi{y}_{i}|\mathbi{x}_{i};a)$为模型$a$观察到数据$\mathbi{x}_{i}$后预测为$\mathbi{y}_{i}$标签的概率,而模型结构$a$本身可以看作是输入$\mathbi{x}$到输出$\mathbi{y}$的映射函数。因此可以简单的把模型$a$看作根据$\mathbi{x}$预测$\mathbi{y}$的一个函数,记为:
\begin{equation}
a = \funp{P}(\cdot|\mathbi{x};a)
\label{eq:15-30}
\end{equation}
\noindent 其中,$\funp{P}(\cdot|\mathbi{x};a)$表示在所有译文句子上的一个分布。图\ref{fig:15-16}展示了神经网络结构搜索方法的主要流程,主要包括三个部分:
\begin{itemize}
\vspace{0.5em}
\item 设计搜索空间:理论上来说网络结构搜索应在所有潜在的模型结构所组成的空间中进行搜索(图\ref{fig:15-16})。在这种情况下如果不对候选模型结构进行限制的话,搜索空间会十分巨大。因此,在实际的结构搜索过程中往往会针对特定任务设计一个搜索空间,这个搜索空间是全体结构空间的一个子集,之后的搜索过程将在这个子空间中进行。如图\ref{fig:15-16}例子中的搜索空间所示,该空间由循环神经网络构成,其中候选的模型包括人工设计的LSTM、GRU等模型结构,也包括其他潜在的循环神经网络结构。
\vspace{0.5em}
\item 选择搜索策略:在设计好搜索空间之后,结构搜索的过程将选择一种合适的策略对搜索空间进行探索,找到最适用于当前任务的模型结构。不同于模型参数的学习,模型结构之间本身不存在直接可计算的关联,所以很难通过传统的最优化算法对其进行学习。因此,搜索策略往往选择采用遗传算法或强化学习等方法间接对模型结构进行设计或优化\upcite{DBLP:conf/icml/SoLL19,DBLP:conf/aaai/RealAHL19,DBLP:conf/icml/RealMSSSTLK17,DBLP:conf/iclr/ElskenMH19,DBLP:conf/iclr/ZophL17,DBLP:conf/cvpr/ZophVSL18,DBLP:conf/icml/PhamGZLD18,DBLP:conf/iclr/BakerGNR17,DBLP:conf/cvpr/TanCPVSHL19,DBLP:conf/iclr/LiuSVFK18}。不过近些年来也有研究人员开始尝试将模型结构建模为超网络中的参数,这样即可使用基于梯度的方式直接对最优结构进行搜索\upcite{DBLP:conf/nips/LuoTQCL18,DBLP:conf/iclr/LiuSY19,DBLP:conf/iclr/CaiZH19,DBLP:conf/cvpr/LiuCSAHY019,DBLP:conf/cvpr/WuDZWSWTVJK19,DBLP:conf/iclr/XieZLL19,DBLP:conf/uai/LiT19,DBLP:conf/cvpr/DongY19,DBLP:conf/iclr/XuX0CQ0X20,DBLP:conf/iclr/ZelaESMBH20,DBLP:conf/iclr/MeiLLJYYY20}
\vspace{0.5em}
\item 进行性能评估:在搜索到模型结构之后需要对这种模型结构的性能进行验证,确定当前时刻找到的模型结构性能优劣。但是对于结构搜索任务来说,在搜索的过程中将产生大量中间模型结构,如果直接对所有可能的结构进行评价,其时间代价是难以接受的。因此在结构搜索任务中也有很多研究人员尝试如何快速获取模型性能(绝对性能或相对性能)\upcite{DBLP:conf/nips/LuoTQCL18,DBLP:journals/jmlr/LiJDRT17,DBLP:conf/eccv/LiuZNSHLFYHM18}
\vspace{0.5em}
\end{itemize}
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.22]{./Chapter15/Figures/figure-main-flow-of-neural-network-structure-search.png}
\caption{神经网络结构搜索的主要流程}
\label{fig:15-16}
\end{figure}
%-------------------------------------------
\parinterval 下面将对网络结构搜索任务中搜索空间、搜索策略以及性能评估几个方向进行简单介绍。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{1. 搜索空间}
\parinterval 对搜索空间建模是结构搜索任务中非常基础的一部分。如图\ref{fig:15-17}所示,结构空间中包含着所有潜在的模型结构,虽然可以假设这些模型结构都是等概率出现的,不过当众多模型结构面对同一个任务的时候,模型本身就具有了不同的性能表现。例如,卷积神经网络非常适合处理图像数据,而类似Transformer这类的模型结构在自然语言处理领域中可能更具优势。此外,由于不同网络结构之间往往存在局部结构上的复用,因此在结构空间中不同结构之间存在着距离上的远近,如图\ref{fig:15-17}中基于自注意力机制的模型结构往往聚在一起,而基于循环神经网络和基于卷积神经网络的各类模型之间的距离也相对较近。因此,在设计搜索空间的时候,很重要的一点在于,根据经验或者实验确定对当前任务而言更容易产出高性能模型结构的区域,将这个区域作为结构搜索任务中的搜索空间则更有可能找到最优结构。以自然语言处理任务为例,最初的网络结构搜索工作主要对由循环神经网络构成的搜索空间进行探索\upcite{DBLP:conf/iclr/ZophL17,DBLP:conf/icml/PhamGZLD18,DBLP:conf/iclr/LiuSY19},而近些年针对Transformer模型结构的研究工作也越来越多地引起研究人员的关注\upcite{DBLP:conf/icml/SoLL19,DBLP:journals/taslp/FanTXQLL20,DBLP:conf/ijcai/ChenLQWLDDHLZ20,DBLP:conf/acl/WangWLCZGH20}
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.6]{./Chapter15/Figures/figure-relationship-between-structures-in-structural-space.jpg}
\caption{结构空间内结构之间的关系}
\label{fig:15-17}
\end{figure}
%-------------------------------------------
\parinterval 在设计搜索空间的时候很重要的一个问题在于如何表示一个网络结构。在目前的结构搜索方法中,通常将模型结构分为整体框架和内部结构(元结构)两部分。整个模型结构由整体框架将若干内部结构的输出按照特定的方式组织起来,得到最终的模型输出。如图\ref{fig:15-18}所示,以循环神经网络模型结构为例,黄色部分即为内部结构,红色部分为整体框架,负责对循环单元进行组织。
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.3]{./Chapter15/Figures/figure-whole-structure-and-internal-structure-in-rnn.png}
\caption{循环神经网络模型中的整体结构和内部结构}
\label{fig:15-18}
\end{figure}
%-------------------------------------------
\parinterval 具体来说,内部结构负责的是如何计算出循环神经网络计算过程中$t$时刻的循环单元输出$\mathbi{h}_t$,如下所示:
\begin{equation}
\mathbi{h}_t = \pi(\hat{\mathbi{h}}_{t-1},\hat{\mathbi{x}_t})
\label{eq:15-31}
\end{equation}
\parinterval 其中函数$\pi(\cdot)$即为结构表示中的内部结构,而对于循环单元之间的组织方式(即整体框架)则决定了循环单元的输入信息,也就是上式中的循环单元表示$\hat{\mathbi{h}}_{t-1}$和输入表示$\hat{\mathbi{x}}_{t}$。理论上二者均能获得对应时刻之前所有可以获得的表示信息,因此可表示为:
\begin{eqnarray}
M = \left\{\begin{array}{ll}
0&P \leqslant p_l\\
1&P > p_l
\end{array}\right.
\label{eq:15-11}
\hat{\mathbi{h}}_{t-1} &=& f(\mathbi{h}_{[0,t-1]};\mathbi{x}_{[1,t-1]}) \\
\hat{\mathbi{x}_t} &=& g(\mathbi{x}_{[1,t]};\mathbi{h}_{[0,t-1]})
\label{eq:15-33}
\end{eqnarray}
其中,$P$是服从伯努利分布的随机变量,$p_l$指每一个子层被丢弃的概率,具体计算方式如下:
\noindent 其中$\mathbi{h}_{[0,t-1]} = \{\mathbi{h}_0,\ldots,\mathbi{h}_{t-1}\}$$\mathbi{x}_{[1,t-1]} = \{\mathbi{x}_1,\ldots,\mathbi{x}_{t-1}\}$,函数$f(\cdot)$$g(\cdot)$即为循环神经网络模型中的整体框架。
\parinterval 可以看到,整体框架和内部结构共同组成了神经网络的模型结构,换句话说确定了在搜索过程中整体框架以及内部结构包括哪些模型也就确定了搜索空间。
\begin{itemize}
\vspace{0.5em}
\item 整体框架:如图\ref{fig:15-17}所示,不同任务下不同结构往往会表现出不同的建模能力,而类似的结构在结构空间中又相对集中,因此在搜索空间的设计中,整体框架部分一般根据不同任务特点选择已经得到验证的经验性结构,通过这种方式能够快速定位到更有潜力的搜索空间。如对于图像任务来说,一般会将卷积神经网络设计为候选搜索空间\upcite{DBLP:conf/iclr/ElskenMH19,DBLP:conf/icml/PhamGZLD18,DBLP:conf/iclr/LiuSY19,DBLP:conf/eccv/LiuZNSHLFYHM18,DBLP:conf/icml/CaiYZHY18},而对于包括机器翻译在内的自然语言处理任务而言,则会更倾向于使用循环神经网络或基于自注意力机制的Transformer模型附近的结构空间作为搜索空间\upcite{DBLP:conf/icml/SoLL19,DBLP:conf/iclr/ZophL17,DBLP:conf/icml/PhamGZLD18,DBLP:conf/iclr/LiuSY19,DBLP:journals/taslp/FanTXQLL20,DBLP:conf/ijcai/ChenLQWLDDHLZ20,DBLP:conf/acl/WangWLCZGH20}。此外,也可以拓展搜索空间以覆盖更多网络结构\upcite{DBLP:conf/acl/LiHZXJXZLL20}
\vspace{0.5em}
\item 内部结构:由于算力限制,网络结构搜索的任务通常使用经验性的架构作为模型的整体框架,之后通过对搜索到的内部结构进行堆叠得到完整的模型结构。而对于内部结构的设计需要考虑到搜索过程中的最小搜索单元以及搜索单元之间的连接方式,最小搜索单元指的是在结构搜索过程中可被选择的最小独立计算单元(或被称为搜索算子、操作),在不同搜索空间的设计中,最小搜索单元的颗粒度各有不同,相对较小的搜索粒度主要包括诸如矩阵乘法、张量缩放等基本数学运算\upcite{DBLP:journals/corr/abs-2003-03384},中等粒度的搜索单元包括例如常见的激活函数,如ReLU、Tanh等\upcite{DBLP:conf/iclr/LiuSY19,DBLP:conf/acl/LiHZXJXZLL20,Chollet2017XceptionDL},同时在搜索空间的设计上也有研究人员倾向于选择较大颗粒度的局部结构作为搜索单元,如注意力机制、层标准化等人工设计的经验性结构\upcite{DBLP:conf/icml/SoLL19,DBLP:conf/nips/LuoTQCL18,DBLP:journals/taslp/FanTXQLL20}。不过,对于搜索颗粒度的问题,目前还缺乏有效的方法针对不同任务进行自动优化。
\vspace{0.5em}
\end{itemize}
\parinterval 实际上,使用“整体+局部”的两层搜索空间表示模型的原因在于:问题过于复杂,无法有效的遍历原始的搜索空间。如果存在足够高效的搜索策略,搜索空间的表示也可能会发生变化,比如,直接对任意的网络结构使用统一的表示方式。理论上讲,这样的搜索空间可以涵盖更多的潜在模型结构。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{2. 搜索策略}
\parinterval 在定义好搜索空间之后,如何进行网络结构的搜索也同样重要。该过程被称为搜索策略的设计,其主要目的为根据已找到的模型结构计算出下一个最有潜力的模型结构,为保证模型有效性,在一些方法中也会引入外部知识(如经验性的模型结构或张量运算规则)对搜索过程中的结构进行剪枝。目前常见的搜索策略一般包括基于进化算法、强化学习、贝叶斯优化、梯度的方法的方式,不同的搜索策略一般也和搜索空间中结构建模方式相关。
\begin{itemize}
\vspace{0.5em}
\item 进化算法{\red 检查这些词是不是第一次提到}:最初主要通过进化算法对神经网络中的模型结构以及权重参数进行优化\upcite{DBLP:conf/icga/MillerTH89,DBLP:journals/tnn/AngelineSP94,stanley2002evolving,DBLP:journals/alife/StanleyDG09}。而随着最优化算法的发展,近年来对于网络参数的学习更多地采用梯度下降法的方式,不过使用进化算法对模型结构进行优化却依旧被沿用至今\upcite{DBLP:conf/aaai/RealAHL19,DBLP:conf/icml/RealMSSSTLK17,DBLP:conf/iclr/ElskenMH19,DBLP:conf/ijcai/SuganumaSN18,Real2019AgingEF,DBLP:conf/iclr/LiuSVFK18,DBLP:conf/iccv/XieY17}。目前主流的方式主要是将模型结构看做是遗传算法中种群的个体,通过使用轮盘赌或锦标赛等抽取方式对种群中的结构进行取样作为亲本,之后通过亲本模型的突变产生新的模型结构,最终对这些新的模型结构进行适应度评估{\red (见XXX节)},根据模型结构在校验集上性能表现确定是否能够将其加入种群,整个过程如图\ref{fig:15-19}所示。对于进化算法中结构的突变主要指的是对模型中局部结构的改变,如增加跨层连接、替换局部操作等。
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.25]{./Chapter15/Figures/figure-structure-search-based-on-evolutionary-algorithm.png}
\caption{基于进化算法的结构搜索}
\label{fig:15-19}
\end{figure}
%-------------------------------------------
\vspace{0.5em}
\item 强化学习:除了使用进化算法对网络结构进行学习之外,近些年随着强化学习在各领域中的广泛应用,研究人员也逐渐开始将这种方法引入到神经网络的结构学习中来。例如,研究人员将网络结构的设计看做是序列生成任务,使用字符序列对网络结构进行表述,通过由强化学习指导训练出的循环神经网络对该模型结构序列(目标任务网络结构)进行预测,从而为目标任务生成提供高效的网络结构\upcite{DBLP:conf/iclr/ZophL17}。基于强化学习的结构搜索方法过程如图\ref{fig:15-20}所示,其中主体可以看做是一个模型结构的生成模型,用于产生当前状态下从主体角度上看最适用于当前任务的模型结构,强化学习中的动作在这里指的是由主体{\red (强化学习里经常用Agent,是这里的主体吗???Agent一般被翻译为智能体)}产生一个模型结构,而环境对应着模型将要应用在的任务,当环境得到了模型结构后,环境将输出当前任务下该模型的输出以及对输出结果的评价,二者分别对应强化学习中的状态和奖励,这两个信息将反馈给主体,让结构生成器对该状态下生成的模型结果有一个清晰的了解,从而对自身结构生成的模式进行调整,然后继续生成更优的模型结构。对于基于强化学习的结构搜索策略来说,不同研究工作的差异主要集中在如何表示生成网络的过程以及如何对结构生成器进行优化\upcite{DBLP:conf/iclr/ZophL17,DBLP:conf/cvpr/ZophVSL18,DBLP:conf/iclr/BakerGNR17,DBLP:conf/cvpr/ZhongYWSL18}
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.25]{./Chapter15/Figures/figure-structure-search-based-on-reinforcement-learning.png}
\caption{基于强化学习的结构搜索}
\label{fig:15-20}
\end{figure}
%-------------------------------------------
\vspace{0.5em}
\item 梯度方法:在基于进化算法和强化学习的结构搜索策略中,往往将模型结构看作是离散空间中的若干点,搜索策略通过诸如“进化”或“激励”等方式促进种群或者结构生成器产生更适用于对应任务的模型结构,这种方式相对而言并未直接对模型结构进行优化。不同于这些方法,有研究人员尝试在连续空间中对模型结构进行表示\upcite{DBLP:conf/iclr/LiuSY19},这种方式将模型结构建模为超网络中的权重,通过使用基于梯度的最优化方法对权重进行优化最终达到搜索结构的目的,如图\ref{fig:15-21}所示。这种方式相对进化算法以及强化学习方法而言更加直接,在搜索过程中的算力消耗以及时间消耗上也更有优势,因此也吸引了很多研究人员对基于梯度的结构搜索策略进行不断探索\upcite{DBLP:conf/cvpr/WuDZWSWTVJK19,DBLP:conf/iclr/XuX0CQ0X20,DBLP:conf/acl/LiHZXJXZLL20,DBLP:conf/emnlp/JiangHXZZ19}
\vspace{0.5em}
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.25]{./Chapter15/Figures/figure-structure-search-based-on-gradient-method.png}
\caption{基于梯度方法的结构搜索}
\label{fig:15-21}
\end{figure}
%-------------------------------------------
\end{itemize}
\parinterval 除了上述提到的基于进化算法、强化学习以及梯度的方法之外,结构搜索策略还有很多其他的方式,例如基于贝叶斯优化的方法、基于随机搜索的方法。贝叶斯优化的方法在搜索结构超参数的任务中表现优异,能够在给定模型结构基础上找到最适用于当前任务的超参数\upcite{DBLP:conf/icml/BergstraYC13,DBLP:conf/ijcai/DomhanSH15,DBLP:conf/icml/MendozaKFSH16,DBLP:journals/corr/abs-1807-06906},而随机搜索的方法也在一些结构搜索任务中引起众多研究人员的注意\upcite{DBLP:conf/uai/LiT19,li2020automated,DBLP:conf/cvpr/BenderLCCCKL20}
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{3. 性能评估}
\parinterval 在结构搜索的过程中会产生大量中间结构,因此如何快速获得这些结构的性能优劣也是网络结构搜索任务中的关键一环。通常有三类方法进行模型性能的快速评估。
\begin{itemize}
\vspace{0.5em}
\item 数据以及超参数的调整:一种常见的方法是从数据和超参数的角度简化模型训练难度。具体来说,可采取的策略包括使用更少量、更容易建模的数据作为训练集合\upcite{DBLP:conf/aistats/KleinFBHH17,DBLP:journals/corr/ChrabaszczLH17},如图像任务中使用低分辨率数据对模型进行训练及评估,在自然语言处理任务中也可以选择更容易建模的口语领域数据进行实验。在超参数的方面也可以通过减少模型训练轮数、减少模型的层数、减少每层中神经元数量等方式来简化模型参数,达到加速训练、评估的目的\upcite{DBLP:conf/cvpr/ZophVSL18,Real2019AgingEF,DBLP:journals/corr/abs-1807-06906}。上述两种方法虽然并不能准确地对模型绝对性能进行评价,但是其结果已经能够对搜索起到一定指示作用,并帮助结构搜索策略对结构生成的过程进行调优。
\vspace{0.5em}
\item 现有参数的继承及复用:另一类方法希望从训练过程的角度出发,让中间过程产生的模型结构能够在现有的模型参数基础上进行继续优化,从而快速达到收敛状态进行性能评估\upcite{DBLP:conf/icml/RealMSSSTLK17,DBLP:conf/iclr/ElskenMH19,DBLP:conf/icml/CaiYZHY18,DBLP:conf/aaai/CaiCZYW18,DBLP:conf/iclr/ElskenMH18}。这种方式无需从头训练中间结构,通过“热启动”的方式对模型参数进行优化,大幅减少性能评估过程中的时间消耗。此外对于前文提到的基于梯度的结构搜索方法,由于将众多候选模型结构建模在同一个超网络中,因此在完成对超网络的参数优化的时候,其子模型的模型参数也得到优化,通过这种共享参数的方式也能够快速对网络结构性能进行评估\upcite{DBLP:conf/icml/PhamGZLD18,DBLP:conf/iclr/XieZLL19,DBLP:conf/iclr/LiuSY19,DBLP:conf/iclr/CaiZH19,DBLP:conf/nips/SaxenaV16,DBLP:conf/icml/BenderKZVL18}
\vspace{0.5em}
\item 模型性能的预测:模型性能预测也是一个具有潜力的加速性能评估过程的方法,这种方式旨在通过少量训练过程中的性能变化曲线来预估模型是否具有潜力,从而快速终止低性能模型的训练过程,节约更多训练时间\upcite{DBLP:conf/ijcai/DomhanSH15,DBLP:conf/iclr/KleinFSH17,DBLP:conf/iclr/BakerGRN18}。除了根据训练过程中的曲线进行模型性能的预测之外,也有研究人员根据局部结构的性能来对整体结构性能表现进行预测,这种方式也能更快速地了解构搜索过程中中间结构的表示能力\upcite{DBLP:conf/eccv/LiuZNSHLFYHM18}
\vspace{0.5em}
\end{itemize}
%----------------------------------------------------------------------------------------
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{机器翻译任务下的结构搜索}
\parinterval 目前来说,网络结构搜索的方法在包括图像、自然语言处理等领域中方兴未艾,不过对于自然语言处理的任务来说,更多的是在语言建模、命名实体识别等简单任务上进行的尝试\upcite{DBLP:conf/acl/LiHZXJXZLL20,DBLP:conf/emnlp/JiangHXZZ19}。同时,大多工作更多是在基于循环神经网络的模型结构上进行进行探索,相较目前在机器翻译领域中广泛使用的Transformer模型结构来说,它们在性能表现上并没有体现出绝对优势。此外,由于机器翻译任务的复杂性,对基于Transformer的机器翻译模型的结构搜索方法会更少一些。不过这部分工作依旧在机器翻译任务上得到了很好的表现。例如,在WMT19机器翻译比赛中,神经网络结构优化方法在多个任务上取得了很好的成绩\upcite{DBLP:conf/nips/LuoTQCL18,DBLP:conf/wmt/XiaTTGHCFGLLWWZ19}。对于结构搜索在机器翻译领域的应用目前主要包括两个方面,分别是对模型性能的改进以及模型效率的优化:
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{1. 模型性能改进}
\parinterval 结构搜索任务中一个非常重要的目标在于找到更加适用于当前任务的模型结构。目前来看,有两种思路:1)对模型中局部结构的搜索;2)对局部结构组合方式的优化。
\begin{itemize}
\vspace{0.5em}
\item 搜索模型中的局部结构:在机器翻译任务中,一种典型的局部模型结构搜索方法是面向激活函数的搜索\upcite{DBLP:conf/iclr/RamachandranZL18}。该方法将激活函数看作是简单函数的若干次复合使用,图\ref{fig:15-22}是激活函数结构的一个示例,其中核心单元由两个输入、两个一元函数(如绝对值、幂方运算等)和一个二元函数(如乘法、取最大值运算等)组成。
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{./Chapter15/Figures/figure-activation-function-swish-structure-diagram.png}
\caption{激活函数结构图}
\label{fig:15-22}
\end{figure}
%-------------------------------------------
\noindent 还有方法将为深层神经网络找到更适合的激活函数作为搜索的目标\upcite{DBLP:conf/iclr/RamachandranZL18},通过基于强化学习的搜索策略对激活函数空间进行探索,找到了若干新的激活函数,之后通过对这些激活函数在包括图像分类、机器翻译等任务上进行实验,确定了Swish激活函数在深层神经网络上的有效性,函数公式如下式所示,函数曲线如图\ref{fig:15-23}所示。{\red 下面公式中x的形式}
\begin{eqnarray}
p_l=\frac{l}{2L}\cdot \varphi
\label{eq:15-12}
f(x) &=& x \cdot \delta(\beta x) \\
\delta(z) &=& {(1 + \exp{(-z)})}^{-1}
\label{eq:15-35}
\end{eqnarray}
这里,$1 \leqslant l \leqslant 2L$ ,且$\varphi$是预先设定的超参数。
\parinterval 在Layer Dropout中,一个由$2L$个子层构成的残差网络,其顶层的输出相当于是$2^{2L}$个子网络的聚合结果。通过随机丢弃$n$个子层,则会屏蔽掉$2^n$个子网络的输出,将子网络的总体数量降低至$2^{2L-n}$。如图\ref{fig:15-8}所示的残差网络展开图,当有3个子层时,从输入到输出共存在8条路径,当删除子层sublayer2后,从输入到输出路径的路径则会减少到4条。
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{./Chapter15/Figures/figure-swish-function-image.png}
\caption{Swish函数图像}
\label{fig:15-23}
\end{figure}
%-------------------------------------------
\noindent Swish函数相比传统人工设计的ReLU而言在多个机器翻译的测试集上具有更优的性能表现,同时不要求对原本模型结构进行更多修改,非常容易实现。
\vspace{0.5em}
\item 搜索模型中局部结构的组合:在基于Transformer模型的网络结构搜索任务中,对于局部结构的组合方式的学习也受到了很多关注,其中包括基于进化算法的方法以及基于梯度对现有Transformer模型结构进行改良的方式\upcite{DBLP:conf/icml/SoLL19,DBLP:journals/taslp/FanTXQLL20}。这类方法不同于前文所述的对局部结构的改良,更多地是希望利用现有经验性的局部结构进行组合,找到最佳的整体结构。在模型结构的表示方法上,这些方法会根据先验知识为搜索单元设定一个部分框架,如每当信息传递过来之后先进行层标准化,之后再对候选位置上的操作使用对应的搜索策略进行搜索。另外这类方法也会在Transformer结构中引入多分支的支持,一个搜索单元的输出可以被多个后续单元所使用,通过这种方式有效扩大了结构搜索过程中的搜索空间,能够在现有Transformer结构基础上找到更优的模型结构。对模型中结构组合方式的学习如图\ref{fig:15-24}所示。
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.25]{./Chapter15/Figures/figure-learning-of-local-structure-combination.png}
\caption{局部结构组合方式的学习}
\label{fig:15-24}
\end{figure}
%-------------------------------------------
\vspace{0.5em}
\end{itemize}
\parinterval 此外对于模型结构中超参数的自动搜索同样能够有效提升模型的性能表现\upcite{DBLP:journals/corr/abs-2009-02070}。Transformer模型虽然已经在机器翻译任务中获得了非常优异的性能,不过如果希望稳定训练该模型还需要很多超参数上经验的累积,与此同时,不同翻译任务在使用Transformer模型的时候,也需要对超参数以及局部结构进行相应的调整(如层标准化的位置,注意力操作的过程中是否进行缩放,注意力操作的头数,激活函数等),因此面向超参数的搜索同样能够帮助研究人员快速找到最适用的模型结构。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
%----------------------------------------------------------------------------------------
\subsubsection{2. 模型效率优化}
\parinterval 网络结构搜索的方法除了能够应用于对机器翻译模型性能进行改进之外,也能够用来对模型执行效率进行优化。从实用的角度出发,一些研究人员尝试将设备的计算能力提供给结构搜索方法进行参考,希望能够找到适合于对应设备算力的模型结构。同时也有一些研究人员专注于对大规模的模型进行压缩,加速其在推断过程中的效率,这方面的工作不仅限于在机器翻译模型上,也有部分工作对基于注意力机制的预训练模型进行压缩。
\begin{itemize}
\vspace{0.5em}
\item 面向特定设备的模型结构优化:随着终端设备算力的日益增强,在小设备上直接进行机器翻译的需求也日益增大,简单地对Transformer模型的超参数进行削减能够让翻译模型在这些低算力的设备上运行,不过研究人员仍然希望得到更适用于当前设备的翻译模型。因此一些研究人员开始尝试使用结构搜索的方式对现有Transformer模型进行改良,在结构优化的过程中将设备上的算力条件作为一个约束,为不同硬件设备(如CPU、GPU等设备)发现更加有效的结构\upcite{DBLP:conf/acl/WangWLCZGH20}。例如可以将搜索空间中各种基于Transformer结构的变体建模在同一个超网络中,通过权重共享的方式进行训练。使用硬件算力约束训练得到的子模型,通过进化算法对子模型进行搜索,搜索到适用于目标硬件的模型结构,整个过程如图\ref{fig:15-25}所示。通过该方法搜索到的模型能够在保证机器翻译模型性能的前提下获得较大的效率提升。
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter15/Figures/figure-expanded-residual-network}
\caption{Layer Dropout中残差网络的展开图}
\label{fig:15-8}
\input{./Chapter15/Figures/figure-model-structure-optimization-framework-for-specific-equipment.tex}
\caption{面向特定设备的模型结构优化框架}
\label{fig:15-25}
\end{figure}
%-------------------------------------------
\vspace{0.5em}
\item 模型压缩:此外,在不考虑设备自身算力条件的情况下,也有一些研究人员通过结构搜索的方式对基于Transformer的预训练模型进行压缩。例如,将Transformer模型拆分为若干小组件,然后通过基于采样的结构搜索方法对压缩后的模型结构进行搜索,尝试找到最优且高效的推断模型\upcite{DBLP:journals/corr/abs-2008-06808}。相类似,也有研究者在基于BERT的预训练模型上通过结构搜索的方式进行模型压缩,通过基于梯度的结构搜索方法,针对不同的下游任务所需知识将预训练的BERT模型压缩为相应的小模型\upcite{DBLP:conf/ijcai/ChenLQWLDDHLZ20}
\vspace{0.5em}
\end{itemize}
\parinterval 虽然受限于算力等条件限制,目前很多网络结构搜索的方法并没有直接在机器翻译任务中进行实验,但是这些方法并没有被限制在特定任务上。例如,可微分结构搜索方法被成功的用于学习更好的循环单元结构,这类方法完全可以应用在机器翻译任务上,不过大部分工作并没有在这个任务上进行尝试。此外,受到自然语言处理领域预训练模型的启发,一些研究人员也表示网络结构预搜索可能是一个有潜力方向,也有研究人员尝试在大规模语言模型任务上进行结构搜索\upcite{DBLP:conf/acl/LiHZXJXZLL20},然后将搜索到的模型结构应用到更多其他自然语言处理的任务中,这种方式有效提升了模型结构的可复用性,同时从大规模单语数据中获取到的信息可能比从特定任务下受限的数据集合中所得到的信息更加充分,能够更好地指导模型结构的设计。对于机器翻译任务而言,结构的预搜索同样是一个值得关注的研究方向。
......@@ -7740,6 +7740,1043 @@ author = {Zhuang Liu and
year = {2017}
}
@inproceedings{Bapna2018TrainingDN,
author = {Ankur Bapna and
Mia Xu Chen and
Orhan Firat and
Yuan Cao and
Yonghui Wu},
title = {Training Deeper Neural Machine Translation Models with Transparent
Attention},
pages = {3028--3033},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2018}
}
@inproceedings{WangLearning,
author = {Qiang Wang and
Bei Li and
Tong Xiao and
Jingbo Zhu and
Changliang Li and
Derek F. Wong and
Lidia S. Chao},
title = {Learning Deep Transformer Models for Machine Translation},
pages = {1810--1822},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2019}
}
@article{DBLP:journals/corr/abs-2002-04745,
author = {Ruibin Xiong and
Yunchang Yang and
Di He and
Kai Zheng and
Shuxin Zheng and
Chen Xing and
Huishuai Zhang and
Yanyan Lan and
Liwei Wang and
Tie{-}Yan Liu},
title = {On Layer Normalization in the Transformer Architecture},
journal = {CoRR},
volume = {abs/2002.04745},
year = {2020}
}
@inproceedings{DBLP:conf/emnlp/LiuLGCH20,
author = {Liyuan Liu and
Xiaodong Liu and
Jianfeng Gao and
Weizhu Chen and
Jiawei Han},
title = {Understanding the Difficulty of Training Transformers},
pages = {5747--5763},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2020}
}
@inproceedings{DBLP:journals/corr/HeZRS15,
author = {Kaiming He and
Xiangyu Zhang and
Shaoqing Ren and
Jian Sun},
title = {Deep Residual Learning for Image Recognition},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
pages = {770--778},
year = {2016},
}
@article{Ba2016LayerN,
author = {Lei Jimmy Ba and
Jamie Ryan Kiros and
Geoffrey E. Hinton},
title = {Layer Normalization},
journal = {CoRR},
volume = {abs/1607.06450},
year = {2016}
}
@inproceedings{Vaswani2018Tensor2TensorFN,
author = {Ashish Vaswani and
Samy Bengio and
Eugene Brevdo and
Fran{\c{c}}ois Chollet and
Aidan N. Gomez and
Stephan Gouws and
Llion Jones and
Lukasz Kaiser and
Nal Kalchbrenner and
Niki Parmar and
Ryan Sepassi and
Noam Shazeer and
Jakob Uszkoreit},
title = {Tensor2Tensor for Neural Machine Translation},
pages = {193--199},
publisher = {Association for Machine Translation in the Americas},
year = {2018}
}
@inproceedings{Dou2019DynamicLA,
author = {Zi-Yi Dou and
Zhaopeng Tu and
Xing Wang and
Longyue Wang and
Shuming Shi and
Tong Zhang},
title = {Dynamic Layer Aggregation for Neural Machine Translation with Routing-by-Agreement},
pages = {86--93},
publisher = {AAAI Conference on Artificial Intelligence},
year = {2019}
}
@article{Wang2018MultilayerRF,
title={Multi-layer Representation Fusion for Neural Machine Translation},
author={Qiang Wang and Fuxue Li and Tong Xiao and Yanyang Li and Yinqiao Li and Jingbo Zhu},
journal={ArXiv},
year={2018},
volume={abs/2002.06714}
}
@inproceedings{Dou2018ExploitingDR,
author = {Zi-Yi Dou and
Zhaopeng Tu and
Xing Wang and
Shuming Shi and
Tong Zhang},
title = {Exploiting Deep Representations for Neural Machine Translation},
pages = {4253--4262},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2018}
}
@inproceedings{DBLP:journals/corr/LinFSYXZB17,
author = {Zhouhan Lin and
Minwei Feng and
C{\'{\i}}cero Nogueira dos Santos and
Mo Yu and
Bing Xiang and
Bowen Zhou and
Yoshua Bengio},
title = {A Structured Self-Attentive Sentence Embedding},
publisher = {International Conference on Learning Representations},
year = {2017},
}
@inproceedings{DBLP:conf/nips/SrivastavaGS15,
author = {Rupesh Kumar Srivastava and
Klaus Greff and
J{\"{u}}rgen Schmidhuber},
title = {Training Very Deep Networks},
publisher = {Conference on Neural Information Processing Systems},
pages = {2377--2385},
year = {2015}
}
@inproceedings{DBLP:conf/icml/BalduzziFLLMM17,
author = {David Balduzzi and
Marcus Frean and
Lennox Leary and
J. P. Lewis and
Kurt Wan{-}Duo Ma and
Brian McWilliams},
title = {The Shattered Gradients Problem: If resnets are the answer, then what
is the question?},
publisher = {International Conference on Machine Learning},
volume = {70},
pages = {342--350},
year = {2017}
}
@inproceedings{DBLP:conf/icml/Allen-ZhuLS19,
author = {Zeyuan Allen{-}Zhu and
Yuanzhi Li and
Zhao Song},
title = {A Convergence Theory for Deep Learning via Over-Parameterization},
publisher = {International Conference on Machine Learning},
volume = {97},
pages = {242--252},
year = {2019}
}
@inproceedings{DBLP:conf/icml/DuLL0Z19,
author = {Simon S. Du and
Jason D. Lee and
Haochuan Li and
Liwei Wang and
Xiyu Zhai},
title = {Gradient Descent Finds Global Minima of Deep Neural Networks},
publisher = {International Conference on Machine Learning},
volume = {97},
pages = {1675--1685},
year = {2019}
}
@inproceedings{pmlr-v9-glorot10a,
author = {Xavier Glorot and
Yoshua Bengio},
title = {Understanding the difficulty of training deep feedforward neural networks},
publisher = {International Conference on Artificial Intelligence and Statistics},
volume = {9},
pages = {249--256},
year = {2010}
}
@inproceedings{DBLP:conf/iccv/HeZRS15,
author = {Kaiming He and
Xiangyu Zhang and
Shaoqing Ren and
Jian Sun},
title = {Delving Deep into Rectifiers: Surpassing Human-Level Performance on
ImageNet Classification},
pages = {1026--1034},
publisher = {IEEE International Conference on Computer Vision},
year = {2015}
}
@inproceedings{huang2020improving,
title={Improving Transformer Optimization Through Better Initialization},
author={Xiao Shi {Huang} and Juan {Perez} and Jimmy {Ba} and Maksims {Volkovs}},
publisher = {International Conference on Machine Learning},
year={2020}
}
@inproceedings{DBLP:conf/iclr/ZophL17,
author = {Barret Zoph and
Quoc V. Le},
title = {Neural Architecture Search with Reinforcement Learning},
publisher = {International Conference on Learning Representations},
year = {2017}
}
@inproceedings{DBLP:conf/cvpr/ZophVSL18,
author = {Barret Zoph and
Vijay Vasudevan and
Jonathon Shlens and
Quoc V. Le},
title = {Learning Transferable Architectures for Scalable Image Recognition},
pages = {8697--8710},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
year = {2018}
}
@inproceedings{Real2019AgingEF,
title={Aging Evolution for Image Classifier Architecture Search},
author={E. Real and A. Aggarwal and Y. Huang and Quoc V. Le},
booktitle={AAAI Conference on Artificial Intelligence},
year={2019}
}
@inproceedings{DBLP:conf/icml/SoLL19,
author = {David R. So and
Quoc V. Le and
Chen Liang},
title = {The Evolved Transformer},
volume = {97},
pages = {5877--5886},
publisher = {International Conference on Machine Learning},
year = {2019}
}
@inproceedings{DBLP:conf/icga/MillerTH89,
author = {Geoffrey F. Miller and
Peter M. Todd and
Shailesh U. Hegde},
title = {Designing Neural Networks using Genetic Algorithms},
pages = {379--384},
publisher = {International Conference on Genetic Algorithms},
year = {1989}
}
@inproceedings{mandischer1993representation,
title={Representation and evolution of neural networks},
author={Mandischer, Martin},
publisher={Artificial Neural Nets and Genetic Algorithms},
pages={643--649},
year={1993}
}
@inproceedings{koza1991genetic,
title={Genetic generation of both the weights and architecture for a neural network},
author={Koza, John R and Rice, James P},
publisher={international joint conference on neural networks},
volume={2},
pages={397--404},
year={1991}
}
@inproceedings{DBLP:conf/ijcnn/Dodd90,
author = {N. Dodd},
title = {Optimisation of network structure using genetic techniques},
publisher = {International Joint Conference on Neural Networks, San
Diego, CA, USA, June 17-21, 1990},
pages = {965--970},
year = {1990}
}
@inproceedings{DBLP:conf/nips/HarpSG89,
author = {Steven A. Harp and
Tariq Samad and
Aloke Guha},
title = {Designing Application-Specific Neural Networks Using the Genetic Algorithm},
publisher = {Advances in Neural Information Processing Systems},
pages = {447--454},
year = {1989}
}
@article{DBLP:journals/compsys/Kitano90,
author = {Hiroaki Kitano},
title = {Designing Neural Networks Using Genetic Algorithms with Graph Generation
System},
journal = {Complex Systems},
volume = {4},
number = {4},
year = {1990}
}
@inproceedings{DBLP:conf/icec/SantosD94,
author = {Jos{\'{e}} Santos Reyes and
Richard J. Duro},
title = {Evolutionary Generation and Training of Recurrent Artificial Neural
Networks},
pages = {759--763},
publisher = {IEEE Conference on Evolutionary Computation},
year = {1994}
}
@inproceedings{DBLP:conf/nips/LuoTQCL18,
author = {Renqian Luo and
Fei Tian and
Tao Qin and
Enhong Chen and
Tie{-}Yan Liu},
title = {Neural Architecture Optimization},
publisher = {Advances in Neural Information Processing Systems},
pages = {7827--7838},
year = {2018}
}
@inproceedings{DBLP:conf/icml/PhamGZLD18,
author = {Hieu Pham and
Melody Y. Guan and
Barret Zoph and
Quoc V. Le and
Jeff Dean},
title = {Efficient Neural Architecture Search via Parameter Sharing},
volume = {80},
pages = {4092--4101},
publisher = {International Conference on Machine Learning},
year = {2018}
}
@inproceedings{DBLP:conf/iclr/LiuSY19,
author = {Hanxiao Liu and
Karen Simonyan and
Yiming Yang},
title = {{DARTS:} Differentiable Architecture Search},
publisher = {International Conference on Learning Representations},
year = {2019}
}
@inproceedings{DBLP:conf/acl/LiHZXJXZLL20,
author = {Yinqiao Li and
Chi Hu and
Yuhao Zhang and
Nuo Xu and
Yufan Jiang and
Tong Xiao and
Jingbo Zhu and
Tongran Liu and
Changliang Li},
title = {Learning Architectures from an Extended Search Space for Language
Modeling},
pages = {6629--6639},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2020}
}
@inproceedings{DBLP:conf/emnlp/JiangHXZZ19,
author = {Yufan Jiang and
Chi Hu and
Tong Xiao and
Chunliang Zhang and
Jingbo Zhu},
title = {Improved Differentiable Architecture Search for Language Modeling
and Named Entity Recognition},
pages = {3583--3588},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2019}
}
@inproceedings{DBLP:conf/aaai/RealAHL19,
author = {Esteban Real and
Alok Aggarwal and
Yanping Huang and
Quoc V. Le},
title = {Regularized Evolution for Image Classifier Architecture Search},
pages = {4780--4789},
publisher = {AAAI Conference on Artificial Intelligence},
year = {2019}
}
@inproceedings{DBLP:conf/icml/RealMSSSTLK17,
author = {Esteban Real and
Sherry Moore and
Andrew Selle and
Saurabh Saxena and
Yutaka Leon Suematsu and
Jie Tan and
Quoc V. Le and
Alexey Kurakin},
title = {Large-Scale Evolution of Image Classifiers},
volume = {70},
pages = {2902--2911},
publisher = {International Conference on Machine Learning},
year = {2017}
}
@inproceedings{DBLP:conf/iclr/ElskenMH19,
author = {Thomas Elsken and
Jan Hendrik Metzen and
Frank Hutter},
title = {Efficient Multi-Objective Neural Architecture Search via Lamarckian
Evolution},
publisher = {International Conference on Learning Representations},
year = {2019}
}
@inproceedings{DBLP:conf/iclr/BakerGNR17,
author = {Bowen Baker and
Otkrist Gupta and
Nikhil Naik and
Ramesh Raskar},
title = {Designing Neural Network Architectures using Reinforcement Learning},
publisher = {International Conference on Learning Representations},
year = {2017}
}
@inproceedings{DBLP:conf/cvpr/TanCPVSHL19,
author = {Mingxing Tan and
Bo Chen and
Ruoming Pang and
Vijay Vasudevan and
Mark Sandler and
Andrew Howard and
Quoc V. Le},
title = {MnasNet: Platform-Aware Neural Architecture Search for Mobile},
pages = {2820--2828},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
year = {2019}
}
@inproceedings{DBLP:conf/iclr/LiuSVFK18,
author = {Hanxiao Liu and
Karen Simonyan and
Oriol Vinyals and
Chrisantha Fernando and
Koray Kavukcuoglu},
title = {Hierarchical Representations for Efficient Architecture Search},
publisher = {International Conference on Learning Representations},
year = {2018}
}
@inproceedings{DBLP:conf/iclr/CaiZH19,
author = {Han Cai and
Ligeng Zhu and
Song Han},
title = {ProxylessNAS: Direct Neural Architecture Search on Target Task and
Hardware},
publisher = {International Conference on Learning Representations},
year = {2019}
}
@inproceedings{DBLP:conf/cvpr/LiuCSAHY019,
author = {Chenxi Liu and
Liang{-}Chieh Chen and
Florian Schroff and
Hartwig Adam and
Wei Hua and
Alan L. Yuille and
Fei{-}Fei Li},
title = {Auto-DeepLab: Hierarchical Neural Architecture Search for Semantic
Image Segmentation},
pages = {82--92},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
year = {2019}
}
@inproceedings{DBLP:conf/cvpr/WuDZWSWTVJK19,
author = {Bichen Wu and
Xiaoliang Dai and
Peizhao Zhang and
Yanghan Wang and
Fei Sun and
Yiming Wu and
Yuandong Tian and
Peter Vajda and
Yangqing Jia and
Kurt Keutzer},
title = {FBNet: Hardware-Aware Efficient ConvNet Design via Differentiable
Neural Architecture Search},
pages = {10734--10742},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
year = {2019}
}
@inproceedings{DBLP:conf/iclr/XieZLL19,
author = {Sirui Xie and
Hehui Zheng and
Chunxiao Liu and
Liang Lin},
title = {{SNAS:} stochastic neural architecture search},
publisher = {International Conference on Learning Representations},
year = {2019}
}
@inproceedings{DBLP:conf/uai/LiT19,
author = {Liam Li and
Ameet Talwalkar},
title = {Random Search and Reproducibility for Neural Architecture Search},
pages = {129},
publisher = {Conference on Uncertainty in Artificial Intelligence},
year = {2019}
}
@inproceedings{DBLP:conf/cvpr/DongY19,
author = {Xuanyi Dong and
Yi Yang},
title = {Searching for a Robust Neural Architecture in Four {GPU} Hours},
pages = {1761--1770},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
year = {2019}
}
@inproceedings{DBLP:conf/iclr/XuX0CQ0X20,
author = {Yuhui Xu and
Lingxi Xie and
Xiaopeng Zhang and
Xin Chen and
Guo{-}Jun Qi and
Qi Tian and
Hongkai Xiong},
title = {{PC-DARTS:} Partial Channel Connections for Memory-Efficient Architecture
Search},
publisher = {International Conference on Learning Representations},
year = {2020}
}
@inproceedings{DBLP:conf/iclr/ZelaESMBH20,
author = {Arber Zela and
Thomas Elsken and
Tonmoy Saikia and
Yassine Marrakchi and
Thomas Brox and
Frank Hutter},
title = {Understanding and Robustifying Differentiable Architecture Search},
publisher = {International Conference on Learning Representations},
year = {2020}
}
@inproceedings{DBLP:conf/iclr/MeiLLJYYY20,
author = {Jieru Mei and
Yingwei Li and
Xiaochen Lian and
Xiaojie Jin and
Linjie Yang and
Alan L. Yuille and
Jianchao Yang},
title = {AtomNAS: Fine-Grained End-to-End Neural Architecture Search},
publisher = {International Conference on Learning Representations},
year = {2020}
}
@article{DBLP:journals/jmlr/LiJDRT17,
author = {Lisha Li and
Kevin G. Jamieson and
Giulia DeSalvo and
Afshin Rostamizadeh and
Ameet Talwalkar},
title = {Hyperband: {A} Novel Bandit-Based Approach to Hyperparameter Optimization},
journal = {Journal of Machine Learning Research},
volume = {18},
pages = {185:1--185:52},
year = {2017}
}
@inproceedings{DBLP:conf/eccv/LiuZNSHLFYHM18,
author = {Chenxi Liu and
Barret Zoph and
Maxim Neumann and
Jonathon Shlens and
Wei Hua and
Li{-}Jia Li and
Li Fei{-}Fei and
Alan L. Yuille and
Jonathan Huang and
Kevin Murphy},
title = {Progressive Neural Architecture Search},
volume = {11205},
pages = {19--35},
publisher = {European Conference on Computer Vision},
year = {2018}
}
@article{DBLP:journals/taslp/FanTXQLL20,
author = {Yang Fan and
Fei Tian and
Yingce Xia and
Tao Qin and
Xiang{-}Yang Li and
Tie{-}Yan Liu},
title = {Searching Better Architectures for Neural Machine Translation},
journal = {IEEE Transactions on Audio, Speech, and Language Processing},
volume = {28},
pages = {1574--1585},
year = {2020}
}
@inproceedings{DBLP:conf/ijcai/ChenLQWLDDHLZ20,
author = {Daoyuan Chen and
Yaliang Li and
Minghui Qiu and
Zhen Wang and
Bofang Li and
Bolin Ding and
Hongbo Deng and
Jun Huang and
Wei Lin and
Jingren Zhou},
title = {AdaBERT: Task-Adaptive {BERT} Compression with Differentiable Neural
Architecture Search},
publisher = {International Joint Conference on Artificial Intelligence},
pages = {2463--2469},
year = {2020}
}
@inproceedings{DBLP:conf/acl/WangWLCZGH20,
author = {Hanrui Wang and
Zhanghao Wu and
Zhijian Liu and
Han Cai and
Ligeng Zhu and
Chuang Gan and
Song Han},
title = {{HAT:} Hardware-Aware Transformers for Efficient Natural Language
Processing},
pages = {7675--7688},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2020}
}
@inproceedings{DBLP:conf/icml/CaiYZHY18,
author = {Han Cai and
Jiacheng Yang and
Weinan Zhang and
Song Han and
Yong Yu},
title = {Path-Level Network Transformation for Efficient Architecture Search},
volume = {80},
pages = {677--686},
publisher = {International Conference on Machine Learning},
year = {2018}
}
@article{DBLP:journals/corr/abs-2003-03384,
author = {Esteban Real and
Chen Liang and
David R. So and
Quoc V. Le},
title = {AutoML-Zero: Evolving Machine Learning Algorithms From Scratch},
journal = {CoRR},
volume = {abs/2003.03384},
year = {2020}
}
@article{Chollet2017XceptionDL,
title={Xception: Deep Learning with Depthwise Separable Convolutions},
author = {Fran{\c{c}}ois Chollet},
journal={IEEE Conference on Computer Vision and Pattern Recognition},
year={2017},
pages={1800-1807}
}
@article{DBLP:journals/tnn/AngelineSP94,
author = {Peter J. Angeline and
Gregory M. Saunders and
Jordan B. Pollack},
title = {An evolutionary algorithm that constructs recurrent neural networks},
journal = {IEEE Transactions on Neural Networks},
volume = {5},
number = {1},
pages = {54--65},
year = {1994}
}
@article{stanley2002evolving,
title={Evolving neural networks through augmenting topologies},
author={Stanley, Kenneth O and Miikkulainen, Risto},
journal={Evolutionary computation},
volume={10},
number={2},
pages={99--127},
year={2002},
publisher={MIT Press}
}
@article{DBLP:journals/alife/StanleyDG09,
author = {Kenneth O. Stanley and
David B. D'Ambrosio and
Jason Gauci},
title = {A Hypercube-Based Encoding for Evolving Large-Scale Neural Networks},
journal = {Artificial Life},
volume = {15},
number = {2},
pages = {185--212},
year = {2009},
publisher = {MIT Press}
}
@inproceedings{DBLP:conf/ijcai/SuganumaSN18,
author = {Masanori Suganuma and
Shinichi Shirakawa and
Tomoharu Nagao},
title = {A Genetic Programming Approach to Designing Convolutional Neural Network
Architectures},
pages = {5369--5373},
publisher = {International Joint Conference on Artificial Intelligence},
year = {2018}
}
@inproceedings{DBLP:conf/iccv/XieY17,
author = {Lingxi Xie and
Alan L. Yuille},
title = {Genetic {CNN}},
pages = {1388--1397},
publisher = {IEEE International Conference on Computer Vision},
year = {2017}
}
@inproceedings{DBLP:conf/cvpr/ZhongYWSL18,
author = {Zhao Zhong and
Junjie Yan and
Wei Wu and
Jing Shao and
Cheng{-}Lin Liu},
title = {Practical Block-Wise Neural Network Architecture Generation},
pages = {2423--2432},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
year = {2018}
}
@inproceedings{DBLP:conf/icml/BergstraYC13,
author = {James Bergstra and
Daniel Yamins and
David D. Cox},
title = {Making a Science of Model Search: Hyperparameter Optimization in Hundreds
of Dimensions for Vision Architectures},
volume = {28},
pages = {115--123},
publisher = {International Conference on Machine Learning},
year = {2013}
}
@inproceedings{DBLP:conf/ijcai/DomhanSH15,
author = {Tobias Domhan and
Jost Tobias Springenberg and
Frank Hutter},
title = {Speeding Up Automatic Hyperparameter Optimization of Deep Neural Networks
by Extrapolation of Learning Curves},
pages = {3460--3468},
publisher = {International Joint Conference on Artificial Intelligence},
year = {2015}
}
@inproceedings{DBLP:conf/icml/MendozaKFSH16,
author = {Hector Mendoza and
Aaron Klein and
Matthias Feurer and
Jost Tobias Springenberg and
Frank Hutter},
title = {Towards Automatically-Tuned Neural Networks},
volume = {64},
pages = {58--65},
publisher = {International Conference on Machine Learning},
year = {2016}
}
@article{DBLP:journals/corr/abs-1807-06906,
author = {Arber Zela and
Aaron Klein and
Stefan Falkner and
Frank Hutter},
title = {Towards Automated Deep Learning: Efficient Joint Neural Architecture
and Hyperparameter Search},
journal = {International Conference on Machine Learning},
year = {2018}
}
@article{li2020automated,
title={Automated and Lightweight Network Design via Random Search for Remote Sensing Image Scene Classification},
author={Li, Jihao and Diao, Wenhui and Sun, Xian and Feng, Yingchao and Zhang, Wenkai and Chang, Zhonghan and Fu, Kun},
journal={The International Archives of Photogrammetry, Remote Sensing and Spatial Information Sciences},
volume={43},
pages={1217--1224},
year={2020}
}
@inproceedings{DBLP:conf/cvpr/BenderLCCCKL20,
author = {Gabriel Bender and
Hanxiao Liu and
Bo Chen and
Grace Chu and
Shuyang Cheng and
Pieter{-}Jan Kindermans and
Quoc V. Le},
title = {Can Weight Sharing Outperform Random Architecture Search? An Investigation
With TuNAS},
pages = {14311--14320},
publisher = {IEEE Conference on Computer Vision and Pattern Recognition},
year = {2020}
}
@inproceedings{DBLP:conf/aistats/KleinFBHH17,
author = {Aaron Klein and
Stefan Falkner and
Simon Bartels and
Philipp Hennig and
Frank Hutter},
title = {Fast Bayesian Optimization of Machine Learning Hyperparameters on
Large Datasets},
volume = {54},
pages = {528--536},
publisher = {International Conference on Artificial Intelligence and Statistics},
year = {2017}
}
@article{DBLP:journals/corr/ChrabaszczLH17,
author = {Patryk Chrabaszcz and
Ilya Loshchilov and
Frank Hutter},
title = {A Downsampled Variant of ImageNet as an Alternative to the {CIFAR}
datasets},
journal = {CoRR},
volume = {abs/1707.08819},
year = {2017}
}
@inproceedings{DBLP:conf/aaai/CaiCZYW18,
author = {Han Cai and
Tianyao Chen and
Weinan Zhang and
Yong Yu and
Jun Wang},
title = {Efficient Architecture Search by Network Transformation},
pages = {2787--2794},
publisher = {AAAI Conference on Artificial Intelligence},
year = {2018}
}
@inproceedings{DBLP:conf/iclr/ElskenMH18,
author = {Thomas Elsken and
Jan Hendrik Metzen and
Frank Hutter},
title = {Simple and efficient architecture search for Convolutional Neural
Networks},
publisher = {International Conference on Learning Representations},
year = {2018}
}
@inproceedings{DBLP:conf/icml/BenderKZVL18,
author = {Gabriel Bender and
Pieter{-}Jan Kindermans and
Barret Zoph and
Vijay Vasudevan and
Quoc V. Le},
title = {Understanding and Simplifying One-Shot Architecture Search},
volume = {80},
pages = {549--558},
publisher = {International Conference on Machine Learning},
year = {2018}
}
@inproceedings{DBLP:conf/nips/SaxenaV16,
author = {Shreyas Saxena and
Jakob Verbeek},
title = {Convolutional Neural Fabrics},
publisher = {Advances in Neural Information Processing Systems},
pages = {4053--4061},
year = {2016}
}
@inproceedings{DBLP:conf/iclr/KleinFSH17,
author = {Aaron Klein and
Stefan Falkner and
Jost Tobias Springenberg and
Frank Hutter},
title = {Learning Curve Prediction with Bayesian Neural Networks},
publisher = {International Conference on Learning Representations},
year = {2017}
}
@inproceedings{DBLP:conf/iclr/BakerGRN18,
author = {Bowen Baker and
Otkrist Gupta and
Ramesh Raskar and
Nikhil Naik},
title = {Accelerating Neural Architecture Search using Performance Prediction},
publisher = {International Conference on Learning Representations},
year = {2018}
}
@inproceedings{DBLP:conf/wmt/XiaTTGHCFGLLWWZ19,
author = {Yingce Xia and
Xu Tan and
Fei Tian and
Fei Gao and
Di He and
Weicong Chen and
Yang Fan and
Linyuan Gong and
Yichong Leng and
Renqian Luo and
Yiren Wang and
Lijun Wu and
Jinhua Zhu and
Tao Qin and
Tie{-}Yan Liu},
title = {Microsoft Research Asia's Systems for {WMT19}},
pages = {424--433},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2019}
}
@inproceedings{DBLP:conf/iclr/RamachandranZL18,
author = {Prajit Ramachandran and
Barret Zoph and
Quoc V. Le},
title = {Searching for Activation Functions},
publisher = {International Conference on Learning Representations},
year = {2018}
}
@article{DBLP:journals/corr/abs-2009-02070,
author = {Wei Zhu and
Xiaoling Wang and
Xipeng Qiu and
Yuan Ni and
Guotong Xie},
title = {AutoTrans: Automating Transformer Design via Reinforced Architecture
Search},
journal = {CoRR},
volume = {abs/2009.02070},
year = {2020}
}
@inproceedings{DBLP:conf/acl/WangWLCZGH20,
author = {Hanrui Wang and
Zhanghao Wu and
Zhijian Liu and
Han Cai and
Ligeng Zhu and
Chuang Gan and
Song Han},
title = {{HAT:} Hardware-Aware Transformers for Efficient Natural Language
Processing},
pages = {7675--7688},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2020}
}
@article{DBLP:journals/corr/abs-2008-06808,
author = {Henry Tsai and
Jayden Ooi and
Chun{-}Sung Ferng and
Hyung Won Chung and
Jason Riesa},
title = {Finding Fast Transformers: One-Shot Neural Architecture Search by
Component Composition},
journal = {CoRR},
volume = {abs/2008.06808},
year = {2020}
}
@inproceedings{Wang2019ExploitingSC,
title={Exploiting Sentential Context for Neural Machine Translation},
author={Xing Wang and Zhaopeng Tu and Longyue Wang and Shuming Shi},
publisher={Annual Meeting of the Association for Computational Linguistics},
year={2019}
}
@inproceedings{Wei2020MultiscaleCD,
title={Multiscale Collaborative Deep Models for Neural Machine Translation},
author={Xiangpeng Wei and Heng Yu and Yue Hu and Yue Zhang and Rongxiang Weng and Weihua Luo},
publisher={Annual Meeting of the Association for Computational Linguistics},
year={2020}
}
@article{li2020shallow,
title={Shallow-to-Deep Training for Neural Machine Translation},
author={Li, Bei and Wang, Ziyang and Liu, Hui and Jiang, Yufan and Du, Quan and Xiao, Tong and Wang, Huizhen and Zhu, Jingbo},
journal={Conference on Empirical Methods in Natural Language Processing},
year={2020}
}
@article{DBLP:journals/corr/abs-2007-06257,
author = {Hongfei Xu and
Qiuhui Liu and
Deyi Xiong and
Josef van Genabith},
title = {Transformer with Depth-Wise {LSTM}},
journal = {CoRR},
volume = {abs/2007.06257},
year = {2020}
}
@inproceedings{DBLP:conf/acl/XuLGXZ20,
author = {Hongfei Xu and
Qiuhui Liu and
Josef van Genabith and
Deyi Xiong and
Jingyi Zhang},
title = {Lipschitz Constrained Parameter Initialization for Deep Transformers},
pages = {397--402},
publisher = {Annual Meeting of the Association for Computational Linguistics},
year = {2020}
}
@article{DBLP:journals/corr/abs-2006-10369,
author = {Jungo Kasai and
Nikolaos Pappas and
Hao Peng and
James Cross and
Noah A. Smith},
title = {Deep Encoder, Shallow Decoder: Reevaluating the Speed-Quality Tradeoff
in Machine Translation},
journal = {CoRR},
volume = {abs/2006.10369},
year = {2020}
}
%%%%% chapter 15------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论