# Stabilne trenowanie GAN (odległość Wassersteina, kara gradientu)

EN: **Stable GAN training: Wasserstein loss and gradient penalty** · id `wgan` · aliases: WGAN, WGAN-GP, Wasserstein GAN, gradient penalty, kara gradientu

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Sieci i modele generatywne](https://aiatlasgraph.com/t/neural.md) › [Rodziny modeli generatywnych](https://aiatlasgraph.com/t/generative.md) › [Generatywne sieci przeciwstawne (GAN)](https://aiatlasgraph.com/t/gan.md) › Stabilne trenowanie GAN (odległość Wassersteina, kara gradientu)

## Description

- PL: Rodzina modyfikacji celu GAN, w której krytyk szacuje odległość Wassersteina między rozkładami, a ograniczenie Lipschitza wymusza kara gradientu.
- EN: A family of GAN objective changes where a critic estimates the Wasserstein distance between distributions, with the Lipschitz constraint enforced by a gradient penalty.

## In one sentence

- PL: Zestaw poprawek, dzięki którym rywalizujące sieci generujące uczą się spokojnie, zamiast się rozjeżdżać albo produkować w kółko to samo.
- EN: A set of fixes that let competing generator networks learn steadily instead of falling apart or producing the same thing over and over.

## Problem it solves

- PL: Trening sieci rywalizujących często się psuje: wyniki skaczą, nauka staje w miejscu, a generator powtarza kilka podobnych obrazów.
- EN: Training competing networks often breaks down: results jump around, learning stalls and the generator keeps repeating a few similar images.

## What it does

- PL: Sędzia zamiast mówić tylko „prawdziwe albo fałszywe”, podaje łagodną ocenę odległości, więc generator zawsze wie, w którą stronę się poprawić.
- EN: Instead of a bare real-or-fake verdict, the judge gives a smooth distance score, so the generator always knows which way to improve.

## Everyday example

- PL: Zespół uczy model tworzenia zdjęć produktów do sklepu i po zmianie sposobu oceniania trening przestaje się sypać po kilku godzinach.
- EN: A team training a model to create shop product photos changes the scoring rule, and training stops collapsing after a few hours.

## This concerns you if you…

- PL: twoje sieci rywalizujące uczą się niestabilnie
- PL: chcesz zrozumieć, czemu generator powtarza te same obrazy
- EN: your competing networks train unstably
- EN: want to understand why a generator repeats the same images

## Keywords

WGAN-GP · Wasserstein distance · Earth Mover's distance · Lipschitz constraint · weight clipping · gradient penalty · critic network

## How it works

- PL: Dyskryminator staje się krytykiem zwracającym liczbę zamiast prawdopodobieństwa; różnica jego średnich ocen dla danych i próbek przybliża odległość Wassersteina. Pierwotnie ograniczenie Lipschitza wymuszano przycinaniem wag; WGAN-GP zastępuje je karą, która pcha normę gradientu krytyka do 1 na punktach interpolowanych między danymi a próbkami.
- EN: The discriminator becomes a critic outputting a score instead of a probability; the gap between its mean scores on data and samples approximates the Wasserstein distance. The Lipschitz constraint was first enforced by weight clipping; WGAN-GP replaces it with a penalty pushing the critic's gradient norm towards 1 on points interpolated between data and samples.

## Limits

- PL: Kara gradientu wymaga obliczenia pochodnej krytyka względem interpolowanych wejść, co zwiększa koszt treningu. Stabilniejsza optymalizacja nie gwarantuje najlepszego wyniku dla każdej architektury ani każdego zbioru danych.
- EN: The gradient penalty requires differentiating the critic with respect to interpolated inputs, increasing training cost. More stable optimisation does not guarantee the best result for every architecture or dataset.

## Key terms

- PL: **krytyk**: Sieć oceniająca próbki liczbą, a nie werdyktem prawdziwe/fałszywe.
- PL: **ograniczenie Lipschitza**: Warunek, by wynik sieci nie zmieniał się zbyt gwałtownie przy małej zmianie wejścia.
- PL: **przycinanie wag**: Pierwotny, prosty sposób wymuszania gładkości krytyka, powodujący kłopoty z treningiem.
- EN: **critic**: A network scoring samples with a number, not a real/fake verdict.
- EN: **Lipschitz constraint**: A condition that the output changes only gently when the input changes slightly.
- EN: **weight clipping**: The original, simple way to keep the critic smooth, which hurt training.

## Know first

- [Propagacja wsteczna (backpropagation) (Backpropagation)](https://aiatlasgraph.com/t/backprop.md)
- [Rozkłady prawdopodobieństwa (Probability distributions)](https://aiatlasgraph.com/t/distributions.md)

## Sources

- [Improved Training of Wasserstein GANs](<https://arxiv.org/abs/1704.00028>) `gulrajani-wgangp-2017` · by Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, Aaron Courville

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/wgan · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
