Papers
Topics
Authors
Recent
Search
2000 character limit reached

Task2Vec Embeddings

Updated 17 February 2026
  • The paper introduces Task2Vec, which leverages Fisher Information estimates from a fixed pre-trained probe network to create vector representations of visual tasks.
  • It computes a diagonal, filter-wise approximation of the Fisher Information Matrix, enabling efficient quantification of task similarity for meta-learning and expert model selection.
  • Empirical results show that Task2Vec embeddings capture semantic relationships and facilitate near-oracle expert selection with reduced computational cost and data requirements.

Task2Vec provides a fixed-dimensional, vectorial embedding of visual classification tasks by leveraging estimates of the diagonal Fisher Information Matrix (FIM) of a pre-trained convolutional network, termed the probe network. This embedding enables quantification of task similarity, facilitates meta-learning applications such as model selection, and is label-space-invariant, making it independent of explicit class semantics. Empirical analysis demonstrates that Task2Vec embeddings strongly reflect semantic and taxonomic relations between tasks and enable efficient expert selection in transfer learning contexts, matching or closely approximating oracle performance at a fraction of computational cost (Achille et al., 2019).

1. Formal Definition of Task2Vec Embedding

A "task" TT is specified by a labeled dataset D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n. The core of Task2Vec is the use of a fixed, pre-trained "probe network" ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z, commonly a ResNet-34 or DenseNet-121 model trained on ImageNet. The network parameters θ\theta remain fixed, and only a new linear or MLP head is trained on DD with a cross-entropy loss (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x)).

Task2Vec constructs an embedding using the Fisher Information Matrix (FIM) computed with respect to the feature extractor parameters θ\theta:

F=E(x,y)D[g(x,y)g(x,y)T],g(x,y)=θ(ϕ(θ)(x),y).F = \mathbb{E}_{(x, y) \sim D} \big[ g(x, y) g(x, y)^T \big], \quad g(x, y) = \nabla_\theta \ell(\phi_{(\theta)}(x), y).

A diagonal, filter-wise approximation of FF is employed:

  • Only diagonal entries FjjF_{jj} are retained.
  • For convolutional filters D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n0, each filter's diagonal block is averaged,

D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n1

The embedding is the D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n2-dimensional vector

D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n3

To robustly estimate D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n4, a variational approach is used: parameter uncertainty is modeled with a Gaussian posterior D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n5, yielding a surrogate loss

D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n6

with a closed-form optimality condition showing D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n7 tracks D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n8 up to a regularization term.

2. Practical Computation Protocol

To operationalize Task2Vec:

  • The probe network D={(xi,yi)}i=1nD = \{ (x_i, y_i) \}_{i=1}^n9 is fixed (e.g., pre-trained ResNet-34; DenseNet-121 yields similar performance; VGG-13 is suboptimal).
  • For a new task ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z0, a new classifier head is attached and trained for 2 epochs (Adam optimizer, learning rate ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z1, weight decay ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z2).
  • The head and variational diagonal variances ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z3 are then jointly optimized by minimizing the surrogate loss ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z4 for a few additional epochs (learning rates: ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z5 for ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z6, ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z7 for head parameters).
  • Training uses mini-batches (e.g., size 64), with class-balanced sampling.
  • On each mini-batch, per-sample parameter gradients ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z8 w.r.t. ϕ(θ):XZ\phi_{(\theta)}: X \rightarrow Z9 are computed. Variances θ\theta0 are updated using the Stochastic Gradient Variational Bayes estimator.
  • After optimization, filter-wise embedding coefficients are recovered as

θ\theta1

The overall scale of embeddings can vary, so normalization is applied during comparison.

The entire embedding process requires about θ\theta2 head-training pass and θ\theta3 SGVB pass per task (under θ\theta4 GPU-hour per task).

3. Quantifying Task Similarity

Given two tasks θ\theta5 and θ\theta6 with embeddings θ\theta7 and θ\theta8:

  • Symmetric distance (semantic similarity): normalize elementwise

θ\theta9

and define

DD0

  • Asymmetric distance (transfer/model selection): define a "trivial" task DD1 with embedding proportional to the prior (DD2), then

DD3

with DD4 (for ResNet-34), rewarding more complex source tasks.

Empirical results show that DD5 correlates strongly with semantic and taxonomic distances—e.g., bird order tasks cluster by canonical taxonomy; visual-semantic similarity is preserved for fine-grained and attribute-based datasets.

4. Meta-Learning and Expert Model Selection

A principal application of Task2Vec is "zero-shot" selection of pretrained expert models for novel tasks. Given a library DD6 of feature extractors, each associated with a training task DD7 and an embedding DD8, one selects the expert that minimizes the asymmetric distance to the new task's embedding.

  • Zero-shot Task2Vec selection: Compute DD9 for the new task, score each expert with (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))0, and select (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))1.
  • Model2vec (co-embedding): Learn a per-expert bias (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))2 so "model embedding" (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))3; then rank experts by

(ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))4

and apply a softmax with temperature parameter over (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))5. The bias parameters and temperature are trained to minimize cross-entropy with empirical expert performances.

This enables rapid, data-efficient matching of new tasks to highly compatible pretrained models without exhaustive retraining.

5. Experimental Findings and Empirical Properties

The evaluation of Task2Vec employed 1,460 fine-grained classification tasks from iNaturalist, CUB-200, iMaterialist, and DeepFashion. The expert library comprised 156 ResNet-34 models fine-tuned on specific tasks.

Key empirical results include:

  • Semantic alignment: (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))6 closely tracks average ultrametric taxonomic distance—tasks from the same taxon cluster together. t-SNE projections illustrate that CUB and iNaturalist bird tasks embed near one another; fashion attribute tasks group by visual semantics (e.g., "jeans" neighboring "denim").
  • Difficulty metric: The (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))7 norm (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))8 of Task2Vec correlates with task difficulty measured as misclassification error of the best expert.
  • Model selection: Task2Vec enables expert selection that yields error rates within (ϕ(θ)(x),y)=logp(yϕ(θ)(x))\ell(\phi_{(\theta)}(x), y) = -\log p(y|\phi_{(\theta)}(x))9 (relative improvement) of optimal (oracle) while outperforming chance, ImageNet-only, and other baseline selectors for both homogeneous (e.g., iNat+CUB) and mixed tasks.
  • Data efficiency: With only 500 samples per task, Task2Vec-based expert selection followed by frozen-head training surpasses ImageNet+linear and ImageNet+fine-tuning approaches; this performance gap widens at lower data limits.
  • Probe architecture dependence: ResNet-34 and DenseNet-121 yield sub-θ\theta0 relative error in model selection, while VGG-13 suffers considerably higher error (+38%).

These results confirm the validity and utility of Task2Vec for rapid meta-learning and few-shot adaptation scenarios (Achille et al., 2019).

6. Distinguishing Properties and Limitations

Task2Vec embeddings are of fixed length, reflecting only the probe network structure and not the task label cardinality or semantics. This invariance enables fair comparison between disparate tasks and facilitates meta-learning workflows. The embedding cost is low (sublinear in the number of experts θ\theta1), eliminating the need for θ\theta2 retraining and evaluation.

A limitation is the dependence on the choice of probe architecture; networks such as ResNet-34 and DenseNet-121 perform robustly but models with inferior representation quality (e.g., VGG-13) degrade similarity matching performance. The approach presumes availability of a representative probe network pretrained on a task distribution related to the downstream tasks. A plausible implication is that performance may be impacted if the probe network is poorly aligned with the class of target tasks.

7. Broader Implications and Applications

Task2Vec provides a mechanism for automated reasoning about task structure in deep learning, with immediate applications for transfer, curriculum, and continual learning where matching target tasks to prior trained models is essential. Its capacity to provide a label-independent, computationally efficient, and geometry-preserving task embedding makes it a fundamental tool in meta-learning pipelines, potentially informing future strategies for scalable neural architecture search, dataset-centric transfer evaluation, and automated machine learning frameworks (Achille et al., 2019).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Task2Vec Representations.