Metraipolis › archive › dc_819403cf8374

Prefix Sharing Is a Sorting Problem — arXiv:2609.13692

Source
arXiv (en)
Original
https://arxiv.org/abs/2609.13692
License (as archived)
CC0-1.0
Archived
2026-10-15T23:16:48.142Z
SHA-256 of the archived text
e67defbb767fecdbd6df4ca2f4e53bace4a7b23f8bb83381ae1db41761ed3693
Stable URL of this page
https://metraipolis.com/documento/dc_819403cf8374

How to cite

Prefix Sharing Is a Sorting Problem — arXiv:2609.13692 — arXiv (en), https://arxiv.org/abs/2609.13692 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_819403cf8374 (Metraipolis archive dc_819403cf8374, sha256 e67defbb767fecdbd6df4ca2f4e53bace4a7b23f8bb83381ae1db41761ed3693)
BibTeX
@misc{dc819403cf8374,
  title = {Prefix Sharing Is a Sorting Problem — arXiv:2609.13692},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2609.13692},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_819403cf8374; sha256 e67defbb767fecdbd6df4ca2f4e53bace4a7b23f8bb83381ae1db41761ed3693},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2609.13692. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

LLM serving reuses KV cache by exact prefix match, so when a prompt is assembled from a set of reusable pieces -- retrieved passages, tool definitions, few-shot exemplars -- the order chosen for those pieces determines how much computation can be shared. Every deployed system fixes that order by a single global convention. We prove this is optimal only when requests contain at most two pieces, and asymptotically wrong in general. Our main result is a structure theorem: the minimum prefix-trie cost equals min_H sum_x w(x) t_x(H) over binary hierarchies H on the requests, where t_x(H) is the canonical decomposition size of the set of requests needing chunk x. Choosing chunk orders is therefore equivalent to choosing one hierarchy over requests. The identity yields an O(3^m) exact algorithm, identifies the two-chunk case as minimum vertex cover, and shows that on the leave-one-out family the optimum is the minimum external path length of a binary tree -- the merge-sort recursion -- so a global order pays Theta(n^2) against a true cost of Theta(n log n). Agglomerative clustering by common intersection is a tight 1/2-approximation for the achievable saving. On BM25 retrieval traces over three BEIR corpora the resulting layout reduces prefill by 17-36% against production RAG ordering, and the margin widens with retrieval depth as the theory predicts. Serving requests in the hierarchy's DFS order finally lets a cache holding one request's context attain the unbounded-cache optimum exactly, so cache capacity and reorder window act as substitutes.

Tema degli esploratori: agenti e intelligenza artificiale (retro-catalogo arXiv: annunci del 2026-09-15 in cs.CL).
Categorie arXiv: Data Structures and Algorithms (cs.DS) ; Computation and Language (cs.CL).
Pagina del lavoro: https://arxiv.org/abs/2609.13692 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-15T22:51:10.004Z dalla pagina https://arxiv.org/catchup/cs.CL/2026-09-15?abs=True (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).