[watermarking] Add DFlash support to dual-key gumbel-max watermarking (#59554)

Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com>
Signed-off-by: Simon Veitner <sveitner@redhat.com>
Signed-off-by: Raphael Rialland <raphael.rialland@mistral.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Simon Veitner <sveitner@redhat.com>
Co-authored-by: Raphael Rialland <raphael.rialland@mistral.ai>
Co-authored-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com>
This commit is contained in:
Shern Shiou Tan
2026-10-15 22:06:06 +00:00
committed by GitHub
co-authored by Claude Opus 5.5 Simon Veitner Raphael Rialland Lucas Wilkinson
parent e711723352
commit d92a4f25f2
10 changed files with 626 additions and 61 deletions
+22 -8
View File
@@ -3732,34 +3732,48 @@ def test_dual_key_gumbel_requires_probabilistic_drafting():
config._check_supports_watermarking()
@pytest.mark.parametrize("method", ["eagle", "eagle3", "mtp"])
def test_dual_key_gumbel_supports_probabilistic_speculative_decoding(method):
@pytest.mark.parametrize(
("method", "parallel_drafting"),
[
("eagle", False),
("eagle3", False),
("mtp", False),
("dspark", True),
("dflash", True),
],
)
def test_dual_key_gumbel_supports_probabilistic_speculative_decoding(
method, parallel_drafting
):
config = _watermarked_vllm_config()
config.watermark_config = WatermarkConfig(algorithm="dual_key_gumbel", key=42)
config.speculative_config = SimpleNamespace(
method=method,
draft_sample_method="probabilistic",
rejection_sample_method="standard",
parallel_drafting=False,
parallel_drafting=parallel_drafting,
)
config._check_supports_watermarking()
def test_dual_key_gumbel_supports_dspark():
@pytest.mark.parametrize("architecture", ["DFlash2DraftModel", "LiLiCorrDraftModel"])
def test_dual_key_gumbel_rejects_dflash_candidate_drafts(architecture):
config = _watermarked_vllm_config()
config.watermark_config = WatermarkConfig(algorithm="dual_key_gumbel", key=42)
config.speculative_config = SimpleNamespace(
method="dspark",
method="dflash",
draft_sample_method="probabilistic",
rejection_sample_method="standard",
parallel_drafting=True,
draft_model_config=SimpleNamespace(architectures=[architecture]),
)
config._check_supports_watermarking()
with pytest.raises(ValueError, match="candidate-head drafters"):
config._check_supports_watermarking()
def test_dual_key_gumbel_rejects_non_autoregressive_speculation():
def test_dual_key_gumbel_rejects_unsupported_speculative_method():
config = _watermarked_vllm_config()
config.watermark_config = WatermarkConfig(algorithm="dual_key_gumbel", key=42)
config.speculative_config = SimpleNamespace(
@@ -3769,7 +3783,7 @@ def test_dual_key_gumbel_rejects_non_autoregressive_speculation():
parallel_drafting=False,
)
with pytest.raises(ValueError, match="autoregressive model-based"):
with pytest.raises(ValueError, match="Watermarking supports only"):
config._check_supports_watermarking()