MLCrack

    COMPUTER VISION · INTERVIEW QUESTION

    For contrastive image-text pretraining, why is the temperature parameter important in the softmax objective?

    ⚫ expert · Multimodal · Contrastive Learning

    Hint: Focus on the decision rule, assumptions, and failure mode behind multimodal · contrastive learning.

    Answer

    Temperature controls distribution sharpness. Too high can under-separate examples; too low can make optimization unstable or overemphasize hard negatives.

    Interview reasoning

    Contrastive temperature rescales similarities and controls emphasis on hard competitors. A very low value can overemphasize false negatives and destabilize gradients.

    Contrastive logits divide similarities by temperature before softmax. Lower temperature creates sharper competition and concentrates gradients on difficult negatives, but semantically valid alternative captions may become harmful false negatives. Temperature must be evaluated together with batch size and negative selection.

    Worked example. Similarities 0.8 and 0.7 differ by 0.1; dividing by temperature 0.01 creates a logit gap of 10, yielding extremely sharp probabilities.

    Validation

    Sweep temperature with fixed negatives and monitor held-out retrieval and embedding geometry.

    Sweep temperature with fixed data and negatives, inspecting gradient stability, feature variance and bidirectional retrieval on hard queries.

    Common pitfalls

    The best setting depends on batch and negative distribution, not a universal constant.

    A sharp softmax is not calibrated certainty about image content. Duplicate or multi-positive examples can make the one-positive objective contradictory.

    Likely follow-up: Sweep temperature with fixed negatives and monitor held-out retrieval and embedding geometry.