% !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] (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{Reward Model (LLM)}};

      \foreach \x in {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);

      \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{Reward (Scalar)}};
      \node [anchor=west] (linear) at ([xshift=0.5cm]Wr.east) {\scriptsize{Linear Map}};
      \node [anchor=west, align=left,xshift=-0.4cm] at (linear.west|-oyt.east) {\scriptsize{Representation}};
      \draw [->] ([yshift=0.2cm]Wr.north) -- (output.south);

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

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