برای کنترل خروجی LLM فقط دما نیست، چندتا پارامتر مهم دیگه هم نقش دارن
🔹Temperature: دما مستقیماً میزان تصادفی بودن خروجی رو تعیین میکنه. دمای پایین یعنی مدل خیلی دقیق و قابل پیشبینی جواب میده، دمای بالا یعنی متن خلاقانهتر ولی کمثباتتر
🔹do_sample: اگه فعال باشه، مدل بهجای انتخاب همیشه مطمئنترین کلمه، از بین چند گزینه انتخاب میکنه. در واقع بدون فعال بودنش، تغییر دما هم بیفایدهست
🔹top_k: این پارامتر تعداد گزینههایی رو که مدل میتونه انتخاب کنه محدود میکنه. عدد کم یعنی مدل محتاطتر و جوابها قابلاعتمادتر. عدد بالا یعنی آزادی عمل بیشتر
🔹top_p: بهجای تعداد مشخص، مدل از بین مجموعهای انتخاب میکنه که مجموع احتمالش به یه حد خاص برسه (مثلاً ۹۵٪). این باعث میشه متن تنوع داشته باشه ولی پرت و پلا هم نشه
Configuring Temperature
To control LLM output, temperature isn’t the only factor. Several other parameters also shape the results:
Temperature: Directly controls the randomness of the output. Low values make the model very precise and predictable. Higher values add creativity but reduce stability.
do_sample: If enabled, the model samples from multiple possible tokens instead of always choosing the most likely one. Without this, temperature adjustments won’t matter.
top_k: Limits the model’s choices to the top k most probable tokens. A small value keeps it conservative and reliable; a larger value gives more freedom.
top_p: Instead of a fixed number, the model chooses from the smallest set of tokens whose cumulative probability passes a threshold (e.g., 95%). This keeps variety while avoiding nonsense.
🦴 @scopeofai | #concepts