Workspace IndexKnowledge Notes › KV cache — why the second token is cheaper than the first

#257PoC

KV cache — why the second token is cheaper than the first

The KV cache stores attention keys and values so each new token does not recompute the whole context, which is why prefill is expensive and decoding is fast — and why cache pricing reshapes agent economics.

Not yet scoped.

Why

The PoC measures prefill versus decode cost with and without cache reuse, connecting the mechanism to the cache-read price cut that changes long-context agent bills.

How it works

Not yet built.

Where it lands in Jayverse

  • Auditor / gitboard: track prefill vs decode cost separately for any LLM-backed tool. Agent workflows and Auditor methodology write-ups should prefer cache-read pricing for repeated long-context calls, since that's where the real bill lives.
  • Devnet / alice-tech: reuse the same context prefix across workflow stages. Running agent-team-style stages against a fixed case record only gets cache reuse if each stage doesn't re-pay prefill from scratch.

Key expressions

Words and phrases from this page worth keeping, with the Korean meaning and the sentence they come from.

Expression뜻 · 쓰이는 자리
reshape(구조·형태를) 다시 짜다, 재편하다 · 가격 정책이 전체 비용 구조를 바꿀 때. "why cache pricing reshapes agent economics"
recompute다시 계산하다 · 이전에 계산해둔 것을 매번 새로 구하지 않아도 될 때. "does not recompute the whole context"
versus~ 대(對) ~, ~와 비교하여 · 두 단계나 항목을 나란히 비교할 때. "measures prefill versus decode cost"
cache reuse캐시 재사용 · 이전에 계산한 결과를 다시 활용하는 것. "with and without cache reuse"
price cut가격 인하 · 특정 항목의 가격이 낮아진 것을 가리킬 때. "the cache-read price cut that changes long-context agent bills"
KV cache키/값 캐시(Key-Value cache) · 어텐션의 키·값을 저장해 두어 새 토큰마다 전체 문맥을 다시 계산하지 않게 하는 캐시. "The KV cache stores attention keys and values"
prefill / decode프리필(프롬프트 전체를 한번에 처리하는 단계) / 디코드(토큰을 한 개씩 생성하는 단계) · LLM 추론이 나뉘는 두 단계, 비용 구조가 서로 다름. "why prefill is expensive and decoding is fast"

← All Knowledge Notes · Workspace Index · Top ↑

KV 캐시 — 두 번째 토큰이 첫 번째보다 싼 이유

KV 캐시는 어텐션 키와 값을 저장해 새 토큰마다 전체 컨텍스트를 재계산하지 않게 하며, 그래서 프리필은 비싸고 디코딩은 빠릅니다 — 그리고 캐시 가격이 에이전트 경제를 다시 짜는 이유입니다.

아직 범위 미정.

이 PoC는 캐시 재사용 유무에 따른 프리필 대 디코드 비용을 측정하여, 이 메커니즘을 긴 컨텍스트 에이전트 청구를 바꾸는 캐시 읽기 가격 인하로 연결합니다.

동작 방식

아직 만들지 않음.

Jayverse에서의 위치

  • Auditor / gitboard: LLM 기반 도구마다 prefill과 decode 비용을 따로 추적한다. 에이전트 워크플로우와 Auditor 방법론 문서는 반복되는 롱컨텍스트 호출에 캐시 읽기 가격을 우선해야 한다. 실제 비용이 거기서 나오기 때문이다.
  • Devnet / alice-tech: 워크플로우 단계 전체에서 같은 컨텍스트 프리픽스를 재사용한다. 고정된 케이스 레코드에 대해 agent-team 스타일 단계를 돌릴 때, 각 단계가 prefill을 처음부터 다시 내지 않아야만 캐시 재사용이 실제로 적용된다.

핵심 표현

이 페이지의 영어 본문에서 배울 만한 단어와 표현, 뜻과 나온 자리.

Expression뜻 · 쓰이는 자리
reshape(구조·형태를) 다시 짜다, 재편하다 · 가격 정책이 전체 비용 구조를 바꿀 때. "why cache pricing reshapes agent economics"
recompute다시 계산하다 · 이전에 계산해둔 것을 매번 새로 구하지 않아도 될 때. "does not recompute the whole context"
versus~ 대(對) ~, ~와 비교하여 · 두 단계나 항목을 나란히 비교할 때. "measures prefill versus decode cost"
cache reuse캐시 재사용 · 이전에 계산한 결과를 다시 활용하는 것. "with and without cache reuse"
price cut가격 인하 · 특정 항목의 가격이 낮아진 것을 가리킬 때. "the cache-read price cut that changes long-context agent bills"
KV cache키/값 캐시(Key-Value cache) · 어텐션의 키·값을 저장해 두어 새 토큰마다 전체 문맥을 다시 계산하지 않게 하는 캐시. "The KV cache stores attention keys and values"
prefill / decode프리필(프롬프트 전체를 한번에 처리하는 단계) / 디코드(토큰을 한 개씩 생성하는 단계) · LLM 추론이 나뉘는 두 단계, 비용 구조가 서로 다름. "why prefill is expensive and decoding is fast"

← 전체 기술 노트 · 워크스페이스 인덱스 · 맨 위 ↑