[Model Runner V2] Acceptance estimation for adaptive verification (#52228)

Signed-off-by: Giancarlo Delfin <gdelfin@inferact.ai>
This commit is contained in:
Giancarlo Delfin
2026-09-14 15:58:48 -07:00
committed by GitHub
parent 8e08cef46e
commit 3bb0a03f35
9 changed files with 900 additions and 28 deletions
@@ -123,6 +123,7 @@ def test_speculator_uses_draft_model_hidden_size(monkeypatch, hc_mult, expected)
draft_model_config=draft_model_config,
use_local_argmax_reduction=False,
draft_sample_method="greedy",
enable_adaptive_verification=False,
)
vllm_config = SimpleNamespace(
speculative_config=speculative_config,
@@ -161,6 +162,7 @@ def test_mm_support_configured_after_model_load(monkeypatch):
speculator.dtype = torch.float32
speculator.draft_model_config = draft_model_config
speculator.supports_mm_inputs = False
speculator.use_acceptance_estimator = False
checked_configs = []
@@ -195,6 +197,7 @@ def test_load_model_keeps_mm_support_for_capable_drafter(monkeypatch):
speculator = object.__new__(_TestSpeculator)
speculator.supports_mm_inputs = False
speculator.inputs_embeds = None
speculator.use_acceptance_estimator = False
speculator.vllm_config = SimpleNamespace(model_config=object())
speculator.max_num_tokens = 4
speculator.hidden_size = 3
@@ -219,6 +222,7 @@ def test_load_model_disables_mm_support_for_text_only_drafter(monkeypatch):
speculator = object.__new__(_TestSpeculator)
speculator.supports_mm_inputs = False
speculator.inputs_embeds = None
speculator.use_acceptance_estimator = False
speculator.vllm_config = SimpleNamespace(model_config=object())
draft_model = _TextOnlyDraftModel()
speculator.test_draft_model = draft_model
@@ -251,6 +255,7 @@ def test_multi_module_mm_support_configured_after_model_load(monkeypatch):
speculator = object.__new__(MultiModuleMTPSpeculator)
speculator.supports_mm_inputs = False
speculator.inputs_embeds = None
speculator.use_acceptance_estimator = False
speculator.cached_draft_input_embeds = None
speculator.vllm_config = SimpleNamespace(model_config=object())
speculator.max_num_tokens = 4
@@ -60,6 +60,7 @@ def test_propose_caches_hidden_states_and_returns_sampled_tokens(monkeypatch):
layer_name = "cache_only_layers.2"
speculator = object.__new__(ExtractHiddenStatesSpeculator)
speculator.vllm_config = cast(Any, SimpleNamespace())
speculator.acceptance_estimator = None
speculator.num_hidden_states = 2
speculator.hidden_states = torch.zeros(4, 2, 3)
speculator.draft_attn_layer_names = {layer_name}
@@ -111,6 +112,7 @@ def test_propose_caches_hidden_states_and_returns_sampled_tokens(monkeypatch):
def test_propose_requires_aux_hidden_states():
speculator = object.__new__(ExtractHiddenStatesSpeculator)
speculator.acceptance_estimator = None
speculator.num_hidden_states = 2
input_batch = cast(
Any, SimpleNamespace(idx_mapping=torch.tensor([0], dtype=torch.int32))