← All questions
Retrieval & EmbeddingsHard· MoCo· Momentum Encoder· Contrastive Learning

Why does MoCo need a separate momentum encoder? Why not...

Caching key vectors is memory-efficient but creates a functional inconsistency. A key computed 512 steps ago was generated by parameters (θt-512) that differ from the current query parameters (θt). The momentum encoder forces the key function to change on a controlled timescale, ensuring that the dot product between queries and keys remains meaningful. If the momentum is set to zero, the training fails to converge because the consistency condition is violated.

Code playground (Python)