\begin{tikzpicture}

\tikzstyle{h2o} = [or, mark=diamond, mark size=1pt]
\tikzstyle{snap} = [gr, mark=x, mark size=1.3pt]
\tikzstyle{pyramid} = [bl, mark=+, mark size=1.3pt]
\tikzstyle{prob} = [red, mark=*, mark size=0.7pt]

\begin{groupplot}[group style={columns=4, horizontal sep=1.04cm, vertical sep=1.2cm},
    width=4.0cm,
    height=3.4cm,
    every axis plot/.append style={thick},
    % Label
    xlabel shift=-0.08cm,         
    ylabel shift=-0.15cm,
    xlabel near ticks,
    ylabel near ticks,
    label style={font=\scriptsize},
    xlabel={KV cache ratio},
    ylabel={Rel. performance},
    % Grid
    grid=major,
    xmajorgrids=true,
    ymajorgrids=true,
    major grid style={dotted, black},
    % tick
    tick label style={font=\scriptsize},
    tick pos=left,
    x tick label style={/pgf/number format/.cd, fixed, fixed zerofill, precision=1},
    y tick label style={/pgf/number format/.cd, fixed, fixed zerofill, precision=1},
    xmax=1.0,
    xmin=0.1,
    xtick={0.2, 0.4, 0.6, 0.8, 1.0},
    extra x ticks={0.3, 0.5, 0.7, 0.9},   
    extra x tick labels={,,,},
    extra x tick style={
        grid=none,
        tick style={thin},
        major tick length=2.4pt,
    },    
    % title
    title style={
      at={(axis description cs:0.5,0.88)}, 
      anchor=south,
      font={\footnotesize}
    },    
]

%%%% Retrieval-Matching %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\nextgroupplot[title=Qwen2.5-14B-1M,  
legend columns=4, legend style={at={(0.95,1.28)}, anchor=south west, font=\footnotesize},
]
\addplot[prob] table[x=ratio, y=prob, col sep=comma]{data/qwen-14b.csv};\addlegendentry{KVzip (ours)}
\addplot[h2o] table[x=ratio, y=h2o, col sep=comma]{data/qwen-14b.csv};\addlegendentry{$\text{H}_2\text{O}$}
\addplot[snap] table[x=ratio, y=snap, col sep=comma]{data/qwen-14b.csv};\addlegendentry{SnapKV}
\addplot[pyramid] table[x=ratio, y=pyramid, col sep=comma]{data/qwen-14b.csv};\addlegendentry{PyramidKV}


\nextgroupplot[title=LLaMA3.1-8B]
\addplot[h2o] table[x=ratio, y=h2o, col sep=comma]{data/llama3-8b.csv};
\addplot[snap] table[x=ratio, y=snap, col sep=comma]{data/llama3-8b.csv};
\addplot[pyramid] table[x=ratio, y=pyramid, col sep=comma]{data/llama3-8b.csv};
\addplot[prob] table[x=ratio, y=prob, col sep=comma]{data/llama3-8b.csv};


\nextgroupplot[title=Gemma3-12B, xlabel={KV cache ratio (global)}]
\addplot[h2o] table[x=ratio, y=h2o, col sep=comma]{data/gemma-12b.csv};
\addplot[snap] table[x=ratio, y=snap, col sep=comma]{data/gemma-12b.csv};
\addplot[pyramid] table[x=ratio, y=pyramid, col sep=comma]{data/gemma-12b.csv};
\addplot[prob] table[x=ratio, y=prob, col sep=comma]{data/gemma-12b.csv};

\nextgroupplot[title=LLaMA3-8B-W8A8KV4, title style={
      at={(axis description cs:0.44,0.88)}},    
]
\addplot[h2o] table[x=ratio, y=h2o, col sep=comma]{data/quant.csv};
\addplot[snap] table[x=ratio, y=snap, col sep=comma]{data/quant.csv};
\addplot[pyramid] table[x=ratio, y=pyramid, col sep=comma]{data/quant.csv};
\addplot[prob] table[x=ratio, y=prob, col sep=comma]{data/quant.csv};


\end{groupplot}
\end{tikzpicture}
