Zubnet AIसीखेंWiki › Logits
मूल सिद्धांत

Logits

Raw Scores, Pre-Softmax Outputs
Raw, unnormalized scores जो एक model output करता है इससे पहले कि वो softmax function से probabilities में convert हो जाएँ। एक language model के लिए, logits एक vector हैं जिसमें vocabulary के हर token के लिए एक value है — higher values इंडीकेट करती हैं कि model उन tokens को ज़्यादा likely मानता है। Logits सबसे informative output हैं जो एक model produce करता है, final probability distribution से ज़्यादा information contain करते हुए।

यह क्यों matter करता है

Logits समझना आपको ये समझने में help करता है कि models कैसे “सोचते” हैं। Temperature, top-p, और top-k sampling सब logits पर operate करती हैं। Image generation में classifier-free guidance logits manipulate करती है। Logit bias (specific tokens को offsets add करना) आपको model behavior steer करने देता है। अगर आप basic chat के आगे AI applications build कर रहे हैं, आपको eventually logits के साथ directly work करने की ज़रूरत होगी।

Deep Dive

The model's final layer produces a vector of size V (vocabulary size, typically 32K–128K). Each element is a logit for that token. Softmax converts these to probabilities: P(token_i) = exp(logit_i) / ∑ exp(logit_j). Before softmax, the logits can be any real number — positive, negative, or zero. A logit of 10 vs. 5 means the model considers the first token about e^5 ≈ 150x more likely.

Logit Manipulation

Several techniques work directly on logits. Temperature divides all logits by T before softmax (T<1 sharpens, T>1 flattens). Top-k zeroes out all logits except the k highest. Top-p (nucleus sampling) zeroes out logits for tokens outside the smallest set whose cumulative probability exceeds p. Logit bias adds a fixed offset to specific tokens' logits — adding +10 to the logit for "JSON" makes the model strongly prefer starting with JSON. Repetition penalty reduces logits of recently generated tokens.

Log-Probabilities

Most APIs can return log-probabilities (log of the softmax output) alongside generated tokens. These are useful for: measuring model confidence (low log-prob = uncertain), calibrating outputs (are 90%-confident predictions correct 90% of the time?), and building classifiers from LLMs (compare log-probs of different completions). Log-probs are more numerically stable than raw probabilities for extreme values.

संबंधित अवधारणाएँ

← सभी Terms
← llama.cpp LoRA →