Skip to content

vllm.model_executor.models.clef_joint_schema

Shared joint schema head for Clef decision models.

The head reads the final hidden states of the whole prompt, so it runs as a token_classify pooler.

Each request carries its schema in PoolingParams.extra_kwargs under "joint_schema":

  • question_types: 0 (noul), 1 (choice) or 2 (score) per question.
  • question_spans: the [start, end) of each question's instructions.
  • option_spans: the [start, end) of each option, question by question.
  • option_counts: the number of options of each question.

Spans count from the end of the prompt (-len(prompt) <= start < end <= 0), so they hold after multimodal placeholders are expanded. The output has one value per option, in option_spans order: its probability within its question, or its logit with use_activation=False.

Classes:

Functions:

  • parse_joint_schema –

    The question types, the absolute spans of the questions then of the

JointSchemaHead

Bases: Module

Methods:

  • forward –

    The [O] option logits of one prompt, from its [L, hidden]

forward(hidden_states, lexical, schema)

The [O] option logits of one prompt, from its [L, hidden] final hidden states and each option's [O, hidden] mean output embedding.

JointSchemaPooler

Bases: Pooler

Runs the joint schema head on each finished prompt.

It never raises, because it runs in the engine core: a prompt without a valid schema, such as a profiling dummy, gets an empty output.

_indices(types, spans, counts, device) staticmethod

The schema's indices, plus the option tokens' positions (on the CPU) and their option spans, for the lexical embeddings.

SchemaIndices dataclass

Where one prompt's questions and options are, on the model's device.

Attributes:

option_mask instance-attribute

[Q, max_options], true at the slots of options.

option_question instance-attribute

The question of each option, [O].

option_slots instance-attribute

Each option's flat index in a [Q, max_options] grid, [O].

positions instance-attribute

Every token of every span, questions first.

question_types instance-attribute

[Q].

span_ids instance-attribute

The span of each of positions.

span_lengths instance-attribute

[Q + O].

parse_joint_schema(extra_kwargs, prompt_len)

The question types, the absolute spans of the questions then of the options, and the option counts. None if the schema is missing or invalid.