CLIP › Key Parameters

Michael BrenndoerferFebruary 8, 20261 min read
Language AI HandbookAll chapters
Part 50 of 67Multimodal Models
Chapter 382CLIP › Key Parameters
Reading section 8 of 11 · Key Parameters · 1 minSection 8 of 11 · 1 min

Book contents

Section 8 of 11 · 1 min read

CLIP › Key ParametersOne section · Sections in this chapter8 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Understanding the key parameters for CLIP deployment helps you make informed decisions about which model variant to use and how to configure inference:

  • projection_dim: Dimension of the shared embedding space (512 for ViT-B/32, 768 for larger variants). This determines the size of the vectors you store for retrieval applications and the computational cost of similarity search.
  • temperature: Learned scaling parameter (initialized to approximately 0.07, typically converging to an effective value around 100 after training). Controls the sharpness of the softmax distribution over similarity scores. Higher values produce more confident predictions.
  • num_hidden_layers: Number of transformer layers in the encoders (12 layers for the ViT-B/32 variant). More layers capture more complex visual and linguistic patterns but increase inference time and memory requirements.
  • prompt_template: Template string used to format class labels into natural language descriptions (for example, "a photo of a {}"). This significantly affects zero-shot performance and should match the style of captions in the training data.
  • patch_size: For ViT variants, the size of image patches (32, 16, or 14 pixels). Smaller patches capture finer detail but dramatically increase the number of tokens and the quadratic attention cost.