C.W.K.
Stream
Lesson 08 of 10 · published

Sampler 읽기 — Temperature, Top-P, Seed

~16 min · foundations, sampling, determinism

Level 0수련생
0 XP0/100 lessons0/14 achievements
0/120 XP to next level120 XP to go0% complete

단어 안 바꾸고 프롬프트 바꾸는 다이얼들

같은 프롬프트가 temperature 0이랑 1에서 — 사실상 다른 프롬프트 두 개야. sampler는 contract의 일부 — 그런데 prompt-engineering 콘텐츠 대부분이 무시해.

각 다이얼이 진짜 뭘 하나

  • Temperature — sampling 전에 logit을 scale해. 낮음 = deterministic, 좁음. 높음 = exploratory, 의외. confidence 다이얼 아니야.
  • Top-P (nucleus sampling) — 누적 확률 ≥ p인 가장 작은 token 집합으로 sampling 제한. 극단 temperature를 길들여.
  • Top-K — top-p의 옛날 사촌. 2026 frontier API에서는 덜 흔해.
  • Seed — 일부 provider가 reproducibility를 위해 노출 (best-effort, 비트 단위 X).
  • Stop sequence — sampler가 멈추는 string. fenced output에 유용.

실전 setting

정답 있는 task (extraction, classification, JSON output)에는 default temperature 0 (또는 0.2). variety 중요한 creative/generative task에는 0.7~1.0. 1.2 이상은 거의 안 가 — 보통 top-p 0.9이 더 맞아.

thinking-budget 다이얼

reasoning 모델 (Claude extended thinking, OpenAI o-series, Gemini thinking)에서 thinking budget이 네 번째 차원. 트랙 4에서 다뤄.

Code

같은 프롬프트, 세 가지 sampler regime·python
# Extraction (deterministic)
client.messages.create(
    model="claude-opus-4-7",
    temperature=0,
    max_tokens=256,
    messages=[...]
)

# Brainstorm (varied)
client.messages.create(
    model="claude-opus-4-7",
    temperature=1.0,
    top_p=0.9,
    max_tokens=512,
    messages=[...]
)

# Tight rewrite
client.messages.create(
    model="claude-opus-4-7",
    temperature=0.4,
    max_tokens=384,
    stop_sequences=["\n---\n"],
    messages=[...]
)

External links

Exercise

같은 프롬프트를 temperature 0, 0.7, 1.2로 돌려. 각각 5번 sampling. contract 기준으로 score. 다양한 prose를 만드는 게 아니라 contract 만족을 최대화하는 temperature 골라.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.