Repository navigation
Conversation
…tial transfer Three-arm CPU toy (ParticleGAN / plain fresh-Gaussian GAN / ParticleGAN + pairing) on an 8-Gaussian ring mixture, ka2 recipe, 2,400 steps, seeds 0-2. Pairing is delivered through the PriorManipulator penalty hook; assertions encode the gauntlet's measured margins: pairing beats the ParticleGAN control on coverage and relieves its intramode concentration, but does not beat the plain control. Verdict: partial. Nothing merged.
This branch has not been deployed
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.
Paper watch — cycle 1: pairing regularization on ParticleGAN
Paper: "Pairing Regularization for Mitigating Many-to-One Collapse in GANs" — Lin, Huang, Liu (2026). https://arxiv.org/abs/2604.20130
Mechanism (as published): a pairing network P(x, z) is trained with a contrastive (InfoNCE-style) loss to identify, within a minibatch, which latent produced each generated sample. The loss is added to the generator objective only (weight λ_pair); the discriminator and adversarial loss are untouched. On the paper's 2D toys, pairing rescues a collapsing plain GAN (ring: Naeem coverage 0.372 → 0.851; mixture: pairing+R1 recall 0.957 / coverage 0.861).
This PR asks the transfer question — does the term help a system that already has a learned particle prior? — as one CPU pytest:
tests/test_paperwatch_pairing_regularization.py. No formulation code changes; the pairing term is delivered entirely through the repo's existingPriorManipulatorpenalty hook (GANTraineradds it to the generator loss asprior_manipulation, and the pairing network's parameters ride the generator optimizer as prior router parameters). Candidate codes are detached inside the penalty, as in the paper the latent is exogenous; batch entries that repeat the same particle row are masked out of the denominator, since a repeated row is genuinely unidentifiable.Toy design
prior_code_law="fresh_gaussian".Gauntlet log (standing 10-iteration loop; stopped at 6 — verdict stable)
Controls, mixture @ 800 steps: ParticleGAN cov 0.211 ± 0.018 / disp 0.76 · plain cov 0.616 ± 0.014 / disp 1.54.
Controls, mixture @ 2,400 steps: ParticleGAN cov 0.201 ± 0.014 / disp 0.78 · plain cov 0.638 ± 0.039 / disp 1.07.
prior_manipulation2.75 vsloss_gan0.87 at step 30); generator collapses to a central, per-particle-identifiable blob. Far below both controls.Final margins (mixture, 2,400 steps, λ_pair = 0.03, mean ± sd over seeds 0/1/2)
Ring (coverage / angular uniformity): ParticleGAN 0.215 / 0.978 · plain 0.779 / 0.998 · pairing 0.237 / 0.993.
Verdict: PARTIAL
Pairing does what the paper says to the ParticleGAN control: it relieves intramode concentration (dispersion 0.78 → 1.46, overshooting 1.0) and lifts its coverage in every seed on both targets. But the paper's headline claim — pairing rescues the GAN — does not transfer past the plain baseline here: at an adequate budget the plain fresh-Gaussian GAN was never collapsing (dispersion ≈ 1.07, coverage 0.64), and pairing on ParticleGAN does not catch it. The test's assertions encode exactly these measured margins, including the negative half (
test_pairing_does_not_beat_plain_control), so a future change that moves either boundary fails loudly here first.Failure modes are understood: at λ ≥ 0.1 the identification gradient dominates and the generator trades the data manifold for per-particle identifiability (central blob, dispersion ≈ 2.4–3.9, coverage ≈ 0.08–0.16); at λ = 0.03 the term is a genuine regularizer but its within-mode repulsion overshoots the target spread.
Seam check (standing rule)
The gauntlet exercised
recipe.make_prior(manipulators=...), theManipulatedPrior.regularize→prior_manipulationpath, manipulator-parameter routing inmake_optimizers, andGANTrainer.sampleserved/live weight semantics. All behaved exactly as documented — no seam in our own code was found, so there is nothing to fix in this PR. (One cost note, not a bug: the pairing arm runs ~5× slower than the controls because the B×B pairing scores backpropagate through the generator; the smaller pairing net in round 5 cut that to ~2× but cost accuracy.)Run it
CPU-only; the nine trainings take ~10 minutes on a workstation (5 tests: 2 mechanism unit checks + 3 gauntlet assertions over a shared module-scoped fixture). Verified end-to-end on a clean checkout (pop-os, torch 2.15): 5 passed.