The main differences between the algorithms can be best understood via their respective compute_loss() functions. The NextLat training code includes inline comments to help explain the algorithm.