← All notes

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

Sources

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

Permanent ID: iil:note:2g9c3wpb

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.},
}

Markdown

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.

All artifact files (JSON index)

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.