> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sdvm.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Multiple choice

> MultipleChoiceCompletionSample and MultipleChoiceQuestionAnswerSample: a context, choices and an answer index, in two styles.

A multiple-choice item is a `context`, a list of `choices`, and the `answer_index` of the one correct choice. The same shape covers two different tasks, and the models read the context differently for each.

## Shape

<Tabs>
  <Tab title="Completion stem">
    The context is a sentence stem the correct choice continues, as in HellaSwag. The stem ends mid-sentence by design, so it is never judged for completeness.

    ```python wrap theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
    from sdvm.types import MultipleChoiceCompletionSample

    sample = MultipleChoiceCompletionSample(
        context="A woman applies mascara. she",
        choices=["applies it to her lashes.", "drives off.", "mixes a bowl.", "exits."],
        answer_index=0,
    )
    ```
  </Tab>

  <Tab title="Question">
    The context is a complete question the correct choice answers, as in MMLU. A truncated or malformed question is a defect, so completeness is judged.

    ```python theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
    from sdvm.types import MultipleChoiceQuestionAnswerSample

    sample = MultipleChoiceQuestionAnswerSample(
        context="What is the capital of France?",
        choices=["Berlin", "Paris", "Madrid", "Rome"],
        answer_index=1,
    )
    ```
  </Tab>

  <Tab title="Generic with style">
    `MultipleChoiceSample` takes a `style` of `"continuation"` (default) or `"qa"`. Decoding a server response returns the specific class for the style, so a round-tripped sample carries the same guarantees as one you built directly.

    ```python theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
    from sdvm.types import MultipleChoiceSample

    sample = MultipleChoiceSample(
        context="What is the capital of France?",
        choices=["Berlin", "Paris", "Madrid", "Rome"],
        answer_index=1,
        style="qa",
    )
    ```
  </Tab>
</Tabs>

On the wire:

```json theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
{
  "task_type": "multiple_choice",
  "style": "qa",
  "context": "What is the capital of France?",
  "choices": ["Berlin", "Paris", "Madrid", "Rome"],
  "answer_index": 1
}
```

The type refuses an empty context, fewer than two choices, an `answer_index` outside the choices, or an unknown `style`.

<Warning>
  The distinct types exist so the guarantee is visible in the name. `MultipleChoiceCompletionSample` refuses `style="qa"` and vice versa, so you cannot accidentally get a completeness verdict on a stem.
</Warning>

## Extra columns

Anything beyond the core fields goes in `extra` and comes back untouched:

```python theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
MultipleChoiceQuestionAnswerSample(
    context="...", choices=[...], answer_index=2,
    extra={"subject": "astronomy", "source_id": "mmlu-1234"},
)
```

## What the models return

<CardGroup cols={3}>
  <Card title="sdvm-audit-1" icon="magnifying-glass" href="/models/audit">
    What it returns for this sample.
  </Card>

  <Card title="sdvm-fix-1" icon="wrench" href="/models/fix">
    What it changes, and what it never does.
  </Card>

  <Card title="Examples" icon="code" href="/sdk/examples">
    `hellaswag.py` for stems and `mmlu.py` for questions, end to end.
  </Card>
</CardGroup>
