Class ThresholdSecureAggregationVector<T>
- Namespace
- AiDotNet.FederatedLearning.Privacy
- Assembly
- AiDotNet.dll
Implements dropout-resilient secure aggregation for vector-based model updates.
public sealed class ThresholdSecureAggregationVector<T> : FederatedLearningComponentBase<T>, IDisposable
Type Parameters
TThe numeric type for model parameters (e.g., double, float).
- Inheritance
-
ThresholdSecureAggregationVector<T>
- Implements
- Inherited Members
Remarks
For Beginners: Secure aggregation lets the server compute the sum/average of client updates without learning any single client's update. Each client adds random "masks" to its update. When the server combines all masked updates, the masks cancel out and the server recovers only the aggregate.
This variant is dropout-resilient:
- Some clients may fail to upload masked updates (upload dropout).
- Some clients may upload but fail to complete the unmasking step (unmasking dropout).
As long as enough clients complete the unmasking step (the reconstruction threshold), the server can still recover the aggregate by reconstructing missing self-masks using Shamir secret sharing and by removing leftover pairwise masks for clients that did not upload.
Reference: Bonawitz, K., et al. (2017). "Practical Secure Aggregation for Privacy-Preserving Machine Learning."
Constructors
ThresholdSecureAggregationVector(int, int?)
public ThresholdSecureAggregationVector(int parameterCount, int? randomSeed = null)
Parameters
Properties
MinimumUploaderCount
Gets the minimum number of clients that must upload masked updates for the round to succeed.
public int MinimumUploaderCount { get; }
Property Value
ReconstructionThreshold
Gets the reconstruction threshold required to complete unmasking.
public int ReconstructionThreshold { get; }
Property Value
Methods
AggregateSecurely(Dictionary<int, Vector<T>>, Dictionary<int, double>)
public Vector<T> AggregateSecurely(Dictionary<int, Vector<T>> maskedUpdates, Dictionary<int, double> clientWeights)
Parameters
maskedUpdatesDictionary<int, Vector<T>>clientWeightsDictionary<int, double>
Returns
- Vector<T>
AggregateSecurely(Dictionary<int, Vector<T>>, Dictionary<int, double>, IReadOnlyCollection<int>?)
public Vector<T> AggregateSecurely(Dictionary<int, Vector<T>> maskedUpdates, Dictionary<int, double> clientWeights, IReadOnlyCollection<int>? unmaskingClientIds)
Parameters
maskedUpdatesDictionary<int, Vector<T>>clientWeightsDictionary<int, double>unmaskingClientIdsIReadOnlyCollection<int>
Returns
- Vector<T>
AggregateSumSecurely(Dictionary<int, Vector<T>>)
public Vector<T> AggregateSumSecurely(Dictionary<int, Vector<T>> maskedUpdates)
Parameters
maskedUpdatesDictionary<int, Vector<T>>
Returns
- Vector<T>
AggregateSumSecurely(Dictionary<int, Vector<T>>, IReadOnlyCollection<int>?)
public Vector<T> AggregateSumSecurely(Dictionary<int, Vector<T>> maskedUpdates, IReadOnlyCollection<int>? unmaskingClientIds)
Parameters
maskedUpdatesDictionary<int, Vector<T>>unmaskingClientIdsIReadOnlyCollection<int>
Returns
- Vector<T>
ClearSecrets()
public void ClearSecrets()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
~ThresholdSecureAggregationVector()
protected ~ThresholdSecureAggregationVector()
InitializeRound(List<int>, int, int, double)
Initializes a new secure aggregation round by generating the required cryptographic material.
public void InitializeRound(List<int> clientIds, int minimumUploaderCount = 0, int reconstructionThreshold = 0, double maxDropoutFraction = 0.2)
Parameters
clientIdsList<int>Selected clients for the round.
minimumUploaderCountintMinimum number of clients that must upload masked updates (0 = auto).
reconstructionThresholdintMinimum number of clients that must complete unmasking (0 = auto).
maxDropoutFractiondoubleUsed only when
minimumUploaderCountis 0 (auto).
Remarks
If minimumUploaderCount or reconstructionThreshold are not set (0),
industry-standard defaults are computed based on the selected clients.
MaskUpdate(int, Vector<T>)
public Vector<T> MaskUpdate(int clientId, Vector<T> clientUpdate)
Parameters
clientIdintclientUpdateVector<T>
Returns
- Vector<T>
MaskUpdate(int, Vector<T>, double)
public Vector<T> MaskUpdate(int clientId, Vector<T> clientUpdate, double clientWeight)
Parameters
Returns
- Vector<T>