SamplingParams to sample(), with num_samples for the number of completions per prompt.
This example continues the sampling client and tokenizer from Sample published weights. It raises the temperature, samples from the 50 most likely tokens at each step, and prints the reply:
response.sequences holds one entry per requested sample, up to the max_tokens limit or the first stop sequence.
Parameters
Scales the token distribution before sampling. Lower values make output more deterministic, and higher values make it more varied.
Keep the most likely tokens until their combined probability reaches
top_p. 1.0 turns off this cut-off. Don’t use it when the samples feed an RL loss; see Min-p sampling.Sample from the
top_k most likely tokens. Zero or a negative value turns off this cut-off.Constrain generation to a structure, such as a JSON schema or regular expression. Defaults to
None, which leaves generation unconstrained. See SamplingParams for the accepted format.Next steps
- Min-p sampling: Sample at higher temperatures and match the cut-off in RL losses.
- Sample from a run: Call
sample()on a run’s paired sampler.