← All questions
RAGMedium· Unsupervised Learning· Loss Functions· Gradient

REALM has no relevance labels. So what supervises the r...

REALM uses the masked-token likelihood as its training signal. The coefficient p(z | x)[p(y | z, x)/p(y | x) − 1] determines the gradient; a block receives a positive reward when it improves the prediction of the masked token (y) given the retrieved document (z) and input (x) relative to the average prediction across the retrieved set. Because the coefficients sum to zero, the top-k retrieved documents effectively act as their own pool of negatives.

Code playground (Python)