Cross-equipment token average: how local means become global targets
The data parallels different processes to process different samples and synchronize the gradient.
Learning objectives and first steps2 objectives . 1 first fix
Try to do it after reading
- Explains the cross-equipment token average: mechanisms and premises for how local mean values become global targets
- Positioning the mechanism ' s fault limits with fixed examples
Suggested first
- Gradient Accumulation and Distribution
Issues and mechanisms
The data parallels different processes to process different samples and synchronize the gradient. If processes work, token Same number, local. mean It's possible to have a global impact on average. mean ; If the length or filter is different, a large weight is given to a small batch on a direct average. The correctness of the distribution is first of all statistical objectives and synchronous protocols, rather than equipment that can be activated.
Effective losses and positive counts for each process are recorded and targets are constructed on a global basis. The actual inverse scaling also balances the average or the sum of the framework gradients and avoids duplication of process numbers. The non-deficit count can be synchronized separately, while the loss path is kept on the right scale against the target. The indicator log will also need to be attributed to the same calibre and cannot be used only as a share of the main process.
A concrete example
The synthesis process consisted of four and one valid token, respectively, with a partial average loss of one and five. The three direct averages, and the global goal is four plus five divided by five, or 1.8. A similar deviation in statistical weights occurs when the local mean is reversed by the average frame gradient. A metric model can be used to combine the full data gradient in a single process before simulating multiple process comparisons as planned.
Borders and checks
In some cases, the final batch or dynamic filtering would make the number zero valid and should be processed in a synchronized contract, without allowing a process to skip the necessary communications leading to other processes waiting. Repeated sampling and data fragments may also lead to duplicates of global sample identities. Not only do values are compared at the time of validation, but processes samples ID should also be recorded with valid counts.
When the communication interface or gradient accumulates, the old zoom factor should be re-produced. (a) The single card code cannot be copied with a line of equipment divided; It is not possible to mix rights objectives by sequence with rights objectives by token. The actual multi-process and multi-carat effects need to be performed in the corresponding environment, and the value in this chapter is merely a fixed calculation of the clearly defined denominator.
A method of verification
The samples could also be redistributed to the process, the global aggregation could be maintained, and the global gradient could be checked without a change in the way it is divided. If the result changes, priority is given to local averages, final batches and invalid targets. When communications fail or a process filters all samples, they should exit or synchronize with the uniform control stream, rather than the result of a silent continuation of parts of the device. Global indicators also need to be effectively counted, and a single loss from the main process does not represent the data actually seen from other processes.
Check understanding
Local mean One and Five, why is mean not three?
On both sides, there are different numbers of validitys, with four and one weights different. Global token averages 1.8, and a simple average mean defines rights objectives such as process.
The frame has already averaged the gradient and does it automatically resolve the imbalance in length?
No, I won't. The framework does not know how much effective token weight the target should be, and the caller still has to construct the correct loss scaling and global counting.
Sources and reconciliations
Definitions, methods and interfaces are available.
- PyTorch — Distributed Data Parallel
- PyTorch FSDP — Experiences on Scaling Fully Sharded Data Parallel
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.