% !Mode:: "TeX:UTF-8"
% !TEX encoding = UTF-8 Unicode

\begin{center}
  \begin{tikzpicture}
    \def\ssep{1.5cm}
    \def\nsize{0.3cm}

    \tikzstyle{lnode} = [minimum width=7cm,minimum height=1.1cm,inner sep=2pt,draw,thick,fill=white];
    \begin{scope}

      \node [anchor=center] (x1) at (0,0) {\footnotesize{$x_1$}};
      \node [anchor=center] (xcdots) at ([xshift=\ssep]x1.center) {\footnotesize{$\cdots$}};
      \node [anchor=center] (xm) at ([xshift=\ssep]xcdots.center) {\footnotesize{$x_m$}};
      \node [anchor=center] (y1) at ([xshift=\ssep]xm.center) {\footnotesize{$y_1$}};
      \node [anchor=center] (ycdots) at ([xshift=\ssep]y1.center) {\footnotesize{$\cdots$}};
      \node [anchor=center] (yt) at ([xshift=\ssep]ycdots.center) {\footnotesize{$y_{T}$}};

      \foreach \x in {x1, xm, y1, yt}
      \draw [->] ([yshift=0.2cm]\x.center) -- ([yshift=0.55cm]\x.center);

      \node [anchor=center] (oy1) at ([yshift=2.6cm]y1.center) {\footnotesize{$\mathbf{h}_{y_1}$}};
      \node [anchor=center] (oycdots) at ([yshift=2.6cm]ycdots.center) {\footnotesize{$\cdots$}};
      \node [anchor=center] (oyt) at ([yshift=2.6cm]yt.center) {\footnotesize{$\mathbf{h}_{y_T}$}};

      \node [anchor=south,draw,thick,minimum width=9cm,minimum height=1.3cm] (llm) at ([yshift=0.4cm]$(xm.north)!.5!(y1.north)$) {\large{Value Model (LLM)}};

      \foreach \x in {oy1, oyt}
      \draw [<-] ([yshift=-0.25cm]\x.center) -- ([yshift=-0.6cm]\x.center);

      \filldraw [fill=red!20,draw=white] ([xshift=-0.5cm,yshift=0.2cm]oyt.north west) -- ([xshift=0.5cm,yshift=0.2cm]oyt.north east) -- ([yshift=1cm,xshift=0]oyt.north east) -- ([yshift=1cm,xshift=0]oyt.north west) -- ([xshift=-0.5cm,yshift=0.2cm]oyt.north west);
      \filldraw [fill=red!20,draw=white] ([xshift=-0.5cm,yshift=0.2cm]oy1.north west) -- ([xshift=0.5cm,yshift=0.2cm]oy1.north east) -- ([yshift=1cm,xshift=0]oy1.north east) -- ([yshift=1cm,xshift=0]oy1.north west) -- ([xshift=-0.5cm,yshift=0.2cm]oy1.north west);
      \node at ([yshift=0.6cm]$(oy1.north)!.5!(oyt.north)$) {\footnotesize{$\cdots$}};

      \node [anchor=south] (Wr) at ([yshift=0.3cm]oyt.north) {\footnotesize{$\mathbf{W}_r$}};
      \node [anchor=south] (output) at ([yshift=0.5cm]Wr.north) {\footnotesize{Value (Scalar)}};
      \draw [->] ([yshift=0.2cm]Wr.north) -- (output.south);
      \node [anchor=west] (linear) at ([xshift=0.5cm]Wr.east) {\scriptsize{Linear Map}};
      \node [anchor=south] (Wr) at ([yshift=0.3cm]oy1.north) {\footnotesize{$\mathbf{W}_r$}};
      \node [anchor=south] (output) at ([yshift=0.5cm]Wr.north) {\footnotesize{Value (Scalar)}};
      \draw [->] ([yshift=0.2cm]Wr.north) -- (output.south);
      \node [anchor=east,align=center] at ([xshift=-0.0cm]oy1.west) {\scriptsize{Representation}};

      \draw [->] ([yshift=-0.1cm]oyt.north) -- ([yshift=0.18cm]oyt.north);
      \draw [->] ([yshift=-0.1cm]oy1.north) -- ([yshift=0.18cm]oy1.north);

    \end{scope}
  \end{tikzpicture}
\end{center}
