ChatPaper.aiChatPaper

얕은 프리필, 깊은 디코딩: 레이어 비대칭 KV 가시성을 통한 효율적인 장문맥 추론

Shallow Prefill, Deep Decoding: Efficient Long-Context Inference via Layer-Asymmetric KV Visibility

May 7, 2026
저자: Jungsuk Oh, Hyeseo Jeon, Hyunjune Ji, Kyongmin Kong, Jay-Yoon Lee
cs.AI

초록

디코더 전용 언어 모델에서 장문맥 추론은 긴 프롬프트가 프리필 단계에서 처리되고, 모든 계층에서 캐싱되며, 자기회귀적 디코드 단계 동안 반복적으로 어텐션을 받기 때문에 비용이 많이 든다. 본 논문에서는 얕은 프리필, 깊은 디코드(SPEED)를 제안한다. 이는 앵커가 아닌 프롬프트 토큰의 KV 상태를 하위 계층에서만 구체화하고, 디코드 단계 토큰은 전체 깊이로 유지하는 단계 비대칭 KV 가시성 정책이다. 기존 접근법이 상위 계층의 프롬프트 KV 상태를 저장하거나 구성하는 비용을 낮추는 데 초점을 맞춘 반면, SPEED는 프리필 토큰을 상위 계층의 디코드 가시성 집합에서 완전히 제외한다. 최소한의 BoS 앵커를 사용한 이 단순한 변경은 광범위한 벤치마크 성능을 유지하면서 장문맥 비용을 크게 절감한다. 제어된 Llama-3.1-8B 명령어 튜닝 연구에서, 프리필 토큰에 전체 계층의 75%만 사용한 SPEED는 OLMES 스타일 벤치마크에서 평균 51.2점을 기록하여 전체 깊이 기준 모델의 51.4점과 유사했으며, 128K 문맥에서 TTFT를 33%, TPOT을 22% 개선하고 활성 KV 메모리를 25.0% 줄였다. 계층별 진단에 따르면 이러한 절단은 전체 깊이 모델의 주요 프롬프트 선택 및 표현 안정화 영역을 유지하는 것으로 나타났다. 이러한 결과는 디코드 단계 토큰이 전체 깊이로 유지될 때 장문맥 프롬프트 토큰이 항상 전체 깊이의 KV-캐시 객체로 지속될 필요가 없음을 보여준다.
English
Long-context inference in decoder-only language models is costly because long prompts are processed during Prefill, cached at every layer, and repeatedly attended to during autoregressive Decode. We introduce Shallow Prefill, dEEp Decode (SPEED), a phase-asymmetric KV-visibility policy that materializes non-anchor prompt-token KV states only in lower layers while keeping Decode-phase tokens full-depth. Unlike previous approaches that make upper-layer prompt KV states cheaper to store or construct, SPEED removes prefill tokens from the upper-layer Decode visibility set altogether. With a minimal BoS anchor, this simple change preserves broad benchmark quality while reducing long-context cost. In a controlled Llama-3.1-8B instruction-tuning study, SPEED using only 75\% of layers for prefill tokens reaches 51.2 average score on OLMES-style benchmarks, compared with 51.4 for the full-depth baseline, while improving TTFT by 33\%, TPOT by 22\%, and reducing active KV memory by 25.0\% at 128K context. Layer-wise diagnostics suggest that this cutoff retains the main prompt-selection and representation-stabilization regions of the full-depth model. These results show that long-context prompt tokens need not always persist as full-depth KV-cache objects when Decode-phase tokens remain full-depth.
PDF11May 12, 2026