← All questions
Retrieval & EmbeddingsHard· ANCE· Hard Negative Mining· Training Dynamics

Why does ANCE rebuild the ANN index during training ins...

The effectiveness of hard negative mining depends on the current state of the model parameters (θt). A negative sample that is hard for a current checkpoint will eventually become easy as the model pushes the margin up during training. If you use a statically mined set, the margin effectively decays, leading to a significant loss in gradient weight. ANCE periodically refreshes the index to maintain an optimal sampling distribution, acknowledging that this process is compute-intensive and must be performed asynchronously.

Code playground (Python)