SPB Git forge

spb/wp13_uqo

Public
3commits 1branches 1releases
1.2 MBsize
maindefault branch
1 h agolast push
TeX 93.9% Python 6%
2.7 KB · 56 lines latex
Raw Blame History
1% --- Context-management mechanism: truncation + adaptive summarization ---2\begin{figure}[htbp]3\centering4\begin{tikzpicture}[vqfont,5  msg/.style={vqbox, minimum width=0.62cm, minimum height=0.62cm, inner sep=1pt, font=\vqtiny},6  oldm/.style={msg, fill=VQInk!8, draw=VQInk!45},7  recm/.style={msg, fill=VQTeal!16, draw=VQTeal!70!black},8  brace/.style={decorate, decoration={brace, amplitude=4pt}, draw=VQInk!55, line width=0.5pt}]910% ---- BEFORE row ----11\node[vqsmall, anchor=west, text=VQInk] at (-0.2,2.5) {\textbf{Before} (full message history)};12\foreach \i in {0,1,2,3,4} { \node[oldm] (o\i) at (\i*0.7,1.3) {}; }13\node[recm] (r0) at (3.7,1.3) {};14\node[recm] (r1) at (4.4,1.3) {};15\node[recm] (r2) at (5.1,1.3) {};16\node[recm] (r3) at (5.8,1.3) {};17\node[recm] (r4) at (6.5,1.3) {};18% oversized tool result being capped19\node[vqbox, fill=VQRed!10, draw=VQRed!75!black, minimum width=0.62cm, minimum height=1.15cm,20      inner sep=1pt, font=\vqtiny] (big) at (1.4,1.55) {};21\node[vqtag, right=1pt of big, yshift=6pt] {cap at 5000 chars};2223\draw[brace] (-0.25,0.92) -- (2.75,0.92);24\node[vqsmall, anchor=north, text=VQInk!75] at (1.25,0.82) {older turns};25\draw[brace] (3.4,0.92) -- (6.8,0.92);26\node[vqsmall, anchor=north, text=VQTeal!60!black] at (5.1,0.82) {last $k=5$};2728% ---- Transformation gate ----29\node[vqorange, text width=6.0cm] (gate) at (3.2,-0.55)30  {\textbf{Estimate} $t \approx \text{chars}/4$. \quad If $t>\tau=10^{5}$:};31\draw[vqarr] (1.25,0.5) -- (gate.north -| 1.25,0);3233% ---- AFTER row ----34\node[vqsmall, anchor=west, text=VQInk] at (-0.2,-2.55) {\textbf{After}};35\node[vqpurple, minimum width=2.75cm, minimum height=0.62cm, font=\vqtiny] (sum) at (1.18,-1.95)36  {\textbf{[summary]} (one model call)};37\node[recm] (s0) at (3.7,-1.95) {};38\node[recm] (s1) at (4.4,-1.95) {};39\node[recm] (s2) at (5.1,-1.95) {};40\node[recm] (s3) at (5.8,-1.95) {};41\node[recm] (s4) at (6.5,-1.95) {};4243\draw[vqflow] (gate.west) to[out=180,in=90] node[vqtag,pos=0.6,left]{summarize} (sum.north);44\draw[vqarr] (gate.east) to[out=0,in=90] node[vqtag,pos=0.55,right]{keep} (5.1,-1.63);4546\end{tikzpicture}47\caption{\textbf{Context management.} Before each model call the server caps every individual48tool-result block at a fixed character budget (red), then estimates the total token count with a49cheap chars-per-four heuristic. If the estimate exceeds the threshold $\tau$, the older turns are50compressed by a single dedicated summarization call into one synthetic \texttt{[summary]} message51(purple), while the most recent $k=5$ turns (teal) are kept verbatim. The mechanism makes52conversation length effectively unbounded at the cost of one extra call when the threshold is53crossed.}54\label{fig:context}55\end{figure}56