Skip to content

vllm.v1.worker.gpu.spec_decode.eagle.utils

Functions:

_should_share(eagle, flag, draft, target)

Share unless the draft declares its own copy that differs from the target.

A draft that declares its own copy but has no top-level one (e.g. MTP heads stored per layer) keeps it.

get_target_lm_head(target_model, target_language_model)

The target's lm_head — from get_language_model() for *ForConditionalGeneration targets, else the top-level module.

maybe_share_target_embed(draft_model, draft_inner, target_inner)

Share the target input embedding with the drafter when needed.

share_target_lm_head(draft_model, target_lm_head, quantization, can_share=True)

Install the target lm_head, or its quantized copy, on a drafter that shares it. Returns the installed head, or None if the drafter keeps its own.