Abstract
The paper proposes a novel technique for representing templates and instances of concept classes. A template representation refers to the generic representation that captures the characteristics of an entire class. The proposed technique uses end-to-end deep learning to learn structured and composable representations from input images and discrete labels. The obtained representations are based on distance estimates between the distributions given by the class label and those given by contextual information, which are modeled as environments. We prove that the representations have a clear structure allowing to decompose the representation into factors that represent classes and environments. We evaluate our novel technique on classification and retrieval tasks involving different modalities (visual and language data).
Introduction
Standard deep learning models for image classification typically operate as "black boxes," mapping inputs to probability vectors via cross-entropy loss. While effective, these representations often lack explicit structure, making it difficult to interpret model decisions or manipulate representations semantically—for example, searching for an image similar to a query but with a specific object swapped.
This paper introduces CoDiR (Composable Distance-based Representation learning), a method that replaces the standard final classification layer of a neural network with a structured matrix of distance estimates. By measuring how far an image is from various "environments" (randomized sets of labels), the model learns interpretable, high-rank representations that can be mathematically decomposed and recomposed to perform complex semantic tasks.
Methodology
The core innovation of CoDiR is the transition from a flat probability vector to a structured matrix representation. Instead of a standard softmax output, the model uses a fully connected layer to estimate the distance between an input instance and a set of "environments" ($e_j$).
Environments and Distance Metrics
Environments are contextual distributions created by randomly grouping labels (e.g., an environment might include "grass," "ball," and "sky"). The model employs the Fisher Integral Probability Metric (IPM), a stable distance measure related to the Wasserstein distance, to calculate the "effort" required to move the distribution of a class to the distribution of an environment.
Template vs. Instance Representations
- Template ($T$): The average distance of an entire class (e.g., "Football") to all environments.
- Instance Representation ($D$): A 2D matrix for a specific image, where each element represents the distance between a class and an environment for that specific input.
Because the resulting representation is a matrix, the authors can apply Singular Value Decomposition (SVD). By modifying the resulting $U$ matrix (representing class factors), users can "edit" the representation—such as swapping a "traffic light" factor for a "stop sign" factor—and reconstruct a new representation for semantic image retrieval.
Evaluation and Results
The researchers evaluated CoDiR using the Microsoft COCO dataset, utilizing 91 object categories for classification. To provide richer contextual dimensions, they also developed "CoDiR (capt)" environments by extracting frequent nouns, verbs, and adjectives from image captions.
As shown in the results table, CoDiR consistently outperformed standard binary cross-entropy (BXENT) baselines across various neural network backbones. On a ResNet-101 backbone, CoDiR achieved an F1 score of 0.657 compared to the baseline's 0.592 when using caption-based environments. Beyond classification, CoDiR demonstrated superior performance in "Modified Nearest Neighbor" tasks, successfully switching target labels while maintaining high contextual similarity.
Discussion and Insights
CoDiR effectively treats context as a coordinate system. A concept like "cat" is defined not just by its label, but by its relative distance to traits like "furry," "indoor," or "sofa-adjacent." This approach yields high-rank representations that capture latent continuous features and common-sense knowledge beyond simple discrete labels.
While the $O(n_c \times n_e)$ memory footprint is larger than a standard classification layer, the benefits are significant: semantic manipulation becomes a linear algebra problem. Future work may explore more principled ways to select environments or apply this structured approach to fully unsupervised representation learning.
Summary updated