64K context for an 8B model with GQA

A document assistant uses an 8B FP16 model on a 48 GB GPU. Each of the two concurrent requests may use 65,536 tokens, with KV width at one quarter of total hidden width.

Jump to results

Inputs

Model and context
B
%
GPU and runtime

Enter bandwidth independently of the memory preset. Capacity and bandwidth specifications use decimal GB.

GB/s
%
%

Results

Runs in your browser
Required memory
37.161GB
Minimum GPU count
1GPUs Aggregate memory lower bound
Decode bandwidth ceiling
52.08tok/s Ideal aggregate across the batch

Compare measured decode speed with this bandwidth ceiling. Verify the model fits each rank individually.

GPU memory footprint
GPU memory footprint37.161 GB required on 1 devices. 17.18 GB of KV cache.Used VRAM37.161 GBWeightsKV cacheWorkspaceFree1 × 43.2 GB usable65,536 tokens / sequence
Detailed results
Model weights16 GB
Active KV cache17.18 GB
Activation and scratch reserve3.982 GB
Usable memory per GPU43.2 GB
Usable memory across GPUs43.2 GB
KV per cached token131.072 kB
Ceiling per sequence26.04 tok/s

What to try

Two long requests fit the modeled memory on one card. Try a third concurrent prompt to see how quickly long-context admission consumes workspace headroom.

How the estimate works

KV bytes = 2 × layers × hidden width × KV-head ratio × bytes × tokens × sequences

The model assumes dense decoder-only attention. FP16 uses two bytes per parameter, FP8 and INT8 use one, and Q4_K_M uses a rough 0.60 bytes to include mixed precision and quantization metadata. Use the actual model file size to check this assumption.

Keys and values grow with the live context and batch. GQA reduces the cached width by the ratio of KV heads to query heads. Workspace is an adjustable percentage of weights plus KV, with a separate allowance for unavailable GPU memory.

The GPU count is a memory lower bound. The decode ceiling assumes perfect sharding and one sweep of weights and active KV per batch step at full bandwidth. Kernel overhead, compute, prefill, cache sharing, allocator fragmentation, and interconnect can lower measured output.

Frequently asked questions

Do output tokens also count toward the 64K context allocation?

Yes. Reserve space for the prompt and the generated tokens expected to remain in the active cache at once.

What happens if I model 64K with no grouped-query attention?

With all other settings fixed, switching KV width from 25% to 100% quadruples the estimated cache bytes.

Open LLM inference & GPU VRAM calculator