---
title: "SoftTriple Loss: Deep Metric Learning Without Triplet Sampling"
description: "How SoftTriple learns useful image embeddings with several centers per class, avoiding triplet sampling while preserving local structure."
canonical: "https://research.elamur.ai/free/en/papers/qian-2019-softtriple-loss-deep-metric-learning/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/qian-2019-softtriple-loss-deep-metric-learning/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2019](https://md.research.elamur.ai/free/en/papers/2019/) / SoftTriple Loss: Deep Metric Learning Without Triplet Sampling

# SoftTriple Loss: Deep Metric Learning Without Triplet Sampling

Paper · 2019 · Qi Qian, Lei Shang, Baigui Sun et al.

**Authors:** [Qi Qian](https://md.research.elamur.ai/free/en/authors/qi-qian/), Lei Shang, [Baigui Sun](https://md.research.elamur.ai/free/en/authors/baigui-sun/), Juhua Hu, Tacoma Tacoma, [Hao Li](https://md.research.elamur.ai/free/en/authors/hao-li/) and [Rong Jin](https://md.research.elamur.ai/free/en/authors/rong-jin/) · **Year:** 2019 · **Venue:** IEEE/CVF International Conference on Computer Vision (ICCV) · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**402** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2991234496) · [IEEE/CVF International Conference on Computer Vision (ICCV)](https://openalex.org/S4363607764) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [PDF](https://arxiv.org/pdf/1909.05235)
- [DOI 10.1109/iccv.2019.00655](https://doi.org/10.1109/iccv.2019.00655)
- [arXiv 1909.05235](https://arxiv.org/abs/1909.05235)
- [OpenAlex](https://openalex.org/W2991234496)

Citations: OpenAlex, 2026-10-14.

## Deep dive: SoftTriple Loss: Deep Metric Learning Without Triplet Sampling

How SoftTriple learns useful image embeddings with several centers per class, avoiding triplet sampling while preserving local structure. · about 33 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

Learning a useful distance between images requires more than recognizing their training labels. A retrieval system needs nearby images to share meaningful properties, including when the categories encountered during evaluation were absent from training. SoftTriple studies how to learn that geometry without constructing and selecting large numbers of image triplets. Its starting point is a practical difficulty: training sees a small batch at a time, but useful relationships extend across the dataset. Choosing comparisons only among the images currently available can give an incomplete picture of which examples should be close.

The paper connects this problem to an apparently different objective: SoftMax classification. With normalized image embeddings and normalized classification weights, the authors show that SoftMax can be interpreted as a smooth objective over triplets containing an image and class representatives. Each classification weight acts as a center. This explains why classification training can produce embeddings that work for distance-based retrieval, even though its immediate task is to predict labels. It also exposes a restriction: ordinary SoftMax provides a single center for each class, although a class may contain several visually distinct groups.

SoftTriple replaces that single representative with several learned centers. An image receives a similarity score for each class by combining its similarities to that class’s centers, giving greater weight to the closer ones. The loss then encourages the correct class to score above competing classes by a small margin. The centers occupy an expanded final fully connected layer, so training can use an ordinary classification-style pipeline without selecting image triplets. A regularizer encourages redundant centers within a class to coincide, allowing an initially generous collection to become more compact.

Experiments examine image retrieval and clustering on CUB-2011, Cars196, and Stanford Online Products. Both normalized SoftMax and SoftTriple perform strongly against the metric-learning methods discussed in the paper, and SoftTriple consistently improves on the normalized SoftMax baseline. For CUB-2011 with 64-dimensional embeddings, the authors report a 10% R@1 improvement over ProxyNCA and a 2% improvement over normalized SoftMax. Their analysis of center counts supports the central design choice: several representatives help capture variation within a class, while regularization reduces the sensitivity to allocating too many.

The contribution is therefore both conceptual and practical. The conceptual result explains a connection between classification loss and triplet-based geometry. The practical method uses that connection to represent classes more flexibly while avoiding explicit triplet selection. The evidence concerns fine-grained visual retrieval and clustering under the paper’s experimental conditions. It does not establish that every same-class pair becomes close, that the learned centers have human-readable meanings, or that the approach has already been validated for ordinary classification or language tasks.

### Ideas worth borrowing

Represent a category through several reference points. A shared label need not imply a visually uniform group. The paper’s bird example makes this concrete: different poses can create distinct regions within the same species. Several centers let training accommodate such variation without requiring every image to move towards the same location. The reusable idea is to distinguish membership in a category from membership in a local cluster. It applies wherever a supervised category contains meaningful internal variation and the representation must preserve useful neighborhoods.

Look for geometry inside a classification objective. The SoftMax analysis asks what relationships an existing loss already encourages before proposing a replacement. Its classification weights become reference points, and differences between class scores become relative similarity constraints. This is useful beyond the particular loss because it changes how an objective can be examined: predicting the right label may also shape a space suitable for retrieval. A researcher can investigate that geometry directly instead of assuming classification and distance learning require unrelated machinery.

Replace transient comparisons with persistent representatives. Images in a batch are temporary participants in training; learned class centers persist across updates. Comparing an image with those centers gives it access to representatives of classes that need not appear among the other images in the current batch. The tradeoff is approximation: a center summarizes a region instead of reproducing every example. This idea is useful when exhaustive example-to-example comparison is impractical and when compact representatives can retain the distinctions important to the task.

Smooth a brittle assignment. Choosing the nearest center with a hard maximum creates abrupt changes when an image is similarly close to competing centers. SoftTriple instead uses a distribution over centers, concentrating more weight on those with larger similarities. This makes the class score depend on several plausible representatives while retaining a preference for the closest. The broader lesson applies to systems that route an input among alternatives: a soft assignment can make optimization less sensitive to small changes around a decision boundary.

Allocate capacity, then encourage redundancy to disappear. The authors do not try to identify the ideal center count for every class before training. They begin with several centers and penalize distances between representatives belonging to the same class, encouraging unnecessary ones to merge. This offers a reusable way to manage uncertain capacity. Its value is clearest when the useful number of components varies across categories, but the distinction between encouraging compactness and physically removing parameters must remain explicit.

Test the simple baseline under the same conditions. Normalized SoftMax is more than background motivation: it is a direct experimental comparator. Its strong performance shows that some gains come from learning through persistent class representatives, before multiple centers enter the picture. Comparing SoftTriple with this baseline makes the additional contribution easier to identify. The same principle helps elsewhere whenever a proposed objective changes several aspects of training: preserve a nearby, simple alternative so that improvements can be attributed more carefully.

State when a representative preserves an original constraint. The paper does not rely only on an intuitive claim that centers summarize examples. It gives a conditional bound relating center-based margins to margins between actual embeddings. The bound makes the approximation error visible: examples must remain sufficiently close to their representatives. This is a useful research habit whenever a compressed construction replaces a more expensive objective. A clear condition reveals both why the approximation may work and where its guarantee stops.

### How Mova uses it

For Mova, the small transparent language system written in Rust, SoftTriple offers a possible design for a component that learns similarity between labeled items. This is a prospective application. The paper establishes results for images, and there is no basis for describing SoftTriple as an implemented part of Mova or as a demonstrated improvement to its language processing.

The most relevant idea is that a linguistic category may need several representatives. If Mova were to learn embeddings for labeled textual items, a single center could force varied examples into an overly narrow arrangement. A collection of centers could instead provide room for different contexts or usages while retaining the shared category. That possibility concerns the organization of a learned representation; it does not establish that a center would correspond to a grammatical rule, an interpretable meaning, or a recognized linguistic distinction.

A concrete experimental component could follow the paper’s separation between representation learning and comparison. An encoder would produce an embedding for an item. A trainable bank would hold several representatives for each supervised category. Soft assignments would combine item-to-center similarities into category scores, and a margin-based SoftTriple objective would train the encoder and representatives together. After training, a retrieval component could compare item embeddings directly. This describes a possible architecture, not a claim about Mova’s present implementation.

Transparency would require additional care. A center can be inspected numerically, and nearby training items could help an engineer examine what it represents. Nevertheless, SoftTriple supplies no procedure that converts a learned vector into an explanation. Naming a center after a linguistic concept would therefore require separate evidence. Several centers for a category could reflect useful contextual variation, incidental correlations, or an optimization artifact; the loss alone does not distinguish those interpretations.

The practical experiment worth borrowing would compare normalized SoftMax against SoftTriple while holding the representation size, training data, and evaluation procedure fixed. It would also examine whether multiple centers improve retrieval on categories withheld during training, since that separation is central to the visual experiments. The regularizer would deserve its own comparison rather than being treated as automatically beneficial.

A Rust implementation could express the required operations through normalized vectors, dot products, exponential weighting, and the training objective. Whether that implementation would be appropriate for Mova depends on a concrete supervised task and its resource constraints. The paper’s contribution supplies a candidate mechanism and a way to reason about it. Evidence for language, usefulness to Mova, and readable explanations would still have to come from evaluation of that component.

### The problem and its context

Distance metric learning is concerned with the organization of a representation space. An embedding is a vector assigned to an example. A useful distance should place related examples near one another and separate examples whose labels differ. In [information retrieval and search](https://md.research.elamur.ai/free/en/topics/information-retrieval/), this geometry determines which items appear as neighbors of a query. In clustering, it influences which items are grouped together. The paper also identifies nearest-neighbor classification as an application.

These tasks differ from simply predicting one of the labels used during training. A classifier can make correct decisions while organizing the space in ways that are less useful for comparing unfamiliar examples. Metric learning therefore states the desired relationships explicitly. Rather than asking only whether an image receives the right label, it asks how that image compares with a similar example and a dissimilar one.

#### From fixed features to learned embeddings

The paper describes earlier metric learning as operating on features computed in advance. An algorithm received vectors and learned how distances between them should be measured. A standard formulation used a Mahalanobis distance:

```
dist_M(xᵢ, xⱼ) = (xᵢ − xⱼ)ᵀ M(xᵢ − xⱼ)
```

Here, xᵢ and xⱼ are the feature vectors for examples indexed by i and j. The matrix M is the learned metric, and the superscript T denotes transposition. The expression measures the difference between the vectors after weighting its directions through M.

In this setting, the dimensionality of the original features creates a computational problem. The matrix must remain positive semidefinite, a constraint that makes the resulting quadratic expression suitable as a distance measure. The paper states that maintaining this property can cost up to O(d³), where d is the input dimension.

Earlier approaches addressed this in different ways. Some reduced the feature dimension with principal component analysis. Others imposed a low-rank structure, reduced how often the matrix required projection, or learned auxiliary quantities in a lower-dimensional space before recovering the metric. These methods addressed the expense of metric optimization, but they still depended on the information present in the original features. Features designed independently of the task could discard distinctions that later distance learning could not recover.

The success of deep networks in classification changed the starting point. The paper cites [ImageNet Classification with Deep Convolutional Neural Networks](https://md.research.elamur.ai/free/en/papers/krizhevsky-2012-imagenet-classification-deep-convolutional/) as part of that background. Rather than fixing features first and learning a metric afterward, deep metric learning could learn a representation directly from raw inputs. The output dimension could be chosen as part of the network, reducing the importance of the earlier high-dimensional matrix problem.

This shift did not remove the need to specify useful relationships. It moved the main difficulty towards deciding which relationships to use during optimization.

#### Why triplets become difficult

A triplet consists of an anchor, a positive example with the same label, and a negative example with another label. Its constraint says that the anchor should be closer to the positive than to the negative, with a margin separating the comparisons. This relative requirement can accommodate local structure: examples need not all occupy the same location merely because they share a label.

The paper contrasts triplets with earlier pairwise constraints. Pairwise objectives encourage small distances within a class and large distances across classes. Triplet objectives express a comparison around a particular anchor. The authors regard that local comparison as especially suitable for classes with internal variation.

The number of possible comparisons is the immediate obstacle. Pairwise relationships can grow as O(n²), while triplets can grow as O(n³), with n denoting the number of examples. Processing every triplet is therefore impractical in the training setting considered.

Deep-network optimization adds another restriction. A training iteration has access to a mini-batch rather than the entire dataset. Even within that batch, possible pairs and triplets grow as O(m²) and O(m³), where m is the batch size. The authors note that selecting useful constraints remains necessary even for a batch of 32 examples.

There are consequently related selection problems: which images enter a batch, and which comparisons are constructed from them. A batch may miss an anchor’s informative neighbors elsewhere in the dataset. A selection rule can then only choose among the relationships that happen to be available. The concern is not simply wasted computation; incomplete neighborhoods may also lead training toward less useful embeddings.

#### Sampling and proxies before SoftTriple

The paper reviews several responses. Increasing batch size offers more candidate relationships, but requires more GPU memory and enlarges the set of triplets to examine. Other approaches deliberately build batches from neighboring classes.

Within a batch, [FaceNet](https://md.research.elamur.ai/free/en/papers/schroff-2015-facenet-unified-embedding-face-recognition/) selects semi-hard negatives. Lifted structured embedding uses negative examples that fall within a margin for each positive pair. Distance-weighted sampling chooses examples according to their distance from the anchor. Hierarchical triplet loss uses a class hierarchy to identify difficult triplets with an adaptive violation margin. These strategies seek more informative training signals, although the authors argue that the batch still provides incomplete coverage of the full distribution.

Proxy-based learning changes what participates in a comparison. A proxy is a learned representative that stands in for examples. Because there are fewer proxies than images, they can remain available across batches. The paper describes ProxyNCA as comparing an original example with proxies and notes that its labeled setting uses a single proxy per class.

Another cited metric-learning approach uses several latent representatives for a class and constructs comparisons through them. SoftTriple brings the multiple-center idea into an objective that fits deep-network training through the final fully connected layer.

The immediate motivation comes from strong results obtained with SoftMax-trained embeddings. Classification loss already avoids image-triplet selection. If its geometry can be understood, the authors reason, it may provide a starting point for a more flexible metric-learning objective. SoftTriple’s central question is therefore how to retain that convenient training structure while giving each class a richer representation.

### The method, step by step

SoftTriple can be understood as a sequence of changes to normalized SoftMax. First, interpret its classification weights as centers. Next, allow each class to have several centers. Then replace a hard nearest-center decision with a smooth class score. Finally, regularize the center collection so that redundant representatives are encouraged to merge.

Learning embeddings with SoftTriple The steps in order.

The important separation is between an image embedding and the class representatives used to train it. The encoder produces a vector for each image. The final layer stores centers associated with training classes. Those centers provide persistent reference points during optimization; the resulting image embeddings are what the retrieval and clustering evaluations examine.

#### Begin with SoftMax classification

Let xᵢ denote the embedding of image i, and let yᵢ be its label. Ordinary SoftMax assigns a probability to the correct class through dot products with classification weights:

```
Pr(Y = yᵢ | xᵢ) = exp(wᵧᵢᵀxᵢ) / Σⱼ₌₁ᶜ exp(wⱼᵀxᵢ)
```

The variable Y represents a class label. Each vector wⱼ belongs to the final fully connected layer, and C is the number of training classes. The operation exp is the exponential function. The denominator sums scores over all classes, turning the exponentiated similarities into a probability distribution.

The final layer contains one weight vector for each class. Each has dimension d, matching the embedding dimension. Viewed geometrically, wⱼ can act as a reference direction for class j.

Training minimizes the negative logarithm of the correct-class probability:

```
ℓSoftMax(xᵢ) = −log[exp(wᵧᵢᵀxᵢ) / Σⱼ exp(wⱼᵀxᵢ)]
```

The symbol ℓSoftMax denotes the loss assigned to example i, and log is the natural logarithm. The remaining symbols retain their meanings. Giving the correct class a larger share of the probability lowers this loss.

SoftTriple’s analysis focuses on normalized vectors. Both embeddings and centers have unit Euclidean length, so their dot products compare directions without allowing vector magnitude to dominate the score.

#### Express the triplet requirement

For an anchor xᵢ, a same-class example xⱼ, and a different-class example xₖ, the distance-based constraint is:

```
‖xᵢ − xₖ‖₂² − ‖xᵢ − xⱼ‖₂² ≥ δ
```

The notation ‖·‖₂ is Euclidean length. The parameter δ is a prescribed margin. The constraint requires the negative example to be farther from the anchor than the positive example by at least that margin.

With unit-length embeddings, the authors express the same type of requirement through dot products, absorbing a rescaling into the margin:

```
xᵢᵀxⱼ − xᵢᵀxₖ ≥ δ
```

Here, the positive dot product should exceed the negative dot product. The symbol δ now denotes the margin in this similarity-based form; the paper explicitly sets aside the rescaling between the distance and similarity expressions.

A hinge loss penalizes violations:

```
ℓtriplet(xᵢ, xⱼ, xₖ) = [δ + xᵢᵀxₖ − xᵢᵀxⱼ]₊
```

The operator [·]₊ keeps its argument when positive and otherwise returns zero. The loss is therefore inactive once the required separation is achieved. Its practical difficulty is deciding which anchor-positive-negative combinations should contribute to training.

#### See normalized SoftMax as smooth triplet learning

Normalized SoftMax introduces a scale into the class similarities:

```
ℓSoftMax_norm(xᵢ) = −log[exp(λwᵧᵢᵀxᵢ) / Σⱼ exp(λwⱼᵀxᵢ)]
```

The factor λ controls the scale of the normalized dot products before exponentiation. Since normalization fixes vector lengths, this factor controls how sharply class-score differences affect the loss.

The authors then give an equivalent optimization expression:

```
ℓSoftMax_norm(xᵢ) = maxₚ∈Δ [λΣⱼ pⱼxᵢᵀ(wⱼ − wᵧᵢ) + H(p)]
```

The vector p is a distribution over classes. Its component pⱼ assigns weight to class j. The set Δ is the probability simplex: its members have non-negative entries that sum to one. The function H(p) is the entropy of the distribution.

The difference inside the sum compares the anchor’s similarity to a competing center with its similarity to the correct center. Each term therefore concerns a triplet comprising an image, its own class center, and another class center. The entropy term smooths the choice among such comparisons instead of placing all emphasis on a single competitor.

The maximizing distribution has a closed form:

```
pⱼ = exp[λxᵢᵀ(wⱼ − wᵧᵢ)] / Σₗ exp[λxᵢᵀ(wₗ − wᵧᵢ)]
```

The index l runs over classes in the denominator. All other symbols are as defined above. Competing centers with larger relative scores receive more weight, but the distribution remains smooth rather than making an abrupt selection.

Substituting this distribution into the optimization recovers the normalized SoftMax expression. The authors establish that equivalence using the optimality conditions of the constrained problem. The result is a mathematical interpretation of the loss, not an empirical analogy based only on similar outcomes.

The associated center-based preference is:

```
xᵢᵀwᵧᵢ − xᵢᵀwⱼ ≥ 0
```

The embedding should be at least as similar to its own center as to another class’s center. This helps explain why a classification objective can produce useful distances between embeddings.

Without entropy, the maximization concentrates on the strongest competing score. The paper interprets the entropy contribution as reducing sensitivity to outlying comparisons, while λ controls the balance between a sharper emphasis on difficult competitors and smoothing. This interpretation motivates preserving the smooth construction when moving to multiple centers.

#### A distinction from ProxyNCA

The paper also analyzes ProxyNCA. In the expression it discusses, the correct-class proxy is omitted from the denominator:

```
ℓProxyNCA(xᵢ) = −log[exp(wᵧᵢᵀxᵢ) / Σⱼ≠ᵧᵢ exp(wⱼᵀxᵢ)]
```

The vectors wⱼ are proxies, and the summation includes classes other than yᵢ. The omission changes the mathematical behavior: the resulting objective need not have a lower bound.

The authors suggest applying a hinge to this expression:

```
ℓProxyNCA_hinge(xᵢ) = [−log[exp(wᵧᵢᵀxᵢ) / Σⱼ≠ᵧᵢ exp(wⱼᵀxᵢ)]]₊
```

The hinge operator has the same meaning as before. This is an analytical suggestion, not an experimentally established component of SoftTriple. The authors explicitly leave its validation outside their investigation.

#### Give each class several centers

The limitation of the SoftMax interpretation is its single representative per class. A bird species photographed in different poses may occupy several useful local groups. Requiring those groups to share a center can make the representation unnecessarily restrictive.

SoftTriple assigns K centers to each class. A direct similarity definition chooses the best-matching representative:

```
Sᵢ,꜀ = maxₖ xᵢᵀw꜀ᵏ
```

The symbol Sᵢ,꜀ is the similarity of image i to class c. The vector w꜀ᵏ is center k of that class, and k ranges over its K centers. The score is the largest image-to-center dot product.

This changes how class membership is expressed. An image needs to fit an appropriate representative of its class; it does not need to fit every representative equally well. Different images can therefore be associated with different regions while sharing the same label.

The margin condition becomes:

```
Sᵢ,ᵧᵢ − Sᵢ,ⱼ ≥ δ, for j ≠ yᵢ
```

The correct class’s best-matching center must produce a score larger than the competing class’s best-matching center by δ. The class index j ranges over incorrect labels.

Putting these scores into the classification-style objective yields HardTriple:

```
ℓHardTriple(xᵢ) = −log[exp(λ(Sᵢ,ᵧᵢ − δ)) / (exp(λ(Sᵢ,ᵧᵢ − δ)) + Σⱼ≠ᵧᵢ exp(λSᵢ,ⱼ))]
```

The name HardTriple refers to the hard choice of center within each class. The factors λ and δ retain their roles as score scale and margin. Subtracting the margin from the correct-class score makes training require more than a narrow win over competitors.

This construction already provides multiple centers, but its maximum operator is not smooth. Near a tie, a small movement can switch which representative determines the score. The next step addresses that sensitivity.

#### Replace hard selection with weighted similarity

The maximum can be viewed as selecting a distribution over centers. Adding entropy gives the relaxed optimization:

```
max_q∈Δ [Σₖ qₖxᵢᵀw꜀ᵏ + γH(q)]
```

The distribution q is now over centers within a particular class, rather than over classes. The parameter γ weights its entropy. The simplex Δ has the same meaning as before, with the relevant number of components determined by the center collection.

The solution assigns weights through exponentiated similarities:

```
qₖ = exp(xᵢᵀw꜀ᵏ/γ) / Σₗ exp(xᵢᵀw꜀ˡ/γ)
```

The index l runs over centers of class c. A center whose dot product is larger receives more weight. The parameter γ controls how concentrated or spread out those weights are.

SoftTriple uses the resulting weighted average as its class similarity:

```
S′ᵢ,꜀ = Σₖ qₖxᵢᵀw꜀ᵏ
```

The prime distinguishes the smooth score S′ᵢ,꜀ from the hard maximum Sᵢ,꜀. The weights qₖ depend on both the image and the class being evaluated.

A subtle distinction matters here. The weighted average is evaluated using the distribution obtained from the entropy-regularized problem. It is not the entire optimized expression including the entropy term. Nor does the paper define the final class score simply as the logarithm of a sum of exponentials. Its stated score is the weighted average of center similarities.

The resulting SoftTriple loss is:

```
ℓSoftTriple(xᵢ) = −log[exp(λ(S′ᵢ,ᵧᵢ − δ)) / (exp(λ(S′ᵢ,ᵧᵢ − δ)) + Σⱼ≠ᵧᵢ exp(λS′ᵢ,ⱼ))]
```

The smooth scores replace the hard scores in the previous loss. The distribution within a class handles ambiguity among its representatives, while the outer class comparison encourages the correct label to win by the margin.

These nested comparisons have different purposes. Within a class, weighting identifies which representatives fit an image. Across classes, the loss distinguishes the correct category from alternatives. Keeping those roles separate makes the construction easier to understand than treating it as a single larger classifier.

#### Explain when centers preserve image triplets

The paper gives a conditional argument connecting representative-based comparisons to relationships among actual examples. Suppose xᵢ and xⱼ share a class and the same nearest center, while xₖ belongs to another class. Assume a center-based margin holds:

```
xᵢᵀwᵧᵢ − xᵢᵀwᵧₖ ≥ δ
```

The centers wᵧᵢ and wᵧₖ denote the relevant representatives for the corresponding examples. The margin δ is the separation achieved between these representative similarities.

The argument also assumes that examples remain close to their associated centers:

```
‖xᵢ − wᵧᵢ‖₂ ≤ ε
```

The quantity ε bounds the Euclidean discrepancy between an embedding and its representative. The condition is assumed across the examples involved, not merely asserted from the existence of centers.

Under these assumptions, the original-example comparison satisfies:

```
xᵢᵀxⱼ − xᵢᵀxₖ ≥ δ − 2ε
```

The bound states that replacing representatives with examples can weaken the margin by an amount controlled by approximation error. The proof separates each example into its center plus a residual, then bounds the residual contributions using unit-length embeddings and the assumed ε.

This result gives a reason to use several centers. Better local representatives can reduce the discrepancy between examples and centers. But it also shows the limits of the argument. The positive examples must share a nearest center, and the closeness condition must hold. The theorem does not establish that every same-label pair, including pairs from different local groups, receives the same guarantee.

#### Encourage a compact collection of centers

Increasing the center count offers more representational flexibility, but it enlarges the final layer and increases optimization cost. The authors also identify overfitting as a risk. Choosing an appropriate count in advance is difficult because the internal structure of a class is not known.

Their strategy begins with a sufficiently large collection and encourages similar representatives to coincide. For a center t in class j, they construct a matrix of differences:

```
Mⱼᵗ = [wⱼ¹ − wⱼᵗ, …, wⱼᴷ − wⱼᵗ]ᵀ
```

The matrix Mⱼᵗ has a row corresponding to the difference between each center and the reference center wⱼᵗ. The indices j, t, and K denote the class, selected reference center, and allocated center count.

A sum of row lengths gives the relevant mixed norm:

```
‖Mⱼᵗ‖₂,₁ = Σₛ₌₁ᴷ ‖wⱼˢ − wⱼᵗ‖₂
```

The notation ‖·‖₂,₁ means that Euclidean lengths are computed for rows and then added. A row becomes zero when its pair of centers coincides. Penalizing these lengths therefore encourages redundant representatives to share a location.

The paper accumulates such distances within each class. With normalized centers, it writes the regularizer through pairwise dot products:

```
R(wⱼ¹, …, wⱼᴷ) = Σₜ₌₁ᴷ Σₛ₌ₜ₊₁ᴷ √(2 − 2wⱼˢᵀwⱼᵗ)
```

The function R penalizes distances among centers of class j. The square-root expression is the Euclidean separation between normalized centers. The inner sum considers centers after t, so each displayed pair is included through that ordering.

The complete objective is:

```
min [(1/N)Σᵢ ℓSoftTriple(xᵢ) + τΣⱼ₌₁ᶜ R(wⱼ¹, …, wⱼᴷ)/(CK(K − 1))]
```

The symbol N is the number of training examples. The first term averages the per-example loss. The coefficient τ controls regularization strength, while C and K account for the class and center counts in the stated normalization.

This objective contains a productive tension. The supervised loss benefits when centers capture useful local differences; the regularizer encourages unnecessary separation to disappear. The method adapts the collection’s distinct locations through training. It does not specify a separate stage that physically deletes duplicate parameters from the final layer.

### Experiments and results

The experiments evaluate whether the learned embedding space supports retrieval and clustering on fine-grained image datasets. This is a test of geometry beyond predicting the training labels: the evaluation classes are separated from those used to train the network.

The paper reports comparisons at 64-dimensional embeddings and at larger embedding sizes. This distinction is important because representation size affects performance. A result obtained with a larger vector cannot automatically be attributed entirely to the loss function.

#### Shared training and evaluation procedure

The backbone is Inception with batch normalization. Its parameters begin from training on ImageNet ILSVRC 2012, associated with the [ImageNet Large Scale Visual Recognition Challenge](https://md.research.elamur.ai/free/en/papers/russakovsky-2014-imagenet-large-scale-visual-recognition/), before adaptation to each target dataset.

Input images are cropped to 224 × 224. Training augmentation consists of random cropping and horizontal mirroring. Evaluation uses a single center crop. This limits a source of variation between training objectives, although the paper notes that a cited baseline uses a different testing procedure.

Optimization uses Adam, a batch size of 32, and 50 epochs. The initial backbone learning rate is 1e-4, while the initial center learning rate is 1e-2. Both rates are divided by 10 at epochs 20 and 40. Batch-normalization behavior is frozen for CUB-2011 and Cars196; it continues to update for Stanford Online Products. Image embeddings and center vectors are normalized.

The general SoftTriple settings are τ = 0.2, γ = 0.1, δ = 0.01, and K = 10. These respectively control center regularization, the softness of assignments within a class, the correct-class margin, and the allocated representatives per class. Stanford Online Products uses a modified configuration discussed below.

The principal internal baseline is normalized SoftMax, denoted SoftMax_norm in the paper. It provides the closest comparison because it uses the same basic class-score framework while retaining a single representative per class. Other comparisons include ProxyNCA and several methods that construct or select example-based relationships.

Retrieval is measured with Recall@k. It assesses whether a query’s retrieved neighborhood contains an item with the appropriate label. R@1 focuses on the nearest retrieved item. Clustering is measured with normalized mutual information:

```
NMI = 2I(Ω; 𝒞) / [H(Ω) + H(𝒞)]
```

The collection Ω contains the ground-truth labels, and 𝒞 contains clustering assignments. The function I measures mutual information, while H measures entropy. The denominator normalizes agreement using the uncertainty of the label and cluster assignments.

The numerical discussion requires care. The paper’s experimental prose gives several relative R@1 improvements, while its table captions identify broader comparisons without supplying numerical entries alongside them. The results below therefore retain the reported improvements as stated. They do not reconstruct absolute recall values or infer missing NMI scores.

#### CUB-2011: bird categories with internal variation

CUB-2011 contains 11,788 images spanning 200 bird species. The training partition uses the first 100 classes, and the remaining classes are reserved for evaluation. The partition matters because retrieval must transfer beyond the species represented by the training centers.

For 64-dimensional embeddings, the authors report that normalized SoftMax exceeds the existing metric-learning methods in their comparison. This supports the paper’s analytical motivation: a classification-style objective can already learn useful distances, even before introducing several representatives.

SoftTriple performs best among the benchmark methods discussed for that setting. The authors report an R@1 improvement of 10% over ProxyNCA and 2% over normalized SoftMax. These are reported improvements, rather than absolute R@1 scores. They support the benefit of a richer class representation under the experiment’s conditions.

The comparison also contains testing qualifications. Npairs* uses a multiscale test, whereas the other methods use a single crop. The SemiHard result is taken from the facility-location metric-learning work cited by the authors. These details mean the benchmark comparison should be read with attention to how each result was obtained.

For the larger-embedding comparison, SoftTriple uses 512 dimensions. The other methods do not all share that size. HDC uses 384 dimensions, Margin uses 128, and HTL uses 512. Margin additionally uses ResNet50, the architecture associated with [Deep Residual Learning for Image Recognition](https://md.research.elamur.ai/free/en/papers/he-2015-deep-residual-learning-image-recognition/), whereas the SoftTriple experiments use Inception.

Against HTL, which shares the Inception backbone and the 512-dimensional representation, the paper reports an R@1 improvement of more than 8%. Against Margin, it reports about 2%. The authors describe Margin’s backbone as stronger, but this remains a comparison across different configurations instead of an isolated change to the loss.

The authors also observe that larger representations improve performance across the methods they discuss. Their interpretation is that a higher-dimensional space can separate examples more effectively. This reinforces why the fixed-size comparisons and the larger-embedding comparisons serve different purposes.

#### Cars196: transfer to unseen vehicle categories

Cars196 contains 16,185 images across 196 car categories. The first 98 classes supply training data, with the remaining categories used for testing. As with the bird experiment, the learned centers correspond to training labels while the embedding is evaluated on different categories.

At 64 dimensions, normalized SoftMax improves R@1 over ProxyNCA by 3%, according to the authors’ discussion. SoftTriple then adds about 2% over normalized SoftMax. The pattern agrees with CUB-2011: the classification baseline already supplies a strong metric representation, and multiple centers provide a further gain.

The distinction between these comparisons is useful. The normalized SoftMax result concerns the value of learning through class representatives instead of relying on the compared metric-learning alternatives. The additional SoftTriple result concerns the flexibility gained by permitting more than one representative. Treating both as a single undifferentiated improvement would obscure what the experiment helps explain.

For larger embeddings, the paper follows the dimensional configurations described in the bird experiments. HTL is the strongest previously reported comparator identified in the discussion. SoftTriple improves its R@1 by 3%.

The car results broaden the empirical support beyond bird species, but they remain within fine-grained visual recognition. They show that the observed pattern is not limited to the particular appearance variations of birds. They do not independently establish which car attributes each center captures.

#### Stanford Online Products: many classes, few images each

Stanford Online Products contains 120,053 product photographs from eBay.com, distributed over 22,634 classes. The training split includes 11,318 classes; the remainder are used for evaluation.

The center configuration changes because each class contains about 5 images. The authors use K = 2 and omit the regularizer. They also raise the initial learning rate for centers from 0.01 to 0.1. This is a substantive adaptation to the dataset, not simply the default configuration applied unchanged.

With 64-dimensional embeddings, normalized SoftMax improves R@1 over ProxyNCA by 2%. Increasing the representatives from 1 to 2 yields a further 0.4% for SoftTriple. The gain over the single-center baseline is smaller than the corresponding improvement reported for the bird and car settings, while remaining favorable.

The product result is especially useful for understanding what the method actually requires. It does not suggest allocating a large center bank regardless of class size. The authors instead reduce the count when each class has only a few observations and remove the within-class penalty in that setting.

For the larger-embedding comparison, both normalized SoftMax and SoftTriple exceed the previously strongest methods discussed by the authors. SoftTriple’s reported R@1 improvement over the prior best is more than 3%. The prose does not give an exact absolute recall score for this claim.

The chart collects exact reported comparisons against ProxyNCA from the 64-dimensional experiments. Each row concerns its named dataset, so the display is not a ranking of dataset difficulty or absolute retrieval quality. The percentages retain the authors’ wording; they should not be silently reinterpreted as reconstructed recall scores or percentage-point differences.

Reported R@1 improvements over ProxyNCA on CUB-2011, Cars196, and SOP, with 64-dimensional embeddings Representative-based objectives improve on ProxyNCA in the reported comparisons.

**The numbers**

| System or setting | reported R@1 improvement % |
| --- | --- |
| SoftMax_norm, SOP | 2 |
| SoftMax_norm, Cars196 | 3 |
| SoftTriple, CUB-2011 (this paper) | 10 |

#### What the results establish together

Across the datasets, the repeated finding is that explicit image-triplet sampling is not necessary for strong performance in these experiments. Normalized SoftMax already supports that conclusion. SoftTriple then improves the results while giving the class representation more room to capture local variation.

The evidence is stronger for the full method than for every explanation offered for it. Retrieval gains demonstrate that the resulting neighborhoods are more useful under the reported evaluations. They do not, by themselves, reveal whether a particular center represents pose, viewpoint, background, or another visual factor.

The clustering metric broadens the intended evaluation beyond nearest-neighbor retrieval, but the numerical claims available in the experimental discussion concentrate on R@1. An account of the results should therefore avoid claiming a particular NMI improvement that the prose does not state.

The authors make their implementation available through an official code repository. That accompanies the methodological description, but the reported evidence remains tied to the stated backbone, preprocessing, optimization schedule, embedding sizes, and dataset partitions.

### What the ablations show

The most informative controlled analyses concern the number of centers and the role of the regularizer. These address the proposed explanation directly: multiple representatives should help describe a class, but an unnecessarily large collection should not be allowed to overfit unchecked.

#### More centers help before capacity becomes excessive

On CUB-2011, the authors vary the number of centers and examine R@1. Increasing the count from 1 to 10 produces a substantial improvement in their discussion. This is the most direct support for replacing the single-center design: additional representatives improve retrieval rather than merely enlarging the final layer without benefit.

The interpretation is local flexibility. With one center, all examples of a class must relate to the same representative. With several, different groups can align with different representatives. The experiment supports the usefulness of that flexibility, although it does not assign semantic names to the resulting groups.

The analysis also guards against a simplistic conclusion that ever more centers must keep helping. Once the allocation is sufficiently large, regularized SoftTriple remains approximately stable in the authors’ account. Without regularization, further capacity leads to declining performance, which they attribute to overfitting.

This comparison supports the regularizer as a way to reduce sensitivity to the initial allocation. It does not establish a universally appropriate count for all datasets. The product experiment’s different configuration is a practical reminder that class size and data structure still matter.

#### The regularizer changes center redundancy

A separate CUB-2011 analysis initializes K = 20 and compares training with and without the penalty. The figure examines the number of distinct centers associated with each class.

Without the regularizer, the authors describe a collection that retains similar representatives. With it, the effective collection becomes substantially more compact. This supports the intended mechanism: penalizing pairwise center separation encourages redundant representatives to coincide.

The evidence concerns distinct locations, not a measured reduction in the allocated final-layer width. The paper does not describe physically removing parameter slots after convergence. Accordingly, fewer unique centers should not automatically be translated into a particular storage saving or inference-speed improvement.

The center-count analysis and the retrieval curve complement each other. The former shows that regularization changes the organization of the representatives. The latter shows that regularization helps maintain performance when capacity is generous. Together they make a stronger case than either observation alone.

#### Retrieved examples provide qualitative support

The authors also compare retrieved neighbors for normalized SoftMax and SoftTriple. The figure marks returned images whose labels differ from the query’s label.

Their interpretation is that normalized SoftMax already retrieves meaningful neighbors, while SoftTriple removes some incorrect-category images near the top of the displayed results. This visual comparison agrees with the aggregate retrieval findings and helps make the effect concrete.

It remains qualitative evidence. Selected query results do not measure how frequently each type of failure occurs, and the figure does not establish that all errors of a particular visual kind disappear.

The paper does not report a complete ablation across every mechanism. In particular, the experimental discussion does not isolate the contribution of the margin, sweep the assignment-smoothing parameter, or provide a numerical HardTriple-versus-SoftTriple comparison. Those components have analytical motivation, but their individual empirical effects are less directly established than the effects of center multiplicity and regularization.

### Limitations

The paper’s central result should be read within its experimental and mathematical scope. Avoiding triplet selection is a clear procedural change. Establishing that this change is universally preferable, or that the centers fully recover the geometry of the original dataset, would require broader evidence.

#### Limits the authors identify

The authors explicitly describe a tradeoff in the number of centers. Additional representatives can reduce approximation error by placing reference points closer to examples. They also enlarge the final fully connected layer, increase computation, and can slow optimization.

Overfitting is another stated concern. The analysis without regularization shows why center count is not merely an engineering choice about memory. Excess capacity can damage the learned retrieval representation. The proposed penalty addresses this problem in the reported analysis, but it does not remove the underlying need to balance flexibility and compactness.

The paper also treats choosing the number of centers as difficult. Its adaptive strategy starts with a generous allocation and encourages merging; it does not solve the problem by discovering an unconstrained architecture from nothing. An initial K is still required.

The authors leave ordinary classification evaluation for future work. SoftTriple has a classification-style form, and they argue that it could be useful for classification, but the experiments concern retrieval and clustering. Success on those tasks cannot be presented as an already demonstrated improvement in classification accuracy.

Likewise, the bounded ProxyNCA variant is a suggestion instead of a validated result. The analytical observation about the original objective motivates the proposal, but the paper does not test whether the proposed hinge produces better embeddings.

#### The center guarantee has specific assumptions

A careful reader should distinguish the theorem from a general equivalence between center-based and example-based training. The guarantee assumes that the relevant examples remain close to their representatives. If that discrepancy is large, the transferred margin can become weak.

The positive examples in the theorem also share the same nearest center. That condition is aligned with the paper’s emphasis on local clusters, but it narrows the conclusion. The result does not require all examples of a class to be mutually close, and it does not prove the same bound for arbitrary positives associated with different centers.

There is a further distinction between the theorem and the implemented score. The theorem concerns specified center-based similarities satisfying a margin. The training objective uses a smooth weighted class score. The derivation motivates the representative-based approach, but it does not state that minimizing the finite training objective automatically establishes every theorem assumption for every possible triplet.

This matters for interpreting the phrase “without triplet sampling.” SoftTriple avoids explicitly forming and selecting image triplets. It does not prove that every original triplet constraint has been checked and satisfied. Its persistent centers provide an alternative source of training relationships.

#### The experiments cover a particular visual setting

The empirical scope is fine-grained image retrieval and clustering. The evaluated categories involve birds, cars, and products. The paper supplies no language experiment, no validation of a Rust implementation, and no result showing that the same center behavior transfers unchanged to textual categories.

The shared backbone is pretrained on ImageNet before adaptation. The authors also freeze batch normalization on the bird and car datasets because they regard those images as similar to ImageNet. The outcomes therefore reflect this training foundation as well as the chosen loss. They do not isolate what SoftTriple would achieve from random initialization.

Evaluation separates training and test categories, which is valuable evidence for transfer of the embedding geometry. It does not establish performance under every other distribution change. Differences in image sources, label quality, or the structure of categories would require their own assessment.

The product experiment further limits any claim that the method has a single fixed configuration. It changes the center count, removes regularization, and alters the center learning rate. These are reasonable adaptations, but they show that the reported recipe responds to dataset characteristics.

#### Benchmark comparisons contain configuration differences

Some larger-embedding comparisons differ in both representation dimension and backbone. Margin uses a different architecture and a different vector size from SoftTriple. HDC also uses a different embedding dimension. Such comparisons establish a practical result among the reported systems, but they do not attribute every gain solely to the objective.

The HTL comparison is more closely aligned in the bird experiment because the backbone and embedding dimension match. Even there, the paper’s strongest causal evidence for its own design comes from comparisons that directly vary centers and regularization.

Testing procedures also matter. The multiscale Npairs* result does not use the same image-testing procedure as the single-crop results. The paper notes this difference, and it should remain visible when interpreting the benchmark.

The numerical reporting imposes another boundary. The prose states relative R@1 improvements, while the accompanying table captions refer to results whose entries are not available in the paper text discussed here. Exact absolute scores, complete recall curves, and missing clustering comparisons cannot be inferred from those improvement statements. Nor should a reported percentage gain be converted into a different numerical convention without evidence.

#### Compactness and interpretability are different claims

The regularizer encourages fewer distinct representatives, but distinctness is not the same as semantic clarity. A center is a learned vector. The paper’s pose example explains why multiple centers might be useful; it does not demonstrate that the trained centers partition images specifically by pose.

There is no center-labeling mechanism that turns those vectors into explanations. A readable description of a center would require additional inspection or evaluation. This is especially relevant when considering the method for a transparent system: a compact representation can still be difficult to explain.

Finally, the paper does not provide measured runtime or memory results sufficient to quantify the end-to-end efficiency benefit. It removes a sampling procedure and retains a conventional training structure, while adding center comparisons and regularization. Those changes explain where practical benefits may arise, but they do not establish a universal speedup or a particular resource saving.

### What came after

[Topic-Guided Sampling For Data-Efficient Multi-Domain Stance Detection](https://md.research.elamur.ai/free/en/papers/arakelyan-2023-topic-guided-sampling-data-efficient/) cites SoftTriple in 2023. Its title identifies a different application area: choosing training data for stance detection across domains, with topic information guiding sampling.

That citation establishes a connection in the later literature, but it does not by itself identify which SoftTriple mechanism the stance-detection work adopts. A citation could concern representative-based learning, the challenge of selecting informative comparisons, or another part of the earlier argument. Without a description of the later method’s use of SoftTriple, assigning it a specific center construction or loss would go beyond the available evidence.

The difference in terminology also deserves care. SoftTriple removes explicit triplet selection from its training objective. Topic-guided sampling, as named by the later title, concerns selecting data. Those are potentially different decisions within a training pipeline. The appearance of “sampling” in both research problems is not enough to show that the later work restores, replaces, or extends SoftTriple’s procedure.

The defensible later-work account is therefore narrow: SoftTriple is cited by a subsequent paper on data-efficient stance detection, but the particular technical dependence and its measured consequences are not established by the citation information. No result from that later application can be used to claim that SoftTriple itself has demonstrated language-task benefits.

SoftTriple’s reusable contribution remains clear without extending that citation beyond its evidence. It explains why a classification objective can learn useful neighborhood geometry, then relaxes the single-center restriction while retaining a familiar optimization pipeline. Its experiments support multiple representatives and regularized compactness for the tested visual tasks; later applications must establish their own connection between that mechanism and the structure of their data.

## Cite

Cite as Qi Qian, Lei Shang, Baigui Sun, Juhua Hu, Tacoma Tacoma, Hao Li and Rong Jin. 2019. SoftTriple Loss: Deep Metric Learning Without Triplet Sampling. IEEE/CVF International Conference on Computer Vision (ICCV).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.1109/iccv.2019.00655](https://doi.org/10.1109/iccv.2019.00655) · [arXiv 1909.05235](https://arxiv.org/abs/1909.05235)

```bibtex
@inproceedings{qian2019softtriple,
  title = {{SoftTriple Loss: Deep Metric Learning Without Triplet Sampling}},
  author = {Qi Qian, Lei Shang, Baigui Sun, Juhua Hu, Tacoma Tacoma, Hao Li and Rong Jin},
  booktitle = {IEEE/CVF International Conference on Computer Vision (ICCV)},
  year = {2019},
  doi = {10.1109/iccv.2019.00655},
  eprint = {1909.05235},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1109/iccv.2019.00655}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
