File size: 3,672 Bytes
74b7543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb,amsthm,mathtools,times}
\usepackage[margin=1.25in]{geometry}
\usepackage{hyperref}

\usepackage{microtype}
\input{macros}
\usepackage{times}

\newcommand{\znote}[1]{{\color{violet}[ZW: #1]}}


\newcommand{\one}{\mathbf{1}}
\usepackage[numbers]{natbib}
\bibliographystyle{plainnat}

\title{Looping implicit reasoning on two-hop QA}
\author{Hengyu Fu, Tianyu Guo, Zixuan Wang, Hanlin Zhu}
\date{}
%\def\usebigfont{1}
\ifdefined\usebigfont
\renewcommand{\mddefault}{bx}
\renewcommand\seriesdefault{b}
\renewcommand\bfdefault{bx} % just to make sure
\usepackage{times}
\usepackage[fontsize=13pt]{scrextend}
\makeatletter
\@ifpackageloaded{geometry}{\AtBeginDocument{\newgeometry{letterpaper,left=1.56in,right=1.56in,top=1.71in,bottom=1.77in}}}{\usepackage[letterpaper,left=1.56in,right=1.56in,top=1.71in,bottom=1.77in]{geometry}}
\AtBeginDocument{\newgeometry{letterpaper,left=1.56in,right=1.56in,top=1.71in,bottom=1.77in}}
\linespread{1}
\usepackage{hyperref} % watch out for error: ! Illegal parameter number in definition of \Hy@tempa.
\else
\usepackage{times}
\fi
\begin{document}
\maketitle
\section{Model Architecture}
\begin{itemize}
    \item Input: $X=[x_1,x_2,\dots,x_n]\in \mathcal{X}^{\otimes n}\subset \R^{V\times n }$, where $\mathcal{X}$ is the token space in one-hot format, i.e., $\mathcal{X}=\{e_i|i=1,2,\dots,V\}\subset \R^{V}$ with $V$ being the vocabulary size.
    \item Embedding \& LM head: We consider a weight-tying Embedding matrix $\Phi\in \R^{d\times V}$.
    \item Inner layers: We consider the inner layers as a whole mapping: $f:\R^{d\times n} \rightarrow \R^{d \times n}$.
\end{itemize}
The standard gpt-based model $f_{\rm gpt}: \mathcal{X}^{n}\rightarrow \R^{V \times n}$ can be written as:
\begin{align*}
    f_{\rm gpt}(X)=\sigma(\Phi^{\top}f(\Phi X)),
\end{align*}
where $\sigma$ is the column-wise Softmax operator and $f$ consists of Transformers layers. 

Suppose we have a series of mappings $f^{(1)},f^{(2)},...,f^{(m)}$. Given the input $X$, we define our hyper-connection model $f_{\rm hyper}$ iteratively as:
\begin{align*}
    H^{(0)}&=\Phi X,\\
    H^{(i+1)}&= f^{(i)}(H^{(i)})+{\rm Norm}( \alpha^{(i)}\odot\Phi\sigma(\Phi^{\top}f^{(i)}(H^{(i)}))+\beta^{(i)} \odot H^{(0)}),~i=0,1,.\dots,m-1.\\
    f_{\rm hyper}(X)&=\sigma(\Phi^{\top}H^{(m)}).
\end{align*}
Here ${\rm Norm}$ can be any norm operator (e.g., RMSNorm), $\alpha^{(i)} , \beta^{(i)}\in \R^{1\times n}$ are the gating weights. We may optionally apply stop-gradient to the embedding matrix $\Phi$ for training stability. Now we elaborate on the design for each component.
\paragraph{Design of $f^{(i)}$} We can use either \textbf{looping} or \textbf{stacking} structure:
\begin{itemize}
    \item \textbf{Looping} We tie the weights of all $f^{(i)}$, i.e., $f^{(1)}=\cdots=f^{(m)}=f$.
    \item \textbf{Stacking} We can first  train a gpt-based model $f_{\rm gpt}$ and use the trained transformer layers $f$ as a warm-up initialization of $f^{(i)}=f$ (but they are not weight-tying for the later training).
\end{itemize}

\paragraph{Design of $\alpha^{(i)}$ and $\beta^{(i)}$}
We can either fix $\alpha^{(i)}, \beta^{(i)} $ as hyperparameters, or use learnable $w_{\alpha}^{(i)}, w_{\beta}^{(i)}\in \R^{d}$ to determine $\alpha^{(i)}$ and $\beta^{(i)}$:
\begin{align*}
    \alpha^{(i)}={\rm Sigmoid}(w_{\alpha}^{(i)\top}\Phi\sigma(\Phi^{\top}f^{(i)}(H^{(i)}))),~~\beta^{(i)}={\rm Sigmoid}(w_{\beta}^{(i)\top}H^{(0)}).
\end{align*}
Specifically, we may choose $\alpha^{(m-1)}=\beta^{(m-1)}=0$ because we don't want to mix our final outputs again with the embeddings.


\bibliography{references}
\end{document}