SecureGradientExchange<T>

Models & Types · AiDotNet.FederatedLearning.Vertical

Provides encryption for gradient tensors exchanged between parties in vertical FL.

Inheritance: FederatedLearningComponentBase<T> → SecureGradientExchange<T>

For Beginners

In vertical FL, parties exchange embedding values and gradients. These intermediate values can leak information about the raw features. Secure gradient exchange encrypts these values during transit so that an eavesdropper or curious party cannot analyze them.

How It Works

This implementation uses symmetric encryption (AES-GCM) with per-session keys derived via Diffie-Hellman key agreement. In production, each party pair would negotiate a shared secret; in simulation mode, keys are derived deterministically from a seed.

Two modes of protection:

Reference: Based on techniques from Google’s production FL system and FATE VFL framework.

Constructors

Constructor Summary
SecureGradientExchange(bool useEncryption, int? seed) Initializes a new instance of SecureGradientExchange.

Methods

Method Summary
Tensor<T> RecoverGradients(Tensor<T> protectedGradients, Tensor<T> mask) Recovers the original gradient tensor from a protected representation.
ValueTuple<Tensor<T>, Tensor<T>> ProtectGradients(Tensor<T> gradients) Protects a gradient tensor before sending it to another party.