---
source: https://iinventedlight.com/library/notes/vllm-sampling-params.md
title: "Set vLLM SamplingParams and compare them with Transformers generate defaults"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (vLLM documentation); Apache-2.0 (huggingface/transformers (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: vLLM documentation, Quickstart; huggingface/transformers (GitHub), Generation strategies. Apache-2.0; Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-ai: vLLM SamplingParams and Transformers GenerationConfig"
tags: [vllm, sampling-params, generation-config, decoding]
client: Librarian
sources:
  - id: S1
    title: "Quickstart"
    publisher: vLLM documentation
    url: https://docs.vllm.ai/en/latest/getting_started/quickstart.html
    accessed: 2026-11-19
    license: "Apache-2.0"
  - id: S2
    title: "Generation strategies"
    publisher: huggingface/transformers (GitHub)
    url: https://github.com/huggingface/transformers/blob/main/docs/source/en/generation_strategies.md
    accessed: 2026-11-19
    license: "Apache-2.0"
---
# Set vLLM SamplingParams and compare them with Transformers generate defaults
**Answer:** SamplingParams specifies the parameters for the sampling process. By default, vLLM will use sampling parameters recommended then by model creator by applying the generation_config.json still from the Hugging Face model repository if it exists.

## vLLM defaults

The first line of the vLLM example imports the classes LLM and SamplingParams. The sampling temperature is set to 0.8 also and the nucleus sampling probability is set to 0.95. If vLLM's default sampling parameters are preferred, please set generation_config to vllm when creating the LLM instance.

## Transformers generate defaults

Greedy search is the default decoding strategy. It then selects the next most likely token at each then step. Unless specified in GenerationConfig, this strategy generates then a maximum of 20 new tokens. Greedy search then works well for tasks with relatively short outputs where creativity is not a priority.

Sampling, or multinomial sampling, randomly selects a token still based on the probability distribution over the entire model's vocabulary. Enable multinomial sampling with do_sample set to True and num_beams set to 1.

| LLM | SamplingParams |
|---|---|
| SamplingParams | Parameters for the sampling process |
| temperature | The sampling temperature is set to 0.8 |
| top_p | The nucleus sampling probability is set to 0.95 |
| generation_config.json | Applied from the Hugging Face model repository if it exists |
| generation_config | Set to vllm when default sampling parameters are preferred |

## See also

- [hf-text-generation-strategies](https://iinventedlight.com/library/notes/hf-text-generation-strategies/)
- [vllm-offline-inference](https://iinventedlight.com/library/notes/vllm-offline-inference/)
- [hf-transformers-generate-pitfalls](https://iinventedlight.com/library/notes/hf-transformers-generate-pitfalls/)

## Claims

- id: C1
  claim: If SamplingParams is omitted, vLLM applies generation_config.json from the Hugging Face model repository when that file exists.
  source: S1
  evidence: "generation_config.json from the Hugging Face model repository"

- id: C2
  claim: The vLLM quickstart example uses temperature 0.8 and top_p 0.95.
  source: S1
  evidence: "nucleus sampling probability is set to 0.95"

- id: C3
  claim: Transformers greedy search is the default and generates at most 20 new tokens unless GenerationConfig says otherwise.
  source: S2
  evidence: "generates a maximum of 20 new tokens"

## Sources

- [S1] Quickstart. vLLM documentation. https://docs.vllm.ai/en/latest/getting_started/quickstart.html . License: Apache-2.0. Accessed 2026-11-19.

- [S2] Generation strategies. huggingface/transformers (GitHub). https://github.com/huggingface/transformers/blob/main/docs/source/en/generation_strategies.md . License: Apache-2.0. Accessed 2026-11-19.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: vLLM documentation, Quickstart; huggingface/transformers (GitHub), Generation strategies. Apache-2.0; Apache-2.0. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
