Neural Program Synthesis Rishabh Singh, Google Brain Great - - PowerPoint PPT Presentation

neural program synthesis
SMART_READER_LITE
LIVE PREVIEW

Neural Program Synthesis Rishabh Singh, Google Brain Great - - PowerPoint PPT Presentation

Neural Program Synthesis Rishabh Singh, Google Brain Great Collaborators! Deep Learning and Evolutionary Progression Vision Perceptual Tasks Speech Language Algorithmic Tasks Programming Neural Program Learning M ore Complex Tasks G


slide-1
SLIDE 1

Neural Program Synthesis

Rishabh Singh, Google Brain

slide-2
SLIDE 2

Great Collaborators!

slide-3
SLIDE 3

Deep Learning and Evolutionary Progression

Vision Speech Language Programming Perceptual Tasks Algorithmic Tasks

slide-4
SLIDE 4

Neural Program Learning More Complex Tasks Generalizability Interpretability

slide-5
SLIDE 5

Long term Vision

Agent to win programming contests

Program Representations Fuzzing/Security Testing Program Repair Program optimization

[T

  • pCoder]
slide-6
SLIDE 6

Neural Program Induction

slide-7
SLIDE 7

Differentiable Neural Computer [Graves et al. Nature 2016]

slide-8
SLIDE 8

Neural RAM [Kurach et al. ICLR 2016]

An LSTM Controller choosing modules and arguments

14 modules

Differentiable Semantics

slide-9
SLIDE 9

Neural Program Induction

Differentiable memory, stack Lots of Examples Single-task learning Non-Interpretable programs Examples: NTM, DNC, etc. Difficult to Generalize

Neural Program Synthesis

Functional Abstractions Lots of Examples Single-task learning Interpretable programs Examples: QuickSort Generalizes Better

Meta- Neural Program Synthesis

Functional Abstractions Few Examples Multi-task learning Interpretable programs Strong Generalization

slide-10
SLIDE 10

Spectrum of Program Meta-Induction

  • J. Devlin, R. Bunel, R. Singh, M. Hausknecht, P

.Kohli [NIPS 2017]

slide-11
SLIDE 11

Neural Program Induction

Differentiable memory, stack Lots of Examples Single-task learning Non-Interpretable programs Examples: NTM, DNC, etc. Difficult to Generalize

Neural Program Synthesis

Functional Abstractions Lots of Examples Single-task learning Interpretable programs Examples: QuickSort Generalizes Better

Meta- Neural Program Synthesis

Functional Abstractions Few Examples Multi-task learning Interpretable programs Strong Generalization

slide-12
SLIDE 12

Neuro-Symbolic Program Synthesis [ICLR 2017]

Emilio Parisotto, Abdelrahman Mohamed, Rishabh Singh, Lihong Li, Dengyong Zhou, Pushmeet Kohli

slide-13
SLIDE 13

FlashFill in Excel 2013

Gulwani, Harris, Singh [CACM Research Highlight 2012]

* Taken from Gulwani, Polozov, Singh NOW 2017
slide-14
SLIDE 14

FlashFill DSL

slide-15
SLIDE 15

Example FlashFill Task

Input (v) Output William Henry Charles Charles, W. Michael Johnson Johnson, M. Barack Rogers Rogers, B. Martha D. Saunders Saunders, M. Concat(f1, ConstStr(“, ”), f2, ConstStr(“.”)) f1 = SubStr(v, (Word,-1,Start), (Word,-1,End)) f2 = SubStr(v, CPos(0), CPos(1))

slide-16
SLIDE 16

General Methodology

DSL

Sampler – Training Data Neural Model

Synthesizer

slide-17
SLIDE 17

Synthetic Training Data

slide-18
SLIDE 18

Real-world Test Data

slide-19
SLIDE 19

Neural Architecture

I/O Encoder

Examples

Tree Decoder

slide-20
SLIDE 20 S -> e + e

CFG/DSL:

S -> e + e e -> x e -> 1 e -> 0 Non-Terminals = {S, e} Terminals = {x, 1, 0, +}

S e e e

S -> e + e S -> e + e a1: S -> e + e a1: e -> x a2: e -> 1 a3: e -> 0 a4: e -> x a5: e -> 1 a6: e -> 0

a1 a5

e -> 1

1

e -> 1

1 x

e -> x

a1

a1: e -> x a2: e -> 1 a3: e -> 0

f(x) = x + 1 + + +

Key Idea: Guided Enumeration

slide-21
SLIDE 21 S -> e + e

Problem

How to assign probabilities to each action ai such that the global tree state is taken into account?

S e e e

S -> e + e S -> e + e a1: S -> e + e a1: e -> x a2: e -> 1 a3: e -> 0 a4: e -> x a5: e -> 1 a6: e -> 0

a1 a5

e -> 1

1

e -> 1

1 x

e -> x

a1

a1: e -> x a2: e -> 1 a3: e -> 0

f(x) = x + 1 + + +

Key Idea: Guided Enumeration

slide-22
SLIDE 22

Neural- Guided Enumeration

f ( ,I-O) =

slide-23
SLIDE 23

Key Challenges

2

Program Representation Example Representation I-O

slide-24
SLIDE 24
  • Recursive-Reverse-Recursive Neural

Network (R3NN)

slide-25
SLIDE 25

Input:

Distributed representations

  • f each leaf’s symbol.

Output:

Global root representation.

Recursive

slide-26
SLIDE 26

Input:

root representation from recursive pass

Output:

Global leaf representations.

Reverse-Recursive

slide-27
SLIDE 27
  • 1. An LSTM produces a vector for each I/O pair.
  • 2. All I/O pair LSTM vectors are combined into a single

conditioning vector c.

  • 3. The R3NN model takes additional input c when generating the

program tree. The whole model is trained end-to-end.

Conditioning on I/O Examples

slide-28
SLIDE 28

Cross-Correlation Encoder

slide-29
SLIDE 29

Synthetic Data Results (< 13 AST)

slide-30
SLIDE 30

FlashFill Benchmarks

Batching Trees for larger programs R3NN for contextual program embeddings

slide-31
SLIDE 31
  • J. Devlin, J. Uesato, S. Bhuptiraju, R. Singh, A. Mohamed, P

. Kohli

RobustFill [ICML 2017]

slide-32
SLIDE 32

Multiple I/O Examples

slide-33
SLIDE 33

Extended DSL

slide-34
SLIDE 34

92% Generalization Accuracy

slide-35
SLIDE 35

Robustness with Noise

slide-36
SLIDE 36

Incorrect Generalization

slide-37
SLIDE 37

Program Induction Model

slide-38
SLIDE 38

Induction vs Synthesis

slide-39
SLIDE 39

Other Synthesis Domains

FlashFill (Functional) More Complex DSLs Karel (Imperative with Control Flow) Python & R Scripts (Stateful Variables) Grammar Learning (CFG s & CSGs) Specification Modalities Natural Language (NL2Excel) Partial Programs (Sketching)

slide-40
SLIDE 40

Karel the Robot

Input Output Program

slide-41
SLIDE 41

Karel DSL

slide-42
SLIDE 42

Synthesis Architecture

CNNs for Encoder, LSTMs for decoder

slide-43
SLIDE 43

Supervised Learning

Top-1 Top-5 Supervised 71.91 80.00

slide-44
SLIDE 44

Multiple Consistent Programs

Input Output

slide-45
SLIDE 45

Reinforcement Learning

Top-1 Top-5 Supervised 71.91 80.00 REINFORCE 71.99 74.11 Beam REINFORCE 77.68 82.73

  • 1. First Supervised Training
  • 2. Sample Program from the model
  • 3. Run the program on I/O
  • 4. Positive Reward if Output matches
slide-46
SLIDE 46

Stanford CS106a Test

7/16 problems = 43% Neural Symbolic

slide-47
SLIDE 47

Neural Program Representations for Software Engineering Applications

slide-48
SLIDE 48

Fuzzing for Security Bugs

Random Mutations

Crash!

Execute Binary Seed Input Coverage guided — AFL

slide-49
SLIDE 49

Neural Grammar-based Fuzzing

Patrice Godefroid, Hila Peleg Rishabh Singh. Learn&Fuzz: Machine Learning for Input Fuzzing. ASE 2017

More coverage, Bugs!

slide-50
SLIDE 50

Learning where to Fuzz

Mohit Rajpal, William Blum, Rishabh Singh. Not all bytes are equal: Neural byte sieve for fuzzing.

Identify useful bytes from past fuzzing

More coverage More crashes

slide-51
SLIDE 51

Neural Program Repair

Sahil Bhatia, Rishabh Singh. Automated Correction for Syntax Errors in Programming Assignments using RNNs.

slide-52
SLIDE 52

Neural Programmer

Natural Language Input/Output Examples Partial Programs

Neural Synthesis [ICLR2017

, ICML2017]

Neural Repair [ICSE2018, ICLRW 2018] Program Induction [NIPS2017] Neural Fuzzing [ASE2017

, arxiv2017] Long T erm Vision: An agent to win programming contests Neural Architectures for Program and Spec Representation Rishabh Singh, rising@google.com

[T

  • pCoder]