latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
PowerSGDState
- class tensorplay.distributed.algorithms.ddp_comm_hooks.powerSGD_hook.PowerSGDState(process_group, matrix_approximation_rank=1, start_powerSGD_iter=1000, min_compression_rate=2, use_error_feedback=True, warm_start=True, orthogonalization_epsilon=0, random_seed=0, compression_stats_logging_frequency=10000, batch_tensors_with_same_shape: bool = False)[source]
Store both the algorithm’s hyperparameters and internal state for all gradients during training.
Particularly,
matrix_approximation_rankandstart_powerSGD_iterare the main hyperparameters that should be tuned by the user. For performance, we suggest to keep binary hyperparametersuse_error_feedbackandwarm_starton.matrix_approximation_rankcontrols the size of compressed low-rank tensors, which determines the compression rate. The lower the rank, the stronger the compression.
To tune
matrix_approximation_rank, we suggest to start from 1 and increase by factors of 2 (like an exponential grid search, 1, 2, 4, …), until a satisfactory accuracy is reached.start_powerSGD_iterdefers PowerSGD compression until stepstart_powerSGD_iter, and vanilla allreduce runs prior to stepstart_powerSGD_iter.min_compression_rateis the minimum compression rate required when a layer is compressed.
Compression statistics are logged every
compression_stats_logging_frequencyiterations once PowerSGD compression starts.orthogonalization_epsiloncan be a very small value (e.g., 1e-8) added to every normalized matrix column in orthogonalization step, to prevent div-by-zero error if any column has all 0s.batch_tensors_with_same_shapecontrols whether to compress and decompress tensors with same shape in a batched operation to achieve higher parallelism.
Warning
If error feedback or warm-up is enabled, the minimum value of
start_powerSGD_iterallowed in DDP is 2.- compression_stats()[source]
Return latest compression statistics as tuple.
Returns tuple of form (compress_rate, numel_before_compression, numel_after_compression).
- maybe_increase_iter(bucket)[source]
Track iterations and trigger log message at start of local SGD.
Help improve this page
Found an error, an unclear step, or a missing example?

