Add Leleka arXiv manuscript and evidence map
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# Рукопис Leleka для arXiv
|
||||
|
||||
**Leleka: Model Compression and Session Multiplexing for Long-Context Coding Agents on One GPU.**
|
||||
|
||||
Англомовний рукопис містить метод, виміри, аналіз якості, пов’язані роботи та додаток із походженням експериментів. У `leleka.tex` вбудовано бібліографію. Для компіляції достатньо стандартних пакетів LaTeX.
|
||||
|
||||
## Що саме додає Leleka
|
||||
|
||||
- **KAR.** Вкладене кодування походить із Koference. Han та співавтори вже квантують ту саму n-грамну таблицю Qwen3.8-Flash-Next до 13,4 ГБ за двобітного коду й відновлюють лише вибрані рядки. Внесок Leleka — шлях від конверсії GGUF з обмеженою пам’яттю до обслуговування з розрідженого `memfd`. Він зберігає вихідні офсети архіву та перевіряє хеш списку діапазонів і їхніх байтів. Виміряні 36,6 ГіБ стосуються повної та розрідженої копій **того самого** KAR. [N-Gram Memories at Two Bits](https://arxiv.org/abs/2610.21810v3), [SlackTier](https://arxiv.org/abs/2611.13413), [реалізація розрідженого завантаження](../kar-sparse-memfd.md).
|
||||
- **Мультиплексування.** Strata вже паркує сесії в RAM і дозволяє запозичити чекпойнт, SGLang уже вирівнює певні рекурентні чекпойнти за сіткою, а Marconi та HiState оцінюють вартість рекомп’ютації та пам’яті. Внесок Leleka — конкретний спосіб відновлення одного слота Qwen: спільні блоки K/V та індексу, узгоджені стани GDN, історії PLE і MTP, імпорт лише відсутніх блоків та оцінка витіснення за приростом повторної обробки відносно найближчого вцілілого предка на байт, який справді вивільниться. 5-кратна різниця p95 TTFT виміряна проти контрольного режиму з однією активною історією. [Strata](https://github.com/Niko1221/Strata/blob/41cf05a06a25dd29103b7b27a2279a3f60c21876/docs/DETAILS.md), [SGLang](https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/managers/schedule_policy.py), [Marconi](https://arxiv.org/abs/2411.19379), [HiState](https://arxiv.org/abs/2610.41508), [заміри Leleka](../prefix-cache.md).
|
||||
|
||||
## Джерела результатів
|
||||
|
||||
| Твердження | Запис і прив’язка до історії |
|
||||
| --- | --- |
|
||||
| Архів KAR level 2 займає 55,296 ГБ проти 83,618 ГБ вихідних GGUF. Розмір і відносну похибку також виміряли для рівнів 2 і 3 на двох вибраних зрізах. | [Перевірка повної конверсії та зрізів](../build-validation.md). Техніка вкладених бітових площин походить із Koference, ревізія `806d2398`. Походження декодера зафіксовано в [GPU KAR](../../gpu/kar/README.md). |
|
||||
| Таблиця PLE займає 16,0 ГБ проти 28,8 ГБ. У парному replay prefill становить 4 206 проти 3 741 токенів/с. Різниця у швидкості decode невизначена, зміна логітів вимірювана. | `740d84113`, `5cc2257ea`. [Парні заміри KAR і GGUF](../experiments/kar-off-ab-5090.md), [швидкість](../e2e-data/kar-off-ab/speed/speed.md), [числова якість](../e2e-data/kar-off-ab/quality-a-kar-vs-gguf.txt). |
|
||||
| Розріджений `memfd` вивільняє 36,6 ГіБ проти повної копії того самого KAR. Записані top-16 log-probabilities і draft traces збігаються побітно. | `4c1b10e2b`, `2a23976c5`, `0111c3dc6`. [Перелік діапазонів](../kar-sparse-memfd.md), [релізні результати Q12 та A6](../release/5090-v0.1-checklist.md). |
|
||||
| У синтетичній трасі чотирьох сесій p95 TTFT зменшується з 27,6 до 5,5 с. Для двох сесій із приблизно 180k токенів TTFT повернення становить 2,72–4,76 с, імпорт стану — 175–194 мс. | `8ad4dd5d7`, `d53db650f`, `25538a830`, `44e57ee30`. Контроль — режим одного активного стану в тестовому рушії. [Префіксний кеш, розділ Results](../prefix-cache.md). |
|
||||
| Живий Codex із трьома сесіями здійснив 48 перемикань, медіана імпорту 29 мс. Максимум черги 51 с. | `7d580590d`, `b54e334a8`. [Звіт живого запуску](../experiments/orchestrator-subagents-smoke.md). |
|
||||
|
||||
Усі наведені GPU-результати взято з історії репозиторію. Числові висновки в рукописі розрізняють розмір файлів, резидентну пам’ять, швидкість prefill, TTFT і час завершення задачі. Порівняння з іншими реалізаціями кешування подано в огляді літератури. Походження коду Strata описано в [upstream.md](../upstream.md).
|
||||
|
||||
## Збірка й подання
|
||||
|
||||
Команди для TeX Live з кореня репозиторію.
|
||||
|
||||
```powershell
|
||||
New-Item -ItemType Directory -Force dist/leleka-arxiv | Out-Null
|
||||
pdflatex -interaction=nonstopmode -halt-on-error -output-directory=dist/leleka-arxiv docs/paper/leleka.tex
|
||||
pdflatex -interaction=nonstopmode -halt-on-error -output-directory=dist/leleka-arxiv docs/paper/leleka.tex
|
||||
tar.exe -czf dist/leleka-arxiv/leleka-source.tar.gz -C docs/paper leleka.tex
|
||||
```
|
||||
|
||||
Робоча основна категорія `cs.DC`. Ім’я **Pavlo Ratushnyi** взято з історії Git. Перед поданням узгодьте список авторів, афіліації й контакт, а також посилання на матеріали, які можна відкрити читачам. Пакет вихідного коду містить лише `leleka.tex`. [Вимоги arXiv до TeX](https://info.arxiv.org/help/submit_tex.html), [інструкції з подання](https://info.arxiv.org/help/submit/index.html).
|
||||
@@ -0,0 +1,631 @@
|
||||
\documentclass[11pt]{article}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{lmodern}
|
||||
\usepackage[letterpaper,margin=0.95in]{geometry}
|
||||
\usepackage{microtype}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{booktabs}
|
||||
\usepackage[hidelinks]{hyperref}
|
||||
\urlstyle{same}
|
||||
\setlength{\emergencystretch}{2em}
|
||||
|
||||
\title{Leleka: Model Compression and Session Multiplexing\\
|
||||
for Long-Context Coding Agents on One GPU}
|
||||
\author{Pavlo Ratushnyi}
|
||||
\date{November 2026}
|
||||
|
||||
\begin{document}
|
||||
\maketitle
|
||||
|
||||
\begin{abstract}
|
||||
Leleka serves long-context coding agents on one RTX 5090. It
|
||||
integrates Koference's nested bit-plane encoding with a verified
|
||||
sparse archive view for a 51.2-billion-weight n-gram embedding table.
|
||||
The view preserves file offsets and materializes only the pages
|
||||
covering the serving path's reads. Level-2 KAR reduces the per-layer
|
||||
embedding (PLE) representation from 28.8 to 16.0~GB relative to GGUF.
|
||||
Separately, sparse materialization reclaims 36.6~GiB relative to a
|
||||
full copy of the same KAR archive, with bitwise agreement on recorded
|
||||
output traces. The KAR--GGUF comparison changes 4.27\% of teacher-forced
|
||||
argmaxes against 1.50--1.87\% across same-encoding runs.
|
||||
Leleka multiplexes sessions at request boundaries using
|
||||
reference-counted attention blocks and checkpoints of recurrent,
|
||||
embedding-history and speculative draft state on a common prefill
|
||||
grid. It imports only blocks absent from the live slot and ranks
|
||||
checkpoints by marginal prefill savings per reclaimable byte. On 96
|
||||
synthetic requests from four interleaved sessions, p95 time to first
|
||||
token falls from 27.6 to 5.5~s against a single-active-history cache.
|
||||
Returning sessions at about 180k tokens see 2.72--4.76~s versus
|
||||
53.1--53.7~s, with agreement on tested greedy continuations against a
|
||||
full read on the same grid. A live Codex run records a 29~ms median
|
||||
state import on session switches and a 51~s maximum queue wait.
|
||||
\end{abstract}
|
||||
|
||||
\section{Introduction}
|
||||
|
||||
Coding agents repeatedly send histories of source files, model replies
|
||||
and tool results. Interleaving requests can overwrite a reusable
|
||||
history when the engine keeps one active slot. For a hybrid model,
|
||||
each reused prefix needs its matching recurrent state as well as
|
||||
attention data.
|
||||
|
||||
Leleka serves Qwen3.8-Flash-Next IQ3\_S in one active slot with a
|
||||
262,144-token context limit. It inherits Strata's quantized experts,
|
||||
attention-cache streaming, multi-token prediction (MTP), and sparse
|
||||
PLE lookup \cite{strata,leleka}. Strata supports conversation parking,
|
||||
and prior work compresses this same Qwen table \cite{strata,twobitngram}.
|
||||
Leleka adds two serving mechanisms.
|
||||
|
||||
\begin{enumerate}
|
||||
\item \textbf{Verified sparse loading of KAR.} Leleka converts GGUF to
|
||||
Koference's KAR with bounded memory \cite{koference} and stages
|
||||
packed PLE rows for CUDA reconstruction. Its sealed memory file
|
||||
preserves offsets and contains only verified ranges used in
|
||||
serving. We measure re-encoding and sparse loading separately.
|
||||
\item \textbf{Single-slot restoration of hybrid model state.} Sessions
|
||||
share attention and index blocks and checkpoint recurrent, PLE
|
||||
and MTP state on the same grid as cold prefill. Leleka imports
|
||||
missing blocks into the live slot and scores eviction by marginal
|
||||
prefill work per byte actually released. We check greedy output
|
||||
agreement and measure both state import and queue latency.
|
||||
\end{enumerate}
|
||||
|
||||
\section{Weight encoding and selective materialization}
|
||||
\label{sec:encoding}
|
||||
|
||||
\paragraph{Koference encoding and the Leleka converter.}
|
||||
KAR-2 is the container version used in the Koference reference
|
||||
\cite{koference}. A quantization \emph{level} is the number of bit planes
|
||||
read for a tensor. Leleka ports the offline encoder and range decoder.
|
||||
For a group of $g$ source weights, it rounds the maximum absolute weight
|
||||
to an FP16 scale $s$ and uses a small positive scale for an all-zero group.
|
||||
It fits a tree of scalar partitions to a sample of the normalized weights.
|
||||
At each depth it splits each parent cell at a boundary minimizing the
|
||||
sum of squared errors of the two child cells. The reconstruction value
|
||||
for a cell is its sample mean rounded to FP16. The encoder stores the
|
||||
leaf index most-significant plane first. Reading the first $\ell$ planes
|
||||
selects an ancestor cell and reconstructs $\hat{w}_i^{(\ell)}$ as
|
||||
\[
|
||||
\hat{w}_i^{(\ell)} =
|
||||
s_{\lfloor i/g \rfloor}\,
|
||||
c_\ell\!\left[\sum_{j=0}^{\ell-1} 2^{\ell-1-j} b_j(i)\right],
|
||||
\]
|
||||
where $c_\ell$ is the table of $2^\ell$ reconstruction values, and $b_j(i)$
|
||||
is the bit for weight $i$ in plane $j$. Ignoring padding, codebooks and
|
||||
metadata, the encoding costs $\ell + 16/g$ bits per weight. The serving
|
||||
experiment uses $\ell=2$ and $g=32$ throughout the PLE table. The streamed
|
||||
converter reads bounded GGUF chunks, samples at most 65,536 normalized
|
||||
values per tensor or partition, and writes per-tensor sections. It splits
|
||||
the PLE tensor at row boundaries to respect the container's 32-bit plane
|
||||
stride. The converter hashes the physical GGUF data and the decoded FP32
|
||||
stream without writing that expanded stream to disk. It verifies the
|
||||
archive and its tensor checksums.
|
||||
|
||||
\paragraph{Random access in the PLE table.}
|
||||
The evaluated level-2 table has 320,001,536 rows of 160 weights, stored
|
||||
in two partitions. Each row needs 10 bytes of scales and two 20-byte
|
||||
plane slices, for 50 bytes per row or 2.5 bits per weight. The native
|
||||
IQ4\_NL GGUF PLE table uses 90 bytes per row. The CUDA-serving path
|
||||
stages the packed rows selected by the PLE lookup, maintains a bounded
|
||||
device row cache, and gathers and reconstructs rows on the device.
|
||||
The routed experts in both serving arms come from the same native
|
||||
quantized GGUF bank. The full KAR archive is also measured as an offline
|
||||
artifact, which establishes a storage rate for that encoding.
|
||||
|
||||
\paragraph{Verified sparse archive view.}
|
||||
The loader derives the union of the metadata and all codebook, scale
|
||||
and bit-plane ranges reachable by any legal PLE row lookup. It rounds
|
||||
that union to page boundaries and merges the resulting extents. The
|
||||
loader copies only those extents into a sealed Linux memory file
|
||||
(\texttt{memfd}) of the original length. The engine can therefore
|
||||
use the archive's existing offsets and row decoder. The sparse
|
||||
verifier derives the same extents, checks that they cover all allowed
|
||||
reads, and validates a pinned SHA-256 digest that binds their lengths,
|
||||
offsets and bytes. The residency guard uses the verified extent list.
|
||||
Direct I/O avoids a second copy in the disk page cache, and the memory
|
||||
governor locks and repopulates only the copied extents. This last detail
|
||||
matters because populating holes would allocate zero pages. The sparse
|
||||
view serves the same encoded PLE bytes as the full in-memory KAR archive.
|
||||
|
||||
\section{Request-boundary session multiplexing}
|
||||
\label{sec:mux}
|
||||
|
||||
\paragraph{Canonical checkpoints.}
|
||||
One request owns the execution state from prefill to completion or
|
||||
cancellation. For a prompt with $n$ tokens, grid-mode prefill ends
|
||||
chunks on a fixed global token grid, with the final chunk ending at
|
||||
$n-1$ before the first verification step. Chunk boundaries can affect
|
||||
floating-point arithmetic. A continuation restored from a grid point
|
||||
therefore follows the same suffix chunk schedule as a full grid-mode
|
||||
prefill of that prompt.
|
||||
|
||||
The store holds two kinds of records. A shared block holds quantized
|
||||
attention K/V cells and pooled attention-index rows for one consecutive
|
||||
token span. A checkpoint holds the model's Gated DeltaNet (GDN)
|
||||
recurrent state, PLE history, attention-index tails and MTP draft state,
|
||||
plus references to its blocks. Blocks are indexed by a hash chain over
|
||||
the token prefix. The runtime compares the token IDs on lookup so a
|
||||
collision cannot produce a cache hit. In the measured configuration,
|
||||
shared block data costs 14,208 bytes per token and each checkpoint
|
||||
carries about 127~MB of additional state.
|
||||
|
||||
\paragraph{Restoring into one slot.}
|
||||
The runtime uses the deepest matching checkpoint at or before $n-1$.
|
||||
It tracks the valid leading span of that prefix in the live slot,
|
||||
skips its complete blocks, and imports the remaining blocks up to the
|
||||
checkpoint. The restore refreshes
|
||||
the device attention index, invalidates stale resident K/V entries, and
|
||||
installs the recurrent, embedding and draft state before prefilling the
|
||||
suffix. A continuing session can reuse the live K/V without copying it.
|
||||
The engine publishes completed chunks and discards an invalid cache on
|
||||
restore failure so it can read the full prompt again. A separate
|
||||
request-end mode can save the committed reply state with decode-generated
|
||||
cells. The grid-mode equality results apply to prefills on the same grid.
|
||||
|
||||
\paragraph{Eviction under a shared byte cap.}
|
||||
Under a byte cap, the policy ranks each candidate for eviction by a
|
||||
heuristic
|
||||
\[
|
||||
\frac{p_v\,(\ell_v-\ell_{\mathrm{ancestor}(v)})}{m_{\mathrm{freed}}(v)}.
|
||||
\]
|
||||
Here $\ell_v$ is the length of the node's prefix,
|
||||
$\ell_{\mathrm{ancestor}(v)}$ is that of its nearest surviving ancestor,
|
||||
$p_v$ incorporates recency, evidence of branch reuse and a prior for
|
||||
session frontiers, and $m_{\mathrm{freed}}(v)$ counts the checkpoint
|
||||
and any blocks that would lose their last reference, excluding blocks
|
||||
needed by the incoming checkpoint. After selecting a victim, the policy
|
||||
recomputes both the fallback ancestor and the reclaimable bytes for the
|
||||
remaining candidates. Thus the score reflects work that the next
|
||||
eviction would add and memory it would free in the shared host store.
|
||||
|
||||
\section{Evaluation}
|
||||
|
||||
The experiments use one RTX 5090 (32~GB) and a Ryzen 9 9950X3D host
|
||||
with approximately 121~GiB of usable RAM. We compare KAR against native
|
||||
GGUF PLE inside the same runtime, sparse against full materialization of
|
||||
identical KAR bytes, and grid checkpointing against a legacy
|
||||
single-active-history policy. A live gateway smoke test exercises three
|
||||
Codex sessions. The appendix gives the software and model
|
||||
identities available from the measurement records \cite{leleka}. GB
|
||||
denotes $10^9$ bytes and GiB denotes $2^{30}$ bytes.
|
||||
|
||||
\subsection{Size and numerical cost of compression}
|
||||
|
||||
\begin{table}[ht]
|
||||
\centering
|
||||
\small
|
||||
\begin{tabular}{@{}lrrr@{}}
|
||||
\toprule
|
||||
Comparison & Reference & KAR or sparse & Reduction \\
|
||||
\midrule
|
||||
Complete source shards vs.\ level-2 archive (GB) & 83.618 & 55.296 & 33.87\% \\
|
||||
GGUF vs.\ level-2 PLE representation (GB) & 28.800 & 16.000 & 44.44\% \\
|
||||
Full vs.\ sparse KAR memory file (GiB) & 51.50 & 14.90 & 36.60 GiB \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\caption{Three byte comparisons at different boundaries. The first
|
||||
measures offline conversion. The second measures the serving table.
|
||||
The third measures allocated archive pages at the same encoding.}
|
||||
\label{tab:size}
|
||||
\end{table}
|
||||
|
||||
The complete level-2 archive contains 1,225 records at an accounted
|
||||
2.500025 bits per source weight (Table~\ref{tab:size}). The largest
|
||||
per-tensor relative $\ell_2$ reconstruction error is 0.6801. A separate
|
||||
57.64~MB sample containing expert and embedding slices illustrates
|
||||
the rate--distortion trade-off. Level 2 produces 36.97~MB with a maximum
|
||||
relative $\ell_2$ error of 0.334. Level 3 produces 51.76~MB with error
|
||||
0.160. These errors are relative to decoded source GGUF weights. For
|
||||
serving, the sparse view copies 16,000,348,672 bytes of the level-2
|
||||
archive in two extents.
|
||||
|
||||
In the paired sparse/full comparison, six balanced blocks use the same
|
||||
five-turn, roughly 245k-token workload. At the end of turn five,
|
||||
system \texttt{Shmem} is 55.2~GiB with the full archive and 18.6~GiB
|
||||
with the sparse view, and \texttt{MemAvailable} rises from 8.5 to
|
||||
45.1~GiB. The output check compares 2,057 top-16 log-probability rows
|
||||
and 1,036 draft-trace entries with bitwise agreement. The measured
|
||||
decode-rate difference is $+0.58\%$ (standard error 0.91 percentage
|
||||
points).
|
||||
|
||||
\begin{table}[ht]
|
||||
\centering
|
||||
\small
|
||||
\begin{tabular}{@{}lrr@{}}
|
||||
\toprule
|
||||
Replay metric & GGUF PLE & KAR level-2 PLE \\
|
||||
\midrule
|
||||
Prefill (tokens/s) & $3{,}741 \pm 5$ & $4{,}206 \pm 28$ \\
|
||||
Decode (tokens/s) & $181.6 \pm 0.8$ & $180.5 \pm 1.2$ \\
|
||||
Per-request prefill p10/p50/p90 & 1,394 / 2,366 / 4,717 & 1,440 / 2,560 / 5,449 \\
|
||||
Per-request decode p10/p50/p90 & 149.5 / 170.3 / 209.0 & 140.9 / 167.8 / 207.6 \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\caption{Paired replay with 59 fixed requests and three interleaved
|
||||
passes per arm. Aggregate rates are pass means $\pm$ sample standard
|
||||
deviation. Per-request prefill percentiles use requests with at least
|
||||
1,000 uncached tokens and decode percentiles use requests with at
|
||||
least 100 generated tokens.}
|
||||
\label{tab:replay}
|
||||
\end{table}
|
||||
|
||||
Table~\ref{tab:replay} holds the request sequence fixed across arms.
|
||||
The prefix store starts empty for each pass, both PLE tables are in
|
||||
host memory, and each pass processes 555,449 uncached prompt tokens.
|
||||
KAR increases prefill tokens/s by 12.4\% relative to GGUF, or about
|
||||
16.5 seconds less prefill across the trace. With three paired passes,
|
||||
the descriptive 95\% $t$ interval for the prefill difference is roughly
|
||||
$[383,547]$ tokens/s and that for the decode difference is
|
||||
$[-3.8,1.6]$ tokens/s, calculated from the rounded paired summaries.
|
||||
The sample comes from a single boot. The arms generate their own replies
|
||||
without feeding them into subsequent prompts, so total decode times
|
||||
reflect different output token counts.
|
||||
|
||||
\begin{table}[ht]
|
||||
\centering
|
||||
\small
|
||||
\begin{tabular}{@{}lrrrr@{}}
|
||||
\toprule
|
||||
PLE comparison & Top-1 $\lvert\Delta\log p\rvert$ p99
|
||||
& Argmax flips & Margin $\geq 0.25$ & Top-5 overlap \\
|
||||
\midrule
|
||||
GGUF vs.\ GGUF & 0.162 & 56 (1.87\%) & 5 & 0.967 \\
|
||||
KAR vs.\ KAR & 0.146 & 45 (1.50\%) & 3 & 0.968 \\
|
||||
KAR vs.\ GGUF & 0.468 & 128 (4.27\%) & 44 & 0.919 \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\caption{Teacher-forced numerical comparison at 3,000 positions per
|
||||
arm. Top-1 change measures the reference argmax's log-probability
|
||||
where it is present in both traces. The margin column counts flips
|
||||
where the reference top two tokens differ by at least 0.25 nats.}
|
||||
\label{tab:quality}
|
||||
\end{table}
|
||||
|
||||
The teacher-forced experiment uses two recorded 300-token continuations
|
||||
at each of five prompt lengths from 45,766 to 242,849 tokens. It uses
|
||||
repeated same-source runs to estimate the numerical variation of this
|
||||
configuration. The cross-encoding comparison exceeds the same-source
|
||||
variation (Table~\ref{tab:quality}). The two other cross-encoding
|
||||
pairings give 4.20\% and 4.70\% argmax flips. In a separate live
|
||||
comparison, two coding tasks with three runs per encoding give 12
|
||||
completions. All pass the final static acceptance checks, including
|
||||
re-scoring both arms after a shared acceptance-check correction.
|
||||
Browser probes identify a restart-button defect in one KAR-generated
|
||||
solution and inconclusive interaction failures in two others. This
|
||||
small task sample leaves the impact on agent quality unresolved.
|
||||
|
||||
\subsection{Interleaved session latency}
|
||||
|
||||
\begin{table}[ht]
|
||||
\centering
|
||||
\small
|
||||
\begin{tabular}{@{}lrr@{}}
|
||||
\toprule
|
||||
Four-session trace metric & Legacy & Shared prefix store \\
|
||||
\midrule
|
||||
Prompt tokens reused & 580,618 (26.5\%) & 1,927,168 (88.0\%) \\
|
||||
Prompt tokens processed anew & 1,608,955 & 262,405 \\
|
||||
TTFT mean / p50 (s) & 12.5 / 11.3 & 2.5 / 1.7 \\
|
||||
TTFT p95 / max (s) & 27.6 / 27.6 & 5.5 / 5.8 \\
|
||||
Sum of per-request TTFT (s) & 1,200 & 244 \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\caption{A seeded synthetic coding-agent workload of 24 requests
|
||||
per session. TTFT is time to first token. The sum aggregates request
|
||||
latencies across the trace.}
|
||||
\label{tab:short}
|
||||
\end{table}
|
||||
|
||||
The four-session test models interleaved coding histories with
|
||||
heavy-tailed tool outputs. Each session grows from roughly 3k to 40k
|
||||
tokens and shares about 2.5k initial tokens with the other sessions.
|
||||
Both modes use the same workload generator and serve one request at a
|
||||
time. The legacy arm uses the port's single-active-history cache with
|
||||
conversation parking unavailable in that arm. It loses the private
|
||||
active history when another session overwrites it. The shared store retains reusable blocks on a
|
||||
2,048-token grid within a 7.8~GiB cap. On the 96 requests covering
|
||||
2,189,573 prompt tokens, the store reduces p95 TTFT by a factor of 5.0
|
||||
(Table~\ref{tab:short}). The experiment is one recorded run per policy.
|
||||
Re-running the last request of each session with cache lookup and
|
||||
insertion bypassed reproduces all four tested greedy token sequences.
|
||||
|
||||
\begin{table}[ht]
|
||||
\centering
|
||||
\small
|
||||
\begin{tabular}{@{}lrrrr@{}}
|
||||
\toprule
|
||||
Prompt tokens / turn & Legacy TTFT (s) & Grid TTFT (s)
|
||||
& Grid reuse & Import (ms) \\
|
||||
\midrule
|
||||
103,051 / 2 & 28.1--28.2 & 2.33 & 98,304 & 101 \\
|
||||
106,082 / 3 & 28.6 & 2.79 & 98,304 & 101 \\
|
||||
183,051 / 2 & 53.1 & 4.76 & 172,032 & 175--177 \\
|
||||
186,082 / 3 & 53.6--53.7 & 2.72 & 180,224 & 182--194 \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\caption{Returning requests for two alternating sessions at each
|
||||
context scale, on an 8,192-token grid. Ranges cover sessions A and B.
|
||||
Import time is a component of the request, separate from suffix prefill.}
|
||||
\label{tab:long}
|
||||
\end{table}
|
||||
|
||||
In the long-context experiment, two sessions alternate for three turns.
|
||||
They share about 8k tokens and add about 3k per turn. Each session's
|
||||
first request is cold in grid mode because the shared prefix is shorter
|
||||
than one grid block. For returning requests, the legacy policy reuses
|
||||
7,998 tokens, whereas the new policy restores up to 180,224 tokens.
|
||||
Table~\ref{tab:long} shows an 11.2--19.7$\times$ TTFT ratio at the
|
||||
180k scale. End-of-third-turn greedy outputs match the cache-bypassed
|
||||
full grid prefill for both sessions at both depths. Cancellation during
|
||||
prefill and decode was exercised at 100k, with agreement on retry.
|
||||
|
||||
\subsection{Live gateway and queueing}
|
||||
|
||||
In a Codex CLI smoke test, an orchestrator and two workers share the
|
||||
same engine while implementing a web application. Of 122 requests, 44
|
||||
overlap another at the gateway and 48 switch the engine's live session.
|
||||
The median import time on a switch is 29~ms (max 48~ms), and 98.1\% of
|
||||
prompt tokens are reused. The p90 queue wait is 5.0~s and the maximum
|
||||
is 51~s. All 122 responses complete and all 161 function calls pass
|
||||
the recorded name and argument checks. The task takes 791~s, compared
|
||||
with 766~s for a same-boot single-agent run. Each arm has one trial and
|
||||
uses a different agent trajectory (127,288 versus 96,647 output tokens).
|
||||
This is evidence of working session alternation and a measurement of
|
||||
head-of-line blocking. The effect on time to task completion remains
|
||||
uncertain.
|
||||
|
||||
\section{Related work}
|
||||
|
||||
\paragraph{Progressive weights and sparse lookup.}
|
||||
Any-Precision LLM, Matryoshka Quantization, AnyBCQ and MatGPTQ support
|
||||
multiple precisions from one set of weights
|
||||
\cite{anyprecision,matquant,anybcq,matgptq}. MatMoE varies the precision
|
||||
of routed experts \cite{matmoe}. In particular, non-uniform Any-Precision
|
||||
also refines clusters and uses a codebook at each bit width
|
||||
\cite{anyprecision,matgptq}. KAR's grouping and scalar split rule come
|
||||
from Koference. Leleka serves PLE at a fixed precision in the evaluated
|
||||
profile, with the same Strata-derived expert path in both arms
|
||||
\cite{strata,fiddler}.
|
||||
|
||||
Engram uses token-derived n-gram lookups that support host placement
|
||||
and prefetch \cite{engram}. Strata reads selected rows from the native
|
||||
IQ4\_NL table of the same Qwen model \cite{strata}. The closest
|
||||
quantization comparison is Han et al.'s Conditional Program (CP),
|
||||
which uses Gaussian trellis codes and independently decodable rows.
|
||||
Their Qwen3.8-Flash-Next evaluation reports 13.4~GB at a two-bit code
|
||||
rate and 10.2~GB at a 1.5-bit code rate, including scale overhead.
|
||||
Their serving tests use DeepSeek on four or eight H200 GPUs
|
||||
\cite{twobitngram}. SlackTier evaluates lookup scheduling and tier
|
||||
placement by prefetch deadlines \cite{slacktier}. Leleka's deployment
|
||||
contribution is a KAR loader that materializes and verifies the
|
||||
reachable pages of a larger archive, preserves offsets for the
|
||||
existing row reader, and serves those rows from host RAM on one GPU.
|
||||
Comparing CP and KAR on the same runtime, weight source and request
|
||||
trace remains open.
|
||||
|
||||
\paragraph{Prefix reuse and recurrent checkpoints.}
|
||||
PagedAttention enables block-granular sharing, vLLM's automatic prefix
|
||||
cache uses parent hashes and reference counts, and SGLang and
|
||||
CachedAttention reuse prefixes across requests \cite{pagedattention,
|
||||
vllmhash,sglang,cachedattention}. SGLang's hybrid cache stores K/V and
|
||||
recurrent checkpoints with separate replacement lists, and its
|
||||
scheduler supports aligning chunks to a recurrent checkpoint grid
|
||||
\cite{sglanghybrid,sglanggrid}. Sparse Prefix Caching studies exact
|
||||
resume from selected recurrent states and optimizes their placement
|
||||
from a distribution of prefix overlaps \cite{sparseprefix}. The grid
|
||||
in Leleka serves a particular role in the port: it ties cache
|
||||
checkpoints to the floating-point chunk schedule while the saved state
|
||||
also includes the attention-index tails, embedding history and MTP ring.
|
||||
|
||||
Marconi combines recency and compute saved per footprint
|
||||
\cite{marconi}. HiState also accounts for reclaimed storage and added
|
||||
recomputation, using adaptive checkpoint spacing and separate SSD
|
||||
storage for historical states \cite{histate}. Leleka implements an
|
||||
online score for its shared host store in which token savings are
|
||||
measured relative to the nearest surviving ancestor and memory savings
|
||||
depend on block references after each tentative eviction. Upstream
|
||||
Strata parks conversation images in host RAM, lets another conversation
|
||||
borrow a checkpoint, and offers optional batched generation
|
||||
\cite{strata}. Leleka's design shares individual prefix blocks among
|
||||
checkpoints and restores the missing portion into one live slot.
|
||||
The measured latency comparison uses the port's single-active-history
|
||||
control. Relative performance against Strata's parking or batching and
|
||||
other hybrid caches remains an empirical question.
|
||||
|
||||
\section{Discussion and conclusion}
|
||||
|
||||
The two contributions address different parts of the serving state.
|
||||
The verified sparse loader keeps the compressed PLE path intact while
|
||||
removing the resident archive pages that the model never reads.
|
||||
The session store retains shared attention blocks and coupled model
|
||||
checkpoints so returning requests can resume in the same slot.
|
||||
The two mechanisms share the host memory budget. Measuring their joint
|
||||
effect would require varying both factors on the same workload.
|
||||
|
||||
The data cover one model and one primary GPU, mostly greedy inference,
|
||||
two coding tasks for the PLE comparison, and one live orchestration
|
||||
trial. Exact grid-resume checks compare short greedy continuations
|
||||
against a full read on the same grid. The configured 256k capacity,
|
||||
approximately 245k compression replay and 180k interleaved workload
|
||||
measure different operating points. The strongest demonstrated benefits
|
||||
are reduced host residency and time to first token for returning
|
||||
sessions, while the live trial identifies queueing as a separate limit
|
||||
on interactive performance.
|
||||
|
||||
\appendix
|
||||
\section{Experiment provenance}
|
||||
|
||||
\begin{table}[!ht]
|
||||
\centering
|
||||
\small
|
||||
\setlength{\tabcolsep}{4pt}
|
||||
\begin{tabular}{@{}ll@{}}
|
||||
\toprule
|
||||
Item & Git SHA or SHA-256 \\
|
||||
\midrule
|
||||
Leleka snapshot & \texttt{5db2a5da3d8230764201efa7a8994601df974e47} \\
|
||||
Strata reference & \texttt{41cf05a06a25dd29103b7b27a2279a3f60c21876} \\
|
||||
Koference codec & \texttt{806d2398ae1daaceb2917242911e5680cbfb3608} \\
|
||||
GGUF model pair & \texttt{80d5e3333801cedbca81a5c19c24ed6bb48fd56977acd190318f66b23a1766a3} \\
|
||||
KAR archive & \texttt{536d612ca60eab460cb978f51748fc6fa4e9d611d4601e777884e8b51385afa5} \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\caption{Source and artifact identifiers. The experiment descriptions
|
||||
give the builds used for each comparison.}
|
||||
\label{tab:revisions}
|
||||
\end{table}
|
||||
|
||||
\small
|
||||
\begin{description}
|
||||
\item[Source history.] The source revisions and weight digests are
|
||||
listed in Table~\ref{tab:revisions}. The local Strata import and patch
|
||||
set are documented in \path{docs/upstream.md}.
|
||||
\item[Weights.] The model-pair SHA-256 is the identity recorded by the
|
||||
KAR/GGUF PLE comparison. The records and aggregate results are listed in
|
||||
\path{docs/build-validation.md}, \path{docs/kar-sparse-memfd.md}
|
||||
and the release checklist (\texttt{Q12}, \texttt{A6}).
|
||||
\item[Sparse/full comparison.] The three-arm harness
|
||||
\path{scripts/e2e/decode/single-copy-ab.sh} compares the pre-change
|
||||
full copy, sparse copy and file-backed source in balanced order.
|
||||
The full/sparse results here use a fixed five-turn corpus, a
|
||||
300-token output cap, an 8,192-token grid, a 6,144~MiB prefix cap,
|
||||
disabled placement seeding and the same resident GGUF expert bank.
|
||||
\item[KAR/GGUF A/B.] Same rebuilt release package in both arms, based
|
||||
on \texttt{17e372944279} with opt-in native PLE changes and
|
||||
results in \path{docs/experiments/kar-off-ab-5090.md}
|
||||
(evidence commits \texttt{740d84113}, \texttt{5cc2257ea}).
|
||||
Ubuntu 26.04, Linux 7.0.0-38, CUDA toolkit 13.2.2,
|
||||
cuBLAS 12.9.1.4, NVIDIA driver 595.99.02 and Codex CLI 0.163.0.
|
||||
The server release record lists a 600~W GPU power limit.
|
||||
The replay uses INT8 K/V, request-end checkpoints and a 6,144~MiB
|
||||
prefix cap. Serialized pass order is KAR, GGUF, GGUF, KAR, KAR, GGUF.
|
||||
GGUF PLE is prewarmed in the page cache and KAR PLE uses a sparse
|
||||
sealed memory file. The paired numerical check uses a static expert
|
||||
tier. Aggregate tables and analysis are under
|
||||
\path{docs/e2e-data/kar-off-ab/}.
|
||||
\item[Session-cache controlled tests.] Generator introduced in
|
||||
\texttt{d53db650f}, policy introduced in \texttt{8ad4dd5d7}.
|
||||
Jobs 923 and 927 are the legacy and grid-cache four-session runs.
|
||||
\path{docs/prefix-cache.md} sections 2 and 3 report the four-session
|
||||
and alternating long-context results. The harness uses greedy decoding,
|
||||
16--24 tokens for the reported equality checks, MTP, static expert
|
||||
placement with seeding disabled, INT8 K/V and a 20,480-token
|
||||
GPU-resident K/V window. The driver series is 595.99 and the
|
||||
model shard 0 digest begins \texttt{4c1eb2ce}. The workloads are
|
||||
synthetic and run the real model.
|
||||
\item[Live smoke.] Package commit \texttt{83bdd85bb482} with Codex CLI
|
||||
0.163.0. Report and harness are recorded in \texttt{b54e334a8} and
|
||||
\texttt{7d580590d}, respectively. The warm-up precedes both task
|
||||
cells. Raw request captures and weights are outside the paper
|
||||
source package.
|
||||
\end{description}
|
||||
|
||||
\normalsize
|
||||
|
||||
\begin{thebibliography}{99}
|
||||
\bibitem{strata}
|
||||
Strata project.
|
||||
\href{https://github.com/Niko1221/Strata/blob/41cf05a06a25dd29103b7b27a2279a3f60c21876/docs/DETAILS.md}{\emph{Strata -- the details}}.
|
||||
Engine documentation at \texttt{41cf05a0}, October 2026.
|
||||
|
||||
\bibitem{leleka}
|
||||
Leleka project. \emph{Leleka source and measurement records}. Repository
|
||||
snapshot \texttt{5db2a5da3}, 2026. Evidence paths in Appendix~A.
|
||||
|
||||
\bibitem{koference}
|
||||
Koference project. \emph{KAR v2 format specification and reference
|
||||
decoder}. Revision \texttt{806d2398}, local research source. Reference
|
||||
decoder provenance is recorded in Leleka's \path{gpu/kar/README.md}.
|
||||
|
||||
\bibitem{anyprecision}
|
||||
Yeonhong Park et al.
|
||||
\emph{Any-Precision LLM: Low-Cost Deployment of Multiple,
|
||||
Different-Sized LLMs}. ICML, 2024.
|
||||
\url{https://arxiv.org/abs/2402.10517}.
|
||||
|
||||
\bibitem{matquant}
|
||||
Pranav Nair et al. \emph{Matryoshka Quantization}. 2025.
|
||||
\url{https://arxiv.org/abs/2502.06786}.
|
||||
|
||||
\bibitem{anybcq}
|
||||
Gunho Park et al. \emph{AnyBCQ: Hardware Efficient Flexible
|
||||
Binary-Coded Quantization for Multi-Precision LLMs}. 2026.
|
||||
\url{https://arxiv.org/abs/2510.10467}.
|
||||
|
||||
\bibitem{matgptq}
|
||||
Maximilian Kleinegger, Elvir Crn\v{c}evi\'c, and Dan Alistarh.
|
||||
\emph{MatGPTQ: Efficient and Accurate Inference over Nested
|
||||
Quantized Models}. 2026. \url{https://arxiv.org/abs/2602.03537}.
|
||||
|
||||
\bibitem{matmoe}
|
||||
Renjie Wei et al. \emph{MatMoE: Matryoshka Mixture-of-Experts with
|
||||
Dynamic Mixed-Precision Quantization for Efficient Inference}. 2026.
|
||||
\url{https://arxiv.org/abs/2611.01704}.
|
||||
|
||||
\bibitem{fiddler}
|
||||
Keisuke Kamahori et al.
|
||||
\emph{Fiddler: CPU-GPU Orchestration for Fast Inference of
|
||||
Mixture-of-Experts Models}. ICLR, 2025.
|
||||
\url{https://arxiv.org/abs/2402.07033}.
|
||||
|
||||
\bibitem{engram}
|
||||
Xin Cheng et al. \emph{Conditional Memory via Scalable Lookup:
|
||||
A New Axis of Sparsity for Large Language Models}. 2026.
|
||||
\url{https://arxiv.org/abs/2601.07372}.
|
||||
|
||||
\bibitem{twobitngram}
|
||||
Donghoon Han, Minseop Jung, Dong Woo Kwak, SeungJae Lee, and
|
||||
Junhoo Lee. \emph{N-Gram Memories at Two Bits: Quantizing Lookup Tables
|
||||
in Large Language Models}. 2026.
|
||||
\url{https://arxiv.org/abs/2610.21810v3}.
|
||||
|
||||
\bibitem{slacktier}
|
||||
Wen Huang and Jack Liu. \emph{Placing LLM Lookup Tables by Per-Layer
|
||||
Prefetch Deadlines}. 2026. \url{https://arxiv.org/abs/2611.13413}.
|
||||
|
||||
\bibitem{pagedattention}
|
||||
Woosuk Kwon et al. \emph{Efficient Memory Management for Large Language
|
||||
Model Serving with PagedAttention}. SOSP, 2023.
|
||||
\url{https://arxiv.org/abs/2309.06180}.
|
||||
|
||||
\bibitem{vllmhash}
|
||||
vLLM project. \emph{Automatic Prefix Caching}. Design documentation,
|
||||
v0.15.0. \url{https://docs.vllm.ai/en/v0.15.0/design/prefix_caching/}.
|
||||
|
||||
\bibitem{sglang}
|
||||
Lianmin Zheng et al. \emph{SGLang: Efficient Execution of Structured
|
||||
Language Model Programs}. 2024. \url{https://arxiv.org/abs/2312.07104}.
|
||||
|
||||
\bibitem{sglanghybrid}
|
||||
SGLang project.
|
||||
\href{https://pytorch.org/blog/hybrid-models-meet-sglang-more-than-full-attention/}{%
|
||||
\emph{Hybrid Models Meet SGLang: More than Full Attention}}.
|
||||
PyTorch Foundation technical article.
|
||||
|
||||
\bibitem{sglanggrid}
|
||||
SGLang project.
|
||||
\href{https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/managers/schedule_policy.py}{%
|
||||
\emph{Prefill scheduler and recurrent checkpoint alignment}}.
|
||||
Source code, accessed November 19, 2026.
|
||||
|
||||
\bibitem{cachedattention}
|
||||
Bin Gao et al. \emph{Cost-Efficient Large Language Model Serving for
|
||||
Multi-turn Conversations with CachedAttention}. USENIX ATC, 2024.
|
||||
\url{https://www.usenix.org/conference/atc24/presentation/gao-bin-cost}.
|
||||
|
||||
\bibitem{marconi}
|
||||
Rui Pan et al. \emph{Marconi: Prefix Caching for the Era of Hybrid
|
||||
LLMs}. MLSys, 2025. \url{https://arxiv.org/abs/2411.19379}.
|
||||
|
||||
\bibitem{sparseprefix}
|
||||
Mikhail Shirokikh and Sergey Nikolenko.
|
||||
\emph{Sparse Prefix Caching for Hybrid and Recurrent LLM Serving}.
|
||||
2026. \url{https://arxiv.org/abs/2605.05219}.
|
||||
|
||||
\bibitem{histate}
|
||||
Zaifeng Pan et al. \emph{HiState: Hierarchical Prefix Cache Management
|
||||
for Hybrid LLM Serving in Agentic Workloads}. 2026.
|
||||
\url{https://arxiv.org/abs/2610.41508}.
|
||||
\end{thebibliography}
|
||||
|
||||
\end{document}
|
||||
Reference in New Issue
Block a user