Introduction
Contrastive Language-Image Pretraining (CLIP) has revolutionized zero-shot image classification, but its reliance on Vision Transformers (ViTs) presents a significant computational challenge. Because ViT compute scales quadratically with the number of image tokens, deploying these models on resource-constrained devices often requires training entirely separate, smaller architectures like TinyCLIP or MobileCLIP. This approach is both training-intensive and inflexible; once deployed, a model's computational cost is fixed regardless of the complexity of the input image.
WAVECLIP addresses these limitations by introducing a "coarse-to-fine" inference strategy. By replacing standard image patching with wavelet-based tokenization, WAVECLIP allows for dynamic, adaptive-resolution inference, enabling the model to "early exit" on simple images while refining its predictions for harder ones.
Methods
The core innovation of WAVECLIP is the replacement of the standard ViT "patchify" step with a Discrete Wavelet Transform (DWT).
Wavelet Tokenization and Progressive Inference
Instead of partitioning an image into a static grid, WAVECLIP decomposes the image into multiple frequency subbands (e.g., LL for coarse approximation; LH, HL, and HH for fine details). The model processes these tokens progressively, starting with the coarsest level. If the model achieves high confidence in its initial prediction, it can terminate inference early to save compute.
Causal Cross-Level Attention and KV-Caching
To ensure efficiency during refinement, WAVECLIP employs a block-causal attention mask. This architecture allows finer detail tokens to attend to previously processed coarse tokens, but prevents coarse tokens from looking "forward" into high-frequency details. This design choice is critical because it enables Key-Value (KV) caching; the model reuses the computations from lower resolutions when it decides to refine an image, avoiding the overhead of re-processing the entire token sequence.
Training and Gating
WAVECLIP is trained via a lightweight distillation process, learning to mimic the embeddings of a frozen, pre-trained CLIP teacher. At inference time, a "margin gate" ($\theta_m$) monitors the gap between the top-1 and top-2 predicted classes to determine if further refinement is necessary.
Key Results
WAVECLIP transforms the static accuracy-compute trade-off into a dynamic curve. By adjusting the confidence threshold at runtime, developers can tune the model's performance to match current hardware constraints, such as a "low power" mode for mobile devices.
Empirical evaluations on ImageNet-1k demonstrate significant efficiency gains:
- Efficiency at Scale: WAVECLIP-mid achieves 64.2% accuracy using only 7.8 GFLOPs, a substantial reduction compared to the baseline CLIP ViT-B/16, which requires 16.87 GFLOPs for 66.3% accuracy.
- Matched Performance: At its highest setting, WAVECLIP matches the baseline accuracy of 66.3% while reducing total compute to 14.03 GFLOPs (a ~16.8% reduction).
- Caching Benefits: The implementation of KV-caching saves up to 20% in computational overhead compared to a naive progressive approach that re-encodes tokens at every level.
Conclusion and Future Work
WAVECLIP demonstrates that wavelets provide a mathematically principled and computationally efficient framework for multi-resolution vision tasks. While the current work focuses on standard 224x224 resolutions and relies on distillation from a frozen teacher, the authors suggest that the benefits of this approach will scale even more effectively with high-resolution imagery. Future research may explore deeper wavelet decomposition levels to provide even more granular control over the accuracy-speed trade-off.
Summary updated