← All questions
Retrieval & EmbeddingsMedium· Contrastive Learning· Hard Negative Mining

Your contrastive loss is 0.08 after one epoch and recal...

A strong answer recognizes that a low loss value in this context is a sign of an easy negative pool, not a high-quality retriever. With 255 in-batch negatives at a margin of 8 nats, the expected loss is approximately 0.082, meaning the model is not being challenged. Rather than adjusting hyperparameters like learning rate or encoder size, you must mine negatives from the model’s own top-k predictions. This approach significantly increases the gradient weight per negative, forcing the model to learn from more difficult examples.

Code playground (Python)