% \resizebox{1.0\linewidth}{!}{
\begin{tikzpicture}


\tikzstyle{box} = [rectangle, minimum height=0.5cm, rounded corners=.08cm, inner sep=2pt, text=black, font=\small]
\tikzstyle{lm} = [box, minimum width=0.7cm, fill=black!20]
\tikzstyle{kv} = [box, minimum width=0.7cm, fill=dg!66]
\tikzstyle{kvp} = [box, minimum width=0.7cm, fill=dg!28]
\tikzstyle{arrow} = [-stealth, line width=0.25 mm]
\tikzstyle{txt} = [font=\small]
\tikzstyle{label} = [font=\scriptsize]

% lm as a compressor
\node[lm] (lm) {$\lm$};

\tikzstyle{cell} = [minimum size=0.15cm, draw=black, fill=dg!60, inner sep=0pt, outer sep=0pt, line width=0.3pt]
\matrix (kv) [right=0.72cm of lm,
             matrix of nodes,
             nodes in empty cells,
             column sep=0.0cm,
             row sep=0.0cm] {
  \node[cell] (m11) {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] (m3) {}; \\
  \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; \\
  \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] {}; \\  
  \node[cell] (m41) {}; & \node[cell] {}; & \node[cell] (m42) {}; & \node[cell] {}; & \node[cell] {}; & \node[cell] (m44) {}; \\  
};

\matrix (kvp) [right=0.6cm of kv,
             matrix of nodes,
             nodes in empty cells,
             column sep=0.0cm,
             row sep=0.0cm] {
  \node[cell] {}; & \node[cell] {}; \\
  \node[cell] {}; & \node[cell] {}; \\
  \node[cell] {}; & \node[cell] {}; & \node[cell] {};\\  
  \node[cell] {}; & \node[cell] {}; & \node[cell] {};\\  
};

\node[label, above=-0.16cm of kv] {$\kvc$};
\node[label, above=-0.18cm of kvp] {$\kvp$};

\node[lm, right=0.3cm of kvp] (lm2) {$\lm$};

% Arrows
\draw[arrow] (lm) -- node[label, above=-0.07cm] (arr1) {prefill} ([xshift=0.1cm]kv.west);
\draw[arrow] ([xshift=-0.1cm]kv.east) -- node[label, above=-0.03cm] {evict} ([xshift=0.1cm]kvp.west);
\draw[arrow] ([xshift=-0.06cm]kvp.east) -- (lm2);

\node[txt, below=0.16cm of lm, anchor=north, text=dr] (ctx) {Context};
\draw[arrow] ($(ctx.north) + (0,-0.1)$) -- (lm);
\node[txt, below=0.16cm of lm2, anchor=north] (q) {Repeat prompt};
\draw[arrow] ($(q.north) + (0,-0.12)$) -- (lm2);
\node[txt, above=0.47cm of lm2, anchor=center, text=dr] (ctx2) {Context};
\draw[arrow] (lm2) -- node[label, anchor=west] {decode} ($(ctx2.south)+(0, 0.05)$);

\end{tikzpicture}
% }