The critic of contrastive RL is trained by classification. For a batch of rows, let be the matrix of critic values, where scores the state and action of row against the goal of row . The goal on the diagonal is the one that row's trajectory really reached. The paper trains the critic with the InfoNCE objective
infonce_critic_loss(F)
F is a square array of shape with .(loss, per_row): loss is the Python float (a sum over the batch, not a mean), and per_row is a NumPy array of shape holding the terms of the sum.F are large in magnitude (for example ).ValueError if F is not a non-empty square matrix.