fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

Replicate result from a multi GPU training with less GPUs

Open ever4244 opened this issue 6 years ago • 1 comments

Hi:

When I am reimplementing the baseline result from some paper I am always confused by the batch size issue.

For example, if a paper says the training is done with max-token 4000, trained with 8 GPUs, then I assume the effect batch size is 4000x8 =32000

If I only have 2 GPU, then if I want to get to as closer performance as possible, I should set the update frequency to 4? So that my effective batch size would be 4000x2x4=32000? The gradient would be computed per mini-batch (4000) in each GPUs and then accumulate delta for 2GPU x 4 times to make the network update? Is this how the gradient computation and updating work?

If not what is the best way of replicating the publish result's batch size with a lesser number of GPUs considering all other things are equal?

BTW: if I do training with 1 GPU and then 4GPU, would that affect the performance? It is important because I sometimes can have 1 GPU available, sometimes I have more. If the result of an experiment is very inconsistent due to the GPU numbers, then I have to redo some experiments, as the result difference could be caused by effect batch size changes.

ever4244 avatar Apr 20 '20 21:04 ever4244

For example, if a paper says the training is done with max-token 4000, trained with 8 GPUs, then I assume the effect batch size is 4000x8 =32000 If I only have 2 GPU, then if I want to get to as closer performance as possible, I should set the update frequency to 4?

Yes, your understanding is correct.

if I do training with 1 GPU and then 4GPU, would that affect the performance

It should only affect the runtime performance. It should not affect the quality of the results.

lematt1991 avatar Apr 21 '20 12:04 lematt1991