Tiếp theoHướng dẫn tiếp theo
Lấy mẫu hạt nhân và Top-k
Ngôn ngữ AI
HƯỚNG DẪN AI về ngôn ngữ
Temperature and sampling settings control how a generator selects tokens from model scores.
Nghe hướng dẫn nàyAI thuật lại · ~3 min
They affect diversity and candidate selection, while a predictable selection is not a guarantee that the generated claim or code is correct.
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.
Comparing sampled output at temperatures below and above one.
Selecting greedy decoding when a deterministic token-selection rule is wanted.
Using top-k to limit the number of eligible token candidates.
Using top-p to select candidates by cumulative probability.
Sampling research examines how candidate filters and adaptive settings affect the quality and diversity of generated text. Evaluate settings for the actual task instead of assuming that one temperature always maximizes correctness. Comparisons should report the model, decoding mode, filters, and relevant constraints. For structured output, validation of the produced structure remains useful regardless of how predictable the token choices are. Generation controls shape selection; evidence checking and application validation establish whether the selected output is suitable.
Bản tin miễn phí
Ba câu chuyện AI đã được xác minh vào mỗi buổi sáng các ngày trong tuần, được viết bằng tiếng Anh đơn giản. Miễn phí mãi mãi, không có quảng cáo.
Một email mỗi ngày trong tuần. Hủy đăng ký trong một cú nhấp chuột. Chúng tôi không bao giờ bán hoặc chia sẻ địa chỉ của bạn.
Tự kiểm tra
Phản hồi tức thì về mọi câu trả lời và chứng chỉ có thể chia sẻ với ID có thể xác minh sau khi bạn vượt qua khóa học.
Hỗ trợ giáo dục AI miễn phí. AI Understanding là tổ chức phi lợi nhuận 501(c)(3) — không bao giờ có quảng cáo, không có tường phí. Hãy quyên góp
Temperature and sampling settings control how a generator selects tokens from model scores. They affect diversity and candidate selection, while a predictable selection is not a guarantee that the generated claim or code is correct.
Nhiệt độ cao hơn làm phẳng phân bố xác suất, do đó, các mã thông báo ít có khả năng được chọn thường xuyên hơn, tạo ra đầu ra đa dạng hơn (và rủi ro hơn).
Hạt nhân có thể vượt quá giới hạn một chút vì toàn bộ mã thông báo được giữ lại.
Nhiệt độ chia từng logit cho T trước softmax; T dưới 1 làm sắc nét sự phân bố, T trên 1 làm phẳng nó.
Khả năng dự đoán liên quan đến hành vi lựa chọn, trong khi tính đúng đắn và giá trị cấu trúc vẫn cần được kiểm tra.
Giải mã tham lam là một quy tắc lựa chọn. Nhiệt độ dương nhỏ không giống về mặt toán học với việc chia cho 0.
Tiếp tục học hỏi
Đã chọn thêm hướng dẫn cho chủ đề này
Tiếp theoHướng dẫn tiếp theo
Lấy mẫu hạt nhân và Top-k
Ngôn ngữ AI