HyperCLIP: Adapting Vision-Language models with Hypernetworks

Victor Akinwande, Mohammad Sadegh Norouzzadeh, Devin Willmott, Anna Bair, Madan Ravi Ganesh, J. Zico Kolter

Large-scale vision-language models (VLMs) like CLIP have revolutionized how we approach computer vision, but their massive size—often billions of parameters—makes them nearly impossible to deploy on resource-constrained edge devices. While techniques like distillation or pruning help, they often require complex, multi-step post-processing.

A new paper, HyperCLIP, proposes a clever alternative: instead of trying to shrink a giant model after the fact, why not train a small model that can dynamically "specialize" itself for any given task?

TL;DR

HyperCLIP uses a hypernetwork to dynamically adapt the weights of a small image encoder based on specific text inputs (like class labels). By jointly training the hypernetwork and encoders end-to-end, the authors produce deployment-friendly vision models that significantly outperform standard small-scale baselines on zero-shot tasks.

What Problem Does This Paper Address?

The success of VLMs stems from their ability to learn general representations from massive web-scale datasets. However, this generality requires enormous vision encoders. When you try to use a much smaller encoder (like a MobileNet or a small EfficientNet) in a standard CLIP setup, the performance drops significantly because the small model lacks the capacity to represent the entire breadth of the data domain.

Current solutions for edge deployment—pruning, quantization, and distillation—usually happen after a large model is already trained. These methods are often computationally expensive, require specialized hardware, or need additional labeled data for fine-tuning. HyperCLIP aims to bake efficiency into the pre-training process itself.

Methods

The core innovation is the HyperCLIP architecture, which consists of three components trained jointly:

  1. A standard (but small) image encoder.
  2. A standard text encoder.
  3. A hypernetwork.
Figure 1: (Left) The traditional CLIP architecture with SigLIP loss. (Right) the HyperCLIP variant. Overview of HyperCLIP. We use an hypernetwork to generate the weights of a smaller vision model within the SigLIP contrastive pre-training framework. The entire setup is trained end-end. HyperCLIP increases the zero-shot accuracy of SigLIP models with small image encoders by up to 3% on ImageNet and 5% on CIFAR-100 with minimal training throughput overhead.

Instead of a fixed image encoder, HyperCLIP uses the hypernetwork to "precondition" the image encoder for a specific task. The hypernetwork takes text embeddings (generated from the task's class labels) and outputs a subset of parameters for the image encoder.

Crucially, the authors found that they don't need to generate all the weights. Instead, the hypernetwork only produces the scale and bias parameters for the normalization layers (like BatchNorm or LayerNorm). The rest of the image encoder's weights (convolutions and MLPs) remain shared and are learned normally during training.

The hypernetwork architecture uses a non-causal Transformer to process text embeddings and output normalization parameters.

At deployment time, you simply pass your class labels through the text encoder and hypernetwork once to generate the specialized normalization weights. You then discard the text encoder and hypernetwork, leaving a tiny, high-performing image classifier ready for the edge.

Datasets

  • Training: The models were trained on 128 million samples from a filtered version of the DataComp dataset.
  • Evaluation: A massive suite of benchmarks was used, including:
  • Classification: ImageNet-1K, CIFAR-100, CIFAR-10, Caltech-101, Food101, Oxford-IIIT Pet, Pascal VOC 2007, and STL-10.
  • Retrieval: Flickr30k and MSCOCO 2014.
  • Robustness/Fairness: ImageNet-R, ImageNet-O, GeoDE, and Dollar Street.

Key Insights and Ideas

  • Normalization as a Control Surface: The most significant "aha" moment is that adapting only the normalization layers is sufficient to "specialize" a small model for a task. This drastically reduces the number of parameters the hypernetwork needs to generate (from millions to tens of thousands), making the training process feasible.
  • Dynamic Specialization beats Static Generality: A small model that can adapt its internal normalization based on what it's looking for (the text prompts) can outperform a slightly larger model that has fixed weights.
  • Inference-Driven Adaptation: Unlike LoRA (Low-Rank Adaptation), which adds new parameters to a model, HyperCLIP modifies the existing parameters of the base architecture, meaning the final deployed model has exactly the same inference cost as the original small encoder.

Key Results

HyperCLIP consistently improves performance across various small-scale architectures (EfficientNet, MobileNetV3, TinyNet, etc.).

Table 2: Comparison of HyperCLIP and SigLIP models trained on 128M samples from the DataComp large pool using text-based and DFN filters. Metrics include Top-1 zero-shot accuracy, top-1 mean recall, and worst-group top-1 zero-shot accuracy across various tasks. ‘Arch’ denotes the image encoder architecture, and HC indicates experiments using HyperCLIP.
  • Accuracy Gains: On ImageNet-1K, HyperCLIP improved the zero-shot accuracy of an EfficientNet-B0 by 2.4% and TinyNet by 3.3%. On CIFAR-100, gains were as high as 5%.
  • Efficiency: A HyperCLIP-adapted EfficientNet-B0 (4.6M parameters) performs nearly as well as a standard EfficientNet-B1 (7.2M parameters), effectively allowing for a "free" model scale-up in terms of accuracy.
  • Training Throughput: While the hypernetwork adds complexity, the training overhead is often minimal. For EfficientNet-B0, the throughput decrease was only 3.3%.
Table 1: We show the architecture details for each image encoder, the type and dimension of normalization layers (batch norm, layer norm, or group norm) adapted, as well as the impact on the training throughput from introducing the hypernet.

Limitations and Future Work

  • Scaling the Hypernetwork: The authors limited adaptation to normalization layers because generating millions of weights for larger encoders is still an open research challenge.
  • LayerNorm Bottleneck: Models using LayerNorm (like EdgeNext) saw a much larger drop in training throughput (up to 47%) compared to BatchNorm models, likely due to parallelization bottlenecks in computing statistics.
  • Future Directions: The authors suggest that as hypernetwork training dynamics are better understood, future versions might be able to adapt the entire image encoder, potentially leading to even greater gains.

Summary updated

BibTeX
@misc{akinwande2024hyperclip,
  author = {Victor Akinwande and Mohammad Sadegh Norouzzadeh and Devin Willmott and Anna Bair and Madan Ravi Ganesh and J. Zico Kolter},
  title = {{HyperCLIP: Adapting Vision-Language models with Hypernetworks}},
  year = {2024},
  eprint = {2412.16777},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.16777},
}
Figure