Course contentsShow
← Machine Learning and Deep Learning
Lesson 3369 of 3,53873. Privacy in Machine LearningFree lesson

Masking and Secret Sharing

Techniques where users mask their data with random values that cancel out in aggregate but hide individuals.

Masking and Secret Sharing

What You'll Learn

You'll discover how participants can hide their individual data contributions using random masks that cancel out mathematically when aggregated, protecting privacy while enabling collaborative computation.

The Core Idea

Imagine you and your colleagues want to compute your average salary without revealing individual earnings. Masking and secret sharing let each person add a random number to their true value before sharing. When these masked values are aggregated, the random noise cancels out, revealing only the collective result—never exposing any single person's data.

In machine learning contexts, this technique appears in secure aggregation protocols (which you've already learned). Each participant masks their model update or gradient with random values. These masks are carefully designed so that when the server aggregates contributions from all participants, the random components sum to zero and disappear, leaving only the true aggregate.

How It Works

Secret sharing splits a secret value into multiple "shares" distributed among participants. No single share reveals anything about the original value, but combining enough shares reconstructs it. For example, splitting your gradient into three random pieces where only their sum equals the original gradient.

Masking adds or multiplies secret random values to your data. If paired participants use complementary masks (e.g., +R and -R), these cancel during aggregation while hiding individual contributions.

The Privacy Benefit

An adversary seeing only your masked value learns nothing about your true data—it looks completely random. Only when enough participants' masked values combine does meaningful information emerge, and that information is collective, not individual.

This differs from differential privacy (adding calibrated noise) because here the "noise" completely vanishes at aggregation, preserving exact accuracy while protecting privacy during transmission.

Key Takeaway: Masking and secret sharing protect individual data by adding random values that hide contributions in transit but mathematically cancel out during aggregation, enabling privacy-preserving collaborative computation without accuracy loss.