From 54d4ab1b9a59501ddd9bd5c74e585908b34d0730 Mon Sep 17 00:00:00 2001 From: MOVZX Date: Wed, 23 Sep 2026 07:53:15 -0400 Subject: [PATCH] [Guards] The draft guard reports the draft model's own architecture Co-Authored-By: Hinata Signed-off-by: MOVZX --- vllm/v1/e2_guards.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/vllm/v1/e2_guards.py b/vllm/v1/e2_guards.py index 5f0ed88ad4..7624ae1d96 100644 --- a/vllm/v1/e2_guards.py +++ b/vllm/v1/e2_guards.py @@ -100,9 +100,23 @@ def _name(value) -> str: return getattr(value, "name", str(value)) -def _profile(vllm_config) -> tuple[list[str], object, object, list[str] | None]: - """Resolved (architectures, mode, cudagraph mode, splitting ops).""" +def _profile( + vllm_config, role: str = "target" +) -> tuple[list[str], object, object, list[str] | None]: + """Resolved (architectures, mode, cudagraph mode, splitting ops). + + For ``role="draft"`` the architectures are the DRAFT model's + (``speculative_config.draft_model_config``): the drafter is constructed + with the target's VllmConfig, whose model_config names the target. The reference host + logged the target architecture on the draft line before this fix. + The graph profile is the engine's single CompilationConfig for both roles. + """ model_config = getattr(vllm_config, "model_config", None) + if role == "draft": + spec = getattr(vllm_config, "speculative_config", None) + draft_config = getattr(spec, "draft_model_config", None) + if draft_config is not None: + model_config = draft_config if model_config is None: raise RuntimeError("e2-guard: vllm_config has no model_config to check") compilation_config = getattr(vllm_config, "compilation_config", None) @@ -137,7 +151,7 @@ def assert_graph_profile_is_executable(vllm_config, *, role: str = "target") -> ``Qwen4ExpMTP`` builds ``Qwen4ExpMultiTokenPredictor`` rather than ``Qwen4ExpForCausalLM``, from a config rebuilt in ``mtp.py``. """ - architectures, mode, cudagraph_mode, splitting_ops = _profile(vllm_config) + architectures, mode, cudagraph_mode, splitting_ops = _profile(vllm_config, role) detail = ( f"architectures={architectures} breakable={os.environ.get(BREAKABLE_ENV)} " f"compilation_mode={_name(mode)} cudagraph_mode={_name(cudagraph_mode)}"