The general idea of hard example mining is once the loss(and gradients) are computed for every sample in the batch, you sort batch samples in the descending order of losses and pick top-k samples from it and do backward pass only for those k samples. i.e samples which contribute to more learning(aka hard example).
This ensures that samples which do not contribute much to the network’s learning is ignored.