sgl-project/sglang · error · ValueError

Ring Attention requires one of the ring-capable backends ({'

Error message

Ring Attention requires one of the ring-capable backends ({', '.join(RING_CAPABLE_ATTENTION_BACKENDS)}), got {self.attention_backend!r}

What it means

When ring_degree > 1, the selected attention_backend must be one of RING_CAPABLE_ATTENTION_BACKENDS; any explicitly set non-ring backend raises. If unset, it defaults to the first ring-capable backend.

Source

Thrown at python/sglang/multimodal_gen/runtime/server_args/server_args.py:980

            self.backend != Backend.DIFFUSERS
            and isinstance(self.pipeline_config, MiniMaxH3PipelineConfig)
            and self.attention_backend == "laser_attn"
            and "text_encoder" not in self.component_attention_backends
        ):
            # Laser Attention is used only by the MiniMax-H3 transformer.
            # SDPA is faster than Ascend FA for its Qwen3-VL text encoder.
            logger.info(
                "Automatically set torch_sdpa backend for the MiniMax H3 text "
                "encoder; laser_attn applies to the transformer"
            )
            self.component_attention_backends["text_encoder"] = "torch_sdpa"

        if self.ring_degree > 1:
            if (
                self.attention_backend is not None
                and self.attention_backend not in RING_CAPABLE_ATTENTION_BACKENDS
            ):
                raise ValueError(
                    "Ring Attention requires one of the ring-capable backends "
                    f"({', '.join(RING_CAPABLE_ATTENTION_BACKENDS)}), got "
                    f"{self.attention_backend!r}"
                )
            if self.attention_backend is None:
                self.attention_backend = RING_CAPABLE_ATTENTION_BACKENDS[0]
                logger.info(
                    "Ring Attention requires a ring-capable backend; "
                    "attention_backend has been automatically set to %s",
                    self.attention_backend,
                )

        if self.attention_backend is None and self.backend != Backend.DIFFUSERS:
            if (
                current_platform.is_cuda()
                and self.pipeline_class_name is None
                and self.num_gpus == 1
                and self.tp_size == 1

View on GitHub (pinned to 0132848349)

Solutions

  1. Remove the explicit attention_backend and let it default to RING_CAPABLE_ATTENTION_BACKENDS[0]
  2. Or set attention_backend to one of the values listed in the error message
  3. Check RING_CAPABLE_ATTENTION_BACKENDS in server_args.py for your version's supported set

Example fix

# before
ServerArgs(ring_degree=2, attention_backend="flashinfer")
# after
ServerArgs(ring_degree=2)  # auto-selects first ring-capable backend
Defensive patterns

Strategy: validation

Validate before calling

if cfg.get('ring_degree', 1) > 1 and cfg.get('attention_backend') not in (None, *RING_CAPABLE_ATTENTION_BACKENDS):
    del cfg['attention_backend']  # let the default ring-capable backend kick in

Type guard

def backend_supports_ring(b) -> bool:
    return b in RING_CAPABLE_ATTENTION_BACKENDS

Prevention

When it happens

Trigger: ServerArgs(ring_degree=2, attention_backend='flashinfer') where 'flashinfer' is not in RING_CAPABLE_ATTENTION_BACKENDS; mixing a Ring Attention launch with a backend that lacks ring support.

Common situations: Reusing a single-GPU config (with a pinned attention backend) for a multi-node ring setup; upgrading when the ring-capable list changed so a previously valid backend was dropped.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/6fa3a07f97dabae1. Report an issue: GitHub.