During LLM inference, there are two distinct phases with very different computational characteristics:
Prefill Phase: The model processes all the tokens of one prompt in a single forward pass. Each token requires a forward pass through all model parameters, and since the whole prompt is processed together, data loaded from memory is reused across its tokens. In this problem, prefill covers one sequence of sequence_length tokens; batch_size is not used for prefill.
Decode Phase: The model generates output tokens one at a time per sequence. Each step still requires loading all model weights, but processes only one new token per sequence. In this problem, decode covers one decode step for a batch of batch_size sequences, so it processes batch_size tokens (one per sequence).
Implement a function that analyzes both phases of LLM inference using the Roofline Model framework. Given the model size, sequence configuration, and hardware specifications, determine:
sequence_length tokens and decode processes batch_size tokensWhen arithmetic intensity equals the ridge point exactly, classify as 'compute-bound'.
Round all floating-point values in the output to 4 decimal places.