SHiFT: An Efficient, Flexible Search Engine for Transfer Learning

Cédric Renggli, Xiaozhe Yao, Luka Kolar, Luka Rimanic, Ana Klimovic, Ce Zhang

TL;DR

Finding the best pre-trained model to fine-tune on a new downstream dataset often feels like searching for a needle in a massive, distributed haystack of model repositories. SHiFT is the first downstream-task-aware search engine for transfer learning, introducing a declarative query language (SHiFT-QL) and a cost-based execution engine that optimizes model ranking. By combining successive halving, multi-level caching, and incremental execution, SHiFT achieves up to a 45× speedup over brute-force fine-tuning while identifying models with near-optimal downstream accuracy.

What Problem Does This Paper Address?

Transfer learning is standard practice in modern computer vision and NLP, but picking the wrong pre-trained model can devastate downstream task accuracy—leading to performance gaps of more than 40% in practice.

Today, model hubs like Hugging Face, TensorFlow Hub, and PyTorch Hub host tens of thousands of models, but they only provide basic keyword and metadata filtering. Selecting the best model typically requires practitioners to write custom scripts to evaluate various proxy metrics (such as linear probe accuracy, nearest-neighbor accuracy, or dataset-similarity scores like Task2Vec). However, running these proxies across dozens or hundreds of candidate models is computationally prohibitive, and brute-force fine-tuning all of them is out of the question.

Furthermore, real-world machine learning development is iterative: practitioners frequently clean data, add labels, and augment features. Repeating full model searches across every dataset tweak wastes enormous computational resources.

Methods

SHiFT casts transfer learning model selection as a data management problem:

  • Unified Relational Abstraction: SHiFT abstracts models, data readers, and historical fine-tuning performance into relational database views (Models, DataReaders, and BenchmarkResults). Dockerized execution environments unify API differences across TensorFlow, PyTorch, and Hugging Face.
  • SHiFT-QL: A declarative query language extending SQL. Users define lazily materialized proxy scoring views (e.g., ranking via linear probes or $k$-NN classifiers) and dataset similarity views (e.g., Task2Vec distances). These can be combined with standard SQL operators (such as UNION and WHERE) to express sophisticated hybrid search strategies.
  • Decoupled Task Execution: The execution engine splits task-aware queries into heavy Inference Tasks (running models to extract intermediate feature representations) and lightweight Proxy Tasks (training linear heads or evaluating $k$-NN over extracted representations).
  • Cost-Model-Guided Successive Halving (SH): To prune unpromising models quickly, SHiFT uses successive halving to evaluate models on small chunks of data before allocating more data to the best performers. Because GPUs excel at batch parallelism, the authors implement an analytical cost model that predicts whether the sequential overhead of successive halving will actually outperform full-batch inference for a given dataset and hardware setup.
  • Incremental Execution & Mutable Readers: SHiFT tracks dataset changes via change-readers and add-readers. When new samples are added, SHiFT uniformly distributes them across successive-halving buckets rather than appending them to the tail. This prevents premature model elimination due to distribution shift without requiring a full dataset reshuffle.
   [ SHiFT-QL Query ]
           │
           ▼
   [ Query Parser / Translator ]
           │
   ┌───────┴────────────────────────┐
   ▼                                ▼
[ Cost Model ]            [ Intermediate Cache ]
   │ (Decide SH vs. Full)           │ (Features / Proxies)
   └───────┬────────────────────────┘
           ▼
[ Task Scheduler & Execution ] ──► (GPU Inference / CPU Proxy)

Datasets

The authors evaluated SHiFT across vision and NLP classification benchmarks:

  • Computer Vision:
  • Oxford Flowers 102: 1K train / 6K test images.
  • CIFAR-100: 50K train / 10K test images.
  • Dmlab: 65K train / 23K test images.
  • Diabetic Retinopathy: Used to validate distribution shifts during incremental data additions.
  • VTAB-1K Benchmark: 19 diverse vision tasks used to evaluate SHiFT’s meta-learning and benchmarking module across 250+ Hugging Face transformer models.
  • Natural Language Processing (GLUE Benchmark):
  • CoLA: 8.5K train / 1K test samples.
  • SST-2: 67K train / 1.8K test samples.
  • Candidate Models: 100 vision models (various ResNets, MobileNets, ViTs) and 60 NLP models (BERT, RoBERTa, DistilBERT variants).

Key Insights and Ideas

  • Successive halving isn't always faster on GPUs: Although successive halving reduces the total number of processed samples, the sequential dependencies and recurring model-loading overheads can make it slower than full-data inference on small datasets (like Oxford Flowers) where GPUs are underutilized. The cost model accurately determines the crossover point.
  • Uniform sample interleaving prevents distribution traps: Appending new data to the end of a dataset creates a subtle flaw in multi-fidelity bandits: early-eliminated models never see the new distribution. Interleaving new data uniformly across existing buckets preserves statistical expectation without invalidating prior cached inferences.
  • Decoupling representation from ranking enables zero-inference label updates: Because extracted feature representations are cached independently from proxy classifiers, changing labels or swapping a nearest-neighbor classifier for a linear probe requires zero GPU forward passes—only fast CPU recalculations.
  • Hybrid queries mitigate proxy regret: Single proxy strategies frequently fail on outlier datasets. Combining task-agnostic top picks (e.g., best upstream accuracy) with task-aware candidates yields far more robust downstream performance.

Key Results

  • End-to-End Speedup: Compared to fine-tuning all candidate models, SHiFT finds near-optimal models 22.6× to 45.0× faster on vision tasks while maintaining negligible accuracy regret.
  • Optimization Gains: Compared to an unoptimized baseline executing the same search strategy, SHiFT's cost-driven successive halving achieves up to a 1.57× speedup.
  • Incremental Data Updates: When 10% of features change in a dataset, SHiFT executes the model search query up to 4.0× faster than running from scratch on an 8-GPU cluster.
  • Label Changes: Updating downstream training labels is orders of magnitude cheaper, completing in seconds because heavy inference operations are completely bypassed.

Limitations and Future Work

  • No Native Sample Deletion: While adding and modifying samples are supported via mutable readers, deleting samples currently forces a complete re-execution from scratch.
  • Query Tree Optimizations: The parser currently evaluates parsed query trees strictly bottom-up; logical query optimizations such as predicate push-downs or cross-node compute balancing are deferred to future work.
  • Heterogeneous Model Scheduling: The cost model currently assumes homogeneous inference profiles; when model sizes vary by orders of magnitude in multi-GPU setups, the scheduler can misjudge the overhead of successive halving due to stragglers.
  • Data Provenance: Change tracking relies on basic index mapping rather than integration with modern, robust machine learning data-provenance systems.

Summary updated

BibTeX
@article{renggli2022shift,
  author = {Cédric Renggli and Xiaozhe Yao and Luka Kolar and Luka Rimanic and Ana Klimovic and Ce Zhang},
  title = {{SHiFT: An Efficient, Flexible Search Engine for Transfer Learning}},
  journal = {Proc. VLDB Endow.},
  year = {2022},
  url = {https://openreview.net/forum?id=h9yHch3W7h},
}
Figure