Cost is not decreasing with transformer when src sent length is 100 more and target sent length is 10 less
I am working ok with your transformer when training with wmt-ende dataset, so I tried a new dataset which is different, and with the property of what I said in this issue title。The cost is not decreasing when training and the cost is above 4 most of the time。I was using transformer_base hparam set. Any suggestions you think may help me train my own dataset?
Two things you should definitely try first: using large learning_rate_warmup_steps (as in transformer_base_single_gpu) and lowering the learning rate, say 3 times or even 5 times. Let us know if this helps! Also, if you can, make a PR with your dataset (or even a small version of it), then I can take a look myself.
thanks, the warm up steps works, and I found make the encode sentence shorter helps too。When the encode sentence is 100 less(earlier the encode sentence is 200 more), the model can easily learn well,making me wonder if longer sentence with more words makes the attention mechanism more difficult to learn?
It's quite probable: the attention needs to learn to select from the set, the larger it is, the more positions to consider. And at the beginning all are equally likely as the weights are random.