概述
它們影響多樣性和候選人選擇,而可預測的選擇並不能保證產生的聲明或代碼是正確的。
深入探討
A language model produces a score, called a logit, for each candidate token. Softmax converts these scores into probabilities, and a sampling procedure selects the next token. For positive temperature T, dividing logits by T changes the relative probability distribution before sampling. Values below one sharpen differences; values above one flatten them. If two logits differ by six, then division by temperature two gives a difference of three. That calculation describes the scores, not the truth of either candidate. Greedy decoding selects a highest-scoring token instead of sampling. It should be treated as a decoding rule rather than implemented by literally dividing logits by zero. A very small positive temperature concentrates probability but still differs conceptually from disabling sampling. Candidate filters offer another control. Top-k keeps a specified number of highest-probability tokens. Top-p, also called nucleus sampling, sorts candidates by probability and keeps the smallest leading set whose cumulative probability reaches or exceeds the chosen threshold. For probabilities 0.55, 0.30, 0.10, and 0.05 with top-p 0.80, the first two candidates are sufficient because they sum to 0.85. Their total need not equal the threshold exactly. These choices can influence diversity and repeatability, but no filter proves that an output is factual, safe, or syntactically valid. Generation behavior also depends on implementation and the rest of the decoding configuration, so record the actual settings when comparing results.
現實世界的實施
比較溫度低於和高於 1 時的取樣輸出。
當需要確定性令牌選擇規則時選擇貪婪解碼。
使用 top-k 來限制合格令牌候選的數量。
使用 top-p 透過累積機率來選擇候選者。
溫度和採樣的未來
抽樣研究檢查候選過濾器和自適應設定如何影響生成文字的品質和多樣性。評估實際任務的設置,而不是假設某一溫度始終能夠最大化正確性。比較應報告模型、解碼模式、篩選器和相關約束。對於結構化輸出,無論令牌選擇的可預測性如何,產生的結構的驗證仍然有用。產生控制形狀選擇;證據檢查和應用程式驗證確定所選輸出是否合適。
付諸實踐
為什麼這很重要
- 速度與規模. 語言工作流程可以在不犧牲一致性的情況下更快地移動。
- 交通與覆蓋範圍. 它擴展了跨語言和溝通方式的訪問。
- 更明確的決策. 團隊可以花更多時間進行判斷,而自動化則可以處理重複。
留意
- 幻覺的事實可以悄悄地進入報告、支持流程或研究成果。
- 及時的敏感性可能會在類似的請求中產生不一致的結果。
- 如果存取控制薄弱,敏感文字資料可能會暴露。
後續步驟
- 在推出之前定義輸出格式、語氣和品質標準。
- 當準確性很重要時,請使用可信任來源進行地面回應。
- 為高風險輸出保留人工審查檢查點。
- 追蹤故障模式並定期重新訓練提示或工作流程。
不斷探索
常見問題
什麼是溫度和採樣?
溫度和採樣設定控制生成器如何從模型分數中選擇標記。它們影響多樣性和候選人選擇,而可預測的選擇並不能保證產生的聲明或代碼是正確的。
升高溫度對模型的輸出有何影響?
較高的溫度會使機率分佈變得平坦,因此不太可能的代幣會被更頻繁地挑選,從而產生更多樣化(且風險更高)的輸出。
與 top-k 相比,什麼決定了 top-p 採樣中的候選集?
核心可以稍微超過截止值,因為整個令牌都被保留。
從力學上來說,溫度其實對邏輯有什麼影響?
在softmax之前,溫度將每個logit除以T; T 低於 1 會使分佈變得尖銳,T 高於 1 會使分佈變得平坦。
對於結構化資料任務,選擇更可預測的標記選擇無法建立什麼?
可預測性涉及選擇行為,而正確性和結構有效性仍需要檢查。
貪心解碼如何選擇下一個token?
貪婪解碼是一種選擇規則。小的正溫度在數學上並不等同於除以零。