00:00:00

Share Your Feedback 🏝️

Temperature | Temperature Effect

Temperature | Temperature Effect

MinWoo(Daniel) Park | Tech Blog

Read more
Previous: Model | DeepSeek-Coder-v2 Next: Model | Apple - LFM

Temperature | Temperature Effect

  • Related Project: Private
  • Category: Paper Review
  • Date: 2024-05-20

The Effect of Sampling Temperature on Problem Solving in Large Language Models

  • url: https://arxiv.org/abs/2402.05201
  • pdf: https://arxiv.org/pdf/2402.05201
  • html https://arxiv.org/html/2402.05201v1
  • abstract: In this research study, we empirically investigate the effect of sampling temperature on the performance of Large Language Models (LLMs) on various problem-solving tasks. We created a multiple-choice question-and-answer (MCQA) exam by randomly sampling problems from standard LLM benchmarks. Then, we used four popular LLMs with five prompt-engineering techniques to solve the MCQA problems while increasing the sampling temperature from 0.0 to 1.0. Despite anecdotal reports to the contrary, our empirical results indicate that changes in temperature in the range 0.0 to 1.0 do not have a statistically significant impact on LLM performance for problem-solving tasks. In addition, these results appear to hold regardless of the LLM, the prompt-engineering technique, or the problem domain. All code, data, and supplemental materials are available on GitHub at: https://github.com/matthewrenze/jhu-llm-temperature.

[참고자료 1] Temperature 와 Top-$p$ (Top-$k$)

LLM의 하이퍼파라미터 temperaturetop_p (또는 top_k)와 같은 파라미터에 대한 간단한 설명

온도 (Temperature)

언어 모델에서 temperature 파라미터는 어휘에 대한 확률 분포의 “날카로움”을 조절하는데, 낮은 온도는 분포를 더 뾰족하게 만들어 (확률이 높은 토큰을 선호하여) 예측을 더 결정적으로 만들고, 높은 온도는 확률 분포를 더 평평하게 만들어 랜덤성을 증가시킵니다.

온도 \(T\)를 사용하여 수정된 확률은 다음과 같이 계산됩니다.

\[P'(x) = \frac{e^{(\log(P(x))/T)}}{\sum_{x'} e^{(\log(P(x'))/T)}}\]

\(P(x)\)는 원래 확률이고, \(P'(x)\)는 조정된 확률로, \(T\)가 1보다 클 때 확률은 더 평등하게 분포되고, \(T\)가 1보다 작을 때 특정 토큰들이 더 강조됨을 의미합니다.


Top-$P$ (또는 Top-$K$)

top_p는 누적 확률이 특정 임계값 \(p\)에 도달할 때까지 가장 가능성이 높은 토큰을 선택하는 샘플링 전략으로, 생성할 토큰의 다양성을 허용하면서도 randomness를 제한하는 방법입니다.

주어진 확률 분포에서, 토큰들을 확률에 따라 내림차순으로 정렬하고, 누적 확률이 \(p\)를 초과할 때까지 상위 토큰들을 유지합니다. 예를 들어, \(p = 0.9\)이면 확률의 상위 90%에 해당하는 토큰만 고려됩니다.

  • 온도가 낮고 top_p 설정이 제한적일수록 더 결정적 출력되며, 반대로 온도가 높고 top_p 설정이 느슨할수록 randomness와 creativity가 증가한다고 합니다. (Temperature Creativity 논문 참조)
  • 토큰이 자주 나타나거나 이미 나타난 경우에 대한 패널티를 적용해 샘플링 과정에서 다양성을 증가시킬 수 있습니다.
Previous: Model | DeepSeek-Coder-v2 Next: Model | Apple - LFM

post contain ""

    No matching posts found containing ""