Skip to content

vllm.v1.worker.gpu.model_states.encoder_only

Classes:

EncoderOnlyModelState

Bases: DefaultModelState

ModelState for encoder-only (BERT/RoBERTa) models.

Encoder attention needs no KV cache: it runs full, bidirectional self-attention over each request's tokens in a single forward. Such layers return no get_kv_cache_config and therefore never enter kv_cache_config.kv_cache_groups, so the KV-backed attention path never builds their metadata. We build their (non-causal) metadata here, keeping the normal KV-backed path untouched.