📖

Temperature (AI)란 무엇인가요?

Temperature는 AI 모델 출력의 무작위성이나 예측 가능성을 조절하는 샘플링 하이퍼파라미터입니다. 작동 방식, 중요성, 설정 방법을 알아보세요.

AI에서 Temperature는 모델이 다음 토큰, 단어 또는 픽셀을 선택할 때 사용하는 확률 분포를 재구성하여 출력의 무작위성을 조절하는 하이퍼파라미터입니다. 이는 주로 대규모 언어 모델(LLM) 및 기타 생성 모델의 맥락에서 논의되며, 예측 가능성창의성 사이의 다이얼 역할을 합니다. 값을 낮추면 모델이 매번 가장 가능성 높은 옵션을 선택하는 경향이 있고, 값을 높이면 덜 가능성 있는 옵션도 기꺼이 선택합니다.

Temperature의 작동 원리

모델은 각 토큰을 생성하기 전에 어휘 내 모든 가능성에 대해 logit이라 불리는 원시 점수를 계산합니다. 이러한 logit은 softmax 함수를 통해 확률로 변환되며, 바로 이 지점에서 temperature가 개입합니다. softmax가 적용되기 전에 각 logit은 temperature 값 T로 나누어집니다.

T = 1일 때 분포는 변하지 않습니다. T < 1일 때 확률이 더 벌어집니다. 이미 가능성 높은 토큰은 더욱 가능성 높아지므로 샘플링이 모델의 "최선의 추측"에 가깝게 유지됩니다. T > 1일 때 분포는 평평해지고 확률이 낮은 토큰의 비중이 커지므로 출력이 더 다양해집니다. 예를 들어 모델이 다음 단어로 "the"를 60%, "a"를 20% 확신한다면, temperature 0.2에서는 거의 매번 "the"를 출력하는 반면, temperature 1.2에서는 다섯 번 중 한 번 정도 "a"를 출력합니다.

중요한 이유

Temperature는 재훈련 없이 모델 동작을塑造하는 가장 간단하고 강력한 수단 중 하나입니다. 낮은 temperature는 할루시네이션 비용이 큰 코드 생성, 사실적 질문 응답, 구조화된 데이터 추출과 같은 정밀도를 요구하는 작업에 선호됩니다. 높은 temperature는 정확성보다 참신함과 다양성이 중요한 브레인스토밍, 스토리텔링, 대화에 유용합니다.

이는 또한 프롬프트 엔지니어링의 핵심 요소이기도 합니다. OpenAI, Anthropic, Google의 API를 포함한 대부분의 LLM API는 top-p(핵 샘플링) 및 top-k와 같은 관련 제어와 함께 temperature를 조정 가능한 파라미터로 노출합니다. 사용자 경험에 직접적인 영향을 미치기 때문에, 개발자가 모델을 데모에서 프로덕션으로 전환할 때 가장 먼저 조정하는 설정 중 하나입니다.

주요 temperature 범위와 사용 시기

  • 0.0 — 그리디 디코딩. 모델은 항상 가장 확률이 높은 토큰을 선택합니다. 최대 결정론; 재현 가능한 코드나 수학에 유용합니다.
  • 0.0–0.3 — 낮고 집중적. 번역, 요약, 분류, 사실 기반 응답에 적합합니다.
  • 0.4–0.7 — 균형 잡힘. 범용 대화 어시스턴트의 일반적인 기본값입니다.
  • 0.7–1.0 — 더 다양함. 창작 글쓰기, 마케팅 카피, 아이디어 도출에 유용합니다.
  • 1.0+ — 매우 무작위적. 출력이 비일관적이 될 수 있으며, 연구나 실험적 예술 외에는 거의 사용되지 않습니다.

Temperature는 판결과 같은 것이 아니라 노브로 이해하는 것이 가장 좋습니다. top-p 또는 top-k 샘플링과 함께 사용하고, 특정 작업, 모델, 대상에 따라 조정하세요. 동일한 값이 애플리케이션에 따라 매우 다르게 느껴질 수 있기 때문입니다.

자주 묻는 질문

What is a good temperature value for ChatGPT or other LLMs?
A temperature between 0.2 and 0.7 is a sensible starting point for most tasks. Use the lower end for factual answers, coding, and summarization where consistency matters, and the higher end for brainstorming or creative writing where variety is welcome. Many production systems default to around 0.7 for general conversation.
What is the difference between temperature and top-p in AI?
Temperature rescales the entire probability distribution, making it sharper or flatter before a token is sampled. Top-p (nucleus sampling) instead trims the distribution to the smallest set of tokens whose combined probability exceeds a threshold like 0.9. The two settings are complementary: temperature changes how spread out probabilities are, while top-p changes how many candidates are considered at all.
Does temperature 0 make AI outputs identical every time?
Usually, yes, but not always. Temperature 0 (greedy decoding) makes the model pick the single most probable next token at every step, so on a fixed prompt with no other randomness in the pipeline, the output is reproducible. In practice, parallelism, batching, and floating-point quirks on GPUs can occasionally introduce small variations, which is why some teams still set very low values like 0.01 instead of true zero for strict reproducibility.
Can higher temperature make a model more accurate?
Not in general. Higher temperature increases diversity and creativity but also raises the chance of factual errors and hallucinations. For tasks where accuracy is measured against a known answer, lower temperatures almost always perform better on benchmarks. Higher temperatures can occasionally help on tasks with many valid responses, where exploration unlocks a better answer than the model's first guess.