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
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.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: vLLM documentation, Quickstart; huggingface/transformers (GitHub), Generation strategies. Apache-2.0; Apache-2.0.
Cite this
iinventedlight. 2026. "Set vLLM SamplingParams and compare them with Transformers generate defaults." iinventedlight Library, iil:note:2g9c3wpb, version of 2026-11-19. https://iinventedlight.com/library/notes/vllm-sampling-params/. License: CC-BY-4.0.
@misc{iil_note_2g9c3wpb,
author = {{iinventedlight}},
title = {{Set vLLM SamplingParams and compare them with Transformers generate defaults}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/vllm-sampling-params/},
note = {Permanent ID iil:note:2g9c3wpb. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- vllm-sampling-params.table.json (table; CC-BY-4.0)
- vllm-sampling-params.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/vllm-sampling-params.md.