InfoNCE denominator: which candidates are competing
InfoNCE can be understood as identifying the case in a pool of candidates.
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- Expands the pool of candidates for the comparative classification
- Hand-counting probabilities and rules of exclusion
Suggested first
- Inner vectors & Parameters
- Classified loss and gradient
The denominator defines learning problems
InfoNCE can be understood as identifying the case in a pool of candidates. The positive score is indexed into the molecule and the positive and negative are joined into the denominator. Different papers or realization of differences in candidate pools, symmetry and self-exclusion rules cannot be considered identical by reference to the name of the loss alone.
The positive logit for setting an anchor is 2 and the negatives are 1 and 0, and the temperature is absorbed into logit. It's a normal probability. e ²/( e ²+ e+1 ), about 0.665241 and negative logarithm loss about 0.40706. After the second negative case was deleted, the probability was approximately 0.731059, and the loss was about 0.331622. The change in the number of candidates will change the baseline of the loss and cannot directly compare the original loss in different negative pools to representation quality.
In the same two-view training, anchor points should not themselves compete as a general candidate, otherwise they often change their targets because of their high level of similarities. Whether only another view is available and whether other samples of the same kind are positive is clear in mask. A diagonal mask is miswritten and may exclude the correct example.
Values and sampling are part of the definition
Stabilization can be achieved in the form of cross-altex and log-sum-exp equivalents, avoiding direct calculation of large indices. The same mathematical objectives should not spill out because of the instability of the code. The label index will also be consistent with the calibrated candidate order, especially when the local numbering is not used for cross-equipment aggregations.
The distribution of denominators affects the distinction that is learned. Random negatives, similar difficulties and exposures represent different tasks, and the need for sampling amendments depends on the definition of the target. The larger the number of candidates, which also leads to a holiday and calculation of expenses, the greater the number, the better.
For a fixed small matrix, you can list anchors, positive and negative by row, calculate probability by hand, and contrast it to the achievement. Checking shape is not sufficient to detect the candidate mask error, as the error mask usually still generates the legal matrix.
This section uses the rationale for the comparison classification in CPC and SimCLR, with three fractions being synthetic examples. Probability and loss are only used to validate the formula and do not represent the results of any reproducing of the paper.
Value recovery
import mathp=math.exp(2)/sum(math.exp(x) for x in [2,1,0])assert math.isclose(p,0.6652409557748219)assert math.isclose(-math.log(p),0.4076059644443804)Positive 2, negative 1 and zero. What are the chances of positive?
Approximately 0.66541, the logarithmic loss is approximately 0.40706, and the denominator includes its own index item.
Number of different negative cases loss I'll compare it to who. representation Better?
Inadvisable, the pool of candidates has changed the baseline for classification difficulties and loss and should be assessed more consistently.
Sources and reconciliations
Definitions, methods and interfaces are available.
- Representation Learning with Contrastive Predictive Coding
- A Simple Framework for Contrastive Learning of Visual Representations
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.