Memory: weights, KV cache and what is left
Before speed, RA-BIT asks whether the model fits. Weights cost their parameter count times the bytes of the precision. For serving, the KV cache grows with every token in flight, so the memory left after the weights decides how many sequences one replica can decode together.
weights = params × bytes (BF16 2 B · FP8 1 B · INT4 ≈ 0.52 B at group 128) KV/token = 2 · L · n_kv · d_head · bytes budget = HBM · 0.9 · gpus − 1.5 GB · gpus − weights − workspace sequences = budget ÷ KV per sequence (whole paged blocks)
- L
- layers
- n_kv
- key/value heads (grouped-query attention uses fewer than the attention heads)
- d_head
- head dimension
- 0.9
- the engine's GPU memory utilization (vLLM default)
Variants handled: MLA latent caches, sliding-window layers (cache min(context, window)), FP8 KV, prefix sharing, and KV replicated rather than split across tensor-parallel ranks when there are fewer KV heads than ranks.
For training, mixed-precision Adam holds 16 bytes per trainable parameter, sharded by tensor and pipeline parallelism and then by ZeRO stage 1, 2 or 3 over data parallelism. Activations follow Korthikanti et al. (arXiv 2205.05198), with or without recomputation. LoRA keeps the frozen base and trains only the adapters.