From coding to training algorithms