Generating Diverse Programs with Instruction Conditioned Reinforced Adversarial Learning

Aishwarya Agrawal, Mateusz Malinowski, Felix Hill, S. M. Ali Eslami, Oriol Vinyals, Tejas KulkarniarXiv 2018 · OpenReview

Abstract

Advances in Deep Reinforcement Learning have led to agents that perform well across a variety of sensory-motor domains. In this work, we study the setting in which an agent must learn to generate programs for diverse scenes conditioned on a given symbolic instruction. Final goals are specified to our agent via images of the scenes. A symbolic instruction consistent with the goal images is used as the conditioning input for our policies. Since a single instruction corresponds to a diverse set of different but still consistent end-goal images, the agent needs to learn to generate a distribution over programs given an instruction. We demonstrate that with simple changes to the reinforced adversarial learning objective, we can learn instruction conditioned policies to achieve the corresponding diverse set of goals. Most importantly, our agent's stochastic policy is shown to more accurately capture the diversity in the goal distribution than a fixed pixel-based reward function baseline. We demonstrate the efficacy of our approach on two domains: (1) drawing MNIST digits with a paint software conditioned on instructions and (2) constructing scenes in a 3D editor that satisfies a certain instruction.

Introduction

Creating complex virtual environments for AI training is currently a bottleneck because these worlds are typically hand-designed by humans. While generative models like GANs can create images, many applications require the underlying program or "source code" of a scene to make it useful for simulators.

The core challenge is ambiguity. A single instruction like "Paint a 7" or "Place a cube" corresponds to an infinite number of valid visual outcomes (different styles, colors, or positions). Standard machine learning objectives, such as minimizing the pixel-wise distance (L2 loss) between a generated image and a target, tend to fail here. They often produce a single "average" blurry result or lack the diversity found in the real world. This paper seeks a way to generate a distribution of diverse, instruction-consistent programs.

Methods

The authors extend the Reinforced Adversarial Learning (RAL) framework. The architecture consists of three main components:

  1. The Generator (Policy Network): An LSTM-based recurrent network that takes a symbolic instruction as input. At each timestep, it observes the current state of the canvas/scene and outputs a program command (e.g., a brush stroke or an object placement).
  2. The Renderer: A non-differentiable environment (like a paint library or a 3D editor) that executes the program commands to produce an image. Because this step is non-differentiable, standard backpropagation cannot be used.
  3. The Discriminator: A neural network that looks at an (Instruction, Image) pair and tries to determine if the image is a "real" example from the dataset or a "fake" one produced by the generator.

Instead of a human-defined reward, the Discriminator’s output serves as the reward signal for the Generator. The Generator is trained using Reinforcement Learning (A2C and REINFORCE) to maximize this reward—essentially learning to "fool" the discriminator by creating increasingly realistic and instruction-compliant scenes.

Datasets and Tasks

The model was evaluated on two distinct domains:

  • MNIST Digit Painting: Based on the classic MNIST dataset, but converted into a task where the agent uses the libmypaint library. Instructions follow templates like "Draw [digit]" or "Paint [digit]."
  • 3D Scene Construction: Inspired by the CLEVR dataset. The agent interacts with a 3D editor to place objects (cubes, spheres, cylinders) of various sizes and colors on a grid based on instructions like "There is a small sphere."
Instruction-conditioned 3D scene construction. (a) Single-object scenes for simple instructions. (c) Multi-object scenes where the agent must maintain instruction consistency amidst clutter.

Key Insights

  • Adversarial Rewards > Fixed Rewards: A fixed reward (like L2 distance) forces the agent to converge on a single "safe" output. The adversarial reward is dynamic; it encourages the agent to explore the entire distribution of valid scenes, leading to much higher diversity.
  • Handling Unspecified Attributes: When an instruction is under-specified (e.g., it doesn't mention the color of the sphere), the RAL agent naturally learns to vary those attributes (color, position) across different runs, whereas the baseline fails to follow the instruction or lacks variety.
  • Program-Based Generation: By generating programs rather than raw pixels, the output is inherently structured, interpretable, and compatible with 3D engines and simulators.

Results

The RAL approach was compared against a "Fixed Pixel-based" (L2) baseline:

  • MNIST Painting: The RAL agent achieved a higher Inception Score (1.39 vs. 1.22) and a better FID (259.7 vs. 283.5), indicating higher quality and diversity.
  • 3D Scenes: The RAL agent was significantly more accurate. On a "Correctness" scale (judged by humans), it scored 6.8 vs. 1.4 for the baseline.
  • Diversity: In the 3D domain, the entropy of generated colors was nearly double that of the baseline (1.48 vs. 0.77), proving the agent wasn't just repeating the same "safe" color.
Diverse MNIST digit generation. The agent learns a distribution of painting programs, resulting in varied styles for the same symbolic instruction.

Conclusion

The proposed reinforced adversarial learning framework successfully generates diverse programs conditioned on symbolic instructions. By leveraging a discriminator as a reward signal, the agent learns to capture the inherent ambiguity in human instructions, producing a distribution of valid outputs rather than a single average. Future work will focus on scaling this approach to natural language instructions and more complex, photorealistic environments.

Summary updated

Abstract

Advances in Deep Reinforcement Learning have led to agents that perform well across a variety of sensory-motor domains. In this work, we study the setting in which an agent must learn to generate programs for diverse scenes conditioned on a given symbolic instruction. Final goals are specified to our agent via images of the scenes. A symbolic instruction consistent with the goal images is used as the conditioning input for our policies. Since a single instruction corresponds to a diverse set of different but still consistent end-goal images, the agent needs to learn to generate a distribution over programs given an instruction. We demonstrate that with simple changes to the reinforced adversarial learning objective, we can learn instruction conditioned policies to achieve the corresponding diverse set of goals. Most importantly, our agent's stochastic policy is shown to more accurately capture the diversity in the goal distribution than a fixed pixel-based reward function baseline. We demonstrate the efficacy of our approach on two domains: (1) drawing MNIST digits with a paint software conditioned on instructions and (2) constructing scenes in a 3D editor that satisfies a certain instruction.
BibTeX
@misc{agrawal2018generating,
  author = {Aishwarya Agrawal and Mateusz Malinowski and Felix Hill and S. M. Ali Eslami and Oriol Vinyals and Tejas Kulkarni},
  title = {{Generating Diverse Programs with Instruction Conditioned Reinforced Adversarial Learning}},
  year = {2018},
  eprint = {1812.00898},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.00898},
}
Figure