Where does the generation time go?
Tesla T4 · 2-layer Llama · 128 tokens↓ Lower is better
Source · gpu-inference-optimization-lab / 02_autoregressive_decode_optimization.ipynb @ 1630d52 Recorded notebook output (opens in a new tab)GPU performance · 2026
GPU Inference Optimization Lab
Profiling showed the decode loop was bound by kernel launches, not arithmetic, so I targeted launches: torch.compile reached 2.74×, and CUDA-graph capture of a static-cache decode step reached 5.11×, from 552.6 ms to 108.2 ms per generation.
Method & limits
One recorded run on a randomly initialized 2-layer Llama, fp32 baseline against fp16 optimized. Each time is the mean of three timed generations after one warmup. Results depend on hardware and workload.
- Hardware
- Tesla T4, one GPU
- Workload
- 64-token prompt, 128 new tokens, batch 1
- Runs
- Mean of 3 timed generations, 1 warmup
- Model
- Randomly initialized 2-layer Llama