DDP Disparity denominator: the average gradient is not always full sample mean
Common DDP training to calculate local gradients in individual processes and then synchronize averages.
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- Calculate weights of samples varying from device to device
- Understand synchronisation function separately from target
Suggested first
- Target function to oversee learning
- Basic training and validation cycle
Synchronization success does not mean that the target weight is correct
Common DDP training to calculate local gradients in individual processes and then synchronize averages. If the local sample is averaged for each process and the sample is equal in number, this usually corresponds to the global sample mean value. When numbers vary, the average unit becomes a process, with individual sample weights varying from one process to another.
Each of the two devices had two samples and one sample, with a local gradient of 2 to 10. (a) An average of 6 processes; The full sample target should be 14/3. If each local loss has been averaged, you can multiply the number of devices by local/global quantities before synchronisation. Here the equipment is two times four and two times two, respectively, with an average of 14/3 synchronized.
The number of valid tokens in the sequence model may vary even if the sample number for each device is the same. The number of token is still required to be counted globally if the target is at token, etc. Ignores the local mean value of padding only for local calibres and does not automatically become a global calibre.
Communication protocols and mathematical targets have to be verified separately
All processes should be involved in the pooled communications in a compatible order. A process that skips the reverse or exits abnormally ahead of schedule may leave other processes waiting. Mechanisms such as Join, which do not vary between input and input, address participation and waiting issues and do not determine whether the sample weight meets the target; Both types of issues are checked separately.
The same trap exists for the validation of indicators. A simple average of accuracy per card is equal to global accuracy only if the number of valid samples per card is equal. It would be more prudent to summarize the correct numbers and totals and to divide them again. Sorting indicators such as AUC also uses options that fit the global ranking or a clear approximation.
A composite model containing only three records can be used to compare the single-process gradient with the two-process gradients, item by item. Fixed parameters, non-execution of step, and closing of random layers allow the differences to be concentrated on the conclusion itself. It is only possible to compare the final loss number or communication to whether it is complete and not to identify the weight deviations of each parameter.
This section addresses PyTorch 2 Common DDP Altitude of gradient, does not cover all communications hook or special return settings. 14/3 with a multiplier, no multi-process or cluster start. When custom hook is used, its sum or mean is re-produced.
The number of samples is equal. Is it possible that the average number of rights varies from token?
Maybe. Different serial lengths lead to different numbers of token, and target denominators must actually optimize units.
Can the Join mechanism automatically guarantee that the goal is full sample average?
Communication coordination cannot be equated with a definition of objectives. There is still a need to specify how to divide the gradient when entering, the weight of the sample and the stop policy.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.