Skip to content

vllm.entrypoints.openai.decisions.strategies

Read strategies: how a model is asked for label probabilities.

Only models in READ_STRATEGIES are currently supported.

Classes:

  • ClefFlashStrategy –

    Clef-Flash's joint schema prompt with Qwen3.5 image/video processing.

  • D3Strategy –

    Decision 3.0 code-readout models. Each question is one classify read of

  • DiffusionGemmaCanvasStrategy –

    DiffusionGemma. Each read is one read-only request with one denoising step:

  • JointSchemaStrategy –

    Clef-Omni. The whole request is one pooling read: the state, then every

  • LiquidStrategy –

    Liquid decision models (d1). The prompt and the label tokens are the

  • NextTokenStrategy –

    Autoregressive models. Each question is one request: the state, then the

  • ReadPromptRequest –

    Chat options for one read, ending at the generation prompt so the label

  • ReadStrategy –
  • SlotLMStrategy –

    Slot-readout models: one PrefixLM request per question on slot_prompt.

Functions:

  • cap_pixels –

    Shrink image to at most max_pixels pixels (bicubic).

  • common_prefix_len –

    The number of leading token ids that every prompt starts with.

  • prompt_tail –

    The prompt's ids after its last added token.

  • reply_label_ids –

    The prompt's ids after its last added token, and the token each of

  • select_read_strategy –

    Raise ValueError when the model cannot serve structured decisions.

  • type_label_ids –

    The reply's first token for each label of every registered question

ClefFlashStrategy

Bases: JointSchemaStrategy

Clef-Flash's joint schema prompt with Qwen3.5 image/video processing.

D3Strategy

Bases: ReadStrategy

Decision 3.0 code-readout models. Each question is one classify read of the prompt the checkpoint's d3_format.py writes: the state, the question and one line per option under an answer code. The readout scores every code at the last token, and a question's probabilities are the softmax of its own codes' logits at the checkpoint's temperature.

_options(q)

Each option's line in the model's order, and the index of each of q.options in that order.

_render_media(prefix, media, cache_salt) async

The system prompt and the media placeholders, with the media read once for every question of the request.

DiffusionGemmaCanvasStrategy

Bases: NextTokenStrategy

DiffusionGemma. Each read is one read-only request with one denoising step: one question, or with read_joint one canvas of questions.

_init_joint_lines(tokenizer)

Whether every answer line "k: label" ends in one label token.

_joint_canvas(questions, prompt_ids, start)

The answer lines with noise in the slots, and each label's tokens.

_joint_chunks(questions)

The fewest even runs that fit the canvas, each with its first number.

_joint_content(state, questions, start)

The user turn of a joint read: the state, then the numbered questions.

_joint_question(number, question) staticmethod

A numbered question. The heading shows even without instructions, so each answer line's number matches a question.

JointSchemaStrategy

Bases: ReadStrategy

Clef-Omni. The whole request is one pooling read: the state, then every question with its options, as the model was trained to read them. The model's joint schema head scores each option, so a read has no labels.

Mirrors encode_record in the checkpoint's joint_schema_model.py. Each piece is tokenized on its own, so the spans of the questions and the options are known. The spans count from the end of the prompt, so they hold after the media placeholders, which come before the state, expand.

Methods:

  • encode –

    The prompt, the schema for the pooler, and each question's option

_options(q)

Each option's index in q.options, id and description, in the model's order: choices sorted by name, noul true then false, score levels by index.

_render_media(media, cache_salt) async

The system prompt and the media, with the media's placeholders expanded. A video's soundtrack is heard with it when every video has one.

_soundtrack(video_url) async

The video's soundtrack, or None when it has no decodable one.

encode(questions, state, prefix=None)

The prompt, the schema for the pooler, and each question's option indices in the order of the output. prefix is what precedes the state: the system prompt, and the media if there are any.

LiquidStrategy

Bases: NextTokenStrategy

Liquid decision models (d1). The prompt and the label tokens are the ones the checkpoint was trained with, from the prompt.py it ships.

_codes(question) staticmethod

A choice's codes are A to Z, or the option names when those are already single letters.

NextTokenStrategy

Bases: ReadStrategy

Autoregressive models. Each question is one request: the state, then the question with its labeled options, and the logprobs of the label tokens as the reply's first token. The requests share the state. With prefix caching, it is prefilled once.

_content(state, question)

The user turn: the state, then the question.

_generation_prompt()

A chat prompt's ids up to the generation prompt, with thinking off.

_image_parts(urls) async

The images as chat content parts, fetched once so that every question reads the same pictures.

_label_groups(question)

The tokens that count for each label. A label scores its best one.

_prompts(read_request, contents, instructions, image_parts) async

Each content rendered as a chat prompt, with the prompt's ids.

_question_read(result, groups, logprobs, position=0, usage=True) staticmethod

The answer at position. Only a read with usage counts tokens.

_read_input(engine_input, prompt_ids)

The engine input for a read of the rendered prompt.

_warm_shared_prefix(prompts, request_id, *, lora_request, priority, cache_salt, trace_headers, extra_args=None) async

Prefill the tokens every question starts with, before the reads.

The reads share the state only through the prefix cache. Reads that start together cannot reuse each other's recurrent state, so on hybrid models each of them would prefill the state again. Attention-only models share the blocks within a step and skip this.

ReadPromptRequest

Bases: OpenAIBaseModel

Chat options for one read, ending at the generation prompt so the label is the reply's first token. Thinking is off unless the request enables it.

ReadStrategy

Bases: ABC

Methods:

  • num_requests –

    The engine requests a decision takes.

  • read –

    One read per question, in order.

  • read_joint –

    Like read, with questions sharing canvases. Only if joint_reads.

  • render_state –

    The request's state as the model reads it.

num_requests(questions, joint=False)

The engine requests a decision takes.

read(questions, instructions, state, *, request_id, chat_template_kwargs, lora_request, priority, cache_salt=None, trace_headers=None, media=None) abstractmethod async

One read per question, in order.

read_joint(questions, instructions, state, *, request_id, chat_template_kwargs, lora_request, priority, cache_salt=None, trace_headers=None, media=None) async

Like read, with questions sharing canvases. Only if joint_reads.

render_state(state)

The request's state as the model reads it.

SlotLMStrategy

Bases: NextTokenStrategy

Slot-readout models: one PrefixLM request per question on slot_prompt.

_prefix_text(state)

The prompt up to where the suffix starts.

cap_pixels(image, max_pixels)

Shrink image to at most max_pixels pixels (bicubic).

common_prefix_len(prompts)

The number of leading token ids that every prompt starts with.

prompt_tail(tokenizer, prompt_ids)

The prompt's ids after its last added token.

reply_label_ids(tokenizer, prompt_ids, labels=LABELS)

The prompt's ids after its last added token, and the token each of labels adds after them as the first token of the reply. Raises ValueError if a label is not one distinct token there.

select_read_strategy(model_config, supported_tasks)

Raise ValueError when the model cannot serve structured decisions.

type_label_ids(tokenizer, prompt_ids)

The reply's first token for each label of every registered question type. Raises ValueError as reply_label_ids does.