Optimizing Contrastive Learning with Semi-Online Triplet Mining
Przemysław Buczkowski, Marek Kozłowski, Piotr Brzeziński · Applied Sciences · 2025
Contrastive learning is a machine learning technique in which models learn by contrasting similar and dissimilar data points. Its goal is to learn a representation of data in such a way that similar instances are close together in the representation space, while dissimilar instances are far apart. Our industrial use case focuses on a special case of contrastive learning called triplet learning. Building triplets with adequate difficulty is crucial to effective training convergence in such a setup. By combining online and offline mining techniques, we propose a method of mining hard triplets that is both performant and memory-inexpensive. Our experiments demonstrate that the method leads to improved identity pairing (which is the specific case of clustering) both on a real-life industry shoe dataset and on a generated benchmark one.