Repository navigation
Conversation
PATE-GAN's DP guarantee (Jordon et al., ICLR 2019) relies on the post-processing theorem: the discriminator/student must be a function only of privacy-protected teacher labels, per Eq. 7 and Fig. 4. The student is defined only over generated samples labeled by the noisy teacher consensus, never over real data. _train_epoch_discriminator forwards real training rows through the discriminator with an unconditional real label, and the gradient penalty separately interpolates real and fake samples. Both paths let real data influence the discriminator, and therefore the generator, with no privacy protection on that path. This holds regardless of the epsilon or lamda used. Add an opt-in discriminator_use_real_data flag (default True, so CTGAN, AdsGAN, and DPGAN are unaffected) that, when False, trains the discriminator only on generator output split by its teacher label, and skips the gradient penalty. PATEGAN.fit() now passes False.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PATE-GAN's discriminator (the "student") is trained directly on real data, which breaks the post-processing theorem the paper's privacy guarantee depends on. This holds regardless of the epsilon or lambda used.
gan.py's_train_epoch_discriminatorforwardsreal_Xthrough the discriminator with an unconditional real label (true_labels_generatordefaults to all ones and PATE-GAN never overrides it), producingerrD_real, which is backpropagated. The gradient penalty (_loss_gradient_penalty) separately interpolates real and fake samples, a second path for real data to reach the discriminator.Since the discriminator the generator learns from is not purely a function of DP-protected labels, Theorem 1's proof does not apply to this implementation as written.
Fix
Add an opt-in
discriminator_use_real_dataflag toGAN(defaultTrue, preserves current behavior everywhere else). WhenFalse:_train_epoch_discriminatorskips the real-data forward pass and the gradient penalty.errD_real/errD_fakeare computed only from generator output, split by its teacher label, matching Eq. 7.TabularGANforwards the new parameter toGAN.PATEGAN.fit()passesdiscriminator_use_real_data=False.Confirmed via grep that
CTGANPlugin,AdsGANPlugin, andDPGANPluginare the only other consumers ofTabularGAN/GAN, and none pass this parameter, so their behavior is unchanged.Scope
This PR fixes only this issue. A separate audit of the same plugin found three smaller privacy accounting bugs (an exponent typo in the moments accountant, teacher queries that skip the accountant charge under one condition, and a noise scale that does not match how it is used elsewhere in the accountant). Those are not included here and can be filed separately if useful.
Test plan
pateganon a small synthetic dataframe,discriminator_use_real_dataconfirmedFalseon the resulting model, fit and generate both succeed.ctganthe same way,discriminator_use_real_dataconfirmedTrue(default, unchanged), fit and generate both succeed.NaNfromtorch.meanof an empty tensor); confirmed this path is exercised and handled correctly on a real 1367-row dataset with 24 continuous features.Disclaimer
The issue was identified by me while going through the PATE-GAN code for its implementation in my own project and the fix was created in partnership with Claude and the documentation and its implementation into my fork was done by Claude single handedly.