+++ Meet us at SCCON in Berlin, 13–15 October +++ Experience Kolibri, our new sovereign model, live in action for the public sector +++ Hall 26A, Booth 126 +++

Aleph Alpha
Roofline plot illustrating inference performance
Research

Eric Schreiber

Inference Performance from First Principles

Introduction

Validation CHEETAH

What matters for fast inference?

Roofline Model
Prefill vs Decode Time Share

Prefill

Prefill Compute Scaling

Be cautious with average TTFT numbers

TTFT‾scenario 1=BB×B×tprefill=B×tprefill,TTFT‾scenario 2=1B×∑i=1Bi×tprefill=1B×B(B+1)2×tprefill=B+12×tprefill.\begin{aligned} \overline{TTFT}_\text{scenario 1} &= \frac{B}{B} \times B \times t_{prefill} = B \times t_{prefill}, \\ \overline{TTFT}_\text{scenario 2} &= \frac{1}{B} \times \sum_{i=1}^B i\times t_{prefill} = \frac{1}{B}\times \frac{B(B+1)}{2} \times t_{prefill} = \frac{B+1}{2} \times t_{prefill}. \end{aligned}

Decode

tdecode≈weights+KV cachememory bandwidtht_{\text{decode}} \approx \frac{\text{weights} + \text{KV cache}}{\text{memory bandwidth}}
Decode Memory Loading
Batch Amortisation
Four Decode Regimes

Low batch size, short sequence length

High batch size, short sequence length

Low batch size, long sequence length

High batch size, long sequence length

Decode Bottleneck Heatmap

What changes for MoE models?

Expected Unique Routed Experts

Prefill or decode: what to optimise for

Appendix: CHEETAH

What CHEETAH models

tmem,c=DcWmem ηmem,c,tcompute,c=FcWcompute ηcompute,c,tbottleneck,c=max⁡(tmem,c, tcompute,c)t_{\text{mem},c} = \frac{D_c}{W_{\text{mem}}}\,\eta_{\text{mem},c}, \qquad t_{\text{compute},c} = \frac{F_c}{W_{\text{compute}}}\,\eta_{\text{compute},c}, \qquad t_{\text{bottleneck},c} = \max(t_{\text{mem},c},\, t_{\text{compute},c})
tcomm=α⋅VWcomm ηcommt_{\text{comm}} = \frac{\alpha \cdot V}{W_{\text{comm}}}\,\eta_{\text{comm}}
Algorithm All-Reduce All-Gather
Ring2(n−1)/n2(n-1)/n(n−1)/n(n-1)/n
Tree2log⁡2n2\log_2 n—
Butterflylog⁡2n\log_2 n—
tcomm=α⋅V⋅ηcomm⋅max⁡(nnodes−1nnodes⋅1Winter,1nnodes⋅1Wintra).t_{\text{comm}} = \alpha \cdot V \cdot \eta_{\text{comm}} \cdot \max\left( \frac{n_{\text{nodes}}-1}{n_{\text{nodes}}} \cdot \frac{1}{W_{\text{inter}}}, \frac{1}{n_{\text{nodes}}} \cdot \frac{1}{W_{\text{intra}}} \right).
tlayer={max⁡(tbottleneck,tcomm)overlap enabledtbottleneck+tcommotherwise.t_{\text{layer}} = \begin{cases} \max(t_{\text{bottleneck}}, t_{\text{comm}}) & \text{overlap enabled}\\ t_{\text{bottleneck}} + t_{\text{comm}} & \text{otherwise} \end{cases}.
ttotal=∑ℓ=1Ltlayer,ℓ+L τlayer+τglobal+τbatch⋅Bt_{\text{total}} = \sum_{\ell=1}^{L} t_{\text{layer},\ell} + L\,\tau_{\text{layer}} + \tau_{\text{global}} + \tau_{\text{batch}}\cdot B
Bmax=MGPU−MmodelS⋅Mper-seq,B_{\text{max}} = \frac{M_{\text{GPU}} - M_{\text{model}}}{S \cdot M_{\text{per-seq}}},

Limitations and assumptions

Validation

CHEETAH compared to measured baselines on DeepSeek v3

Acknowledgements

Footnotes

More blog posts