implement training
implement decoder