Commit dc9540cc by 曹润柘

合并分支 'caorunzhe' 到 'master'

Caorunzhe

查看合并请求 !923
parents 131278fa 46beaa17
%%%------------------------------------------------------------------------------------------------------------
%%% 调序模型1:基于距离的调序
\begin{center}
\begin{tikzpicture}
\tikzstyle{tnode}=[rectangle,inner sep=0mm,minimum height=1.8em,minimum width=4em,rounded corners=5pt,thick,draw,fill=teal!20]
\tikzstyle{stnode}=[rectangle,inner sep=0mm,minimum height=1.8em,minimum width=4em,rounded corners=5pt,thick,fill=red!20,draw]
\tikzstyle{rnnnode}=[rectangle,inner sep=0mm,minimum height=2em,minimum width=6.5em,rounded corners=5pt,thick,fill=green!20,draw]
\tikzstyle{wnode}=[inner sep=0mm,minimum height=2em,minimum width=5em]
\begin{scope}[]
\node [anchor=west,rnnnode] (r1) at (0, 0) {循环单元$\mathbi{h}_1$};
\node [anchor=south,rnnnode] (r2) at ([xshift=0em,yshift=1em]r1.north){循环单元$\mathbi{h}_2$};
\node [anchor=south] (r3) at ([xshift=0em,yshift=1em]r2.north){$\cdots$};
\node [anchor=south,rnnnode] (r4) at ([xshift=0em,yshift=1em]r3.north){循环单元$\mathbi{h}_n$};
\node [anchor=east,wnode,font=\footnotesize] (wr1) at ([xshift=-1em,yshift=0em]r1.west) {1时刻输入};
\node [anchor=east,wnode,font=\footnotesize] (wr2) at ([xshift=-1em,yshift=0em]r2.west) {2时刻输入};
\node [anchor=east,wnode,font=\footnotesize] (wr3) at ([xshift=-1em,yshift=0em]r4.west) {$n$时刻输入};
\node [anchor=north,wnode] (input) at ([xshift=0em,yshift=-1em]r1.south) {$\mathbi{h}_0$};
\node [anchor=south,wnode] (output) at ([xshift=0em,yshift=1em]r4.north) {输出};
\draw[->,very thick] ([xshift=-0.3em,yshift=-1em]wr1.west)--([xshift=-0.3em,yshift=1em]wr3.west);
\draw[->,thick] ([xshift=0em,yshift=0em]input.north)--([xshift=0em,yshift=0em]r1.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r1.north)--([xshift=0em,yshift=0em]r2.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r2.north)--([xshift=0em,yshift=0em]r3.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r3.north)--([xshift=0em,yshift=0em]r4.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r4.north)--([xshift=0em,yshift=0em]output.south);
\draw[->,thick] ([xshift=0em,yshift=0em]wr1.east)--([xshift=0em,yshift=0em]r1.west);
\draw[->,thick] ([xshift=0em,yshift=0em]wr2.east)--([xshift=0em,yshift=0em]r2.west);
\draw[->,thick] ([xshift=0em,yshift=0em]wr3.east)--([xshift=0em,yshift=0em]r4.west);
\node [anchor=north,font=\small] (label) at ([xshift=-4em,yshift=-0.5em]input.south) {(a)RNN};
\end{scope}
\begin{scope}[xshift=1.9in]
\node [anchor=west,stnode] (r1) at (0, 0) {第1层};
\node [anchor=south,tnode] (r2) at ([xshift=0em,yshift=1em]r1.north){第2层};
\node [anchor=south] (r3) at ([xshift=0em,yshift=1em]r2.north){$\cdots$};
\node [anchor=south,tnode] (r4) at ([xshift=0em,yshift=1em]r3.north){$n$};
\node [anchor=east,wnode,font=\footnotesize,minimum width=3em] (wr1) at ([xshift=-0.3em,yshift=0em]r1.west) {1时刻};
\node [anchor=east,wnode,font=\footnotesize,minimum width=3em] (wr2) at ([xshift=-0.3em,yshift=0em]r2.west) {2时刻};
\node [anchor=east,wnode,font=\footnotesize,minimum width=3em] (wr3) at ([xshift=-0.3em,yshift=0em]r4.west) {$n$时刻};
\node [anchor=north,wnode] (input) at ([xshift=0em,yshift=-1em]r1.south) {$\mathbi{h}_0$};
\node [anchor=south,wnode] (output) at ([xshift=0em,yshift=1em]r4.north) {输出};
\draw[->,very thick] ([xshift=-0.3em,yshift=-1em]wr1.west)--([xshift=-0.3em,yshift=1em]wr3.west);
\draw[->,thick] ([xshift=0em,yshift=0em]input.north)--([xshift=0em,yshift=0em]r1.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r1.north)--([xshift=0em,yshift=0em]r2.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r2.north)--([xshift=0em,yshift=0em]r3.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r3.north)--([xshift=0em,yshift=0em]r4.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r4.north)--([xshift=0em,yshift=0em]output.south);
\node [anchor=north,font=\small] (label) at ([xshift=-2em,yshift=-0.5em]input.south) {(b)原始Transformer模型};
\end{scope}
\begin{scope}[xshift=3.7in]
\node [anchor=west,stnode] (r1) at (0, 0) {第1层};
\node [anchor=south,stnode] (r2) at ([xshift=0em,yshift=1em]r1.north){第2层};
\node [anchor=south] (r3) at ([xshift=0em,yshift=1em]r2.north){$\cdots$};
\node [anchor=south,stnode] (r4) at ([xshift=0em,yshift=1em]r3.north){$n$};
\node [anchor=east,wnode,font=\footnotesize,align=left,minimum width=4em] (wr1) at ([xshift=-1em,yshift=0em]r1.west) {1时刻编\\ 码向量};
\node [anchor=east,wnode,font=\footnotesize,align=left,minimum width=4em] (wr2) at ([xshift=-1em,yshift=0em]r2.west) {2时刻编\\ 码向量};
\node [anchor=east,wnode,font=\footnotesize,align=left,minimum width=4em] (wr3) at ([xshift=-1em,yshift=0em]r4.west) {$n$时刻编\\ 码向量};
\node [anchor=north,wnode] (input) at ([xshift=0em,yshift=-1em]r1.south) {$\mathbi{h}_0$};
\node [anchor=south,wnode] (output) at ([xshift=0em,yshift=1em]r4.north) {输出};
\draw[->,very thick] ([xshift=-0.3em,yshift=-1em]wr1.west)--([xshift=-0.3em,yshift=1em]wr3.west);
\draw[->,thick] ([xshift=0em,yshift=0em]input.north)--([xshift=0em,yshift=0em]r1.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r1.north)--([xshift=0em,yshift=0em]r2.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r2.north)--([xshift=0em,yshift=0em]r3.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r3.north)--([xshift=0em,yshift=0em]r4.south);
\draw[->,thick] ([xshift=0em,yshift=0em]r4.north)--([xshift=0em,yshift=0em]output.south);
\draw[->,thick] ([xshift=0em,yshift=0em]wr1.east)--([xshift=0em,yshift=0em]r1.west);
\draw[->,thick] ([xshift=0em,yshift=0em]wr2.east)--([xshift=0em,yshift=0em]r2.west);
\draw[->,thick] ([xshift=0em,yshift=0em]wr3.east)--([xshift=0em,yshift=0em]r4.west);
\node [anchor=north,font=\small,align=left] (label) at ([xshift=-2em,yshift=0.2em]input.south) {(c)共享权重的\\ Transformer模型};
\end{scope}
\end{tikzpicture}
\end{center}
\ No newline at end of file
......@@ -51,7 +51,7 @@
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{./Chapter15/Figures/figure-relative-position-coding-and-absolute-position-coding.jpg}
\input{./Chapter15/Figures/figure-relative-position-coding-and-absolute-position-coding}
\caption{绝对位置编码(左)和相对位置编码(右)}
\label{fig:15-1}
\end{figure}
......@@ -322,7 +322,7 @@ C(\mathbi{x}_j \mathbi{W}_K,\omega) &=& (\mathbi{x}_{j-\omega},\ldots,\mathbi{x}
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{./Chapter15/Figures/figure-introducing-rnn-mechanism-into-transformer.jpg}
\input{./Chapter15/Figures/figure-introducing-rnn-mechanism-into-transformer}
\caption{在Transformer中引入循环机制}
\label{fig:15-8}
\end{figure}
......@@ -867,17 +867,17 @@ lr &=& d_{\textrm{model}}^{-0.5}\cdot step\_num^{-0.5}
\sectionnewpage
\section{基于句法的神经机器翻译模型}
\parinterval 在统计机器翻译时代,使用句法信息是一种非常有效的机器翻译建模手段(见{\chaptereight})。由于句法是人类运用语言的高级抽象结果,使用句法信息(如句法树)可以帮助机器翻译系统对句子结构进行建模例如,利用句法树提升译文语法结构的正确性。在神经机器翻译中,大多数框架均基于词串进行建模,因此在模型中引入句法树等结构也很有潜力\upcite{DBLP:conf/acl/LiXTZZZ17}。 具体来说,由于传统神经机器翻译模型缺少对句子结构的理解,会导致一些翻译问题:
\parinterval 在统计机器翻译时代,使用句法信息是一种非常有效的机器翻译建模手段(见{\chaptereight})。由于句法是人类运用语言的高级抽象结果,使用句法信息(如句法树)可以帮助机器翻译系统对句子结构进行建模例如,利用句法树提升译文语法结构的正确性。在神经机器翻译中,大多数框架均基于词串进行建模,因此在模型中引入句法树等结构也很有潜力\upcite{DBLP:conf/acl/LiXTZZZ17}。 具体来说,由于传统神经机器翻译模型缺少对句子结构的理解,会导致一些翻译问题:
\begin{itemize}
\vspace{0.5em}
\item 过度翻译问题,如:
\item {\small\bfnew{过度翻译问题}},如:
\begin{equation}
\textrm{“ 两/个/女孩 ”}\ \to \ \textrm{“ two girls and two girls ”} \nonumber
\end{equation}
\vspace{0.5em}
\item 翻译不连贯问题,如:
\item {\small\bfnew{翻译不连贯问题}},如:
\begin{equation}
\textrm{“ 新生/银行/申请/上市 ”}\ \to \ \textrm{“ new listing bank ”} \nonumber
\end{equation}
......@@ -885,15 +885,15 @@ lr &=& d_{\textrm{model}}^{-0.5}\cdot step\_num^{-0.5}
\vspace{0.5em}
\end{itemize}
\parinterval 显然,神经机器翻译系统并没有按照合理的句法结构生成译文。也就是说,模型并没有理解句子的结构\upcite{DBLP:conf/acl/LiXTZZZ17}。甚至对于一些语言差异很大的语言对,会出现将介词短语翻译成一个词的情况。虽然可以通过很多手段对上述问题进行求解,但是使用句法树是最直接的解决问题的方法\upcite{DBLP:conf/acl/EriguchiHT16}
\parinterval 显然,神经机器翻译系统并没有按照合理的句法结构生成译文。也就是说,模型并没有理解句子的结构\upcite{DBLP:conf/acl/LiXTZZZ17}。甚至对于一些语言差异很大的语言对,会出现将介词短语翻译成一个词的情况。虽然可以通过很多手段对上述问题进行求解,但是使用句法树是解决该问题的一种最直接的方法\upcite{DBLP:conf/acl/EriguchiHT16}
\parinterval 那么在神经机器翻译中,如何将这种离散化的树结构融入到基于分布式表示的翻译模型中呢?有以下两种策略:
\begin{itemize}
\vspace{0.5em}
\item 将句法信息加入到编码器,使得编码器更加充分地表示源语言句子。
\item {\small\bfnew{将句法信息加入到编码器}},使得编码器更加充分地表示源语言句子。
\vspace{0.5em}
\item 将句法信息加入到解码器,使得翻译模型能生成更符合句法的译文。
\item {\small\bfnew{将句法信息加入到解码器}},使得翻译模型能生成更符合句法的译文。
\vspace{0.5em}
\end{itemize}
......@@ -903,7 +903,7 @@ lr &=& d_{\textrm{model}}^{-0.5}\cdot step\_num^{-0.5}
\subsection{编码器使用句法信息}
\parinterval 编码器中使用句法信息有两种思路,一种思路是在编码器中显性使用树结构进行建模,另一种思路是把句法信息作为特征输入到传统的序列编码器中。这两种思路与统计机器翻译中基于句法树结构的模型和基于句法特征的模型十分相似(见{\chaptereight})。
\parinterval 编码器中使用句法信息有两种思路,一种思路是在编码器中显性使用树结构进行建模,另一种思路是把句法信息作为特征输入到传统的序列编码器中。这两种思路与统计机器翻译中基于句法树结构的模型和基于句法特征的模型十分相似(见{\chaptereight})。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
......@@ -911,7 +911,7 @@ lr &=& d_{\textrm{model}}^{-0.5}\cdot step\_num^{-0.5}
\subsubsection{1. 基于句法树结构的编码}
\parinterval 一种简单的方法是将源语言句子编码成一个二叉树结构\footnote[6]{所有句法树都可以通过二叉化方法转化为二叉树(见{\chaptereight})。},树节点的信息是由左子树和右子树变换而来,如下所示:
\parinterval 使用句法信息的一种简单的方法是将源语言句子编码成一个二叉树结构\footnote[6]{所有句法树都可以通过二叉化方法转化为二叉树(见{\chaptereight})。},树节点的信息是由左子树和右子树变换而来,如下所示:
\begin{eqnarray}
\mathbi{h}_p &=& f_\textrm{tree}(\mathbi{h}_l,\mathbi{h}_r)
\label{eq:15-50}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论