Skip to content

vllm.v1.core.sched.prefix_lm_scheduler

Prefix caching for PrefixLM requests, which send their prefix length in extra_args["prefix_lm_len"]: salts each prefix's blocks by its digest, as the KV of every prefix token depends on the whole prefix, and caps hits at the prefix. The model turns chunked prefill off, so the rest of the prompt is prefilled in one step.

Classes:

Functions:

  • prefix_lm_len –

    The valid PrefixLM prefix length a request sends, else None.

  • prefix_lm_salt –

    PrefixLM cache_salt: namespace, prefix digest, then the caller's salt.

Attributes:

  • PREFIX_LM_LEN –

    SamplingParams.extra_args key of the length of a prompt's PrefixLM prefix.

  • PREFIX_LM_SALT –

    Start of the cache_salt of every PrefixLM request, and of no other.

PREFIX_LM_LEN = 'prefix_lm_len' module-attribute

SamplingParams.extra_args key of the length of a prompt's PrefixLM prefix.

PREFIX_LM_SALT = 'prefix-lm:' module-attribute

Start of the cache_salt of every PrefixLM request, and of no other.

PrefixLMScheduler

Bases: Scheduler

_salt_by_kind(request)

Salt PrefixLM requests by prefix; keep causal requests out.

prefix_lm_len(params, prompt_token_ids)

The valid PrefixLM prefix length a request sends, else None.

prefix_lm_salt(prefix_token_ids, cache_salt)

PrefixLM cache_salt: namespace, prefix digest, then the caller's salt.