Skip to content

naive_speculate.config.external

User facing interface, defining external user specifiable configuration options.

UserDraftConfig

Bases: BaseModel

User specifiable configuration related to the drafting process in speculative decoding.

Attributes:

Name Type Description
model_name str

Name of the underlying transformers model used for drafting. This name will be used to load the model and tokenizer from transformers library. Example: "Qwen/Qwen3-0.6B"

sample_strategy SampleStrategy

Sampling strategy for token drafting. Default to SampleStrategy.RANDOM.

num_draft_tokens int

Number of tokens to draft in each speculation step. Must be a positive integer. Default to 5.

UserSpeculateConfig

Bases: BaseModel

User specifiable configuration for the speculative decoding process.

Refers to the docstring of DraftConfig and VerifyConfig for more details.

Attributes:

Name Type Description
draft DraftConfig

Configuration for the drafting process.

verify VerifyConfig

Configuration for the verification process.

UserVerifyConfig

Bases: BaseModel

User specifiable configuration related to the verification process in speculative decoding.

Attributes:

Name Type Description
model_name str

Name of the underlying transformers model used for verification. This name will be used to load the model and tokenizer from transformers library. Example: "Qwen/Qwen3-8B"

verify_strategy VerifyStrategy

Verification strategy for drafted tokens. Default to VerifyStrategy.SPECULATIVE_SAMPLING.