논문 해설
LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models
LaCache: 대형 언어 모델의 효율적인 장문맥 모델링을 위한 사다리 형태 KV 캐싱
- 연구 문제 LLM이 긴 입력을 처리하며 계속 생성할 때 KV 캐시 메모리가 커져 OOM이 발생할 수 있으며, 기존 방법은 장거리 정확도와 연속 생성을 함께 만족하기 어렵습니다.
- 연구 방법 LaCache는 학습 없이 KV 상태를 층 방향으로 사다리 모양으로 저장하고, 캐시가 찰 때마다 같은 패턴을 이미 압축된 캐시에 반복 적용합니다.
- 주요 결과 Llama2-7B-Chat의 Wikitext-2 조건, Llama3-8B의 PG19 장문 입력, Needle-In-A-Haystack과 RULER, LongBench 등에서 같은 캐시 예산의 StreamingLLM보다 나은 결과를 보고합니다.
장문 생성에서 KV 캐시가 겪는 문제
대규모 언어 모델이 긴 입력을 처리하고 계속 생성할 때 KV 캐시는 시퀀스 길이에 비례해 커지며, 이는 메모리 부족(OOM)으로 이어질 수 있습니다. 기존 방법들은 이 문제를 해결하면서도 두 요구를 함께 만족하기 어렵습니다. StreamingLLM은 최근 토큰만 고정 길이 윈도우에 유지하여 연속 생성은 가능하지만 장거리 정확도가 떨어집니다. Quest는 전체 KV 캐시를 저장하고 필요한 토큰을 검색하여 정확도는 높지만 긴 문맥에서 메모리 부담으로 OOM이 생길 수 있습니다. H2O는 주의 맵에 의존해 중요 토큰을 고르므로 FlashAttention과 같은 명시적 주의 맵을 계산하지 않는 효율적 구현과 호환되기 어렵습니다.
이 논문은 이러한 상황에서 고정된 저장 예산 안에서 장거리 의존성을 넓게 포착하면서 연속 생성을 지원하는 방법을 다룹니다.

Figure 1 . Illustrative comparisons among (a) recency-based KV cache (Xiao et al., 2023b), (b) retrieval-based KV cache (Tang et al., 2024), and (c) our proposed LaCache featuring a ladder-shaped pattern. Previous KV cache storage strategies struggle to simultaneously balance the needs for both continuous generation without OOM and robust long-range capabilities. In contrast, our proposed LaCache allows LLMs to simultaneously satisfy the two requirements.
원문 · CC BY 4.0 · Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin · LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.사다리 모양 KV 캐시 패턴
LaCache는 학습이 필요 없는 KV 캐시 최적화 방법으로, KV 쌍을 토큰 순서뿐 아니라 층 방향으로도 나누어 저장합니다. 핵심 아이디어는 최근 토큰이 생성 정확도에 중요하지만 그 KV 캐시는 더 적은 층이 처리해도 충분할 수 있다는 점입니다. 이에 따라 초기 토큰의 KV 상태는 앞쪽 층에 보존하고, 이후 토큰은 뒤쪽 층으로 점차 옮겨 가는 계단형 구조를 만듭니다. 이 패턴에서 span S는 같은 토큰의 KV 상태를 보존하는 연속 층의 수이고, overlap O는 각 층에 보존되는 토큰 수입니다. S가 커지면 같은 토큰의 문맥을 더 많은 층에 기록하지만 저장 비용이 늘고, O가 커지면 층마다 더 많은 KV 상태를 보존하여 정확도와 저장 효율 사이의 균형이 바뀝니다.
저자들은 사다리 구조가 각 층의 커버리지를 가능한 고르게 유지하여 정보 보존의 하한을 개선한다고 해석합니다.

Figure 2 . An illustration of LaCache’s KV cache storage pat- tern. LaCache is leveraged to compact the original full KV cache into a compressed, ladder-shaped pattern, allowing for the storage of information from longer-range tokens compared to StreamingLLM (Xiao et al., 2023b) under the same KV cache budget, thereby providing stronger long-range sequence modeling.
원문 · CC BY 4.0 · Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin · LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.반복 압축으로 연속 생성 지원
사다리 패턴만으로는 생성 길이가 무한히 늘어나는 상황을 다루기 어렵습니다. 그래서 LaCache는 KV 캐시가 미리 정한 크기에 도달할 때마다 이미 압축된 KV 캐시에 같은 사다리 패턴을 다시 적용합니다. 이 과정에서 패턴 밖의 KV 상태는 버려지고 확보된 공간에 새 토큰이 들어갑니다. 반복 적용의 결과 오래된 KV 상태는 더 많이 압축되고 최근 KV 상태는 덜 압축되므로 최근 정보를 더 잘 보존합니다. 저자들은 이 방식이 최근성 기반 방법의 설계 원칙과 맞다고 설명합니다.
언어 모델링 결과와 해석
Wikitext-2 실험에서 Llama2-7B-Chat은 KV 캐시 예산 512와 1K 입력 조건에서 전체 캐시 perplexity 4.94, StreamingLLM 6.67, LaCache 5.20을 보였습니다. 이 조건에서 LaCache의 perplexity 증가는 전체 캐시 대비 약 5%이고 StreamingLLM은 약 35%입니다. PG19 실험에서 Llama3-8B는 전체 캐시가 8K 이후 perplexity가 빠르게 증가하고 160K 입력에서 단일 A100 GPU에서 OOM이 발생한다고 보고됩니다. 같은 실험에서 LaCache는 600K 입력까지 합리적인 perplexity를 유지한다고 보고됩니다.
이 결과는 해당 모델과 설정에서 얻은 것이며, 다른 모델과 과제로 일반화하려면 별도 검증이 필요합니다.

Table 1 . Language modeling experiments are conducted on the concatenated Wikitext-2-raw-v1 dataset. We use decoding lengths ranging from 1K to 16K for each tested model and cache budget. When the decoding length exceeds the pre-training length, models using a full cache encounter a perplexity explosion issue. The numbers in brackets indicate the cache size.
원문 · CC BY 4.0 · Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin · LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models · 원문 그림 인용 · 원본 PDF 5쪽에서 그림 영역을 추출했습니다.
Figure 5 . Evaluate LaCache on the first ten books of the concate- nated PG19 dataset, corresponding to a length of 600K tokens.
원문 · CC BY 4.0 · Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin · LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models · 원문 그림 인용 · 원본 PDF 6쪽에서 그림 영역을 추출했습니다.장문맥 이해 벤치마크 결과
장문맥 이해 실험에서 Needle-In-A-Haystack은 Llama3.2-3B-Instruct-128k 모델에서 50% 캐시 예산일 때 StreamingLLM의 정확도 54.54%를 LaCache 99.16%로 높였다고 보고됩니다. RULER 실험에서는 LongChat-7b-v1.5-32k 모델이 50% 캐시 예산 조건에서 StreamingLLM 평균 44.82, LaCache 평균 50.88을 기록했습니다. LongBench에서는 LLaMA2-13B-Chat의 50% 캐시 예산 조건에서 평균 성능 저하가 StreamingLLM 2.4에서 LaCache 1.5로 줄었다고 보고됩니다. 각 결과는 서로 다른 모델과 벤치마크 설정에서 얻은 값이므로 하나의 공통 프로토콜로 묶어 해석하지 않습니다.

Table 3 . Evaluate LaCache on Llama2-7B/13B-Chat models across 21 LongBench datasets under 50% and 25% KV cache budgets.
원문 · CC BY 4.0 · Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin · LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.
Table 5 . Evaluate LongChat-7b-v1.5-32k model (Li et al., 2023) on the RULER benchmark (Fu et al., 2024a) under a 50% cache budget setting. A higher number indicates better performance.
원문 · CC BY 4.0 · Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin · LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.설정 선택과 한계
언어 모델링에서 span S는 모델 층 수의 1/4로 설정되며, 이 값은 Llama2-7B-Chat과 256 캐시 예산, Wikitext-2 조건의 ablation 결과에 근거합니다. 원문은 사다리 패턴이 모든 상황에서 최적이라고 보장하지 않으며, fine-tuning을 포함한 확장은 향후 과제로 남겨 둔다고 밝힙니다. 따라서 이 결과는 학습 없이 적용하는 설정의 범위 안에서 읽어야 하며, 다른 모델이나 과제에 그대로 옮기는 것은 확인되지 않은 일입니다.
논문 정보
- 저자
- Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin
- 학회·저널
- arXiv · 프리프린트
- 최초 공개일
- 2025년 7월 14일
- 등록일
- 2026년 10월 29일
- 수정일
- 2025년 7월 14일
- 버전
- v1
- arXiv
- 2507.14204
- 원문 이용 조건
- CC BY 4.0
- 제공 범위
- 논문 정보, 해설, 허용된 원문 그림
AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.
초록
Recent advancements in Large Language Models (LLMs) have spurred interest in numerous applications requiring robust long-range capabilities, essential for processing extensive input contexts and continuously generating extended outputs. As sequence lengths increase, the number of Key-Value (KV) pairs in LLMs escalates, creating a significant efficiency bottleneck. In this paper, we propose a new KV cache optimization paradigm called LaCache, a training-free method for efficient and accurate generative inference of LLMs. LaCache enables LLMs to simultaneously address both of the critical challenges in long-range modeling: robust long-range capabilities and continuous generation without running out-of-memory (OOM). Specifically, LaCache integrates two key innovations: (1) a ladder-shaped KV cache pattern that stores KV pairs not only sequentially (left-to-right within each layer) but also across layers (from shallow to deep), providing an extended span for capturing long-range dependencies under a fixed storage budget, thereby boosting long-range capabilities; and (2) an iterative compaction mechanism that progressively compresses older caches, freeing up space for new tokens within a fixed cache size. This token distance-based dynamic compression enables more effective continuous generation under constrained cache budgets. Experiments across various tasks, benchmarks, and LLM models consistently validate LaCache's effectiveness in enhancing LLMs' long-range capabilities. Our code is available at https://github.com/GATECH-EIC/LaCache.
원문 인용
Shi, Dachuan, Fu, Yonggan, Yuan, Xiangchi, Yu, Zhongzhi, You, Haoran, Li, Sixu, Dong, Xin, Kautz, Jan, Molchanov, Pavlo, Yingyan, Lin (2025). LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models. arXiv:2507.14204v1. https://arxiv.org/abs/2507.14204v1
BibTeX
@misc{dachuan2025lacache,
title = {{LaCache: Ladder-Shaped KV Caching for Efficient Long-Context Modeling of Large Language Models}},
author = {Shi, Dachuan and Fu, Yonggan and Yuan, Xiangchi and Yu, Zhongzhi and You, Haoran and Li, Sixu and Dong, Xin and Kautz, Jan and Molchanov, Pavlo and Yingyan and Lin},
year = {2025},
eprint = {2507.14204},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2507.14204v1}
}