sgl-project/sglang · error · ValueError

DeepSeekV4 only supports interleave CP strategy, got {cfg.cp

Error message

DeepSeekV4 only supports interleave CP strategy, got {cfg.cp_strategy}

What it means

DeepSeek V4 context parallelism in SGLang is only implemented for the interleave CP strategy. When --enable-prefill-cp is set, validate_deepseek_v4_cp checks cp_strategy and rejects any value other than "interleave" because other strategies (e.g. all-ring or split strategies) are not implemented/tested for this model.

Source

Thrown at python/sglang/srt/arg_groups/deepseek_v4_hook.py:167

    if cfg.speculative_algorithm is not None:
        assert cfg.speculative_algorithm in (
            "EAGLE",
            "DSPARK",
        ), f"Only EAGLE and DSPARK speculative algorithms are supported for {model_arch}"
        if cfg.speculative_algorithm == "EAGLE":
            assert (
                cfg.speculative_eagle_topk == 1
            ), f"Only EAGLE speculative algorithm with topk == 1 is supported for {model_arch}"


def validate_deepseek_v4_cp(server_args: ServerArgs) -> None:
    """Validate DeepSeek V4 context-parallel configuration."""
    cfg = resolving_view(server_args)
    if not cfg.enable_prefill_cp:
        return

    if cfg.cp_strategy != "interleave":
        raise ValueError(
            "DeepSeekV4 only supports interleave CP strategy, " f"got {cfg.cp_strategy}"
        )

    declare_resolution(
        server_args,
        "validate_deepseek_v4_cp",
        enable_dsa_prefill_context_parallel=True,
    )
    declare_resolution(
        server_args,
        "validate_deepseek_v4_cp",
        enable_prefill_context_parallel=False,
    )
    declare_resolution(
        server_args,
        "validate_deepseek_v4_cp",
        dsa_prefill_cp_mode="round-robin-split",
    )

View on GitHub (pinned to 0132848349)

Solutions

  1. Set --cp-strategy interleave (or remove the explicit cp_strategy override so the DeepSeek V4 default applies)
  2. Disable --enable-prefill-cp if you don't need context parallelism for this model
  3. Check any wrapper scripts/config files that override cp_strategy before launch

Example fix

# before
python -m sglang.launch_server --model deepseek-ai/DeepSeek-V4 --enable-prefill-cp --cp-strategy all_ring
# after
python -m sglang.launch_server --model deepseek-ai/DeepSeek-V4 --enable-prefill-cp --cp-strategy interleave
Defensive patterns

Strategy: validation

Validate before calling

from sglang.srt.arg_groups import resolving_view
cfg = resolving_view(server_args)
if getattr(cfg, 'enable_prefill_cp', False):
    assert cfg.cp_strategy == 'interleave', f"bad cp_strategy: {cfg.cp_strategy}"

Try / catch

try:
    _handle_model_specific_adjustments(server_args, hf_config)
except ValueError as e:
    if 'interleave CP strategy' in str(e):
        server_args.cp_strategy = 'interleave'; retry_launch()
    else: raise

Prevention

When it happens

Trigger: Running a DeepSeek V4 model with enable_prefill_cp=True while cp_strategy is set to anything other than "interleave" (e.g. via server args or a config override), during _handle_model_specific_adjustments argument resolution.

Common situations: Copying a CP launch line from a non-DeepSeek-V4 model that used a different cp_strategy, or explicitly setting --cp-strategy expecting generic CP support; defaults being changed by another hook before this validator runs.

Related errors


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