In pipeline parallelism, a model is split across multiple devices (pipeline stages), and training proceeds by feeding micro-batches through the pipeline. At the start and end of each training step, some stages are idle waiting for activations or gradients — this idle time is called the pipeline bubble.
With interleaved (virtual) pipeline scheduling, each pipeline rank holds multiple virtual stages, which reduces the bubble.
Given:
PP (int): the number of pipeline stages (pipeline-parallel size)V (int): the number of virtual stages per pipeline rankM (int): the number of micro-batchesImplement a function pipeline_bubble_ratio(PP, V, M) that returns the pipeline bubble ratio as a float, defined as:
Return the result as a Python float.