Abstract: Deploying large language models (LLMs) on edge devices enables personalized agents with strong privacy and low cost. However, with tens to hundreds of billions of parameters, single-batch autoregressive inference suffers from extremely low arithmetic intensity, creating severe weight-loading and bandwidth pressures on resource-constrained platforms. Recent in-flash computing (IFC) solutions alleviate this bottleneck by co-locating weight-related linear computations in the decode phase with flash, yet still rely on DRAM for the key-value (KV) cache. As context length grows, the KV cache can exceed model weights in size, imposing prohibitive DRAM cost and capacity requirements. Attempts to offload KV cache to flash suffer from severe performance penalties. We propose KVNAND, the first DRAM-free, IFC-based architecture that stores both model weights and KV cache entirely in compute-enabled 3D NAND flash. KVNAND addresses the fundamental performance challenges of flash under intensive KV cache access by leveraging IFC for all memory-bound operations to reduce data transfer overhead, introducing head-group parallelism to boost throughput, and employing page-level KV cache mapping to align token access patterns with flash organization. In addition, we propose a design space exploration framework that evaluates discrete and compact KVNAND variants to balance weight and KV placement, automatically identifying the optimal design trade-off. These techniques mitigate latency, energy, and reliability concerns, turning flash into a practical medium for long-context KV storage. Evaluations on MHA 7B and GQA 70B LLMs show that KVNAND achieves 1.98×/1.94×/2.05× geomean speedup at 128/1K/10K-token contexts compared to DRAM-equipped IFC designs and addresses out-of-memory failures at 100K context length.
The Memory Wall and the KV Cache Crisis
Running Large Language Models (LLMs) on edge devices like smartphones and laptops faces two massive hurdles: capacity and bandwidth.
- Capacity: Modern LLMs (like LLaMA-70B) require over 140GB for weights alone, while most consumer devices are limited to 8–16GB of DRAM.
- The KV Cache Crisis: To maintain context during a conversation, LLMs use a Key-Value (KV) cache. This cache grows linearly with context length. For long documents or extended interactions, the KV cache can exceed the size of the model weights themselves, leading to "Out-of-Memory" (OOM) errors on devices with limited DRAM.
While previous "In-Flash Computing" (IFC) research suggested storing weights in flash to save DRAM, those systems still relied on DRAM for the KV cache. Moving KV data between traditional flash and the processor is too slow, creating a massive latency bottleneck that prevents practical long-context inference.
KVNAND: A DRAM-Free Architecture
KVNAND is a hardware-software co-design that eliminates the need for expensive DRAM by storing both model weights and the KV cache entirely within compute-enabled 3D NAND flash. In this architecture, the NPU (Neural Processing Unit) handles complex non-linear logic, while the 3D NAND flash performs the heavy lifting of memory-bound matrix multiplications directly where the data resides.
Key Innovations
- Architectural Variants: The researchers propose two configurations. KVNAND-Discrete (D) partitions flash dies into separate groups for weights and KV cache to enable Head-Group Parallelism, overlapping QKV generation with attention calculations. KVNAND-Compact (C) co-locates weights and KV cache in the same dies, optimizing for shorter contexts where Feed-Forward Network (FFN) layers are the primary bottleneck.
- Page-Level KV Cache Mapping: Flash memory reads and writes data in "pages" (typically 4KB). Standard KV cache access is often fragmented, leading to significant read amplification. KVNAND organizes KV entries by layer and head group to align perfectly with flash page boundaries, drastically increasing throughput.
- Design Space Exploration (DSE): A specialized framework automatically determines the optimal die allocation based on the specific model architecture and target context length, balancing the needs of weight loading and KV cache access.
Key Insights and Results
- Flash as a Processor: By treating 3D NAND flash as a compute medium rather than just storage, KVNAND leverages massive internal bandwidth to process data in-place, avoiding the energy and latency costs of the "memory trip" to the NPU.
- Error Tolerance: The study found that KV cache data is more tolerant of bit errors than model weights due to the "masking" effect of the Softmax operation. This makes flash—which has lower reliability than DRAM—a viable medium for KV storage.
- Performance Gains: KVNAND achieved geomean speedups of 1.98×, 1.94×, and 2.05× at 128, 1K, and 10K token contexts, respectively, compared to IFC designs that still use DRAM for KV caching.
- Extreme Context Support: The system successfully handled 100K-token contexts on a 70B model, whereas baseline systems failed due to OOM errors. It maintained a usable inference speed of 10 tokens/s for a LLaMA3.1-8B model at this extreme context length.
Limitations and Future Work
While KVNAND represents a breakthrough for on-device AI, challenges remain. NAND flash has limited write endurance; although the authors use "Access-Aware Block Allocation" to balance wear, long-term reliability under heavy KV cache usage requires further study. Additionally, KVNAND requires specialized compute-enabled flash dies, which are not yet standard commodities. Future work will likely focus on optimizing the compute-heavy "prefill" phase and further improving the endurance of flash-based KV storage.
Summary updated