← Back to article

Equation 1 · AI Memory Systems and the Bandwidth Wall in Practice: An Advanced Technical Guide

What does this equation mean?

MKV=2⋅L⋅H⋅dh⋅b⋅s⋅pM_{\mathrm{KV}} = 2 \cdot L \cdot H \cdot d_h \cdot b \cdot s \cdot p

Read the formula alongside the article passage below. Each part has a deeper page with its role in the equation, the supporting passage and nearby citations.

Inputs and operations2 × L × H × d_h × b × s × p
Result or conditionM_KV
How to read the two sides of this formula. Follow the article passage for the meaning of each quantity.

This equation states an equality: the expressions on both sides have the same value under the article’s assumptions. Read the equation part by part below; each part has a contextual explanation and a link to its mathematical background.

Read it piece by piece

MKVM_{\mathrm{KV}}

Symbol M_KV

MKM_KV is part of the quantity the equation computes from the expression on the right.

Understand this part →

LL

Symbol L

L is one factor in the product that computes the quantity on the left.

Understand this part →

HH

Symbol H

H is one factor in the product that computes the quantity on the left.

Understand this part →

dhd_h

Symbol d_h

dhd_h is one factor in the product that computes the quantity on the left.

Understand this part →

bb

Symbol b

b is one factor in the product that computes the quantity on the left.

Understand this part →

ss

Symbol s

s is one factor in the product that computes the quantity on the left.

Understand this part →

pp

Symbol p

the number of bytes.

Understand this part →

=

=

The expressions on both sides represent the same quantity under the stated assumptions.

Understand this part →

See an illustrated explanation →
multiplication

multiplication

Multiply the quantities on either side.

Understand this part →

subscript

subscript

The lower label selects a particular version, component, or indexed member of the quantity. For example, x₀ and xₜ can be values at different positions.

Understand this part →

How to interpret it

Read it with the definitions, units, and assumptions supplied by the article.

What the article says around this equation

The key-value cache is the part of a serving system’s memory footprint that a purchasing decision cannot fix, because it does not exist until a request is running. It grows with every generated token, in proportion to context length, batch size, layer count and head dimension, and its lifetime is exactly the lifetime of the request that owns it — arriving and departing unpredictably, at whatever size that request’s conversation happens to reach. A capacity plan sized for the average context length will be wrong for the tail, and a naive contiguous allocator sized for the tail will waste most of its memory on requests that never reach it. with L transformer layers, H key-value heads, dhd_h head…
Read the full surrounding passage
The key-value cache is the part of a serving system’s memory footprint that a purchasing decision cannot fix, because it does not exist until a request is running. It grows with every generated token, in proportion to context length, batch size, layer count and head dimension, and its lifetime is exactly the lifetime of the request that owns it — arriving and departing unpredictably, at whatever size that request’s conversation happens to reach. A capacity plan sized for the average context length will be wrong for the tail, and a naive contiguous allocator sized for the tail will waste most of its memory on requests that never reach it. with L transformer layers, H key-value heads, dhd_h head dimension, b batch size, s sequence length and p bytes per stored element, the factor of two counting keys and values separately. Every strategy below is, mechanically, an attempt to shrink one term of this product without shrinking the model’s effective context.

Read the equation in its article →

Sources cited in the article section

These citations give research context. Read each source to check which claims it supports.

Return to AI Memory Systems and the Bandwidth Wall in Practice: An Advanced Technical Guide

See this formula across 1 published context →

Browse the mathematical compendium →