GAN Trainer (2D)
A generative adversarial network trains two players against each other: a generator G maps 2D Gaussian noise through two hidden layers of 16 units to fake points, while a discriminator D learns to tell them from the blue real samples. Both are trained with hand-written backpropagation, alternating several discriminator steps per generator step (the k slider) with separate learning rates. Orange points show G’s output on a fixed noise bank, redrawn every frame over a faint heatmap of D’s current decision. Choose the ring of 8 Gaussians, spiral or two moons, follow both loss curves, and watch the status line report how well D separates real from fake as the two networks chase each other.
Runs 100% in your browser — models are trained and computed locally on your device.
Read the full guide to this tool
Notes
- The generator uses the non-saturating loss −log D(G(z)) instead of the original minimax form log(1 − D(G(z))), which keeps gradients alive while D is winning.
- The ring of 8 Gaussians is the classic mode-collapse testbed: G often covers only a few modes and hops between them, because the loss never rewards covering all of the data at once.
- Balance matters: a discriminator trained too hard (high k or learning rate) gives the generator near-zero gradients, while one trained too little gives it a meaningless target.
- At the ideal equilibrium D outputs 0.5 everywhere and both accuracies hover near 50% — the losses oscillate rather than converge, unlike ordinary training.
- Runs 100% in your browser — models are trained and computed locally on your device.