It is trained to minimize: where θ is the set of all parameters associated with the model, and y is the correct answer.
all published experiments of the latter use 3 hops where each hop requires 2 separate Bi-GRUs, one  to model the document and one for the query.