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:
-
JointSchemaHead– -
JointSchemaPooler–Runs the joint schema head on each finished prompt.
-
SchemaIndices–Where one prompt's questions and options are, on the model's device.
Functions:
-
parse_joint_schema–The question types, the absolute spans of the questions then of the
JointSchemaHead
¶
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(Tensor) –[Q, max_options], true at the slots of options. -
option_question(Tensor) –The question of each option,
[O]. -
option_slots(Tensor) –Each option's flat index in a
[Q, max_options]grid,[O]. -
positions(Tensor) –Every token of every span, questions first.
-
question_types(Tensor) –[Q]. -
span_ids(Tensor) –The span of each of
positions. -
span_lengths(Tensor) –[Q + O].
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.