# Conditional Generative Adversarial Nets

Conditioning GANs on extra input steers which samples they generate

Mehdi Mirza, Simon Osindero · arXiv · 2014-11-6

- **Problem** Plain generative adversarial nets give the user no say over which kind of sample comes out. Steering generation needs extra information, such as class labels, which the original setup cannot take.
- **Method** Conditional adversarial nets feed the conditioning input y into both the generator and the discriminator. The generator joins the noise and y in a hidden layer, and the discriminator scores each sample paired with y.
- **Results** On MNIST the conditional model scored 132± 1.8 in Parzen window log-likelihood. That is below the 225± 2 of non-conditional adversarial nets in the same table.

## Why plain GANs can't be steered

Adversarial nets skip Markov chains and inference during learning, so training relies on backpropagation alone. The catch is that a plain generative model gives the user no say over which kind of sample comes out. Conditioning on extra information, such as class labels, part of an image for inpainting, or data from another modality, is the way to steer generation.

Image labelling adds a harder problem, because one image may deserve many tags. Annotators also pick different but related words for the same picture, so the mapping from image to tags is one-to-many rather than one-to-one. The authors therefore treat the output as a conditional predictive distribution over tags, not as a single prediction.

## Feeding the condition into both networks

The key idea is simple: the same conditioning input \\(y\\) goes into the generator and the discriminator. The generator combines the noise prior and \\(y\\) in a joint hidden representation. The discriminator takes a data sample \\(x\\) together with \\(y\\) and outputs one probability, with an MLP in this case. How the joint representation is composed is left flexible, because the adversarial framework allows many ways to combine the inputs.

The unconditional game is the min-max problem with value function V(D,G) over the data and the noise prior. The conditional version keeps the same min-max structure and attaches \\(y\\) to every term, as in the equation below. \\\[ \\min\_G \\max\_D V(D,G) = \\mathbb{E}\_{x\\sim p\_{data}(x)}\[\\log D(x\|y)\] + \\mathbb{E}\_{z\\sim p\_z(z)}\[\\log(1-D(G(z\|y)))\] \\\] The discriminator is trained to push the score of real pairs \\((x,y)\\) up and the score of generated pairs down, while the generator works against it.

## Network sizes and training on MNIST

For MNIST the authors conditioned on class labels encoded as one-hot vectors. The noise prior z has dimensionality 100 and is drawn uniformly from the unit hypercube. Both z and y pass through ReLu hidden layers of 200 and 1000 units, and those two layers feed a joint ReLu layer of 1200 units. A sigmoid output layer then produces 784-dimensional MNIST samples.

The discriminator maps x through a maxout layer of 240 units with 5 pieces, and maps y through a maxout layer of 50 units with 5 pieces. A joint maxout layer of 240 units with 4 pieces feeds the sigmoid output. Training used stochastic gradient descent with mini-batches of 100 and an initial learning rate of 0.1, which decays exponentially toward .000001 with a decay factor of 1.00004.

Momentum started at 0.5 and rose to 0.7, and dropout with probability 0.5 was applied to both networks, with the best validation log-likelihood choosing the stopping point.

## MNIST log-likelihood and samples

The score is a Gaussian Parzen window log-likelihood, fitted to 1000 samples drawn from each of the 10 classes. The test-set log-likelihood is then computed under that window distribution. The conditional model scored 132± 1.8, compared to 225± 2 for non-conditional adversarial nets in the same table. It sits above the Stacked CAE at 121± 1.6 and below the DBN at 138± 2, so it is comparable with some network-based models but beaten by several others.

The authors present these numbers as a proof-of-concept rather than a demonstration of efficacy. They expect that more search over hyper-parameters and architecture could let the conditional model match or exceed the non-conditional results. That expectation is not tested in the paper, so the MNIST evidence stops at the numbers above. The generated digits are arranged with one label per row and one generated sample per column.

## Image features and tag vectors

In the multi-modal setting the generator outputs word vectors rather than pixels, and the condition is an image. Image features come from a convolutional model pre-trained on ImageNet with 21,000 labels, and the output of its last fully connected layer, with 4096 units, serves as the representation. Word vectors of size 200 come from a skip-gram model trained on user tags, titles and descriptions in YFCC100M.

Words appearing fewer than 200 times were dropped, which leaves a dictionary of 247465 words.

Both feature models stay fixed while the adversarial net trains. Backpropagating through them was left as future work, so the gradients stop at the adversarial net. The generator sends 100-dimensional Gaussian noise into a 500-unit ReLu layer and maps the 4096-dimensional image vector into a 2000-unit ReLu layer. A 200-unit linear joint layer outputs the generated word vectors, and the discriminator uses 500 and 1200-unit ReLu layers before a maxout layer of 1000 units with 3 pieces and one sigmoid unit.

## Generating and ranking tags

The authors use the first 150,000 examples of MIR Flickr 25,000 as the training set. Images without any tag are dropped, annotations count as extra tags, and an image with several tags is repeated once per tag. For each image the model generates 100 samples, and for each sample it retrieves the top 20 closest vocabulary words by cosine similarity.

The top 10 most common words across all 100 samples form the generated tag set.

The current experiments use each tag on its own rather than as a set. Generating a set of tags jointly is left as a route to better results.

## Generated tags beyond the training labels

Table 2 shows samples only, so the text gives no tagging score for the multi-modal model. For one water and river image, the generated tags include creek and lake, which are not among that image's user tags and annotations. For a food image, the generated tags include cookie and biscuit, which also do not appear in its user tags. This supports the claim that generated tags can go beyond the training labels, but the evidence is these hand-picked samples.

## Limitations

The MNIST result is a proof-of-concept, and the conditional model scores below non-conditional adversarial nets in the paper's own table. The experiments cover only MNIST with class labels and MIR Flickr 25,000 with tag features. Tags are generated one at a time, and generating sets of tags is left for future work.

## Paper info

- **Authors**: Mehdi Mirza, Simon Osindero
- **Venue**: arXiv · Preprint
- **First published**: 2014-11-6
- **Added**: 2026-11-6
- **Updated**: 2014-11-6
- **Version**: v1
- **arXiv**: 1411.1784
- **Category**: cs.LG · cs.AI · cs.CV · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1411.1784v1) · [PDF ↗](https://arxiv.org/pdf/1411.1784v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Mehdi Mirza, Simon Osindero (2014). Conditional Generative Adversarial Nets. arXiv:1411.1784v1. https://arxiv.org/abs/1411.1784v1

**BibTeX**

```
@misc{mirza2014conditional,
  title = {{Conditional Generative Adversarial Nets}},
  author = {Mehdi Mirza and Simon Osindero},
  year = {2014},
  eprint = {1411.1784},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1411.1784v1}
}
```

## Other paper commentary

- [FastComposer: Tuning-Free Multi-Subject Image Generation with Localized Attention](https://refivu.com/en/papers/da96ee97-6c27-4d11-88b7-679762995493-fastcomposer-tuning-free-multi-subject-image-generation-with.md)
- [MagicAnimate: Temporally Consistent Human Image Animation using Diffusion Model](https://refivu.com/en/papers/d7e4c79d-ac46-4e0f-aef6-34e570d43e2f-magicanimate-temporally-consistent-human-image-animation.md)
- [Train for the Worst, Plan for the Best: Understanding Token Ordering in Masked Diffusions](https://refivu.com/en/papers/64d5ed83-79ac-4425-8629-7aff772bd0c4-train-for-the-worst-plan-for-the-best.md)
- [Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow](https://refivu.com/en/papers/a0c4439d-88d7-4d0f-be30-5509d158003e-flow-straight-and-fast-learning-to-generate-and.md)
- [Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding](https://refivu.com/en/papers/eaa0c3ba-e0e4-4517-8ef7-d6ec6ba261b6-photorealistic-text-to-image-diffusion-models-with-deep.md)
- [Consistency Models](https://refivu.com/en/papers/f97e5129-1522-4b93-9b60-0a1f3af22d42-consistency-models.md)
- [Flood forecasting with machine learning models in an operational framework](https://refivu.com/en/papers/8c06bfa1-bf42-4eb0-a60b-e8159e870151-flood-forecasting-with-machine-learning-models-in-an.md)
- [Unsupervised Deep Anomaly Detection for Multi-Sensor Time-Series Signals](https://refivu.com/en/papers/878b018b-6c5e-4a6c-9708-982ce4d20f8a-unsupervised-deep-anomaly-detection-for-multi-sensor-time.md)
- [Adaptive Fourier Neural Operators: Efficient Token Mixers for Transformers](https://refivu.com/en/papers/e1ad5f0d-a89a-4cb3-8342-dd757fe4cb2a-adaptive-fourier-neural-operators-efficient-token-mixers-for.md)
- [GPT Understands, Too](https://refivu.com/en/papers/1bee23a9-1e12-440d-bf82-0263604d14f2-gpt-understands-too.md)
- [Towards Learning Universal, Regional, and Local Hydrological Behaviors via Machine-Learning Applied to Large-Sample Datasets](https://refivu.com/en/papers/c1ee1227-dd45-4aef-9943-a760b7a45dbc-towards-learning-universal-regional-and-local-hydrological.md)
- [YOLOP: You Only Look Once for Panoptic Driving Perception](https://refivu.com/en/papers/61212604-6561-425b-9de1-178543e2926c-yolop-you-only-look-once-for-panoptic-driving.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [dropout](https://refivu.com/en/terms/db73f75bbdd3-dropout)
- [ReLU](https://refivu.com/en/terms/7b22f5612f6c-relu)
- [cosine similarity](https://refivu.com/en/terms/3baa01a8760d-cosine-similarity)
- [generator](https://refivu.com/en/terms/2935313c9c21-generator)
- [discriminator](https://refivu.com/en/terms/4e47ae7741de-discriminator)
- [Skip-gram model](https://refivu.com/en/terms/7d1ed0f9f004-skip-gram-model)
- [Generative Adversarial Nets](https://refivu.com/en/terms/687618214fcf-generative-adversarial-nets)
- [YFCC100M](https://refivu.com/en/terms/c5d4e1980208-yfcc100m)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/d3b21f1b-88e4-4eb8-87c5-4d87d9be7555-conditional-generative-adversarial-nets)
