ErrorFeedbackCompressor<T>
Models & Types · AiDotNet.FederatedLearning.Compression
Error feedback compressor: wraps any compression method with residual accumulation.
Inheritance: FederatedLearningComponentBase<T> → ErrorFeedbackCompressor<T>
For Beginners
Most compression methods are biased — they lose some information. Error feedback fixes this by remembering what was lost (the “residual”) and adding it back in the next round. Over time, all information eventually gets transmitted, making the compressed training converge to the same solution as uncompressed training.
How It Works
How it works:
Mathematical guarantee: With error feedback, any contractive compressor (compression preserves a fraction of the signal) converges at the same rate as uncompressed SGD, up to a constant factor.
Constructors
| Constructor | Summary |
|---|---|
ErrorFeedbackCompressor(AdvancedCompressionOptions options) |
Initializes a new instance of ErrorFeedbackCompressor. |
Methods
| Method | Summary |
|---|---|
T GetErrorNorm(int clientId) |
Gets the current error norm for a client (useful for monitoring). |
Tensor<T> ApplyErrorFeedback(Tensor<T> gradient, int clientId) |
Applies error feedback to a gradient before compression. |
ValueTuple<Tensor<T>, T> CompressOneBit(Tensor<T> gradient, int clientId) |
Compresses a gradient using 1-bit SGD with error feedback. |
void ResetAllErrors() |
Resets all accumulated errors across all clients. |
void ResetError(int clientId) |
Resets error accumulation for a client. |
void UpdateError(Tensor<T> combined, Tensor<T> decompressed, int clientId) |
Updates the error accumulator after compression. |