arXiv:2611.23035v2 cs.LG

Gemma 4의 K=V 캐시를 한 번만 저장하기: 어텐션 커널 변경 없이 페이지 기반 서빙 엔진의 전역 KV 메모리 절감

Storing the Gemma 4 K=V Cache Once: Exact Global-KV Memory Savings in a Paged Serving Engine with Unchanged Attention Kernels

Kushagra Bainsla

제출 2026-11-18

한국어 초록

Gemma 4 31B의 전역 어텐션 층에서 값은 정규화한 키 투영값이고, 키는 값에 고정 가중치를 곱한 뒤 차원의 4분의 1에 회전 위치 인코딩을 적용한 것이다. Gemma 4 보고서에 따르면 이 설계는 전역 KV 캐시를 최대 37.5% 줄인다. 그러나 우리가 확인한 공개 서빙 엔진은 전체 키와 값을 따로 저장해 KV 헤드와 토큰 하나당 수치 1,024개를 사용했다. 대신 640개 수치로 이루어진 행 하나를 저장한다. 이 표현은 실수 연산에서 정확하며, 기존 페이지 기반 어텐션 커널은 서로 겹치고 스트라이드가 지정된 두 뷰를 각각 키 캐시와 값 캐시로 읽는다. 16비트 31B 모델을 쓰는 vLLM 프로토타입에서 출력은 기본 캐시에 같은 연산을 적용한 에뮬레이션과 비트 단위로 일치했다. 기본 엔진과 비교하면 최종 답 432개 중 2개가 달랐으며, 이는 실행 간 변동 범위 안이었다. 3만 2천~6만 4천 토큰에서 정상 상태의 요청당 디코딩 KV 메모리는 기존의 1.34~1.40분의 1로 줄었다. NIXL 전송과 CPU 오프로딩을 사용해 A100 GPU 두 장에 프리필과 디코딩을 나눈 환경에서, 15GiB 풀을 모두 사용하는 디코딩 엔진은 1만 6천 토큰 프롬프트에서 단계당 토큰을 기본 디코딩 엔진의 1.38배 처리했다. 반복 측정에서 편차는 0.06% 수준이었다. 8천 토큰 프롬프트에서는 1.24배였다. vLLM 블록 풀 모델은 두 비율을 1% 이내 오차로 예측했으며, 실측 비율이 예측보다 0.7~0.9% 높았다. 두 조건 사이의 변화량도 예측과 일치했다. 즉시 실행 모드의 디코딩 처리량은 각각 1.30배와 1.11배가 됐다. 이 경로에서 배치 크기를 1로 놓고 프롬프트 8개를 시험하자 축소 캐시 엔진의 출력 토큰은 에뮬레이션과 같았다. 다만 배치 크기가 같을 때 프로토타입의 즉시 실행 단계는 4~9% 느렸고, 기본 스케일의 8비트 KV 캐시와는 아직 함께 사용할 수 없다.

원문 초록

In the global attention layers of Gemma 4 31B, the value is the normalized key projection, and the key is the value scaled by a fixed weight, with rotary position encoding on one quarter of its dimensions. The Gemma 4 report states that this design reduces the global KV cache by up to 37.5%, but the open serving engines that we checked still store a full key and a full value: 1,024 values per KV head and token. We store one 640-value row instead, exact in real arithmetic, and an unchanged paged attention kernel reads it through two overlapping strided views as its key cache and its value cache. In a vLLM prototype with the 16-bit 31B model, the outputs are bit-identical to an emulation of the same arithmetic on the stock cache, 2 of 432 final answers differ from the stock engine (within its run-to-run noise), and the steady decode KV memory per request falls by a factor of 1.34 to 1.40 at 32K to 64K tokens. On a prefill/decode pair of two A100 GPUs with NIXL transfer and CPU offload, a decode engine with a full 15 GiB pool ran 1.38 times the stock decode tokens per step for 16K-token prompts (repeated to 0.06%) and 1.24 times for 8K-token prompts; a model of the vLLM block pool predicted both ratios to within 1% (the engine was 0.7% to 0.9% higher) and matched the change between them. The eager decode throughput rose by 1.30 and 1.11 times, and on this path the compact engine gave the same output tokens as the emulation for 8 prompts at batch 1. The run-time prototype makes an eager step 4% to 9% slower at equal batch, and the method does not yet stack with an 8-bit KV cache at the default scale.

제출 이력

확인된 버전만 표시합니다. 전체 제출 이력은 arXiv 원문에서 확인하세요.

  1. arXiv:2611.23035v2제출 시각 미확인
  2. arXiv:2611.23035v1제출 시각 미확인

함께 살펴볼 논문

공통 태그를 근거로 연결했습니다. 실제 인용 관계나 논문의 우수성을 뜻하지 않습니다.

공통 태그로 연결된 공개 논문이 아직 없습니다.

토론

이 논문과 연결된 포럼 글이 아직 없습니다.