HybridMpcProtocol<T>

Models & Types · AiDotNet.FederatedLearning.MPC

Combines arithmetic secret sharing (for linear operations) with garbled circuits (for non-linear operations) into a single hybrid MPC protocol.

Inheritance: FederatedLearningComponentBase<T> → HybridMpcProtocol<T>

Implements: ISecureComputationProtocol<T>

For Beginners

Different MPC techniques are efficient for different operations:

How It Works

The hybrid approach uses arithmetic sharing by default and automatically switches to garbled circuits when a non-linear operation is needed. Share conversion between the two representations uses oblivious transfer.

In FL, the typical workflow is:

Reference:

Constructors

Constructor Summary
HybridMpcProtocol(MpcOptions options) Initializes a new instance of HybridMpcProtocol.

Properties

Property Summary
ArithmeticSecretSharing<T> ArithmeticScheme { get; } Gets the arithmetic secret sharing scheme used internally.
BooleanSecretSharing BooleanScheme { get; } Gets the boolean secret sharing scheme used internally.
GarbledCircuitEvaluator CircuitEvaluator { get; } Gets the garbled circuit evaluator.
GarbledCircuitGenerator CircuitGenerator { get; } Gets the garbled circuit generator used for non-linear operations.
IObliviousTransfer ObliviousTransfer { get; } Gets the oblivious transfer protocol.
SecureClippingProtocol<T> Clipping { get; } Gets the secure clipping protocol.
SecureComparisonProtocol<T> Comparison { get; } Gets the secure comparison protocol.

Methods

Method Summary
Tensor<T> Reconstruct(Tensor<T>[] shares)
Tensor<T>[] ScalarMultiply(Tensor<T>[] shares, T scalar)
Tensor<T>[] SecureAdd(Tensor<T>[] sharesA, Tensor<T>[] sharesB)
Tensor<T>[] SecureClipByValue(Tensor<T>[] gradientShares) Performs secure element-wise clipping on secret-shared gradients.
Tensor<T>[] SecureClipGradient(Tensor<T>[] gradientShares) Performs secure gradient clipping on secret-shared gradients.
Tensor<T>[] SecureClippedAggregation(IReadOnlyList<Tensor<T>[]> clientGradientShares, IReadOnlyList<double> weights) Performs secure aggregation with clipping: clips each client’s gradient, then aggregates.
Tensor<T>[] SecureCompare(Tensor<T>[] sharesA, Tensor<T>[] sharesB)
Tensor<T>[] SecureMultiply(Tensor<T>[] sharesA, Tensor<T>[] sharesB)
Tensor<T>[] SecureWeightedSum(IReadOnlyList<Tensor<T>[]> clientGradientShares, IReadOnlyList<double> weights) Securely aggregates gradients from multiple clients using weighted sum.
Tensor<T>[] Share(Tensor<T> value, int numberOfParties)