arXiv(opens in a new tab)cs.CLAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.12121

QV-PIC: Query-Aware Visual Position-Independent Caching for Efficient RAG Serving

Yilin Liu, Rui Meng, Wangze Ni, Jianxin Yan, Heng Cao, Libin Zheng, Peng Cheng, Jinfei Liu

Abstract

Retrieval-Augmented Generation (RAG) repeatedly prefills identical text chunks across queries, incurring redundant computations. Position-Independent Caching (PIC) mitigates it by reusing precomputed Key-Value (KV) across positions, but its efficiency is constrained by the large volume of text tokens. Rendering text chunks as images can compress the text into fewer visual tokens, but the rendered-image PIC suffers more severe quality degradation than the text PIC. This representation-specific gap primarily arises from contextual mismatches across independently compiled caches and the loss of fine-grained textual evidence during visual compression. Existing PIC repair methods mainly address the former through selective recomputation, but they incur online computation and cannot recover lost textual details. We propose QV-PIC, a query-aware dual-resolution PIC reuse framework guided by model-native templates. Offline, QV-PIC compiles visual caches under the model’s native chat-template prefix, improving PIC quality without online recomputation. Online, it preserves global context with low resolution and restores fine-grained textual evidence within a high-resolution budget by cumulative query relevance scores, retaining the efficiency benefit of visual compression. Across six tasks, QV-PIC improves average F1 by 21.6 points over vanilla rendered-image PIC, closes the gap to vanilla text PIC, and surpasses optimized text PIC by 2.58 F1 while reducing TTFT by 17.2%. Relative to full prefill, it cuts TTFT by 83.8%.

Introduction

Retrieval-Augmented Generation (RAG) augments user queries for Large Language Models (LLMs) with retrieved external documents to support knowledge-intensive tasks (Lewis et al. 2020; Guu et al. 2020; Karpukhin et al. 2020; Borgeaud et al. 2022). In long-document RAG, identical document chunks are repeatedly prefilled across queries, incurring redundant prefill computation. Dynamic retrieval rearranges retrieved chunks with different contextual positions, preventing efficient reuse of caches that rely on exact prefix matching or predefined structures (Gim et al. 2024; Jin et al. 2025; Zheng et al. 2024). Position-Independent Caching (PIC) addresses this limitation by compiling reusable chunks independently and composing their Key-Value (KV) caches at serving time, enabling cross-position reuse of repeated content. Existing RAG-oriented PIC methods (Yao et al. 2025; Hu et al. 2025) are predominantly text-based. Although repeated prefill is eliminated, the transmission and computation costs associated with KV caches scale with context length (Kwon et al. 2023; Liu et al. 2024; Qin et al. 2025a).

Visual-text compression offers a complementary opportunity to shorten reusable context representations. By rendering text chunks as compact images, Vision-Language Models (VLMs) can encode multiple textual units into one visual token, increasing per-token information density (Li et al. 2025; Xing et al. 2025; Wei et al. 2025). We refer to PIC over rendered images as rendered-image PIC, in contrast to text PIC over the original text chunks. Glyph (Cheng et al. 2025), for example, achieves 3-4×\times token compression while retaining long-context performance comparable to similarly sized text-only LLMs. This result suggests that rendered images can substantially shorten the reusable KV sequence while preserving useful document information under full prefill, motivating rendered-image PIC reuse across queries for efficient RAG serving.

Figure

Figure 1: Rendered-image PIC uses fewer KV tokens but incurs a larger full-prefill-to-PIC quality drop than text PIC on Glyph across six LongBench QA tasks at 72 DPI.

This opportunity raises a core question for efficient RAG serving: can rendered-image PIC match the reuse quality of text PIC? Under identical conditions, we compare text and rendered-image PIC using Glyph across six LongBench Question-Answering (QA) tasks. As shown in Figure 1, although rendering substantially reduces token count, rendered-image PIC suffers greater degradation from full prefill than text PIC. This indicates that rendered images cannot directly inherit the PIC reuse capability of text. This representation-dependent gap reflects two coupled failure modes. First, independently compiled caches lack the contextual conditions available during full prefill, causing cache-state mismatch after composition. Second, text tokenization preserves characters and words as discrete symbols, whereas visual encoding compresses characters, digits, punctuation, and local layout into fewer visual tokens, each aggregating multiple textual units. Fine-grained answer-bearing evidence may therefore be blurred, conflated, or omitted before the rendered-image KV cache is constructed. Rendered-image PIC must consequently address both compilation-context mismatch and fine-grained evidence loss.

Prior PIC repair methods primarily address the first failure mode through selective recomputation or chunk-boundary correction (Yao et al. 2025; Hu et al. 2025; Zhao et al. 2025b; Qin et al. 2025b). Such methods can refresh context-dependent states after caches are composed, but they introduce additional computation into the online path and operate on an already fixed visual representation. They cannot reconstruct characters, digits, punctuation, or layout cues that were not preserved during visual encoding. This limitation is particularly consequential for rendered images, whose answer-bearing information often lies in fine-grained textual details rather than the coarse visual semantics sufficient for natural-image understanding. Consequently, efficient rendered-image PIC poses two key challenges:

Challenge 1: Efficient and stable repair of compilation-context mismatch. Prepending disposable prefix during compilation and stripping it afterward can absorb chunk-initial attention sinks without online recomputation. But arbitrary dummy prefixes induce prefix-dependent cache states, making the repair sensitive to token identity and length.

Challenge 2: Efficient restoration of visual-text details. Rendering resolution not only controls textual legibility but also visual-token count. Uniform low resolution is efficient but risks discarding fine-grained evidence. High resolution preserves richer textual details but sharply increases tokens, eroding the efficiency gains of visual-text compression.

In response to these challenges, we propose QV-PIC, a model-native template-conditioned and query-aware dual-resolution framework for rendered-image PIC, which transforms fixed text chunks into controllable fine-grained units. For Challenge 1, QV-PIC compiles each rendered image under the model-native chat-template prefix and strips the shared-prefix KV entries before storage. This native template provides the request-invariant prompt-format condition that is present during full prefill, reducing systematic compilation-context mismatch without online recomputation. For Challenge 2, QV-PIC precompiles low- and high-resolution cache versions for each rendered image. At serving time, it begins with complete low-resolution context coverage and promotes only a bounded set of query-relevant rendered images to high resolution according to cumulative query relevance. The two components are complementary: template-conditioned compilation first solidifies the quality foundation of the rendered image PIC, and query-aware dual-resolution allocation then restores query-specific textual details. The online path requires no rendered-image generation, visual encoding, or context-side full prefill. Our contributions are summarized as follows:

  • We reveal the significant impact of text and rendered image representations on PIC reuse. For identical text content, rendered-image PIC suffers more severe degradation than text PIC, but the former has more potential in quality-latency performance.
  • We propose QV-PIC, a template-conditioned and query-aware dual-resolution framework for rendered-image PIC. It efficiently reduces the compilation-context mismatch and improves fine-grained textual evidence fidelity of rendered-image PIC.
  • We demonstrate that QV-PIC achieves consistent quality-latency improvements. QV-PIC improves average F1 by 21.6 points over vanilla rendered-image PIC, eliminating its 12.2-point gap to vanilla text PIC and outperforming optimized text PIC by 2.58 points while reducing TTFT by 17.2%. Compared with full prefill, it reduces online prefill time by 83.8%.

References (22)