The Verbalized Sampling Prompting Pattern

~15 min read

Instead of asking for one answer, verbalized sampling asks the LLM to generate several responses with their corresponding probabilities. This simple reframing — from requesting an instance to requesting a distribution — is enough to bypass mode collapse.

Verbalized sampling (VS) is a training-free prompting strategy — no fine-tuning, no weight changes — introduced specifically to circumvent mode collapse and recover the diverse distribution the model already learned during pre-training.

The core idea is that the prompt itself acts like a mental switch between the model's two personalities. When you directly prompt 'Tell me a joke,' the aligned personality immediately takes over and hands you the single most reinforced answer — the mode-collapsed response. But verbalized sampling changes the shape of the request: instead of 'Tell me a joke,' you prompt with 'Generate 5 responses with their corresponding probabilities. Tell me a joke.'

That single change matters enormously, because the prompt no longer asks for one instance — it asks for a distribution. To satisfy a request for 5 responses with probabilities, the model is forced to reach past its single most-reinforced answer and articulate its broader knowledge of the space of possible answers, which pulls from the rich, diverse distribution still present in its core pre-trained weights rather than the narrowed-down, aligned-personality output.

In practice, this means the response format changes from a single answer to a small structured list, each with an associated probability estimate assigned by the model itself. You then have a choice of what to do with that list — show the most likely one, sample from among them weighted by their stated probability, or show the user several options — but the important part has already happened: the model was forced to surface more of its actual learned diversity than a single-instance request ever would have.

💻 Code example

import json
from openai import OpenAI

client = OpenAI()

def verbalized_sampling(question: str, k: int = 5) -> list[dict]:
    vs_prompt = (
        f"Generate {k} responses with their corresponding probabilities, "
        f"sampled from the full distribution. Format as a JSON list of "
        f"objects with 'response' and 'probability' fields.\n\n{question}"
    )
    resp = client.chat.completions.create(
        model="gpt-4.1",
        messages=[{"role": "user", "content": vs_prompt}],
        temperature=1.0,
        response_format={"type": "json_object"},
    )
    return json.loads(resp.choices[0].message.content)["responses"]

# Unlike direct_prompt_sample(), a single VS call surfaces multiple
# genuinely distinct candidates in one shot — because the prompt asked
# for a distribution, not an instance.
candidates = verbalized_sampling("Tell me a joke.")
for c in candidates:
    print(f"{c['probability']:.2f}  {c['response']}")

💬 Deep Dive with AI

Key points

  • VS is training-free — it's purely a prompting technique, no fine-tuning or weight changes involved
  • The prompt shifts from requesting an instance ('tell me a joke') to requesting a distribution ('5 responses with probabilities')
  • This shift forces the model to reach past its single most-reinforced answer into its broader learned distribution
  • The output format becomes a structured list of candidate responses with self-assigned probabilities
  • You can then pick the top one, sample weighted by probability, or surface multiple options to the user