Temperature scaling: controlling concentration, not knowing that the answer is right or wrong

Temperatures resize differences in a set of fractions and convert them to probabilities.

Thematic shorts • IntroductionCollate in 1 diagram2 self-measured2 First-hand sources
Start Body
Learning objectives and first steps2 objectives . 1 first fix

Try to do it after reading

  • Explain temperature scaling: control concentration, mechanisms and prerequisites for not knowing that the answer is right or wrong
  • Positioning the mechanism ' s fault limits with fixed examples

Suggested first

  • Logits and probability of being normalized

Issues and mechanisms

Temperatures resize differences in a set of fractions and convert them to probabilities. The lower the positive temperature, the more likely the probability is usually concentrated; The bigger the distribution, the more flat. It retains the order of points, but changes the sampling and the convincing expression. If the most likely item of the model is an error, the reduction in temperature would only result in a more stable output of the error, so that temperature cannot be interpreted directly as a rotor of factual accuracy.

A given logit vector z using z to perform softmax after T, where T must be positive. All fractions plus the same constant do not change the probability, and a maximum reduction would avoid an overflow of the index. The limit of T approaching zero is associated with the maximum score; Zero temperatures in the process are usually handled by corrupt branches, and zero can not be directly added to the division. There is also a need for clear selection rules for multiple maximum-segmental parallels.

pi=ezi/T∑jezj/T,T>0

A concrete example

Combination of two fractions [2,0], T is the first probability of about 0.880977, T is about 0.731059, T is about 0.5002014. In three cases, the first was always in the front line, but the opportunity to sample from the second was clearly different. If the first category is determined using a threshold of 0.8, T will change classification decisions for the second time, even if the order is identical. Sorting, probability and final action must be seen separately.

Temperature effects of two fractionsA fixed score of two to zero, and a temperature of two, one and one to five corresponds to the first probability of zero-seven-three-one, zero-eight-one and zero-eight-eight-one-two.T=20.731059 ProbabilityT=10.8800797 ProbabilityT=0.50.982014 Probability
A fixed score of two to zero, and a temperature of two, one and one to five corresponds to the first probability of zero-seven-three-one, zero-eight-one and zero-eight-eight-one-two.

Borders and checks

In calibration missions, the temperature should be combined on independent calibration data, using non-participating data for evaluation; The manual sampling temperature in the generation task is not the same validation process. The change of temperature should be followed by a fixed filter order such as top-p. Different interfaces may ignore the temperature of the corrupt mode, and corresponding versions of the document should be read to avoid the possibility that parameters are set to be effective.

A method of verification

Calibration demonstrations can keep labels fixed and scans several positive temperatures, with separate sorting of indicators and probability errors; The former remain in the strict sequence, while the latter may be improved or degraded. For temperature to be selected, the selection process must be isolated from the final evaluation data. Demonstrations should be generated by recording random seeds and candidate filters, avoiding confusion between temperature changes and different sampling tracks. Only arithmeticals of distributional change are established, on the basis of which there is no direct commitment to answer more reliable or creative answers.

Check understanding

Is the temperature changing and the order of events constant, and is all decisions unchanged?

Not necessarily. The maximum entry category is maintained, but the fixed probability threshold may change and the random sampling may change. The rules of decision-making need to be explained in conjunction with probabilities.

Would all logit plus 1,000 change the outcome?

The value is realized without mathematical change to softmax, but may spill. The same probability can be maintained in the form of stabilization in the form of a reduction in the maximum value, while avoiding the direct calculation of large indices.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. Hugging Face Transformers — Generation
  2. On Calibration of Modern Neural Networks

Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.

← Back to the knowledge directory
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.