Neural Program Synthesis from Diverse Demonstration Videos
1University of Southern California 2Pohang University of Science and Technology
*Equal contribution
Shao-Hua Sun*1 Hyeonwoo Noh*2 Sriram Somasundaram1 Joseph J. Lim1
Neural Program Synthesis from Diverse Demonstration Videos Sriram - - PowerPoint PPT Presentation
Neural Program Synthesis from Diverse Demonstration Videos Sriram Shao-Hua Sun* 1 Hyeonwoo Noh* 2 Joseph J. Lim 1 Somasundaram 1 1 University of Southern California 2 Pohang University of Science and Technology *Equal contribution A program is an
1University of Southern California 2Pohang University of Science and Technology
*Equal contribution
Shao-Hua Sun*1 Hyeonwoo Noh*2 Sriram Somasundaram1 Joseph J. Lim1
Hey, can you…
Motivation
Devlin et al. “Robustfill: Neural program learning under noisy i/o.” ICML 2017 Balog, et al. "Deepcoder: Learning to write programs." ICLR 2017 Rudy R et al. “Leveraging grammar and reinforcement learning for neural program synthesis.” ICLR 2018
Motivation
Devlin et al. “Robustfill: Neural program learning under noisy i/o.” ICML 2017 Balog, et al. "Deepcoder: Learning to write programs." ICLR 2017 Rudy R et al. “Leveraging grammar and reinforcement learning for neural program synthesis.” ICLR 2018
def run() if frontIsClear(): move() else: turnLeft() move() turnLeft repeat(2): turnRight() putMarker()
Motivation
Devlin et al. “Robustfill: Neural program learning under noisy i/o.” ICML 2017 Balog, et al. "Deepcoder: Learning to write programs." ICLR 2017 Rudy R et al. “Leveraging grammar and reinforcement learning for neural program synthesis.” ICLR 2018
def run() if frontIsClear(): move() else: turnLeft() move() turnLeft repeat(2): turnRight() putMarker()
def run() if frontIsClear(): move() else: turnLeft() move() turnLeft repeat(2): turnRight() putMarker()
Program
Input a set of demo videos
Program
Output a program describing the demonstrated behavior Input a set of demo videos
Program
Output a program describing the demonstrated behavior Input a set of demo videos
Challenges
Program
Output a program describing the demonstrated behavior Input a set of demo videos
Challenges
Reviewer module Relation module
Program vector
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program
Relation Module
Extract unique behaviors Demo features
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program
Relation Module
Extract unique behaviors Summarize Demo features Program vector
Demo features
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program Program vector
Relation Module
Extract unique behaviors Summarize Decode
Program vector
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program
Relation Module
Extract unique behaviors Demo features Summarize Decode
Demo1
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
…
Demo1 Encoder
Demo2
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
Encoder
…
Demo1 Demo2
Demok
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
Encoder
…
Demo1 Demo2 Demok
…
Demok
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
Encoder
…
Demo1 Demo2 Demok
…
Overall Tendency
Demo1
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
…
Encoder Demo1 Demo2 Demok
…
Overall Tendency
Review each demo
Reviewer LSTM
Demo1
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
…
Encoder Demo1 Demo2 Demok
…
Overall Tendency Overall Tendency
Reviewer LSTM
Overall Tendency Demo1
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
…
Encoder
Reviewer LSTM
Overall Tendency Demo1
LSTM
t=1 t=2 t=T
…
CNN CNN CNN
…
Encoder
…
Demo feature1
Encoder
Demos
Encoder Encoder
Reviewer Module
Demo features
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program
Relation Module
Extract unique behaviors Summarize Demo features Program vector Decode
if frontIsClear(): move() else: turnLeft()
Demo1 Demo2
…
Reviewer Module
if frontIsClear(): move() else: turnLeft()
Demo1 Demo2
Compare demo pairs to infer branching conditions
…
Reviewer Module
…
Santoro et al. "A simple neural network module for relational reasoning.” NIPS 2017
Demo pairs
…
Reviewer Module
Program vector
…
Santoro et al. "A simple neural network module for relational reasoning.” NIPS 2017
Demo pairs
…
Reviewer Module
Demo features
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program Program vector
Relation Module
Extract unique behaviors Summarize Decode
LSTM def run() move() if <end>
Program vector
Demo features
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program Program vector
Relation Module
Extract unique behaviors Summarize Decode
Richard E Pattis. “Karel the robot: a gentle introduction to the art of programming.” John Wiley & Sons, Inc., 1981
def run() while(inTarget( HellKnight)): attack() moveForward() if isThere(Demon): moveRight() else: moveLeft() moveBackward() def run() if frontIsClear(): move() else: turnLeft() move() turnLeft repeat(2): turnRight() putMarker()
Kempka et al., “Vizdoom: A doom-based ai research platform for visual reinforcement learning.” In CIG, 2016
Decoder Encoder
Program
Encoder Encoder
Average vector Demos
Without reviewer and relation modules
Decoder
A testing demo frame
Encoder
Input Demos
Encoder Encoder
Average vector
State s Action a
move()
Evaluation Metrics
def run(): if frontIsClear(): move() else: turnLeft() move() repeat(2): turnRight() putMarker()
Ground truth
def run(): move() move() turnRight() putMarker() turnRight() putMarker()
Synthesis baseline
Evaluation Metrics
def run(): if frontIsClear(): move() else: turnLeft() move() turnRight() putMarker() turnRight() putMarker()
Ours
def run(): if frontIsClear(): move() else: turnLeft() move() repeat(2): turnRight() putMarker()
Ground truth
def run(): move() move() turnRight() putMarker() turnRight() putMarker()
Synthesis baseline
Evaluation Metrics
def run(): if inTarget(Demon): attack() moveLeft() else: moveRight() if isThere(Demon): attack() moveLeft()
Ground truth
def run(): while(inTarget( HellKnight)): attack() if isThere(Demon): moveRight() attack() else: moveLeft()
Synthesis baseline
Evaluation Metrics
def run(): if inTarget(Demon): attack() moveLeft() else: moveRight() if isThere(Demon): attack() moveLeft()
Ours Ground truth Synthesis baseline
def run(): if inTarget(Demon): attack() moveLeft() else: moveRight() if isThere(Demon): attack() moveLeft() def run(): while(inTarget( HellKnight)): attack() if isThere(Demon): moveRight() attack() else: moveLeft()
Environments and Results
Evaluation Metrics
def run(): if A(): x() else: while(B()): y() z() def run(): if A(): x() else: repeat(5): y() z()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if not A(): y() else: x()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if A(): x() else: y()
Synthesized program Ground truth program
Evaluation Metrics
def run(): if A(): x() else: while(B()): y() z() def run(): if A(): x() else: repeat(5): y() z()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if not A(): y() else: x()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if A(): x() else: y()
Synthesized program Ground truth program
def run(): if A(): x() else: while(B()): y() z() def run(): if A(): x() else: repeat(5): y() z()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if not A(): y() else: x()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if A(): x() else: y()
Synthesized program Ground truth program
Evaluation Metrics
Program aliasing
Different codes with identical program semantics
Evaluation Metrics
def run(): if A(): x() else: while(B()): y() z() def run(): if A(): x() else: repeat(5): y() z()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if not A(): y() else: x()
Synthesized program Ground truth program
def run(): if A(): x() else: y() def run(): if A(): x() else: y()
Synthesized program Ground truth program
25% 30% 35% 40% 45% 50% 55%
Sequence Accuracy Program Accuracy
48.9 41.0 42.4 35.7
Synthesis baseline Ours-full
Environments and Results
30% 40% 50% 60% 70% 80%
Karel ViZDoom
78.4 72.1 48.2 64.1 35.1 62.8
Induction baseline Synthesis baseline Ours (with the reviewer and relation modules)
30% 40% 50% 60% 70% 80%
Karel ViZDoom
78.4 72.1 48.2 64.1 35.1 62.8
Induction baseline Synthesis baseline Ours (with the reviewer and relation modules)
30% 40% 50% 60% 70% 80%
Karel ViZDoom
78.4 72.1 48.2 64.1 35.1 62.8
Induction baseline Synthesis baseline Ours (with the reviewer and relation modules)
30% 40% 50% 60% 70% 80%
Karel ViZDoom
78.4 72.1 48.2 64.1 35.1 62.8
Induction baseline Synthesis baseline Ours (with the reviewer and relation modules)
Environments and Results
Environments and Results
0.1 0.3 0.5 0.7 0.9 5 10 15 20 25 30 35 40
Inudction baseline Synthesis baseline Ours (with the reviewer and relation module)
Execution Accuracy Number of input demos
Environments and Results
Each program: single if-else statement with two branching consequences
Environments and Results
20% 30% 40% 50% 60% 70% 80% 90%
Sequence Accuracy Program Accuracy Execution Accuracy
89.4 69.1 58.8 59.9 44.4 36.1 26.5
Inudction baseline Synthesis baseline Ours-full
Environments and Results
def run() if frontIsClear(): move() else: turnLeft() move() turnLeft repeat(2): turnRight() putMarker()
Demo features
Encoder
Demos
Encoder Encoder
Reviewer Module
Decoder
Program Program vector
Relation Module
Extract unique behaviors Summarize Decode