#8028·verl

[Bug] Fused Megatron LM-head leaves parameter AllGather pending with overlap enabled

Author: ewan0x79Created Sep 27, 2026Updated Sep 27, 2026

System Info

Evidence Environment
Observed GPU failure A downstream VERL SFT integration using vendored Megatron Core 0.16.2; Qwen3.5-35B-A3B; BF16; 2 × 8 NVIDIA H20 GPUs; TP1 / PP1 / CP4 / EP8; packed inputs
Upstream code examined VERL 6093e007cc341973c9d9a6fb3867a85976c7c458; its dependency configuration pins Megatron Core core_v0.18.0

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder
  • My own task or dataset: packed, text-only SFT in a downstream VERL integration

Reproduction

Observed downstream failure

Run the fused LM-head path with DDP parameter AllGather overlap enabled for more than one training batch. In the observed run, the output weight occupied its own DDP parameter bucket.

Relevant settings from that run are shown below as a configuration summary, rather than a complete upstream launch configuration:

yaml
model: Qwen3.5-35B-A3B
dtype: bfloat16
use_remove_padding: true
use_fused_kernels: true
use_distributed_optimizer: true
parallelism:
  tensor: 1
  pipeline: 1
  context: 4
  expert: 8
sequence_parallel: false
ddp:
  overlap_param_gather: true
  overlap_grad_reduce: true
  align_param_gather: false
optimizer:
  overlap_param_gather: false
overlap_moe_expert_parallel_comm: false
delay_wgrad_compute: false

The first training-batch invocation completed, but the second hit a parameter-gather assertion during decoder prefetch. Expert communication overlap was disabled in the failed run; expert parallel size remained 8.

Condensed traceback from the actual failure, with deployment paths and wrapper frames removed:

verl/workers/engine/megatron/transformer_impl.py, forward_step
    output = fused_forward_fn(...)
verl/models/mcore/model_forward_fused.py, _fused_GPTModel_forward
    hidden_states = model.decoder(...)
megatron/core/ssm/gated_delta_net.py, forward
    out, out_bias = self.out_proj(norm_out)
megatron/core/distributed/distributed_data_parallel.py, hook
    self.param_to_bucket_group[param].finish_param_sync(...)
megatron/core/distributed/param_and_grad_buffer.py, finish_param_sync
    self.next_param_gather_bucket_group.start_param_sync()
megatron/core/distributed/param_and_grad_buffer.py, start_param_sync
    assert self.param_gather_handle is None
AssertionError

Instrumentation of the original run, together with source inspection of its fused consumer, explains this sequence for the output-weight bucket:

  1. A decoder forward pre-hook prefetched the output-weight gather, leaving a nonempty handle with param_gather_dispatched=True.
  2. The fused LM-head consumed the weight directly, without invoking output_layer.forward and its DDP pre-hook.
  3. At the batch boundary, finish_grad_sync reset param_gather_dispatched=False, but the output-weight parameter-gather handle was still nonempty.
  4. The next batch prefetched that bucket again and reached the assertion above.

These counters identify training-batch invocations, rather than microbatch indices. An AG-overlap-disabled control completed 10 steps on the original integration revision.

Why the current upstream code appears affected

Current upstream fused output processing selects the LM-head parameter and passes it directly to linear_cross_entropy. The legacy fused forward path also reads the parameter directly. Neither consumer completes the owning DDP parameter gather before that read.

MCore 0.18's DDP forward pre-hook normally calls finish_param_sync before a module consumes its parameters. A fused consumer that skips the output module skips this completion boundary. Its bucket implementation still requires the previous parameter-gather handle to be cleared before another dispatch.

Source inspection identifies the same missing completion boundary in the examined upstream fused consumers.

Expected behavior

Training with fused LM-head kernels and parameter AllGather overlap should complete successive batches. The required parameter gather should complete before the weight is consumed, and a later batch should not inherit an unconsumed output-weight gather handle.