KAP: Bridging the Knowledge Selection-Runtime Consumption Gap in LLM Systems
This work addresses the inefficiency in large language model inference caused by flattening structured knowledge selection signals into ordinary token sequences, which leads to redundant key-value (KV) cache accesses, increased latency, and reduced throughput. To overcome this limitation, the paper introduces Knowledge Access Planning (KAP), a novel paradigm that elevates structured knowledge selection to a first-class runtime primitive. KAP bridges knowledge selection and KV cache consumption through a unified intermediate representation and leverages the GraphSpec compiler-executor framework to enable plan-driven, efficient KV cache access. Experimental results demonstrate that, on long-context question answering tasks ranging from 4K to 128K tokens, KAP achieves comparable answer quality while accessing only 5.5% of the original KV states, substantially reducing latency and redefining the scaling efficiency of long-context generation.