Contrastors is an open-source contrastive learning toolkit from Nomic AI for training and evaluating embedding models efficiently in PyTorch. It is the training framework behind the widely used Nomic Embed model family, covering text embeddings, image embeddings and multimodal retrieval models. The project is hosted on GitHub, where it has earned roughly 800 stars, and it remains in active use, with recent updates in 2025.
Good embeddings power search, RAG pipelines and recommendation systems, but training them contrastively at scale is fiddly: you need large batches, careful negative mining and memory-efficient attention. Contrastors packages the recipes Nomic uses in production, including Flash Attention for speed, GradCache for fitting large batch sizes into limited memory, and multi-GPU training support. It loads common Hugging Face model architectures such as Pythia/GPT-NeoX and BERT, supports masked language modeling pretraining, and can produce Matryoshka representations that let one model serve embeddings at several dimensions. Evaluation tooling is included so trained encoders can be benchmarked before deployment. For teams building retrieval systems, that means the same codebase takes a model from raw training data to a measured, deployable encoder.
Contrastors is free and open source under the Apache License 2.0. There is no paid tier โ the same code used to train Nomic’s published embedding models is available to everyone.
Contrastors is for ML engineers and researchers who need to train their own embedding models for semantic search, retrieval-augmented generation or multimodal retrieval rather than renting embeddings from an API.