[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-84188-en":3,"doc-seo-84188-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},84188,962075114765,"Quinn","https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd",6,"Technology","Fractal KV-Cache Archives: Lossless Symbolic Storage with In-Place Retrieval for Long-Context LLM Inference","The KV cache is the dominant memory cost in long-context autoregressive inference, motivating compression via quantization, eviction, or offloading. This work studies how, after KV states are quantized into codebook indices, the resulting symbol stream should be stored and whether the storage layer can also support retrieval. It reuses contractive iterated-map codes to build a lossless, linear-time archive enabling O(1) random access, O(1) amortized append, and direct substring search on stored vectors without reconstructing surrounding text.","arXiv :2607 .07 144v 1 [ cs .LG] 8 Jul 2026  \nFractal KV-Cache Archives:  \nLossless Symbolic Storage with In-Place Retrieval for Long-Context LLM Inference  \nVladimir Gusev  \nIndependent Researcher  \n[vladimir@scriptum.ru](vladimir@scriptum.ru)  \n[ORCID: 0009-0006-4236-9190](ORCID: 0009-0006-4236-9190)  \nJuly 9, 2026  \nAbstract  \nThe key–value (KV) cache dominates the memory cost of long-context autoregressive inference, and a growing body of work compresses it through quantization, eviction, or offloading. We study a complementary question: once a position’s KV state has been quantized to codebook indices, how should the resulting symbol stream be stored, and can the storage layer do more than store? A family of contractive iterated-map codes that serialize a symbol sequence into a sequence of low-dimensional real vectors is revisited, and it is shown that they form a natural archive format for a quantized KV cache with the following features. The method provides exactly the access pattern a growing cache requires. It is lossless, it runs in linear time, and supports O(1) random access and O(1) amortized append. A controlled study of the quantizer feeding this archive is conducted on GPT-2 with 1024-token contexts. Keeping a small exact window (4 attention sinks + 32 recent tokens) and archiving the rest, per-head residual vector quantization reduces the archived cache by 36–54× relative to an fp16 cache at a perplexity cost of 11–15%, and we quantify a sharp key/value asymmetry—quantizing keys is roughly 4× more damaging than quantizing values, consistent with prior low-bit KV work—and use it to allocate bits in a hybrid scheme. Finally, we show the archive is simultaneously a search index:  \napproximate substring queries execute directly on the stored vectors, and matched context is decoded from the matched vector without ever materializing the surrounding text. We release all code; every number reproduces from a single command on a laptop CPU.  \n1 Introduction  \nServing a transformer language model over a long context is increasingly a memory problem rather than a compute problem. To generate each new token the model attends to cached key and value vectors for every previous position in every layer; for GPT-2 this KV cache is 2×12×12×64 = 18,432 scalars per token, and for production-scale models it reaches hundreds of kilobytes per token, so that for long documents the cache dwarfs the model weights and becomes the binding constraint on batch size and context length. The dominant responses are lossy: low-bit quantization of the cached tensors, eviction of “unimportant” positions, and offloading of cold cache to slower memory [1, 2 , 3 , 4] .  \nThis paper isolates a question that sits downstream of the lossy step and is usually left implicit. Suppose a position’s KV state has already been reduced to a handful of codebook indices by vector  \nquantization. Those indices are a symbol stream. How should the stream be stored, and–more interestingly–can the storage layer serve retrieval and random access rather than being an inert blob? We show that a lossless contractive iterated-map code answers both. Concretely, we test three claims: (i) the code is a lossless, linear-time store with sub-millisecond random access and append; (ii) with a small exact window, per-head residual VQ archives the remaining cache atmore than 30× compression versus an fp16 cache for a bounded, measured perplexity cost; and (iii) substring queries resolve directly on the stored vectors at full recall. The success criterion for each is stated with its experiment.  \nThe code. We use a contractive iterated-map code that reads a symbol sequence over an alphabet of size N and produces a trajectory of points in the plane: a regular N-gon is fixed, one vertex per symbol, and each symbol ck maps the running point by pk = V (ck) + r (pk−1 − V (ck)) for a contraction ratio r. These N contractions form an iterated function system, and the set of points it can reac","cbCaiiXpy3UbSIS5","https://ap.wps.com/l/cbCaiiXpy3UbSIS5","pdf",449986,1,8,"English","en",105,"# Introduction\n## The Code (Contractive Iterated-Map / Fractal Archive)\n## Contributions","[{\"question\":\"What problem does the KV-archive method target in long-context LLM inference?\",\"answer\":\"It targets the high memory cost of the KV cache, which grows with context length and can constrain batch size and achievable context length. The approach compresses and organizes the cached KV information while preserving efficient access.\"},{\"question\":\"How does the archive support O(1) random access and O(1) amortized append?\",\"answer\":\"The method encodes the quantized symbol stream using a contractive iterated-map code and allows decoding via an anchored backward search over fixed-length spans. This design yields O(1) random access to any past position and O(1) amortized append for growing caches.\"},{\"question\":\"How are substring queries handled without materializing surrounding text?\",\"answer\":\"Approximate substring queries are executed directly on the stored vectors in the archive. When a match is found, the matched context is decoded from the matched vector without ever reconstructing the surrounding text.\"}]",1784193800,20,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"fractal-kv-cache-archives-lossless-symbolic-storage-with-in-place-retrieval-for-long-context-llm-inference","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/technology/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/fractal-kv-cache-archives-lossless-symbolic-storage-with-in-place-retrieval-for-long-context-llm-inference/84188/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"What problem does the KV-archive method target in long-context LLM inference?","Question",{"text":75,"@type":76},"It targets the high memory cost of the KV cache, which grows with context length and can constrain batch size and achievable context length. The approach compresses and organizes the cached KV information while preserving efficient access.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does the archive support O(1) random access and O(1) amortized append?",{"text":80,"@type":76},"The method encodes the quantized symbol stream using a contractive iterated-map code and allows decoding via an anchored backward search over fixed-length spans. This design yields O(1) random access to any past position and O(1) amortized append for growing caches.",{"name":82,"@type":73,"acceptedAnswer":83},"How are substring queries handled without materializing surrounding text?",{"text":84,"@type":76},"Approximate substring queries are executed directly on the stored vectors in the archive. When a match is found, the matched context is decoded from the matched vector without ever reconstructing the surrounding text.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,113,118,122,126,129,133],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":111,"slug":112},50,"technology",{"id":114,"doc_module":4,"doc_module_name":45,"category_name":115,"show_sort_weight":116,"slug":117},7,"Healthcare",40,"healthcare",{"id":21,"doc_module":4,"doc_module_name":45,"category_name":119,"show_sort_weight":120,"slug":121},"Research & Report",30,"research-report",{"id":123,"doc_module":4,"doc_module_name":45,"category_name":124,"show_sort_weight":28,"slug":125},9,"Religion & Spirituality","religion-spirituality",{"id":28,"doc_module":4,"doc_module_name":45,"category_name":127,"show_sort_weight":28,"slug":128},"World Cup","world-cup",{"id":130,"doc_module":4,"doc_module_name":45,"category_name":131,"show_sort_weight":130,"slug":132},10,"Lifestyle","lifestyle",{"id":134,"doc_module":4,"doc_module_name":45,"category_name":135,"show_sort_weight":106,"slug":136},19,"General","general"]