Commit 2f692aa1 by 曹润柘

合并分支 'caorunzhe' 到 'master'

Caorunzhe

查看合并请求 !490
parents 51fb326f d594af84
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
% RNN Encoder % RNN Encoder
\coordinate (eemb0) at (0,0); \coordinate (eemb0) at (0,0);
\foreach \x [count=\y from 0] in {1,2,...,3} \foreach \x [count=\y from 0] in {1,2,...,3}
\node[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west] (eemb\x) at ([xshift=0.4\base]eemb\y.east) {\tiny{$e_x()$}}; \node[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west] (eemb\x) at ([xshift=0.4\base]eemb\y.east) {\tiny{$\textrm{e}_x()$}};
\foreach \x in {1,2,...,3} \foreach \x in {1,2,...,3}
\node[rnnnode,fill=blue!30!white,anchor=south] (enc\x) at ([yshift=0.3\base]eemb\x.north) {}; \node[rnnnode,fill=blue!30!white,anchor=south] (enc\x) at ([yshift=0.3\base]eemb\x.north) {};
\node[] (enclabel1) at (enc1) {\tiny{$\mathbi{h}_{m-2}$}}; \node[] (enclabel1) at (enc1) {\tiny{$\mathbi{h}_{m-2}$}};
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
% RNN Decoder % RNN Decoder
\foreach \x in {1,2,...,3} \foreach \x in {1,2,...,3}
\node[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south] (demb\x) at ([yshift=\base]enc\x.north) {\tiny{$e_y()$}}; \node[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south] (demb\x) at ([yshift=\base]enc\x.north) {\tiny{$\textrm{e}_y()$}};
\foreach \x in {1,2,...,3} \foreach \x in {1,2,...,3}
\node[rnnnode,fill=blue!30!white,anchor=south] (dec\x) at ([yshift=0.3\base]demb\x.north) {{\tiny{$\mathbi{s}_\x$}}}; \node[rnnnode,fill=blue!30!white,anchor=south] (dec\x) at ([yshift=0.3\base]demb\x.north) {{\tiny{$\mathbi{s}_\x$}}};
\foreach \x in {1,2,...,3} \foreach \x in {1,2,...,3}
...@@ -80,10 +80,10 @@ ...@@ -80,10 +80,10 @@
} }
{ {
\node [anchor=north west] (line11) at ([yshift=-1.8em]line4.west) {\scriptsize{每个词的one-hot}}; \node [anchor=north west] (line11) at ([yshift=-1.8em]line4.west) {\scriptsize{每个词的One-hot}};
\node [anchor=north west] (line12) at ([yshift=0.3em]line11.south west) {\scriptsize{离散化表示都被转化为\ \ \ \ }}; \node [anchor=north west] (line12) at ([yshift=0.3em]line11.south west) {\scriptsize{离散化表示都被转化为\ \ \ \ }};
\node [anchor=north west] (line13) at ([yshift=0.3em]line12.south west) {\scriptsize{实数向量,即词嵌入}}; \node [anchor=north west] (line13) at ([yshift=0.3em]line12.south west) {\scriptsize{实数向量,即词嵌入}};
\node [anchor=north west] (line14) at ([yshift=0.3em]line13.south west) {\scriptsize{($e_x()$$e_y()$函数)}}; \node [anchor=north west] (line14) at ([yshift=0.3em]line13.south west) {\scriptsize{($\textrm{e}_x()$$\textrm{e}_y()$函数)}};
} }
{ {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
\node[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south] (softmax\x) at ([yshift=0.5\base]dec\x.north) {}; \node[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south] (softmax\x) at ([yshift=0.5\base]dec\x.north) {};
% Decoder input words % Decoder input words
\node[wordnode,below=0pt of demb1] (decwordin) {$\langle$eos$\rangle$}; \node[wordnode,below=0pt of demb1] (decwordin) {$\langle$sos$\rangle$};
\ExtractX{$(demb2.south)$} \ExtractX{$(demb2.south)$}
\ExtractY{$(decwordin.base)$} \ExtractY{$(decwordin.base)$}
\node[wordnode,anchor=base] () at (\XCoord,\YCoord) {Do}; \node[wordnode,anchor=base] () at (\XCoord,\YCoord) {Do};
......
...@@ -83,10 +83,10 @@ ...@@ -83,10 +83,10 @@
\end{scope} \end{scope}
\node[] (tanh) at (aux46){}; \node[] (Tanh) at (aux46){};
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
\node[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)] (GRU) {}; \node[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (Tanh)] (GRU) {};
\end{pgfonlayer} \end{pgfonlayer}
......
...@@ -96,10 +96,10 @@ ...@@ -96,10 +96,10 @@
\end{scope} \end{scope}
\node[] (tanh) at (aux46){}; \node[] (Tanh) at (aux46){};
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
\node[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)] (GRU) {}; \node[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (Tanh)] (GRU) {};
\end{pgfonlayer} \end{pgfonlayer}
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
\draw[-latex,emph] (aux71) -| (aux87); \draw[-latex,emph] (aux71) -| (aux87);
\draw[-latex,emph] (aux71) -| (aux53) -- (aux23) -| (aux46) -- (z76); \draw[-latex,emph] (aux71) -| (aux53) -- (aux23) -| (aux46) -- (z76);
\draw[emph] (aux12) |- (aux23) -| (aux46); \draw[emph] (aux12) |- (aux23) -| (aux46);
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] (tanh) at (aux46) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] (Tanh) at (aux46) {$\mathrm{Tanh}$};
\node[opnode,circle,draw=red,thick] (a1) at (aux53) {}; \node[opnode,circle,draw=red,thick] (a1) at (aux53) {};
\node[opnode,circle,draw=red,thick] (a2) at (aux56) {}; \node[opnode,circle,draw=red,thick] (a2) at (aux56) {};
\node[opnode,circle,draw=red,thick] (a3) at (aux75) {}; \node[opnode,circle,draw=red,thick] (a3) at (aux75) {};
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
\end{scope} \end{scope}
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
\node[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)] (GRU) {}; \node[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (Tanh)] (GRU) {};
\end{pgfonlayer} \end{pgfonlayer}
%%new %%new
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
\draw[-latex,emph] (aux21) -- (aux25) -- (u55); \draw[-latex,emph] (aux21) -- (aux25) -- (u55);
\draw[emph] (aux12) -- (aux22) -- (aux23); \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$}; \node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{Tanh}$};
\node[opnode,circle,draw=red,thick] (i45) at (aux45) {}; \node[opnode,circle,draw=red,thick] (i45) at (aux45) {};
} }
\end{scope} \end{scope}
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
\draw[-latex,emph] (aux21) -- (aux25) -- (u55); \draw[-latex,emph] (aux21) -- (aux25) -- (u55);
\draw[emph] (aux12) -- (aux22) -- (aux23); \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$}; \node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{Tanh}$};
\node[opnode,circle,draw=red,thick] (i45) at (aux45) {X}; \node[opnode,circle,draw=red,thick] (i45) at (aux45) {X};
} }
{ {
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
\draw[-latex,standard] (aux21) -- (aux24) |- (i45); \draw[-latex,standard] (aux21) -- (aux24) |- (i45);
\draw[-latex,standard] (aux21) -- (aux25) -- (u55); \draw[-latex,standard] (aux21) -- (aux25) -- (u55);
\node[opnode,circle] () at (aux34) {$\sigma$}; \node[opnode,circle] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{Tanh}$};
\node[opnode,circle] (i45) at (aux45) {}; \node[opnode,circle] (i45) at (aux45) {};
} }
% cell update % cell update
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
\draw[-latex,emph] (aux21) -- (aux25) -- (u55); \draw[-latex,emph] (aux21) -- (aux25) -- (u55);
\draw[emph] (aux12) -- (aux22) -- (aux23); \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$}; \node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{Tanh}$};
\node[opnode,circle,draw=red,thick] (i45) at (aux45) {X}; \node[opnode,circle,draw=red,thick] (i45) at (aux45) {X};
} }
{ {
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
\draw[-latex,standard] (aux21) -- (aux24) |- (i45); \draw[-latex,standard] (aux21) -- (aux24) |- (i45);
\draw[-latex,standard] (aux21) -- (aux25) -- (u55); \draw[-latex,standard] (aux21) -- (aux25) -- (u55);
\node[opnode,circle] () at (aux34) {$\sigma$}; \node[opnode,circle] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{Tanh}$};
\node[opnode,circle] (i45) at (aux45) {}; \node[opnode,circle] (i45) at (aux45) {};
} }
% cell update % cell update
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
\draw[-latex,emph] (aux21) -- (o27); \draw[-latex,emph] (aux21) -- (o27);
\draw[emph] (aux12) -- (aux22) -- (aux23); \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle,draw=red,thick] () at (aux26) {$\sigma$}; \node[opnode,circle,draw=red,thick] () at (aux26) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux37) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux37) {$\mathrm{Tanh}$};
\draw[-latex,emph] (o27) -- (aux29); \draw[-latex,emph] (o27) -- (aux29);
\draw[-latex,emph] (o27) -| (aux68); \draw[-latex,emph] (o27) -| (aux68);
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
\draw[-latex,emph] (aux21) -- (aux25) -- (u55); \draw[-latex,emph] (aux21) -- (aux25) -- (u55);
\draw[emph] (aux12) -- (aux22) -- (aux23); \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$}; \node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{Tanh}$};
\node[opnode,circle,draw=red,thick] (i45) at (aux45) {}; \node[opnode,circle,draw=red,thick] (i45) at (aux45) {};
} }
{ {
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
\draw[-latex,standard] (aux21) -- (aux24) |- (i45); \draw[-latex,standard] (aux21) -- (aux24) |- (i45);
\draw[-latex,standard] (aux21) -- (aux25) -- (u55); \draw[-latex,standard] (aux21) -- (aux25) -- (u55);
\node[opnode,circle] () at (aux34) {$\sigma$}; \node[opnode,circle] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{Tanh}$};
\node[opnode,circle] (i45) at (aux45) {}; \node[opnode,circle] (i45) at (aux45) {};
} }
% cell update % cell update
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
\draw[-latex,emph] (aux21) -- (o27); \draw[-latex,emph] (aux21) -- (o27);
\draw[emph] (aux12) -- (aux22) -- (aux23); \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle,draw=red,thick] () at (aux26) {$\sigma$}; \node[opnode,circle,draw=red,thick] () at (aux26) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux37) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux37) {$\mathrm{Tanh}$};
\draw[-latex,emph] (o27) -- (aux29); \draw[-latex,emph] (o27) -- (aux29);
\draw[-latex,emph] (o27) -| (aux68); \draw[-latex,emph] (o27) -| (aux68);
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
\draw[-latex,standard] (u55) -| (o27); \draw[-latex,standard] (u55) -| (o27);
\draw[-latex,standard] (aux21) -- (o27); \draw[-latex,standard] (aux21) -- (o27);
\node[opnode,circle] () at (aux26) {$\sigma$}; \node[opnode,circle] () at (aux26) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux37) {$\mathrm{tanh}$}; \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux37) {$\mathrm{Tanh}$};
\draw[-latex,standard] (o27) -- (aux29); \draw[-latex,standard] (o27) -- (aux29);
\draw[-latex,standard] (o27) -| (aux68); \draw[-latex,standard] (o27) -| (aux68);
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
} }
{ {
% input gate formula % input gate formula
\node[formulanode,anchor=north east,text width=10em] () at ([shift={(4\base,-1.5\base)}]aux21) {输入门\\$\mathbi{i}_t=\sigma(\mathbi{W}_i[\mathbi{h}_{t-1},\mathbi{x}_t]+\mathbi{b}_i)$\\$\hat{\mathbi{c}}_t=\mathrm{tanh}(\mathbi{W}_c[\mathbi{h}_{t-1},\mathbi{x}_t]+\mathbi{b}_c)$}; \node[formulanode,anchor=north east,text width=10em] () at ([shift={(4\base,-1.5\base)}]aux21) {输入门\\$\mathbi{i}_t=\sigma(\mathbi{W}_i[\mathbi{h}_{t-1},\mathbi{x}_t]+\mathbi{b}_i)$\\$\hat{\mathbi{c}}_t=\mathrm{Tanh}(\mathbi{W}_c[\mathbi{h}_{t-1},\mathbi{x}_t]+\mathbi{b}_c)$};
} }
{ {
% cell update formula % cell update formula
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
} }
{ {
% output gate formula % output gate formula
\node[formulanode,anchor=north west,text width=10em] () at ([shift={(-4\base,-1.5\base)}]aux29) {输出门\\$\mathbi{o}_t=\sigma(\mathbi{W}_o[\mathbi{h}_{t-1},\mathbi{x}_t]+\mathbi{b}_o)$\\$\mathbi{h}_{t}=\mathbi{o}_t\cdot \mathrm{tanh}(\mathbi{c}_{t})$}; \node[formulanode,anchor=north west,text width=10em] () at ([shift={(-4\base,-1.5\base)}]aux29) {输出门\\$\mathbi{o}_t=\sigma(\mathbi{W}_o[\mathbi{h}_{t-1},\mathbi{x}_t]+\mathbi{b}_o)$\\$\mathbi{h}_{t}=\mathbi{o}_t\cdot \mathrm{Tanh}(\mathbi{c}_{t})$};
} }
\end{scope} \end{scope}
\end{tikzpicture} \end{tikzpicture}
......
...@@ -209,7 +209,7 @@ NMT & 21.7 & 18.7 & -13.7 \\ ...@@ -209,7 +209,7 @@ NMT & 21.7 & 18.7 & -13.7 \\
Transformer-RPR \upcite{Shaw2018SelfAttentionWR} &Shaw等 &2018 &29.2 \\ Transformer-RPR \upcite{Shaw2018SelfAttentionWR} &Shaw等 &2018 &29.2 \\
Transformer-DLCL \upcite{WangLearning} &Wang等 &2019 &29.3 \\ Transformer-DLCL \upcite{WangLearning} &Wang等 &2019 &29.3 \\
SDT \upcite{li2020shallow} &Li等 &2020 & 30.4 \\ SDT \upcite{li2020shallow} &Li等 &2020 & 30.4 \\
Msc \upcite{Wei2020MultiscaleCD} &Wei等 &2020 &30.5 \\ MSC \upcite{Wei2020MultiscaleCD} &Wei等 &2020 &30.5 \\
\end{tabular} \end{tabular}
\end{table} \end{table}
%---------------------------------------------- %----------------------------------------------
...@@ -242,10 +242,10 @@ NMT & 21.7 & 18.7 & -13.7 \\ ...@@ -242,10 +242,10 @@ NMT & 21.7 & 18.7 & -13.7 \\
\item 分布式连续空间表示模型,能捕获更多隐藏信息。神经机器翻译与统计机器翻译最大的区别在于对语言文字串的表示方法。在统计机器翻译中,所有词串本质上都是由更小的词串(短语、规则)组合而成,也就是统计机器翻译模型利用了词串之间的组合性来表示更大的词串。统计机器翻译使用多个特征描述翻译结果,但是其仍然对应着离散的字符串的组合,因此可以把模型对问题的表示空间看做是由一个离散结构组成的集合。在神经机器翻译中,词串的表示已经被神经网络转化为多维实数向量,而且也不依赖任何的可组合性假设等其他假设来刻画离散的语言结构,从这个角度说,所有的词串分别对应了一个连续空间上的点(比如,对应多维实数空间中一个点)。这样,模型可以更好地进行优化,而且对未见样本有更好的泛化能力。此外,基于连续可微函数的机器学习算法已经相对完备,可以很容易地对问题进行建模和优化。 \item 分布式连续空间表示模型,能捕获更多隐藏信息。神经机器翻译与统计机器翻译最大的区别在于对语言文字串的表示方法。在统计机器翻译中,所有词串本质上都是由更小的词串(短语、规则)组合而成,也就是统计机器翻译模型利用了词串之间的组合性来表示更大的词串。统计机器翻译使用多个特征描述翻译结果,但是其仍然对应着离散的字符串的组合,因此可以把模型对问题的表示空间看做是由一个离散结构组成的集合。在神经机器翻译中,词串的表示已经被神经网络转化为多维实数向量,而且也不依赖任何的可组合性假设等其他假设来刻画离散的语言结构,从这个角度说,所有的词串分别对应了一个连续空间上的点(比如,对应多维实数空间中一个点)。这样,模型可以更好地进行优化,而且对未见样本有更好的泛化能力。此外,基于连续可微函数的机器学习算法已经相对完备,可以很容易地对问题进行建模和优化。
\vspace{0.5em} \vspace{0.5em}
\item需要特征工程,特征学习更加全面。经典的统计机器翻译可以通过判别式模型引入任意特征,不过这些特征需要人工设计,因此这个过程也被称为特征工程。特征工程依赖大量的人工,特别是对不同语种、不同场景的翻译任务,所采用的特征可能不尽相同,这也使得设计有效的特征成为了统计机器翻译时代最主要的工作之一。但是,由于人类自身的思维和认知水平的限制,人工设计的特征可能不全面,甚至会遗漏一些重要的翻译现象。神经机器翻译并不依赖任何人工特征的设计,或者说它的特征都隐含在分布式表示中。这些“特征”都是自动学习得到的,因此神经机器翻译并不会受到人工思维的限制,学习到的特征对问题描述更加全面 \item含隐含结构假设,端到端学习对问题建模更加直接。传统的自然语言处理任务会对问题进行隐含结构假设。比如,进行翻译时,统计机器翻译会假设翻译过程由短语的拼装完成。这些假设可以大大化简问题的复杂度,但是另一方面也带来了各种各样的约束条件,并且错误的隐含假设往往会导致建模错误。神经机器翻译是一种端到端模型,它并不依赖任何隐含结构假设。这样,模型并不会受到错误的隐含结构的引导。从某种意义上说,端到端学习可以让模型更加“ 自由”地进行学习,因此往往可以学到很多传统认知上不容易理解或者不容易观测到的现象
\vspace{0.5em} \vspace{0.5em}
\item含隐含结构假设,端到端学习对问题建模更加直接。传统的自然语言处理任务会对问题进行隐含结构假设。比如,进行翻译时,统计机器翻译会假设翻译过程由短语的拼装完成。这些假设可以大大化简问题的复杂度,但是另一方面也带来了各种各样的约束条件,并且错误的隐含假设往往会导致建模错误。神经机器翻译是一种端到端模型,它并不依赖任何隐含结构假设。这样,模型并不会受到错误的隐含结构的引导。从某种意义上说,端到端学习可以让模型更加“ 自由”地进行学习,因此往往可以学到很多传统认知上不容易理解或者不容易观测到的现象 \item需要特征工程,特征学习更加全面。经典的统计机器翻译可以通过判别式模型引入任意特征,不过这些特征需要人工设计,因此这个过程也被称为特征工程。特征工程依赖大量的人工,特别是对不同语种、不同场景的翻译任务,所采用的特征可能不尽相同,这也使得设计有效的特征成为了统计机器翻译时代最主要的工作之一。但是,由于人类自身的思维和认知水平的限制,人工设计的特征可能不全面,甚至会遗漏一些重要的翻译现象。神经机器翻译并不依赖任何人工特征的设计,或者说它的特征都隐含在分布式表示中。这些“特征”都是自动学习得到的,因此神经机器翻译并不会受到人工思维的限制,学习到的特征对问题描述更加全面
\vspace{0.5em} \vspace{0.5em}
\item 模型结构统一,存储消耗更小。统计机器翻译系统依赖于很多模块,比如词对齐、短语(规则)表和目标语言模型等等,因为所有的信息(如$n$-gram)都是离散化表示的,因此模型需要消耗大量的存储资源。同时,由于系统模块较多,开发的难度也较大。神经机器翻译的模型都是用神经网络进行表示,模型参数大多是实数矩阵,因此存储资源的消耗很小。而且神经网络可以作为一个整体进行开发和调试,系统搭建的代价相对较低。实际上,由于模型体积小,神经机器翻译也非常合适于离线小设备上的翻译任务。 \item 模型结构统一,存储消耗更小。统计机器翻译系统依赖于很多模块,比如词对齐、短语(规则)表和目标语言模型等等,因为所有的信息(如$n$-gram)都是离散化表示的,因此模型需要消耗大量的存储资源。同时,由于系统模块较多,开发的难度也较大。神经机器翻译的模型都是用神经网络进行表示,模型参数大多是实数矩阵,因此存储资源的消耗很小。而且神经网络可以作为一个整体进行开发和调试,系统搭建的代价相对较低。实际上,由于模型体积小,神经机器翻译也非常合适于离线小设备上的翻译任务。
...@@ -253,7 +253,7 @@ NMT & 21.7 & 18.7 & -13.7 \\ ...@@ -253,7 +253,7 @@ NMT & 21.7 & 18.7 & -13.7 \\
\vspace{0.5em} \vspace{0.5em}
\end{itemize} \end{itemize}
\parinterval 当然,神经机器翻译也并不完美,很多问题有待解决。首先,神经机器翻译需要大规模浮点运算的支持,模型的推断速度较低。为了获得优质的翻译结果,往往需要大量GPU设备的支持,计算资源成本很高;其次,由于缺乏人类的先验知识对翻译过程的指导,神经机器翻译的运行过程缺乏可解释性,系统的可干预性也较差;此外,虽然脱离了繁重的特征工程,神经机器翻译仍然需要人工设计网络结构,在模型的各种超参的设置、训练策略的选择等方面,仍然需要大量人工参与。这也导致很多实验结果不容易重现。显然,完全不依赖人工进行机器翻译还很遥远。不过,随着研究者的不断攻关,很多问题也得到了解决。 \parinterval 当然,神经机器翻译也并不完美,很多问题有待解决。首先,神经机器翻译需要大规模浮点运算的支持,模型的推断速度较低。为了获得优质的翻译结果,往往需要大量GPU设备的支持,计算资源成本很高;其次,由于缺乏人类的先验知识对翻译过程的指导,神经机器翻译的运行过程缺乏可解释性,系统的可干预性也较差;此外,虽然脱离了繁重的特征工程,神经机器翻译仍然需要人工设计网络结构,在模型的各种超参数的设置、训练策略的选择等方面,仍然需要大量的人工参与。这也导致很多实验结果不容易复现。显然,完全不依赖人工的机器翻译还很遥远。不过,随着研究者的不断攻关,很多问题也得到了解决。
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
% NEW SECTION 10.2 % NEW SECTION 10.2
...@@ -283,7 +283,7 @@ NMT & 21.7 & 18.7 & -13.7 \\ ...@@ -283,7 +283,7 @@ NMT & 21.7 & 18.7 & -13.7 \\
\end{figure} \end{figure}
%---------------------------------------------- %----------------------------------------------
\parinterval 在源语言句子的表示形式确定之后,需要设计相应的编码器和解码器结构。在当今主流的神经机器翻译系统中,编码器由词嵌入层和中间网络层组成。当输入一串单词序列时,词嵌入层会将每个单词映射到多维实数表示空间,这个过程也被称为词嵌入。之后中间层会对词嵌入向量进行更深层的抽象,得到输入单词序列的中间表示。中间层的实现方式有很多,比如:循环神经网络、卷积神经网络、Transformer 等模型都是常用的结构。解码器的结构基本上和编码器是一致的,只不过多了输出层,用于输出每个目标语言位置的单词生成概率 \parinterval 在源语言句子的表示形式确定之后,需要设计相应的编码器和解码器结构。在当今主流的神经机器翻译系统中,编码器由词嵌入层和中间网络层组成。当输入一串单词序列时,词嵌入层会将每个单词映射到多维实数表示空间,这个过程也被称为词嵌入。之后中间层会对词嵌入向量进行更深层的抽象,得到输入单词序列的中间表示。中间层的实现方式有很多,比如:循环神经网络、卷积神经网络、自注意力机制等都是模型常用的结构。解码器的结构基本上和编码器是一致的,在基于循环神经网络的翻译模型中,解码器只比编码器多了输出层,用于输出每个目标语言位置的单词生成概率,而在基于自注意力机制的翻译模型中,除了输出层,解码器还比编码器多一个编码-解码注意力子层,用于帮助模型更好地利用源语言信息
\parinterval 现在,编码器-解码器框架已经成为了神经机器翻译系统的标准架构。当然,也有一些研究工作在探索编码器-解码器框架之外的结构\upcite{Li2020NeuralMT},但是还没有太多颠覆性的进展。因此,本章仍然以编码器-解码器框架为基础对相关模型和方法进行介绍。 \parinterval 现在,编码器-解码器框架已经成为了神经机器翻译系统的标准架构。当然,也有一些研究工作在探索编码器-解码器框架之外的结构\upcite{Li2020NeuralMT},但是还没有太多颠覆性的进展。因此,本章仍然以编码器-解码器框架为基础对相关模型和方法进行介绍。
...@@ -459,18 +459,18 @@ NMT & 21.7 & 18.7 & -13.7 \\ ...@@ -459,18 +459,18 @@ NMT & 21.7 & 18.7 & -13.7 \\
\vspace{-0.5em} \vspace{-0.5em}
\begin{itemize} \begin{itemize}
\vspace{0.5em} \vspace{0.5em}
\item 如何对$\seq{{x}}$$\seq{{y}}_{<j }$进行分布式表示,即词嵌入。首先,将由one-hot向量表示的源语言单词,即由0和1构成的离散化向量表示,转化为实数向量。可以把这个过程记为$\textrm{e}_x (\cdot)$。类似地,可以把目标语言序列$\seq{{y}}_{<j }$中的每个单词用同样的方式进行表示,记为$\textrm{e}_y (\cdot)$ \item 如何对$\seq{{x}}$$\seq{{y}}_{<j }$进行分布式表示,即词嵌入。首先,将由One-hot向量表示的源语言单词,即由0和1构成的离散化向量表示,转化为实数向量。可以把这个过程记为$\textrm{e}_x (\cdot)$。类似地,可以把目标语言序列$\seq{{y}}_{<j }$中的每个单词用同样的方式进行表示,记为$\textrm{e}_y (\cdot)$
\vspace{0.5em} \vspace{0.5em}
\item 如何在词嵌入的基础上获取整个序列的表示,即句子的表示学习。可以把词嵌入的序列作为循环神经网络的输入,循环神经网络最后一个时刻的输出向量便是整个句子的表示结果。如图\ref{fig:10-11}中,编码器最后一个循环单元的输出$\mathbi{h}_m$被看作是一种包含了源语言句子信息的表示结果,记为$\mathbi{C}$ \item 如何在词嵌入的基础上获取整个序列的表示,即句子的表示学习。可以把词嵌入的序列作为循环神经网络的输入,循环神经网络最后一个时刻的输出向量便是整个句子的表示结果。如图\ref{fig:10-11}中,编码器最后一个循环单元的输出$\mathbi{h}_m$被看作是一种包含了源语言句子信息的表示结果,记为$\mathbi{C}$
\vspace{0.5em} \vspace{0.5em}
\item 如何得到每个目标语言单词的概率,即译文单词的{\small\sffamily\bfseries{生成}}\index{生成}(Generation)\index{Generation}。与神经语言模型一样,可以用一个Softmax输出层来获取当前时刻所有单词的分布,即利用Softmax 函数计算目标语言词表中每个单词的概率。令目标语言序列$j$时刻的循环神经网络的输出向量(或状态)为$\mathbi{s}_j$。根据循环神经网络的性质,$ y_j$ 的生成只依赖前一个状态$\mathbi{s}_{j-1}$和当前时刻的输入(即词嵌入$\textrm{e}_y (y_{j-1})$)。同时考虑源语言信息$\mathbi{C}$$\funp{P}(y_j | \seq{{y}}_{<j},\seq{{x}})$可以被重新定义为: \item 如何得到每个目标语言单词的概率,即译文单词的{\small\sffamily\bfseries{生成}}\index{生成}(Generation)\index{Generation}。与神经语言模型一样,可以用一个Softmax输出层来获取当前时刻所有单词的分布,即利用Softmax 函数计算目标语言词表中每个单词的概率。令目标语言序列$j$时刻的循环神经网络的输出向量(或状态)为$\mathbi{s}_j$。根据循环神经网络的性质,$ y_j$ 的生成只依赖前一个状态$\mathbi{s}_{j-1}$和当前时刻的输入(即词嵌入$\textrm{e}_y (y_{j-1})$)。同时考虑源语言信息$\mathbi{C}$$\funp{P}(y_j | \seq{{y}}_{<j},\seq{{x}})$可以被重新定义为:
\begin{eqnarray} \begin{eqnarray}
\funp{P} (y_j | \seq{{y}}_{<j},\seq{{x}}) \equiv \funp{P} ( {y_j | \mathbi{s}_{j-1} ,y_{j-1},\mathbi{C}} ) \funp{P} (y_j | \seq{{y}}_{<j},\seq{{x}}) = \funp{P} ( {y_j | \mathbi{s}_{j-1} ,y_{j-1},\mathbi{C}} )
\label{eq:10-4} \label{eq:10-4}
\end{eqnarray} \end{eqnarray}
$\funp{P}({y_j | \mathbi{s}_{j-1} ,y_{j-1},\mathbi{C}})$由Softmax实现,Softmax的输入是循环神经网络$j$时刻的输出。在具体实现时,$\mathbi{C}$可以被简单地作为第一个时刻循环单元的输入,即,当$j=1$ 时,解码器的循环神经网络会读入编码器最后一个隐层状态$ \mathbi{h}_m$(也就是$\mathbi{C}$),而其他时刻的隐层状态不直接与$\mathbi{C}$相关。最终,$\funp{P} (y_j | \seq{{y}}_{<j},\seq{{x}})$ 被表示为: $\funp{P}({y_j | \mathbi{s}_{j-1} ,y_{j-1},\mathbi{C}})$由Softmax实现,Softmax的输入是循环神经网络$j$时刻的输出。在具体实现时,$\mathbi{C}$可以被简单地作为第一个时刻循环单元的输入,即,当$j=1$ 时,解码器的循环神经网络会读入编码器最后一个隐层状态$ \mathbi{h}_m$(也就是$\mathbi{C}$),而其他时刻的隐层状态不直接与$\mathbi{C}$相关。最终,$\funp{P} (y_j | \seq{{y}}_{<j},\seq{{x}})$ 被表示为:
\begin{eqnarray} \begin{eqnarray}
\funp{P} (y_j | \seq{{y}}_{<j},\seq{{x}}) \equiv \funp{P} (y_j | \seq{{y}}_{<j},\seq{{x}}) =
\left \{ \begin{array}{ll} \left \{ \begin{array}{ll}
\funp{P} (y_j |\mathbi{C} ,y_{j-1}) &j=1 \\ \funp{P} (y_j |\mathbi{C} ,y_{j-1}) &j=1 \\
\funp{P} (y_j|\mathbi{s}_{j-1},y_{j-1}) \quad &j>1 \funp{P} (y_j|\mathbi{s}_{j-1},y_{j-1}) \quad &j>1
...@@ -508,7 +508,7 @@ $\funp{P}({y_j | \mathbi{s}_{j-1} ,y_{j-1},\mathbi{C}})$由Softmax实现,Softm ...@@ -508,7 +508,7 @@ $\funp{P}({y_j | \mathbi{s}_{j-1} ,y_{j-1},\mathbi{C}})$由Softmax实现,Softm
\subsection{长短时记忆网络} \subsection{长短时记忆网络}
\label{sec:lstm-cell} \label{sec:lstm-cell}
\parinterval RNN结构使得当前时刻循环单元的状态包含了之前时间步的状态信息。但是这种对历史信息的记忆并不是无损的,随着序列变长,RNN的记忆信息的损失越来越严重。在很多长序列处理任务中(如长文本生成)都观测到了类似现象。对于这个问题,研究者提出了{\small\bfnew{长短时记忆}}\index{长短时记忆}(Long Short-term Memory)\index{Long Short-term Memory,LSTM}模型,也就是常说的LSTM模型\upcite{HochreiterLong} \parinterval RNN结构使得当前时刻循环单元的状态包含了之前时间步的状态信息。但是这种对历史信息的记忆并不是无损的,随着序列变长,RNN的记忆信息的损失越来越严重。在很多长序列处理任务中(如长文本生成)都观测到了类似现象。对于这个问题,研究者提出了{\small\bfnew{长短时记忆}}\index{长短时记忆}(Long Short-term Memory)\index{Long Short-term Memory,LSTM}模型,也就是常说的LSTM模型\upcite{HochreiterLong}
\parinterval LSTM模型是RNN模型的一种改进。相比RNN仅传递前一时刻的状态$\mathbi{h}_{t-1}$,LSTM会同时传递两部分信息:状态信息$\mathbi{h}_{t-1}$和记忆信息$\mathbi{c}_{t-1}$。这里,$\mathbi{c}_{t-1}$是新引入的变量,它也是循环单元的一部分,用于显性地记录需要记录的历史内容,$\mathbi{h}_{t-1}$$\mathbi{c}_{t-1}$在循环单元中会相互作用。LSTM通过“门”单元来动态地选择遗忘多少以前的信息和记忆多少当前的信息。LSTM中所使用的门单元结构如图\ref{fig:10-15}所示,包括遗忘门,输入门和输出门。图中$\sigma$代表Sigmoid函数,它将函数输入映射为0-1范围内的实数,用来充当门控信号。 \parinterval LSTM模型是RNN模型的一种改进。相比RNN仅传递前一时刻的状态$\mathbi{h}_{t-1}$,LSTM会同时传递两部分信息:状态信息$\mathbi{h}_{t-1}$和记忆信息$\mathbi{c}_{t-1}$。这里,$\mathbi{c}_{t-1}$是新引入的变量,它也是循环单元的一部分,用于显性地记录需要记录的历史内容,$\mathbi{h}_{t-1}$$\mathbi{c}_{t-1}$在循环单元中会相互作用。LSTM通过“门”单元来动态地选择遗忘多少以前的信息和记忆多少当前的信息。LSTM中所使用的门单元结构如图\ref{fig:10-15}所示,包括遗忘门,输入门和输出门。图中$\sigma$代表Sigmoid函数,它将函数输入映射为0-1范围内的实数,用来充当门控信号。
...@@ -1172,7 +1172,7 @@ L(\mathbi{Y},\widehat{\mathbi{Y}}) = \sum_{j=1}^n L_{\textrm{ce}}(\mathbi{y}_j,\ ...@@ -1172,7 +1172,7 @@ L(\mathbi{Y},\widehat{\mathbi{Y}}) = \sum_{j=1}^n L_{\textrm{ce}}(\mathbi{y}_j,\
\vspace{0.2em} \vspace{0.2em}
\parinterval 解码端的每一步Softmax层会输出所有单词的概率,由于是基于贪心的方法,这里会选择概率最大(top-1)的单词作为输出。这个过程可以参考图\ref{fig:10-33}的内容。选择分布中概率最大的单词“Have”作为得到的第一个单词,并再次送入解码器,作为第二步的输入同时预测下一个单词。以此类推,直到生成句子的终止符为止,就得到了完整的译文。 \parinterval 解码端的每一步Softmax层会输出所有单词的概率,由于是基于贪心的方法,这里会选择概率最大(top-1)的单词作为输出。这个过程可以参考图\ref{fig:10-33}的内容。选择分布中概率最大的单词“Have”作为得到的第一个单词,并再次送入解码器,作为第二步的输入同时预测下一个单词。以此类推,直到生成句子的终止符为止,就得到了完整的译文。
\parinterval 贪婪搜索的优点在于速度快。在对翻译速度有较高要求的场景中,贪婪搜索是一种十分有效的系统加速方法。而且贪婪搜索的原理非常简单,易于快速原型。不过,由于每一步只保留一个最好的局部结果,贪婪搜索往往会带来翻译品质上的损失。 \parinterval 贪婪搜索的优点在于速度快。在对翻译速度有较高要求的场景中,贪婪搜索是一种十分有效的系统加速方法。而且贪婪搜索的原理非常简单,易于快速实现。不过,由于每一步只保留一个最好的局部结果,贪婪搜索往往会带来翻译品质上的损失。
%---------------------------------------------- %----------------------------------------------
\begin{figure}[htp] \begin{figure}[htp]
......
...@@ -2,29 +2,32 @@ ...@@ -2,29 +2,32 @@
\begin{tikzpicture}[node distance = 0cm] \begin{tikzpicture}[node distance = 0cm]
\node(num1)[num,fill=red!10]{0}; \node(num1)[num,fill=red!10]{1};
\node(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]{0}; \node(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]{5};
\node(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]{0}; \node(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]{0};
\node(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]{0}; \node(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]{6};
\node(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]{1};
\node(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]{3}; \node(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]{4};
\node(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]{3}; \node(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]{7};
\node(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]{1}; \node(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]{5};
\node(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]{7}; \node(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]{8};
\node(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]{7};
\node(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]{6}; \node(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]{3};
\node(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]{8}; \node(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]{1};
\node(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]{3}; \node(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]{2};
\node(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]{2};
\node(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]{1};
\node(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]{3}; \node(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]{3};
\node(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]{2}; \node(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]{0};
\node(num16)[num,below of = num10,yshift= -0.6cm,fill=blue!10]{4}; \node(num16)[num,below of = num10,yshift= -0.6cm,fill=blue!10]{4};
\draw[->,thick]([xshift=0.4cm,yshift=-0.4cm]num8.east)--([xshift=1.5cm,yshift=-0.4cm]num8.east); \draw[->,thick]([xshift=0.4cm,yshift=-0.4cm]num8.east)--([xshift=1.5cm,yshift=-0.4cm]num8.east);
\node(num17)[num,right of = num8,xshift= 2.5cm,fill=red!10]{0}; \node(num17)[num,right of = num8,xshift= 2.5cm,fill=red!10]{3};
\node(num18)[num,right of = num17,xshift= 0.6cm,fill=green!10]{2}; \node(num18)[num,right of = num17,xshift= 0.6cm,fill=green!10]{6};
\node(num19)[num,below of = num17,yshift=-0.6cm,fill=yellow!10]{7}; \node(num19)[num,below of = num17,yshift=-0.6cm,fill=yellow!10]{2};
\node(num20)[num,below of = num18,yshift= -0.6cm,fill=blue!10]{3}; \node(num20)[num,below of = num18,yshift= -0.6cm,fill=blue!10]{2};
\node [right of = num2,xshift= -0.7cm]{}; \node [right of = num2,xshift= -0.7cm]{};
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
\node [draw=ugreen!30,rectangle,inner ysep=5pt,inner xsep=1.8em,rounded corners=4pt,line width=2pt,fill=ugreen!10] [fit = (tgt_1) (i_0)(tgt_2)(i_5) ] (group1_2) {}; \node [draw=ugreen!30,rectangle,inner ysep=5pt,inner xsep=1.8em,rounded corners=4pt,line width=2pt,fill=ugreen!10] [fit = (tgt_1) (i_0)(tgt_2)(i_5) ] (group1_2) {};
\end{pgfonlayer} \end{pgfonlayer}
\node[anchor=east, word] (l_0) at ([xshift=-2em,yshift=-0.5em]i_0.west){\sffamily\bfnew{词嵌入}}; \node[anchor=east, word] (l_0) at ([xshift=-2em,yshift=-0.5em]i_0.west){\sffamily\bfnew{目标语词嵌入}};
\node[anchor=south, word] (l_1) at ([yshift=2em]l_0.north){\sffamily\bfnew{卷积}}; \node[anchor=south, word] (l_1) at ([yshift=2em]l_0.north){\sffamily\bfnew{卷积}};
\node[anchor=south, word] (l_2) at ([yshift=2.4em]l_1.north){\sffamily\bfnew{门控}}; \node[anchor=south, word] (l_2) at ([yshift=2.4em]l_1.north){\sffamily\bfnew{门控}};
\node[anchor=south, word] (l_3) at ([yshift=0.06em]l_2.north){\sffamily\bfnew{线性单元}}; \node[anchor=south, word] (l_3) at ([yshift=0.06em]l_2.north){\sffamily\bfnew{线性单元}};
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
\node[anchor=south,word] (src_2) at ([xshift=2em,yshift=0.4em]r_2.north){$<$p$>$}; \node[anchor=south,word] (src_2) at ([xshift=2em,yshift=0.4em]r_2.north){$<$p$>$};
\node[anchor=east, word] (t_1) at ([xshift=-4em,yshift=0.5em]r_0.west){\sffamily\bfnew{词嵌入}}; \node[anchor=east, word] (t_1) at ([xshift=-4em,yshift=0.5em]r_0.west){\sffamily\bfnew{源语词嵌入}};
\node[anchor=north, word] (t_2) at ([yshift=-2em]t_1.south){\sffamily\bfnew{卷积}}; \node[anchor=north, word] (t_2) at ([yshift=-2em]t_1.south){\sffamily\bfnew{卷积}};
\node[anchor=north, word] (t_3) at ([yshift=-2.8em]t_2.south){\sffamily\bfnew{门控}}; \node[anchor=north, word] (t_3) at ([yshift=-2.8em]t_2.south){\sffamily\bfnew{门控}};
\node[anchor=north, word] (t_4) at ([yshift=-0.06em]t_3.south){\sffamily\bfnew{线性单元}}; \node[anchor=north, word] (t_4) at ([yshift=-0.06em]t_3.south){\sffamily\bfnew{线性单元}};
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
\node[anchor=north,word] at ([yshift=-0.4em]i_4.south){to}; \node[anchor=north,word] at ([yshift=-0.4em]i_4.south){to};
\node[anchor=north,word] at ([yshift=-0.4em]i_5.south){school}; \node[anchor=north,word] at ([yshift=-0.4em]i_5.south){school};
\node[anchor=east, word] (l_0) at ([xshift=-2em,yshift=-0.5em]i_0.west){\sffamily\bfnew{词嵌入}}; \node[anchor=east, word] (l_0) at ([xshift=-2em,yshift=-0.5em]i_0.west){\sffamily\bfnew{目标语词嵌入}};
\node[anchor=south, word] (l_1) at ([yshift=2em]l_0.north){\sffamily\bfnew{卷积}}; \node[anchor=south, word] (l_1) at ([yshift=2em]l_0.north){\sffamily\bfnew{卷积}};
\node[anchor=south, word] (l_2) at ([yshift=2.4em]l_1.north){\sffamily\bfnew{门控}}; \node[anchor=south, word] (l_2) at ([yshift=2.4em]l_1.north){\sffamily\bfnew{门控}};
\node[anchor=south, word] (l_3) at ([yshift=0.06em]l_2.north){\sffamily\bfnew{线性单元}}; \node[anchor=south, word] (l_3) at ([yshift=0.06em]l_2.north){\sffamily\bfnew{线性单元}};
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
\node[anchor=south,word] (src_2) at ([xshift=2em,yshift=0.4em]r_2.north){$<$p$>$}; \node[anchor=south,word] (src_2) at ([xshift=2em,yshift=0.4em]r_2.north){$<$p$>$};
\node[anchor=east, word] (t_1) at ([xshift=-4em,yshift=0.5em]r_0.west){\sffamily\bfnew{词嵌入}}; \node[anchor=east, word] (t_1) at ([xshift=-4em,yshift=0.5em]r_0.west){\sffamily\bfnew{源语词嵌入}};
\node[anchor=north, word] (t_2) at ([yshift=-2em]t_1.south){\sffamily\bfnew{卷积}}; \node[anchor=north, word] (t_2) at ([yshift=-2em]t_1.south){\sffamily\bfnew{卷积}};
\node[anchor=north, word] (t_3) at ([yshift=-2.8em]t_2.south){\sffamily\bfnew{门控}}; \node[anchor=north, word] (t_3) at ([yshift=-2.8em]t_2.south){\sffamily\bfnew{门控}};
\node[anchor=north, word] (t_4) at ([yshift=-0.06em]t_3.south){\sffamily\bfnew{线性单元}}; \node[anchor=north, word] (t_4) at ([yshift=-0.06em]t_3.south){\sffamily\bfnew{线性单元}};
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
\node[anchor=north,word] at ([yshift=-0.4em]i_4.south){to}; \node[anchor=north,word] at ([yshift=-0.4em]i_4.south){to};
\node[anchor=north,word] at ([yshift=-0.4em]i_5.south){school}; \node[anchor=north,word] at ([yshift=-0.4em]i_5.south){school};
\node[anchor=east, word] (l_0) at ([xshift=-2em,yshift=-0.5em]i_0.west){\sffamily\bfnew{词嵌入}}; \node[anchor=east, word] (l_0) at ([xshift=-2em,yshift=-0.5em]i_0.west){\sffamily\bfnew{目标语词嵌入}};
\node[anchor=south, word] (l_1) at ([yshift=2em]l_0.north){\sffamily\bfnew{卷积}}; \node[anchor=south, word] (l_1) at ([yshift=2em]l_0.north){\sffamily\bfnew{卷积}};
\node[anchor=south, word] (l_2) at ([yshift=2.4em]l_1.north){\sffamily\bfnew{门控}}; \node[anchor=south, word] (l_2) at ([yshift=2.4em]l_1.north){\sffamily\bfnew{门控}};
\node[anchor=south, word] (l_3) at ([yshift=0.06em]l_2.north){\sffamily\bfnew{线性单元}}; \node[anchor=south, word] (l_3) at ([yshift=0.06em]l_2.north){\sffamily\bfnew{线性单元}};
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
\node[anchor=south,word] (src_2) at ([xshift=2em,yshift=0.4em]r_2.north){$<$p$>$}; \node[anchor=south,word] (src_2) at ([xshift=2em,yshift=0.4em]r_2.north){$<$p$>$};
\node[anchor=east, word] (t_1) at ([xshift=-4em,yshift=0.5em]r_0.west){\sffamily\bfnew{词嵌入}}; \node[anchor=east, word] (t_1) at ([xshift=-4em,yshift=0.5em]r_0.west){\sffamily\bfnew{源语词嵌入}};
\node[anchor=north, word] (t_2) at ([yshift=-2em]t_1.south){\sffamily\bfnew{卷积}}; \node[anchor=north, word] (t_2) at ([yshift=-2em]t_1.south){\sffamily\bfnew{卷积}};
\node[anchor=north, word] (t_3) at ([yshift=-2.8em]t_2.south){\sffamily\bfnew{门控}}; \node[anchor=north, word] (t_3) at ([yshift=-2.8em]t_2.south){\sffamily\bfnew{门控}};
\node[anchor=north, word] (t_4) at ([yshift=-0.06em]t_3.south){\sffamily\bfnew{线性单元}}; \node[anchor=north, word] (t_4) at ([yshift=-0.06em]t_3.south){\sffamily\bfnew{线性单元}};
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
\node[data,inner sep=2pt,fill=cyan!40] at (14.4em,2.4em) {19}; \node[data,inner sep=2pt,fill=cyan!40] at (14.4em,2.4em) {19};
\node[data,inner sep=2pt] at (16em,2.4em) {25}; \node[data,inner sep=2pt] at (16em,2.4em) {25};
\node[font=\footnotesize] (in) at (1.6em,4.8em) {输入}; \node[font=\footnotesize] (in) at (1.6em,-1.8em) {输入:$3\times 3$};
\node[font=\footnotesize] at (8.8em,4.8em) {卷积核}; \node[font=\footnotesize] at (8.8em,-1.8em) {卷积核:$2\times 2$};
\node[font=\footnotesize] (out) at (15.2em,4.8em) {输出}; \node[font=\footnotesize] (out) at (15.2em,-1.8em) {输出:$2\times 2$};
%\node[font=\footnotesize,dashed,draw=cyan,very thick,fill=cyan!5,align=center] at ([yshift=-0.3cm,xshift=1.8cm]out.east) {*\ \ :表示\\卷积计算}; %\node[font=\footnotesize,dashed,draw=cyan,very thick,fill=cyan!5,align=center] at ([yshift=-0.3cm,xshift=1.8cm]out.east) {*\ \ :表示\\卷积计算};
%\node[] at ([yshift=-0.3cm,xshift=-2.3cm]in.east) {\ \ \ \ \ }; %\node[] at ([yshift=-0.3cm,xshift=-2.3cm]in.east) {\ \ \ \ \ };
......
...@@ -4,16 +4,19 @@ ...@@ -4,16 +4,19 @@
\begin{tikzpicture}[node distance = 0cm] \begin{tikzpicture}[node distance = 0cm]
\node(num1)[num,fill=red!10]{1}; \node(num1)[num,fill=red!10]{1};
\node(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]{5}; \node(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]{5};
\node(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]{1}; \node(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]{0};
\node(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]{6}; \node(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]{6};
\node(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]{2};
\node(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]{4};
\node(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]{7}; \node(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]{7};
\node(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]{4}; \node(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]{5};
\node(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]{8}; \node(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]{8};
\node(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]{3}; \node(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]{3};
\node(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]{1}; \node(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]{1};
\node(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]{2}; \node(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]{2};
\node(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]{2}; \node(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]{2};
\node(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]{1}; \node(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]{1};
\node(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]{3}; \node(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]{3};
\node(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]{0}; \node(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]{0};
......
...@@ -20,38 +20,42 @@ ...@@ -20,38 +20,42 @@
\draw[red!60,line width=2pt] (0cm,0cm+7*\bcc) rectangle (0cm+6*\bcc,0cm+9*\bcc); \draw[red!60,line width=2pt] (0cm,0cm+7*\bcc) rectangle (0cm+6*\bcc,0cm+9*\bcc);
% 特征图 % 特征图
\draw[fill=blue!8,xshift=5.0cm,yshift=1.3cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+6*\bcc); \draw[fill=blue!8,xshift=5.0cm,yshift=1.3cm,line width=0.6pt] (0cm,0cm-1*\bcc) rectangle (0cm+1*\bcc,0cm+6*\bcc);
\draw[step=\bcc,gray,xshift=5.0cm,yshift=1.3cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+6*\bcc); \draw[step=\bcc,gray,xshift=5.0cm,yshift=1.3cm] (0cm,0cm-1*\bcc) grid (0cm+1*\bcc,0cm+6*\bcc);
\draw[ugreen!60,line width=2pt,xshift=5.0cm,yshift=1.3cm] (0cm,0cm+2*\bcc) rectangle (0cm+1*\bcc,0cm+3*\bcc); \draw[ugreen!60,line width=2pt,xshift=5.0cm,yshift=1.3cm] (0cm,0cm+2*\bcc) rectangle (0cm+1*\bcc,0cm+3*\bcc);
\draw [gray,fill=blue!8,line width=0.6pt](8cm,2.6cm) -- (8.4cm, 2.6cm) -- (9cm,1cm) -- (8.6cm, 1cm) -- (8cm,2.6cm); %最大池化
\draw [gray](8.15cm,2.2cm) -- (8.55cm,2.2cm); \draw [gray,fill=blue!8,line width=0.6pt](8cm,2.2cm) -- (8.4cm, 2.2cm) -- (8.7cm,1.4cm) -- (8.3cm, 1.4cm) -- (8cm,2.2cm);
\draw [gray](8.3cm,1.8cm) -- (8.7cm,1.8cm); \draw [gray](8.15cm,1.8cm) -- (8.55cm,1.8cm);
\draw [gray](8.45cm,1.4cm) -- (8.85cm,1.4cm); %\draw [gray](8.3cm,1.8cm) -- (8.7cm,1.8cm);
%\draw [gray](8.45cm,1.4cm) -- (8.85cm,1.4cm);
\draw [gray,fill=blue!8,line width=0.6pt](11cm,2.2cm) -- (11.4cm, 2.2cm) -- (11.7cm,1.4cm) -- (11.3cm, 1.4cm) -- (11cm,2.2cm); %全连接层
\draw [gray](11.15cm,1.8cm) -- (11.55cm,1.8cm); \draw [gray,fill=blue!8,line width=0.6pt](11cm,2.2cm) -- (11.4cm, 2.2cm) -- (11.7cm,1.8cm) -- (11.3cm, 1.8cm) -- (11cm,2.2cm);
%\draw [gray](11.15cm,1.8cm) -- (11.55cm,1.8cm);
\draw[ugreen!60,line] ([xshift=5.0cm,yshift=1.3cm]0cm+1*\bcc,0cm+6*\bcc) -- (8cm,2.6cm); %最大池化
\draw[ugreen!60,line] ([xshift=5.0cm,yshift=1.3cm]0cm+1*\bcc,0cm) -- (8.15cm,2.2cm); \draw[ugreen!60,line] ([xshift=5.0cm,yshift=1.3cm]0cm+1*\bcc,0cm+6*\bcc) -- (8cm,2.2cm);
\draw[ugreen!60,line] ([xshift=5.0cm,yshift=1.3cm]0cm+1*\bcc,0cm-1*\bcc) -- (8.15cm,1.8cm);
\draw[fill=blue!8,xshift=5.2cm,yshift=1.0cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+6*\bcc);
\draw[step=\bcc,gray,xshift=5.2cm,yshift=1.0cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+6*\bcc); %特征图
%\draw[fill=blue!8,xshift=5.2cm,yshift=1.0cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+6*\bcc);
%\draw[step=\bcc,gray,xshift=5.2cm,yshift=1.0cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+6*\bcc);
\draw[fill=blue!8,xshift=5.4cm,yshift=0.3cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+7*\bcc); %\draw[fill=blue!8,xshift=5.4cm,yshift=0.3cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+7*\bcc);
\draw[step=\bcc,gray,xshift=5.4cm,yshift=0.3cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+7*\bcc); %\draw[step=\bcc,gray,xshift=5.4cm,yshift=0.3cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+7*\bcc);
\draw[fill=blue!8,xshift=5.6cm,yshift=0cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+7*\bcc); \draw[fill=blue!8,xshift=5.6cm,yshift=0cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+8*\bcc);
\draw[step=\bcc,gray,xshift=5.6cm,yshift=0cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+7*\bcc); \draw[step=\bcc,gray,xshift=5.6cm,yshift=0cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+8*\bcc);
\draw[red!60,line width=2pt,xshift=5.6cm,yshift=0cm] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+1*\bcc); \draw[red!60,line width=2pt,xshift=5.6cm,yshift=0cm] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+1*\bcc);
\draw[red!60,line width=2pt,xshift=5.6cm,yshift=0cm] (0cm,0cm+2*\bcc) rectangle (0cm+1*\bcc,0cm+3*\bcc); \draw[red!60,line width=2pt,xshift=5.6cm,yshift=0cm] (0cm,0cm+7*\bcc) rectangle (0cm+1*\bcc,0cm+8*\bcc);
\draw[red!60,line width=2pt,xshift=5.6cm,yshift=0cm] (0cm,0cm+6*\bcc) rectangle (0cm+1*\bcc,0cm+7*\bcc);
\draw[line] (8.4cm, 2.6cm) -- (11cm,2.2cm); % 全连接线
\draw[line] (9cm,1cm) -- (11.3cm, 1.4cm); \draw[line] (8.4cm, 2.2cm) -- (11.2cm,2.2cm);
\draw[line] (8.7cm,1.4cm) -- (11.3cm, 1.8cm);
\draw[red!60,line] ([xshift=5.6cm,yshift=0cm]0cm+1*\bcc,0cm+7*\bcc) -- (8.45cm,1.4cm); \draw[red!60,line] ([xshift=5.6cm,yshift=0cm]0cm+1*\bcc,0cm+7*\bcc) -- (8.15cm,1.8cm);
\draw[red!60,line] ([xshift=5.6cm,yshift=0cm]0cm+1*\bcc,0cm) -- (8.6cm, 1cm); \draw[red!60,line] ([xshift=5.6cm,yshift=0cm]0cm+1*\bcc,0cm) -- (8.25cm, 1.4cm);
\draw[red!60,line] (0cm+6*\bcc,0cm+9*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+7*\bcc); \draw[red!60,line] (0cm+6*\bcc,0cm+9*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+7*\bcc);
\draw[red!60,line] (0cm+6*\bcc,0cm+7*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+6*\bcc); \draw[red!60,line] (0cm+6*\bcc,0cm+7*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+6*\bcc);
...@@ -59,8 +63,8 @@ ...@@ -59,8 +63,8 @@
\draw[red!60,line] (0cm+6*\bcc,0cm) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm); \draw[red!60,line] (0cm+6*\bcc,0cm) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm);
\draw[ugreen!60,line] (0cm+6*\bcc,0cm+6*\bcc) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+3*\bcc); \draw[ugreen!60,line] (0cm+6*\bcc,0cm+6*\bcc) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+3*\bcc);
\draw[ugreen!60,line] (0cm+6*\bcc,0cm+3*\bcc) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+2*\bcc); \draw[ugreen!60,line] (0cm+6*\bcc,0cm+3*\bcc) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+2*\bcc);
\draw[red!60,line] ([xshift=0.3cm,yshift=0.5cm]0cm+6*\bcc,0cm+4*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+3*\bcc); %\draw[red!60,line] ([xshift=0.3cm,yshift=0.5cm]0cm+6*\bcc,0cm+4*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+3*\bcc);
\draw[red!60,line] ([xshift=0.3cm,yshift=0.5cm]0cm+6*\bcc,0cm+2*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+2*\bcc); %\draw[red!60,line] ([xshift=0.3cm,yshift=0.5cm]0cm+6*\bcc,0cm+2*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+2*\bcc);
\node[word] (w1) at (-0.5cm, 3.4cm) {wait}; \node[word] (w1) at (-0.5cm, 3.4cm) {wait};
\node[word] (w2) at ([yshift=-\bcc]w1) {for}; \node[word] (w2) at ([yshift=-\bcc]w1) {for};
...@@ -76,7 +80,7 @@ ...@@ -76,7 +80,7 @@
\node[draw,rectangle callout,callout relative pointer={(0.1,-0.5)}] at (5cm,4.6cm) {\textrm{特征图}}; \node[draw,rectangle callout,callout relative pointer={(0.1,-0.5)}] at (5cm,4.6cm) {\textrm{特征图}};
\draw [thick] (0cm, -0.3cm) -- (0cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{维度大小为 $m \times K$ \\ 的静态与非静态通道\\的句子表示} (2.4cm,-0.5cm) -- (2.4cm, -0.3cm); \draw [thick] (0cm, -0.3cm) -- (0cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{维度大小为 $m \times O$ \\ 的句子表示} (2.4cm,-0.5cm) -- (2.4cm, -0.3cm);
\draw [thick] (3.6cm, -0.3cm) -- (3.6cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{具有多个不同大小\\的卷积核和特征图\\的卷积层} (6cm,-0.5cm) -- (6cm, -0.3cm); \draw [thick] (3.6cm, -0.3cm) -- (3.6cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{具有多个不同大小\\的卷积核和特征图\\的卷积层} (6cm,-0.5cm) -- (6cm, -0.3cm);
\draw [thick] (7.2cm, -0.3cm) -- (7.2cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{最大池化} (9cm,-0.5cm) -- (9cm, -0.3cm); \draw [thick] (7.2cm, -0.3cm) -- (7.2cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{最大池化} (9cm,-0.5cm) -- (9cm, -0.3cm);
\draw [thick] (10cm, -0.3cm) -- (10cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{带有Dropout\\和Softmax输出\\的全连接层} (11.7cm,-0.5cm) -- (11.7cm, -0.3cm); \draw [thick] (10cm, -0.3cm) -- (10cm, -0.5cm) -- node[font=\tiny, align=center,yshift=-0.5cm]{带有Dropout\\和Softmax输出\\的全连接层} (11.7cm,-0.5cm) -- (11.7cm, -0.3cm);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
\section{卷积神经网络} \section{卷积神经网络}
\parinterval {\small\bfnew{卷积神经网络}}\index{卷积神经网络}(Convolutional Neural Network,CNN)\index{Convolutional Neural Network,CNN} 是一种前馈神经网络,由若干的卷积层与池化层组成。早期,卷积神经网络被应用在语音识别任务上\upcite{Waibel1989PhonemeRU},之后在图像处理领域取得了很好的效果\upcite{LeCun1989BackpropagationAT,726791}。近年来,卷积神经网络已经成为语音、自然语言文字、图像处理任务的基础框架\upcite{DBLP:conf/icassp/ZhangCJ17,DBLP:conf/icassp/DengAY13,Kalchbrenner2014ACN,Kim2014ConvolutionalNN,DBLP:journals/corr/HeZRS15,DBLP:conf/cvpr/HuangLMW17,Girshick2015FastR,He2020MaskR}。在自然语言处理领域,卷积神经网络已经得到广泛应用,在文本分类\upcite{Kalchbrenner2014ACN,Kim2014ConvolutionalNN,Ma2015DependencybasedCN}、情感分析\upcite{Santos2014DeepCN,}、语言建模\upcite{DBLP:conf/acl/WangLLJL15,Dauphin2017LanguageMW}、机器翻译\upcite{devlin-etal-2014-fast,kalchbrenner-blunsom-2013-recurrent,Gehring2017ACE,DBLP:journals/corr/GehringAGYD17,Kaiser2018DepthwiseSC,Wu2019PayLA}等任务中取得不错的成绩。 \parinterval {\small\bfnew{卷积神经网络}}\index{卷积神经网络}(Convolutional Neural Network,CNN)\index{Convolutional Neural Network,CNN} 是一种前馈神经网络,由若干的卷积层与池化层组成。早期,卷积神经网络被应用在语音识别任务上\upcite{Waibel1989PhonemeRU},之后在图像处理领域取得了很好的效果\upcite{LeCun1989BackpropagationAT,726791}。近年来,卷积神经网络已经成为语音、自然语言处理、图像处理任务的基础框架\upcite{DBLP:conf/icassp/ZhangCJ17,DBLP:conf/icassp/DengAY13,Kalchbrenner2014ACN,Kim2014ConvolutionalNN,DBLP:journals/corr/HeZRS15,DBLP:conf/cvpr/HuangLMW17,Girshick2015FastR,He2020MaskR}。在自然语言处理领域,卷积神经网络已经得到广泛应用,在文本分类\upcite{Kalchbrenner2014ACN,Kim2014ConvolutionalNN,Ma2015DependencybasedCN}、情感分析\upcite{Santos2014DeepCN,}、语言建模\upcite{DBLP:conf/acl/WangLLJL15,Dauphin2017LanguageMW}、机器翻译\upcite{devlin-etal-2014-fast,kalchbrenner-blunsom-2013-recurrent,Gehring2017ACE,DBLP:journals/corr/GehringAGYD17,Kaiser2018DepthwiseSC,Wu2019PayLA}等任务中取得不错的成绩。
\parinterval\ref{fig:11-1}展示了全连接层和卷积层的结构对比,可以看到在全连接层中,模型考虑了所有的输入,层输出中的每一个元素都依赖于所有输入。这种全连接层适用于大多数任务,但是当处理图像这种网格数据的时候,规模过大的数据会导致模型参数量过大,难以处理。其次,在一些网格数据中,通常具有局部不变性的特征,比如图像中不同位置的相同物体,语言序列中相同的$n$-gram等。而全连接网络很难提取这些局部不变性特征。为此,一些研究人员提出使用卷积层来替换全连接层\upcite{DBLP:conf/eccv/LiuAESRFB16,DBLP:journals/pami/RenHG017} \parinterval\ref{fig:11-1}展示了全连接层和卷积层的结构对比,可以看到在全连接层中,模型考虑了所有的输入,层输出中的每一个元素都依赖于所有输入。这种全连接层适用于大多数任务,但是当处理图像这种网格数据的时候,规模过大的数据会导致模型参数量过大,难以处理。其次,在一些网格数据中,通常具有局部不变性的特征,比如图像中不同位置的相同物体,语言序列中相同的$n$-gram等。而全连接网络很难提取这些局部不变性特征。为此,一些研究人员提出使用卷积层来替换全连接层\upcite{DBLP:conf/eccv/LiuAESRFB16,DBLP:journals/pami/RenHG017}
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
\parinterval 卷积操作作为卷积神经网络的核心部分,其本质是一种特殊的线性运算。区别于全连接的方式,卷积使用一系列{\small\bfnew{卷积核}}\index{卷积核}(Convolution Kernel,也叫滤波器)\index{Convolution Kernel}\index{滤波器} 对局部输入数据进行特征提取,然后通过在输入数据空间维度上移动卷积核来获取所有位置的特征信息。卷积的输入可以是任意维度形式的数据。由于其在图像处理领域应用最为广泛,这里以二维图像为例对卷积核和卷积操作进行简单介绍。 \parinterval 卷积操作作为卷积神经网络的核心部分,其本质是一种特殊的线性运算。区别于全连接的方式,卷积使用一系列{\small\bfnew{卷积核}}\index{卷积核}(Convolution Kernel,也叫滤波器)\index{Convolution Kernel}\index{滤波器} 对局部输入数据进行特征提取,然后通过在输入数据空间维度上移动卷积核来获取所有位置的特征信息。卷积的输入可以是任意维度形式的数据。由于其在图像处理领域应用最为广泛,这里以二维图像为例对卷积核和卷积操作进行简单介绍。
\parinterval 在图像卷积中,卷积核是一组$Q \times U \times O$的参数(如图\ref{fig:11-3})。其中$Q$$U$表示卷积核窗口的宽度与长度,分别对应图像中的长和宽两个维度,$Q \times U$决定了该卷积核窗口的大小。$O$是该卷积核的深度,它的取值和输入数据通道数保持一致。在这里,通道可以看作图像不同的特征,比如灰色图像只有灰度信息,通道数为1;而RGB格式的图像有3个通道,分别对应红绿蓝三种颜色信息。 \parinterval 在图像卷积中,卷积核是一组$Q \times U \times O$的参数(如图\ref{fig:11-3})。其中$Q$$U$表示卷积核窗口的宽度与长度,分别对应图像中的宽和长两个维度,$Q \times U$决定了该卷积核窗口的大小。$O$是该卷积核的深度,它的取值和输入数据通道数保持一致。在这里,通道可以看作图像不同的特征,比如灰色图像只有灰度信息,通道数为1;而RGB格式的图像有3个通道,分别对应红绿蓝三种颜色信息。
%---------------------------------------------- %----------------------------------------------
% 图3. % 图3.
...@@ -87,24 +87,24 @@ ...@@ -87,24 +87,24 @@
\parinterval 在卷积计算中,不同深度下卷积核不同但是执行操作相同,这里以二维卷积核为例展示具体卷积计算。若设输入矩阵为$\mathbi{x}$,输出矩阵为$\mathbi{y}$,卷积滑动步幅为$\textrm{stride}$,卷积核为$\mathbi{w}$,且$\mathbi{w} \in \mathbb{R}^{Q \times U} $,那么卷积计算的公式为: \parinterval 在卷积计算中,不同深度下卷积核不同但是执行操作相同,这里以二维卷积核为例展示具体卷积计算。若设输入矩阵为$\mathbi{x}$,输出矩阵为$\mathbi{y}$,卷积滑动步幅为$\textrm{stride}$,卷积核为$\mathbi{w}$,且$\mathbi{w} \in \mathbb{R}^{Q \times U} $,那么卷积计算的公式为:
\begin{eqnarray} \begin{eqnarray}
\mathbi{y}_{i,j} = \sum_s \sum_t ( \mathbi{x}_{[j\times \textrm{stride}:j\times \textrm{stride}+U-1,i\times \textrm{stride}:i\times \textrm{stride}+Q-1]} \odot \mathbi{w} )_{s,t} \mathbi{y}_{i,j} = \sum \sum ( \mathbi{x}_{[j\times \textrm{stride}:j\times \textrm{stride}+U-1,i\times \textrm{stride}:i\times \textrm{stride}+Q-1]} \odot \mathbi{w} )
\label{eq:11-1-new} \label{eq:11-1-new}
\end{eqnarray} \end{eqnarray}
\noindent \ref{fig:11-4}展示了一个简单的卷积操作示例,卷积核大小为$2 \times 2 $,图像大小为$3 \times 3$,将卷积核在图像上依次进行滑动,滑动步幅为1,根据公式\eqref{eq:11-1-new},图中蓝色位置$\mathbi{y}_{0,0}$的计算为: \noindent 其中$i$是输出矩阵的行下标,$j$是输出矩阵的列下标。图\ref{fig:11-4}展示了一个简单的卷积操作示例,其中$Q$为2,$U$为2,$\textrm{stride}$为1,根据公式\eqref{eq:11-1-new},图中蓝色位置$\mathbi{y}_{0,0}$的计算为:
\begin{eqnarray} \begin{eqnarray}
\mathbi{y}_{0,0} &=& \sum_s \sum_t ( \mathbi{x}_{[0\times 1:0\times 1+2-1,0\times 1:0\times 1+2-1]} \odot \mathbi{w})_{s,t} \nonumber \\ \mathbi{y}_{0,0} &=& \sum \sum ( \mathbi{x}_{[0\times 1:0\times 1+2-1,0\times 1:0\times 1+2-1]} \odot \mathbi{w}) \nonumber \\
&=& \sum_s \sum_t ( \mathbi{x}_{[0:1,0:1]} \odot \mathbi{w} )_{s,t} \nonumber \\ &=& \sum \sum ( \mathbi{x}_{[0:1,0:1]} \odot \mathbi{w} ) \nonumber \\
&=& \sum_s \sum_t \begin{pmatrix} &=& \sum \sum \begin{pmatrix}
0\times 0 & 1\times1\\ 0\times 0 & 1\times1\\
3\times2 & 4\times3 3\times2 & 4\times3
\end{pmatrix}_{s,t} \nonumber \\ \end{pmatrix} \nonumber \\
&=& 0 \times 0 + 1 \times 1 + 3 \times 2 + 4 \times 3 \nonumber \\ &=& 0 \times 0 + 1 \times 1 + 3 \times 2 + 4 \times 3 \nonumber \\
&=& 19 &=& 19
\label{eq:11-2-new} \label{eq:11-2-new}
\end{eqnarray} \end{eqnarray}
\parinterval 在图像处理中,通过设计特定的卷积核来进行特征提取,比如图像边缘信息(图\ref{fig:11-5})。而在卷积神经网络中,只需要指定卷积层中卷积核的数量及大小,卷积核参数通过梯度下降等手段学习得到。这样可以让模型自己学习需要提取哪些特征 \parinterval 卷积计算的作用是提取特征,用不同的卷积核计算可以获取不同的特征,比如图\ref{fig:11-5},通过设计的特定卷积核就可以获取图像边缘信息。在卷积神经网络中,不需要手动设计卷积核,只需要指定卷积层中卷积核的数量及大小,模型就可以自己学习卷积核具体的参数
%---------------------------------------------- %----------------------------------------------
% 图4. % 图4.
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
\end{figure} \end{figure}
%---------------------------------------------- %----------------------------------------------
\parinterval 池化计算选取每个滑动窗口内最突出的值或平均值作为局部信息,压缩了卷积层输出的维度大小,有效地减少了神经网络的计算量,是卷积神经网络中必不可少的操作。在网络建模时,通常在较低层时会使用最大池化,仅保留特征中最显著的部分。而当网络更深时,特征信息都具有一定意义,此时包含的语义信息较多,选取平均池化方法更适合。 \parinterval 池化计算选取每个滑动窗口内最突出的值或平均值作为局部信息,压缩了卷积层输出的维度大小,有效地减少了神经网络的计算量,是卷积神经网络中必不可少的操作。在网络建模时,通常在较低层时会使用最大池化,仅保留特征中最显著的部分。而当网络更深时,特征信息都具有一定意义,比如在自然语言处理任务中,深层网络的特征向量包含的语义信息较多,选取平均池化方法更适合。
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
\subsection{面向序列的卷积操作} \subsection{面向序列的卷积操作}
\parinterval 对比于图像处理任务中二维图像数据,自然语言处理任务中主要处理一维序列,如单词序列。由于单词序列往往是不定长的,很难使用全连接网络处理它,因为变长序列无法用固定大小的全连接网络进行直接建模,而且过长的序列也会导致全连接网络参数量的极具增加。 \parinterval 对比于图像处理任务中二维图像数据,自然语言处理任务中主要处理一维序列,如单词序列。由于单词序列长度往往是不固定的,很难使用全连接网络处理它,因为变长序列无法用固定大小的全连接网络进行直接建模,而且过长的序列也会导致全连接网络参数量的急剧增加。
%---------------------------------------------- %----------------------------------------------
% 图9. % 图9.
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
\parinterval 针对不定长序列,一种可行的方法是使用之前介绍过的循环神经网络,其本质也是基于权重共享的想法,在不同的时间步复用相同的循环神经网络单元进行处理。但是,循环神经网络最大的弊端在于每一时刻的计算都依赖于上一时刻的结果,因此只能对序列进行串行处理,无法充分利用硬件设备进行并行计算,导致效率相对较低。此外,在处理较长的序列时,这种串行的方式很难捕捉长距离的依赖关系。相比之下,卷积神经网络采用共享参数的方式处理固定大小窗口内的信息,且不同位置的卷积操作之间没有相互依赖,因此可以对序列进行高效地并行处理。同时,针对序列中距离较长的依赖关系,可以通过堆叠多层卷积层来扩大{\small\bfnew{感受野}}\index{感受野} (Receptive Field)\index{Receptive Field} ,这里感受野指能够影响神经元输出的原始输入数据区域的大小。图\ref{fig:11-9}对比了这两种结构,可以看出,为了捕捉$\mathbi{e}_2$$\mathbi{e}_8$ 之间的联系,串行结构需要顺序的6次操作,和序列长度相关。而该卷积神经网络中,卷积操作每次对三个词进行计算,仅需要4层卷积计算就能得到$\mathbi{e}_2$$\mathbi{e}_8$之间的联系,其操作数和卷积核的大小相关,相比于串行的方式具有更短的路径和更少的非线性计算,更容易进行训练。因此,也有许多研究人员在许多自然语言处理任务上尝试使用卷积神经网络进行序列建模\upcite{Kim2014ConvolutionalNN,Santos2014DeepCN,Kalchbrenner2014ACN,DBLP:conf/naacl/Johnson015,DBLP:conf/naacl/NguyenG15} \parinterval 针对不定长序列,一种可行的方法是使用之前介绍过的循环神经网络,其本质也是基于权重共享的想法,在不同的时间步复用相同的循环神经网络单元进行处理。但是,循环神经网络最大的弊端在于每一时刻的计算都依赖于上一时刻的结果,因此只能对序列进行串行处理,无法充分利用硬件设备进行并行计算,导致效率相对较低。此外,在处理较长的序列时,这种串行的方式很难捕捉长距离的依赖关系。相比之下,卷积神经网络采用共享参数的方式处理固定大小窗口内的信息,且不同位置的卷积操作之间没有相互依赖,因此可以对序列进行高效地并行处理。同时,针对序列中距离较长的依赖关系,可以通过堆叠多层卷积层来扩大{\small\bfnew{感受野}}\index{感受野} (Receptive Field)\index{Receptive Field} ,这里感受野指能够影响神经元输出的原始输入数据区域的大小。图\ref{fig:11-9}对比了这两种结构,可以看出,为了捕捉$\mathbi{e}_2$$\mathbi{e}_8$ 之间的联系,串行结构需要顺序的6次操作,和序列长度相关。而该卷积神经网络中,卷积操作每次对三个词进行计算,仅需要4层卷积计算就能得到$\mathbi{e}_2$$\mathbi{e}_8$之间的联系,其操作数和卷积核的大小相关,相比于串行的方式具有更短的路径和更少的非线性计算,更容易进行训练。因此,也有许多研究人员在许多自然语言处理任务上尝试使用卷积神经网络进行序列建模\upcite{Kim2014ConvolutionalNN,Santos2014DeepCN,Kalchbrenner2014ACN,DBLP:conf/naacl/Johnson015,DBLP:conf/naacl/NguyenG15}
\parinterval 区别于传统图像上的卷积操作,在面向序列的卷积操作中,卷积核只在序列这一维度进行移动,用来捕捉多连续词之间的特征。需要注意的是,由于单词通常由一个实数向量表示(词嵌入),{\red 因此可以将词嵌入的维度看作是卷积操作中的通道数}。图\ref{fig:11-10}就是一个基于序列卷积的文本分类模型,模型的输入是维度大小为$m\times K \times 2$的句子表示,其中2是输入矩阵的通道数,该模型令其中一个通道的矩阵为静态,另一个为动态,其静态通道的句子表示在整个训练过程中保持不变,动态通道的句子表示通过反向传播进行微调。模型使用多个不同(对应图中不同的颜色)的卷积核来对序列进行特征提取,得到了多个不同的特征序列。然后使用池化层降低表示维度,得到了一组和序列长度无关的特征表示。基于这组压缩过的特征表示,模型再通过全连接网络和Softmax函数作为相应类别的预测。在这其中卷积层和池化层分别起到了特征提取和状态压缩的作用,将一个不定长的序列转化到一组固定大小的特征表示。 \parinterval 区别于传统图像上的卷积操作,在面向序列的卷积操作中,卷积核只在序列这一维度进行移动,用来捕捉连续的多个词之间的特征。需要注意的是,由于单词通常由一个实数向量表示(词嵌入),因此可以将词嵌入的维度看作是卷积操作中的通道数。图\ref{fig:11-10}就是一个基于序列卷积的文本分类模型,模型的输入是维度大小为$m\times O $的句子表示,$m$表示句子长度,$O$表示卷积核通道数,其值等于词嵌入维度,模型使用多个不同(对应图中不同的颜色)的卷积核来对序列进行特征提取,得到了多个不同的特征序列。然后使用池化层降低表示维度,得到了一组和序列长度无关的特征表示。基于这组压缩过的特征表示,模型再通过全连接网络和Softmax函数作为相应类别的预测。在这其中卷积层和池化层分别起到了特征提取和状态压缩的作用,将一个不定长的序列转化到一组固定大小的特征表示。
%---------------------------------------------- %----------------------------------------------
% 图10. % 图10.
...@@ -437,7 +437,7 @@ ...@@ -437,7 +437,7 @@
\mathbi{v}_t & = & \beta \mathbi{v}_{t-1} + (1-\beta)\frac{\partial J(\mathbi{w}_t)}{\partial \mathbi{w}_t} \label{eq:11-9-momentum} \mathbi{v}_t & = & \beta \mathbi{v}_{t-1} + (1-\beta)\frac{\partial J(\mathbi{w}_t)}{\partial \mathbi{w}_t} \label{eq:11-9-momentum}
\end{eqnarray} \end{eqnarray}
\noindent 其中,$\mathbi{w}_t$表示第$t$步更新时的模型参数;$J(\mathbi{w}_t)$表示损失函数均值期望的估计;$\frac{\partial J(\mathbi{w}_t)}{\partial \mathbi{w}_t}$将指向$J(\mathbi{w}_t)$$\mathbi{w}$处变化最大的方向,即梯度方向;$\alpha$ 为学习率;$\mathbi{v}_t$为损失函数在前$t-1$步更新中累积的梯度动量,利用超参数$\beta$控制累积的范围。 \noindent 其中,$\mathbi{w}_t$表示第$t$步更新时的模型参数;$J(\mathbi{w}_t)$表示损失函数均值期望的估计;$\frac{\partial J(\mathbi{w}_t)}{\partial \mathbi{w}_t}$将指向$J(\mathbi{w}_t)$$\mathbi{w}_t$处变化最大的方向,即梯度方向;$\alpha$ 为学习率;$\mathbi{v}_t$为损失函数在前$t-1$步更新中累积的梯度动量,利用超参数$\beta$控制累积的范围。
\parinterval 而在Nesterov加速梯度下降法中,使用的梯度不是来自于当前参数位置,而是按照之前梯度方向更新一小步的位置,以便于更好地“预测未来”,提前调整更新速率,因此,其动量的更新方式为: \parinterval 而在Nesterov加速梯度下降法中,使用的梯度不是来自于当前参数位置,而是按照之前梯度方向更新一小步的位置,以便于更好地“预测未来”,提前调整更新速率,因此,其动量的更新方式为:
\begin{eqnarray} \begin{eqnarray}
...@@ -466,7 +466,7 @@ ...@@ -466,7 +466,7 @@
\subsection{深度可分离卷积} \subsection{深度可分离卷积}
\label{sec:11.3.1} \label{sec:11.3.1}
\parinterval 根据前面介绍,可以看到卷积神经网络容易处理在局部检测和位置不变的特征。对于特定的表达,比如地点、情绪等,使用卷积神经网络能达到不错的识别效果,因此它常被用在文本分类中\upcite{Kalchbrenner2014ACN,Kim2014ConvolutionalNN,DBLP:conf/naacl/Johnson015,DBLP:conf/acl/JohnsonZ17}。不过机器翻译所面临的情况更复杂,除了局部句子片段信息,我们还希望模型能够捕获句子结构、语义等信息。虽然单层卷积神经网络在文本分类中已经取得了很好的效果\upcite{Kim2014ConvolutionalNN},神经机器翻译等任务仍然需要有效的卷积神经网络。随着深度可分离卷积在机器翻译中的探索\upcite{Kaiser2018DepthwiseSC},更高效的网络结构被设计出来,获得了比ConS2S模型更好的性能。 \parinterval 根据前面的介绍,可以看到卷积神经网络容易用于局部检测和处理位置不变的特征。对于特定的表达,比如地点、情绪等,使用卷积神经网络能达到不错的识别效果,因此它常被用在文本分类中\upcite{Kalchbrenner2014ACN,Kim2014ConvolutionalNN,DBLP:conf/naacl/Johnson015,DBLP:conf/acl/JohnsonZ17}。不过机器翻译所面临的情况更复杂,除了局部句子片段信息,我们还希望模型能够捕获句子结构、语义等信息。虽然单层卷积神经网络在文本分类中已经取得了很好的效果\upcite{Kim2014ConvolutionalNN},但是神经机器翻译等任务仍然需要有效的卷积神经网络。随着深度可分离卷积在机器翻译中的探索\upcite{Kaiser2018DepthwiseSC},更高效的网络结构被设计出来,获得了比ConvS2S模型更好的性能。
%---------------------------------------------- %----------------------------------------------
% 图17. % 图17.
...@@ -478,7 +478,7 @@ ...@@ -478,7 +478,7 @@
\end{figure} \end{figure}
%---------------------------------------------- %----------------------------------------------
\parinterval 深度可分离卷积由深度卷积和逐点卷积两部分结合而成\upcite{sifre2014rigid}。图\ref{fig:11-17}展示了标准卷积、深度卷积和逐点卷积的对比,为了方便显示,图中只画出了部分连接。 \parinterval 深度可分离卷积由深度卷积和逐点卷积两部分结合而成\upcite{sifre2014rigid}。图\ref{fig:11-17}对比了标准卷积、深度卷积和逐点卷积,为了方便显示,图中只画出了部分连接。
\parinterval 给定输入序列表示$\seq{x} = \{ \mathbi{x}_1,\mathbi{x}_2,...,\mathbi{x}_m \}$,其中$m$为序列长度,$\mathbi{x}_i \in \mathbb{R}^{O} $$O$ 即输入序列的通道数。为了获得与输入序列长度相同的卷积输出结果,首先需要进行填充。为了方便描述,这里在输入序列尾部填充 $K-1$ 个元素($K$为卷积核窗口的长度),其对应的卷积结果为$\seq{z} = \{ \mathbi{z}_1,\mathbi{z}_2,...,\mathbi{z}_m \}$ \parinterval 给定输入序列表示$\seq{x} = \{ \mathbi{x}_1,\mathbi{x}_2,...,\mathbi{x}_m \}$,其中$m$为序列长度,$\mathbi{x}_i \in \mathbb{R}^{O} $$O$ 即输入序列的通道数。为了获得与输入序列长度相同的卷积输出结果,首先需要进行填充。为了方便描述,这里在输入序列尾部填充 $K-1$ 个元素($K$为卷积核窗口的长度),其对应的卷积结果为$\seq{z} = \{ \mathbi{z}_1,\mathbi{z}_2,...,\mathbi{z}_m \}$
在标准卷积中,若使用N表示卷积核的个数,也就是标准卷积输出序列的通道数,那么对于第$i$个位置的第$n$个通道$ \mathbi{z}_{i,n}^\textrm{\,std}$,其标准卷积具体计算方式如下: 在标准卷积中,若使用N表示卷积核的个数,也就是标准卷积输出序列的通道数,那么对于第$i$个位置的第$n$个通道$ \mathbi{z}_{i,n}^\textrm{\,std}$,其标准卷积具体计算方式如下:
...@@ -569,7 +569,7 @@ ...@@ -569,7 +569,7 @@
\parinterval 在轻量卷积中,模型使用的卷积参数是静态的,与序列位置无关, 维度大小为$K\times a$;而在动态卷积中,为了增强模型的表示能力,卷积参数来自于当前位置输入的变换,具体如下: \parinterval 在轻量卷积中,模型使用的卷积参数是静态的,与序列位置无关, 维度大小为$K\times a$;而在动态卷积中,为了增强模型的表示能力,卷积参数来自于当前位置输入的变换,具体如下:
\begin{eqnarray} \begin{eqnarray}
\funp{f} (\mathbi{X}_{i}) = \sum_{c=1}^d \mathbi{W}_{:,:,c} \odot \mathbi{x}_{i,c} \funp{f} (\mathbi{x}_{i}) = \sum_{c=1}^d \mathbi{W}_{:,:,c} \odot \mathbi{x}_{i,c}
\label{eq:11-15} \label{eq:11-15}
\end{eqnarray} \end{eqnarray}
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
%---------------------------------------------- %----------------------------------------------
\begin{table}[htp] \begin{table}[htp]
\centering \centering
\caption{ 不同翻译模型性能对比\upcite{NIPS2017_7181}} \caption{ 不同翻译模型性能对比\upcite{vaswani2017attention}}
\label{tab:12-12} \label{tab:12-12}
\begin{tabular}{l l l l} \begin{tabular}{l l l l}
\multicolumn{1}{l|}{\multirow{2}{*}{系统}} & \multicolumn{2}{c}{BLEU[\%]} & \multirow{2}{*}{\parbox{6em}{模型训练代价 (FLOPs)}} \\ \multicolumn{1}{l|}{\multirow{2}{*}{系统}} & \multicolumn{2}{c}{BLEU[\%]} & \multirow{2}{*}{\parbox{6em}{模型训练代价 (FLOPs)}} \\
...@@ -328,7 +328,7 @@ ...@@ -328,7 +328,7 @@
\vspace{0.5em} \vspace{0.5em}
\item 其次,对每个头分别执行点乘注意力操作,并得到每个头的注意力操作的输出$\mathbi{head}_i$ \item 其次,对每个头分别执行点乘注意力操作,并得到每个头的注意力操作的输出$\mathbi{head}_i$
\vspace{0.5em} \vspace{0.5em}
\item 最后,将$h$个头的注意力输出在最后一维$d_v$进行拼接(Concat)重新得到维度为$h \times d_v$的输出,并通过对其左乘一个权重矩阵$\mathbi{W}^{\,o}$进行线性变换,从而对多头计算得到的信息进行融合,且将多头注意力输出的维度映射为模型的隐层大小(即$d_{model}$),这里参数矩阵$\mathbi{W}^{\,o} \in \mathbb{R}^{h \times d_v \times d_{model}}$ \item 最后,将$h$个头的注意力输出在最后一维$d_v$进行拼接(Concat)重新得到维度为$h \times d_v$的输出,并通过对其左乘一个权重矩阵$\mathbi{W}^{\,o}$进行线性变换,从而对多头计算得到的信息进行融合,且将多头注意力输出的维度映射为模型的隐层大小(即$d_{model}$),这里参数矩阵$\mathbi{W}^{\,o} \in \mathbb{R}^{h d_v \times d_{model}}$
\vspace{0.5em} \vspace{0.5em}
\end{itemize} \end{itemize}
...@@ -527,7 +527,7 @@ lrate = d_{\textrm{model}}^{-0.5} \cdot \textrm{min} (\textrm{step}^{-0.5} , \te ...@@ -527,7 +527,7 @@ lrate = d_{\textrm{model}}^{-0.5} \cdot \textrm{min} (\textrm{step}^{-0.5} , \te
\vspace{0.5em} \vspace{0.5em}
\end{itemize} \end{itemize}
\parinterval 不同的Transformer可以适应不同的任务,常见的Transformer模型有Transformer Base、Transformer Big和Transformer Deep\upcite{NIPS2017_7181,WangLearning},具体设置如下: \parinterval 不同的Transformer可以适应不同的任务,常见的Transformer模型有Transformer Base、Transformer Big和Transformer Deep\upcite{vaswani2017attention,WangLearning},具体设置如下:
\begin{itemize} \begin{itemize}
\vspace{0.5em} \vspace{0.5em}
......
...@@ -5219,7 +5219,7 @@ author = {Yoshua Bengio and ...@@ -5219,7 +5219,7 @@ author = {Yoshua Bengio and
@article{Waibel1989PhonemeRU, @article{Waibel1989PhonemeRU,
title={Phoneme recognition using time-delay neural networks}, title={Phoneme recognition using time-delay neural networks},
author={Alexander Waibel and Toshiyuki Hanazawa and Geoffrey Hinton and Kiyohiro Shikano and K.J. Lang}, author={Alexander Waibel and Toshiyuki Hanazawa and Geoffrey Everest Hinton and Kiyohiro Shikano and K.J. Lang},
journal={IEEE Transactions on Acoustics, Speech, and Signal Processing}, journal={IEEE Transactions on Acoustics, Speech, and Signal Processing},
year={1989}, year={1989},
volume={37}, volume={37},
...@@ -5228,7 +5228,7 @@ author = {Yoshua Bengio and ...@@ -5228,7 +5228,7 @@ author = {Yoshua Bengio and
@article{LeCun1989BackpropagationAT, @article{LeCun1989BackpropagationAT,
title={Backpropagation Applied to Handwritten Zip Code Recognition}, title={Backpropagation Applied to Handwritten Zip Code Recognition},
author={Yann LeCun and Bernhard Boser and John Denker and Don Henderson and R. Howard and W.E. Hubbard and Larry Jackel}, author={Yann LeCun and Bernhard Boser and John Denker and Don Henderson and R.E.Howard and W.E. Hubbard and Larry Jackel},
journal={Neural Computation}, journal={Neural Computation},
year={1989}, year={1989},
volume={1}, volume={1},
...@@ -5236,7 +5236,7 @@ author = {Yoshua Bengio and ...@@ -5236,7 +5236,7 @@ author = {Yoshua Bengio and
} }
@article{726791, @article{726791,
author={Yann {Lecun} and Leon {Bottou} and Y. {Bengio} and Patrick {Haffner}}, author={Yann {Lecun} and Leon {Bottou} and Yoshua {Bengio} and Patrick {Haffner}},
journal={Proceedings of the IEEE}, journal={Proceedings of the IEEE},
title={Gradient-based learning applied to document recognition}, title={Gradient-based learning applied to document recognition},
year={1998}, year={1998},
...@@ -5448,7 +5448,7 @@ author = {Yoshua Bengio and ...@@ -5448,7 +5448,7 @@ author = {Yoshua Bengio and
@inproceedings{Islam2020HowMP, @inproceedings{Islam2020HowMP,
author = {Md. Amirul Islam and author = {Md. Amirul Islam and
Sen Jia and Sen Jia and
Neil D. B. Bruce}, Neil Bruce},
title = {How much Position Information Do Convolutional Neural Networks Encode?}, title = {How much Position Information Do Convolutional Neural Networks Encode?},
publisher = {International Conference on Learning Representations}, publisher = {International Conference on Learning Representations},
year = {2020}, year = {2020},
...@@ -5458,7 +5458,7 @@ author = {Yoshua Bengio and ...@@ -5458,7 +5458,7 @@ author = {Yoshua Bengio and
author = {Ilya Sutskever and author = {Ilya Sutskever and
James Martens and James Martens and
George E. Dahl and George E. Dahl and
Geoffrey E. Hinton}, Geoffrey Everest Hinton},
publisher = {International Conference on Machine Learning}, publisher = {International Conference on Machine Learning},
pages = {1139--1147}, pages = {1139--1147},
year={2013} year={2013}
...@@ -5473,7 +5473,7 @@ author = {Yoshua Bengio and ...@@ -5473,7 +5473,7 @@ author = {Yoshua Bengio and
} }
@article{JMLR:v15:srivastava14a, @article{JMLR:v15:srivastava14a,
author = {Nitish Srivastava and Geoffrey Hinton and Alex Krizhevsky and Ilya Sutskever and Ruslan Salakhutdinov}, author = {Nitish Srivastava and Geoffrey Everest Hinton and Alex Krizhevsky and Ilya Sutskever and Ruslan Salakhutdinov},
title = {Dropout: A Simple Way to Prevent Neural Networks from Overfitting}, title = {Dropout: A Simple Way to Prevent Neural Networks from Overfitting},
journal = {Journal of Machine Learning Research}, journal = {Journal of Machine Learning Research},
year = {2014}, year = {2014},
...@@ -5491,7 +5491,7 @@ author = {Yoshua Bengio and ...@@ -5491,7 +5491,7 @@ author = {Yoshua Bengio and
@article{Howard2017MobileNetsEC, @article{Howard2017MobileNetsEC,
title={MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications}, title={MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications},
author = {Andrew G. Howard and author = {Andrew Howard and
Menglong Zhu and Menglong Zhu and
Bo Chen and Bo Chen and
Dmitry Kalenichenko and Dmitry Kalenichenko and
...@@ -5522,7 +5522,7 @@ author = {Yoshua Bengio and ...@@ -5522,7 +5522,7 @@ author = {Yoshua Bengio and
title={Locally-connected and convolutional neural networks for small footprint speaker recognition}, title={Locally-connected and convolutional neural networks for small footprint speaker recognition},
author = {Yu-hsin Chen and author = {Yu-hsin Chen and
Ignacio Lopez-Moreno and Ignacio Lopez-Moreno and
Tara N. Sainath and Tara Sainath and
Mirk{\'{o}} Visontai and Mirk{\'{o}} Visontai and
Raziel Alvarez and Raziel Alvarez and
Carolina Parada}, Carolina Parada},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论