Token LabBuscar

← Todos los experimentos
Caché KV y páginas / 3 OF 5

Caché multiquery

One KV head sharply reduces logical cache size.

Cálculo / simulación local

Experimento educativo local, sin API externa. Los datos sintéticos no son mediciones de producción.

Study guide & lesson outlineLEARNING CONTRACT

Understand → implement → investigate

Goal: explain the mechanism in this lesson, reproduce one example and test a failure case. Reading alone does not mark mastery.

02 · Predice y configura

Las notas técnicas, los parámetros y las respuestas están actualmente en inglés.

03 · Analiza la evidencia

Ejecuta para ver resultados.

Métodos y referencias

32 layers, head dimension 128. Dense cache only; excludes model weights, activations, block tables and sharing. Per-sequence allocation rounds up to the next page.

Text / 原始公式
KV bytes=2×layers×KV heads×head dimension×sequence×batch×bytes/value

An estimated cache footprint is not a measured GPU throughput or total memory requirement.

GQA (2023); PagedAttention (2023) ↗

PagedAttention paper ↗

Preguntas de práctica

kv-3 / 01What does “Multi-query cache” test?

One KV head sharply reduces logical cache size.

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 02Which computation produces the result in “Multi-query cache”?

KV ×layers×KV heads×head dimension×sequence×batch×bytes/value

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 03What is the baseline configuration for “Multi-query cache”?

{"sequence":4096,"batch":1,"heads":1,"bytes":2,"block":16}

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 04What numerical result should you check for “Multi-query cache”?

{"KV cache (GiB)":0.0625,"Allocated KV (GiB)":0.0625,"Padding tokens":0}

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 05How would you run a controlled comparison for “Multi-query cache”?

Keep the supplied fixture and other settings fixed; change sequence. Compare logical KV GiB, allocated GiB and padding tokens.

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 06What failure could invalidate a conclusion from “Multi-query cache”?

An estimated cache footprint is not a measured GPU throughput or total memory requirement.

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 07Is “Multi-query cache” a benchmark of a deployed language model?

No. 32 layers, head dimension 128. Dense cache only; excludes model weights, activations, block tables and sharing. Per-sequence allocation rounds up to the next page.

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 08Which evidence should you report for “Multi-query cache”?

Compare logical KV GiB, allocated GiB and padding tokens. Export inputs, engine, result and method; distinguish synthetic fixtures from observed production data.

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 09How can another researcher reproduce “Multi-query cache”?

Open kv-3, reset the preset, retain the exact inputs and run. The calculation is deterministic for identical inputs.

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
kv-3 / 10What is the next validation step after “Multi-query cache”?

An estimated cache footprint is not a measured GPU throughput or total memory requirement. Test the hypothesis on a representative held-out workload and document a baseline, success metric and stopping rule before claiming deployment readiness.

Original teaching answer / local derivation. Method reference: GQA (2023); PagedAttention (2023) ↗

Abrir laboratorio →
MATHEMATICAL REVIEW · 2026-10-26

Assumptions, implementation & acceptance

Count both K and V, KV heads rather than query heads, and sequence×batch exactly once. The byte formula excludes activations, weights, allocator fragmentation and attention workspace.

Engine formulas, scenario presets and numerical safeguards reviewed. Seeded synthetic inputs are not a production benchmark.

Layers, KV heads, head width → Sequence × batch = total tokens → K and V × bytes per value → Logical bytes → allocated blocks
Mechanism map: follow the transformations from top to bottom.

Before running: predict a boundary case

One KV head sharply reduces logical cache size.

Hint: isolate the assumption

Keep the baseline input fixed, change one parameter or boundary, and compare both the numerical result and the claimed units. A passing example verifies this fixture only.

Minimal executable example

Save the example and linked modules in one folder. Use Node.js 22 or newer, then run node kv-3.mjs. No third-party runtime dependencies.

import {calculate,network} from './academy-core.mjs';
const params={
  "sequence": 4096,
  "batch": 1,
  "heads": 1,
  "bytes": 2,
  "block": 16
};
const result=calculate('kv',params);
console.log(result.metrics);

Test and transfer

One KV head sharply reduces logical cache size.

Record input, code version, expected result and observed result in the notebook below. Then construct a counterexample that violates the assumption above and explain why the original conclusion no longer follows.

Download complete kit (.tar.gz) · Complete reference kit and regression checks

Predict, test and keep evidence

Before revealing an answer, predict one result. After the exercise, record the discrepancy and a transfer test. Saved locally across language editions.

Open notebook / export / clear →

The mathematical review scope is recorded per lesson. It does not establish empirical paper reproduction; report suspected errors in your notes. Review scope