Skip to content
Back to full roadmap
topicfoundation

Sampling Parameters

temperature, top_p, top_k, presence/frequency penalty — the creativity-vs-determinism dial.

2 hours2 resources1 prereqs

temperature (0-2): Low (0-0.3) deterministic, ideal for code/JSON. High (0.7-1.2) creative, for brainstorming.

top_p (nucleus sampling): Pick from the top-p% probability pool. Often a healthier creativity knob than temperature.

top_k: Consider only the top-k most likely tokens.

presence_penalty / frequency_penalty: Penalize repeated words/topics.

Rule of thumb: Single correct answer → temp=0. Multiple valid outcomes → temp=0.7-1.0. Don't tune temperature and top_p simultaneously — hold one constant.

Prerequisites

Resources(2)