Standard contrastive learning operates on a binary logic: similar items (positives) are pulled together, while different items (negatives) are pushed apart. However, this approach treats all negatives as equally "wrong," ignoring the inherent structure of the real world. In a biological taxonomy, a "Husky" is technically a negative for the label "Labrador," but it is far more similar to one than it is to a "Ferrari."
Zhang et al. argue that treating all negatives as equally distant forces models to distinguish between closely related sibling classes as aggressively as between completely unrelated objects, which hinders the development of logically structured feature spaces. To solve this, a growing body of research integrates hierarchical taxonomies directly into the contrastive objective, using the tree-like structure of labels to guide how models differentiate between concepts.
The Sibling Strategy for Hard Negatives
The most common mechanism for building intuition in these models is taxonomy-based hard negative sampling. Instead of selecting random negatives from the entire dataset, these frameworks prioritize "sibling" nodes—items that share a common parent in a hierarchy but differ at the leaf level.
Long & Webber demonstrate that selecting negatives from sister nodes forces the model to learn subtle features that distinguish semantically similar classes, preventing the learning of trivial, "easy" features. Similarly, Ma et al. and the authors of MERA show that contrasting a target label against its siblings within the same parent category allows the model to refine subtle distinctions at granular levels while still recognizing broad categories at higher levels.
This strategy is particularly effective in domains with complex, fine-grained labels:
- Legal Judgment: Liu et al. use hierarchical relationships to select dissimilar legal cases that share a high-level category, sharpening the model's ability to recognize rare "long-tail" charges.
- Medical Coding: Yan et al. leverage the ICD10 hierarchy to group medical symptoms, ensuring training sets include hard negatives from the same taxonomic branch.
- Skill Extraction: Decorte et al. show that using sibling concepts from the ESCO taxonomy is more effective than statistical similarity for distinguishing between closely related job skills.
Modulating the Push with Soft Negatives
If all negatives are not equal, the mathematical penalty for confusing them should not be equal either. Researchers have introduced hierarchical soft contrastive learning, where the "push" force of the loss function is modulated by taxonomic distance.
Zhang et al. proposed Relational Contrastive Learning (ReCo), which uses a similarity score derived from a concept tree to adjust the penalty. Closely related categories are treated with more leniency, preventing the model from aggressively separating similar concepts. He et al. extend this in the SEAL framework, weighting negative samples based on hierarchical proximity to encourage a structured feature space that reflects natural taxonomies.
Kokilepersaud et al. formalize this by partitioning negatives into two sets: those that share a superclass with the anchor and those that are entirely unrelated. By prioritizing the former, the optimization process is forced to identify the specific fine-grained features that cause confusion between cousins.
Multi-Granularity and Path Consistency
Beyond simple sibling comparisons, recent work emphasizes maintaining consistency across the entire hierarchical path. Jiang et al. introduced the GOLF framework, which treats instances with partially overlapping label sequences as "relative positives." This recognizes that two items sharing a branch are more related than those from different categories, even if their leaf labels differ.
To achieve this, models often employ a "ladder" of negatives. Pan et al. use large language models to synthesize a spectrum of negative samples ranging from easy to hard. By providing this multi-granularity signal, the model learns to represent the multi-level structure of the data—a concept Scorpio applies to biological sequences to capture the "tree of life" from species to kingdom.
Efficiency through Hierarchical Retrieval
Finally, these hierarchical structures are used to solve the "extreme multi-label" problem in large-scale retrieval. Zhu et al. and Yang et al. demonstrate that organizing items into a hierarchical tree allows for logarithmic search complexity. During training, Yang et al. use a geometric sampling strategy that selects increasingly challenging negatives from deeper levels of the tree, mirroring how the model will eventually navigate the hierarchy during inference.