SecureAggregation<T>
Models & Types · AiDotNet.FederatedLearning.Privacy
In-process secure aggregation following Bonawitz et al. (2017): one SecureAggregationServer and one
SecureAggregationClient per participant, with every message passed through the server.
Inheritance: FederatedLearningComponentBase<T> → SecureAggregation<T>
Implements: IDisposable
For Beginners
Secure aggregation is like a secret ballot: the server can count the votes but never read a single ballot. Each client adds large random numbers to its update; the numbers are arranged so they cancel exactly when every update is added together, and secret sharing lets the server finish the count even when a few clients disconnect.
How It Works
Bonawitz, K., Ivanov, V., Kreuter, B., Marcedone, A., McMahan, H. B., Patel, S., Ramage, D., Segal, A. and Seth, K. (2017). “Practical Secure Aggregation for Privacy-Preserving Machine Learning.” CCS 2017. Honest-but-curious protocol, figure 4:
The modular sum is exact, so the decoded aggregate equals the sum of the survivors’ fixed-point encodings bit for
bit, whatever the masks were. It is decoded in Double and rounded once to T.
Constructors
| Constructor | Summary |
|---|---|
SecureAggregation(int parameterCount, SecureAggregationOptions options) |
Creates secure aggregation for updates of parameterCount values. |
Properties
| Property | Summary |
|---|---|
FixedPointRingEncoding Encoding { get; } |
Gets the fixed-point ring encoding. |
IReadOnlyList<int> ClientIds { get; } |
Gets the clients of the current round, in ascending order. |
int Threshold { get; set; } |
Gets the threshold t of the current round (0 before InitializeRound). |
Methods
| Method | Summary |
|---|---|
SecureAggregationMaskedInput MaskUpdate(int clientId, Vector<T> update, double weight) |
Round 2 for client clientId: returns its masked update. |
Vector<T> AggregateSum(IEnumerable<SecureAggregationMaskedInput> maskedInputs, IEnumerable<int> unmaskingClientIds) |
Round 4: unmasks the sum, decodes it in Double and rounds once to T. |
Vector<T> AggregateWeightedAverage(IEnumerable<SecureAggregationMaskedInput> maskedInputs, IReadOnlyDictionary<int, double> clientWeights, IEnumerable<int> unmaskingClientIds) |
Round 4 for weighted averaging: the clients masked w_u * x_u (see MaskUpdate); this unmasks the sum and divides it, in Double, by the total weight of the clients in U_3, then rounds once to T. |
ulong[] AggregateRingSum(IEnumerable<SecureAggregationMaskedInput> maskedInputs, IEnumerable<int> unmaskingClientIds) |
Round 4: unmasks the sum and returns it in the ring, sum_{u in U_3} Encode(w_u * x_u) mod 2^b. |
void ClearSecrets() |
Drops all clients and server state of the current round. |
void Dispose() |
|
void InitializeRound(IEnumerable<int> clientIds) |
Starts a round: runs AdvertiseKeys and ShareKeys for every client in clientIds. |