learning to infer program sketches
play

Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh - PowerPoint PPT Presentation

Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Goal: We want to automatically write code from the kinds of specifications humans can easily provide, such as examples or natural language


  1. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Goal: We want to automatically write code from the kinds of specifications humans can easily provide, such as examples or natural language instruction. List Processing from IO: Text Editing from IO: Natural language + IO → code [1, 2, 3, 4, 5] → [2, 4] Max Nye → Nye, M. “Consider an array of numbers, [7, 8, 0, 9] → [8, 0] Luke Hewitt → Hewitt, L. find elements in the given array not divisible by two” [1, 2, 3, 4, 5] → [1, 3, 5] [7, 8, 0, 9] → [7, 9]

  2. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Given: Goal: Write a program [1, 2, 3, 4, 5] → [2, 4] which maps inputs to [0, 6, 2, 7] → [0, 6, 2] outputs [5, 10, 5, 1, 8] → [10, 8] How might people solve problems like this?

  3. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Given: Goal: Write a program [1, 2, 3, 4, 5] → [2, 4] which maps inputs to [0, 6, 2, 7] → [0, 6, 2] outputs [5, 10, 5, 1, 8] → [10, 8] How might people solve problems like this? People use a flexible trade-off between pattern recognition and reasoning

  4. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Easy problem: Spec: [1, 2, 3, 4, 5] → [2, 4] [0, 6, 2, 7] → [0, 6, 2] [5, 10, 5, 1, 8] → [10, 8] Solution:

  5. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Easy problem: Spec: [1, 2, 3, 4, 5] → [2, 4] [0, 6, 2, 7] → [0, 6, 2] [5, 10, 5, 1, 8] → [10, 8] Solution: filter(lambda x: x%2==0, input)

  6. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Easy problem: Spec: [1, 2, 3, 4, 5] → [2, 4] [0, 6, 2, 7] → [0, 6, 2] [5, 10, 5, 1, 8] → [10, 8] Solution: filter(lambda x: x%2==0, input) Fast, using pattern recognition

  7. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama More difficult problem: Spec: [3, 4, 5, 6, 7] → [4, 7] [10, 8, 7, 3, 2, 1] → [10, 7, 1] [5, 1, 2, 13, 4] → [1, 13, 4] Solution:

  8. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama More difficult problem: Spec: [3, 4, 5, 6, 7] → [4, 7] [10, 8, 7, 3, 2, 1] → [10, 7, 1] [5, 1, 2, 13, 4] → [1, 13, 4] Solution: filter(<SOMETHING>, input) (Fast, using pattern recognition)

  9. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama More difficult problem: Spec: [3, 4, 5, 6, 7] → [4, 7] [10, 8, 7, 3, 2, 1] → [10, 7, 1] [5, 1, 2, 13, 4] → [1, 13, 4] Solution: filter(<SOMETHING>, input) filter(lambda x: x%3==1, Symbolic reasoning input) (Fast, using pattern recognition)

  10. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama More difficult problem: Spec: [3, 4, 5, 6, 7] → [4, 7] [10, 8, 7, 3, 2, 1] → [10, 7, 1] [5, 1, 2, 13, 4] → [1, 13, 4] Solution: filter(<SOMETHING>, input) filter(lambda x: x%3==1, Symbolic reasoning input) (Fast, using pattern recognition) (Slow)

  11. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Very difficult problem: Spec: [2, 5, 0, 16, 12] → 0 [4, 23, 11, 9, 25] → 25 [3, 29, 30, 14, 16] → 14

  12. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Very difficult problem: Spec: [2, 5, 0, 16, 12] → 0 [4, 23, 11, 9, 25] → 25 [3, 29, 30, 14, 16] → 14 [1, 7, 6, 9, 5] → 7 [5, 5, 1, 8, 8, 12, 4] → 12 [0, 4, 8, 5, 1] → 0 [3, 7, 2, 9, 1] → 9 [1, 0, 3, 7, 3, 8] → 0

  13. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Very difficult problem: Spec: [2, 5, 0, 16, 12] → 0 [4, 23, 11, 9, 25] → 25 [3, 29, 30, 14, 16] → 14 Solution: <SOMETHING> input[input[0]] Symbolic reasoning (Slow)

  14. Q: How do we model this? A: Program sketches filter( [3, 4, 5, 6, 7] Pattern filter(<HOLE>, Symbolic → [4, 7] lambda x: recognition reasoning [10, 8, 7, 3, 2, 1] input) x%3==1, → [10, 7, 1] (e.g., neural network) (e.g., guess and check) input) Program sketch (program specification) Full program Flexible trade-off between pattern recognition and reasoning Solar-Lezama et al, 2008, Murali et al, 2017

  15. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Our system: SketchAdapt Learned neural network ... .25 .05 .02 .03 .25 .30 Neural Production probabilities recognizer Neural [3, 4, 5, 6, 7] → [4, 7] Symbolic sketch filter(lambda x: [10, 8, 7, 1] → [10, 7, 1] filter(<HOLE>, input) enumerator generator [5, 1, 13, 4] → [1, 13, 4] x%3==1, input) Program specification Program sketch Full program

  16. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Our system: SketchAdapt Learned neural network ... .25 .05 .02 .03 .25 .30 Neural Production probabilities recognizer Neural [3, 4, 5, 6, 7] → [4, 7] Symbolic sketch filter(lambda x: [10, 8, 7, 1] → [10, 7, 1] filter(<HOLE>, input) enumerator generator [5, 1, 13, 4] → [1, 13, 4] x%3==1, input) Program specification Program sketch Full program Sketch generator: RNN that proposes program sketches (c.f. RobustFill) Devlin et al, 2017 Balog et al, 2016

  17. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Our system: SketchAdapt Learned neural network ... .25 .05 .02 .03 .25 .30 Neural Production probabilities recognizer Neural [3, 4, 5, 6, 7] → [4, 7] Symbolic sketch filter(lambda x: [10, 8, 7, 1] → [10, 7, 1] filter(<HOLE>, input) enumerator generator [5, 1, 13, 4] → [1, 13, 4] x%3==1, input) Program specification Program sketch Full program Sketch generator: Symbolic synthesizer: RNN that proposes enumerator that fills in program sketches sketches, guided by (c.f. RobustFill) neural recognizer Devlin et al, 2017 (c.f DeepCoder) Balog et al, 2016

  18. Ours Pattern recognition only (neural network) Results: list processing Reasoning only (symbolic enumeration) SketchAdapt can recognize familiar problems and generalize to unfamiliar problems Trained on length 3 programs SketchAdapt Length 3 test programs: List Processing: length 3 test programs 100 % of problems solved 80 60 40 20 SketchAdapt (ours) Synthesizer only (Deepcoder) Generator only (RobustFill) 0 10 1 10 2 10 3 10 4 10 5 Number of candidates evaluated per problem

  19. Ours Pattern recognition only (neural network) Results: list processing Reasoning only (symbolic enumeration) SketchAdapt can recognize familiar problems and generalize to unfamiliar problems Trained on length 3 programs SketchAdapt Length 3 test programs: Length 4 test programs: List Processing: length 3 test programs List Processing: length 4 test programs 100 SketchAdapt (ours) Synthesizer only (Deepcoder) 50 Generator only (RobustFill) % of problems solved % of problems solved 80 SketchAdapt 40 60 30 40 20 20 10 SketchAdapt (ours) Synthesizer only (Deepcoder) Generator only (RobustFill) 0 0 10 1 10 2 10 3 10 4 10 5 10 1 10 2 10 3 10 4 10 5 Number of candidates evaluated per problem Number of candidates evaluated per problem

  20. Natural language + IO examples → Code

  21. Natural language + IO examples → Code Requires less data than pure neural approaches: AOgROisS 100 2ur mRGeO % Rf test SrRgrDms sROveG GenerDtRr RnOy (RRbust)iOO) 80 6ynthesizer RnOy (DeeSFRGer) 60 40 SketchAdapt 20 0 2000 4000 6000 8000 79214 (fuOO GDtDset) 1umber Rf trDining SrRgrDms useG

  22. Natural language + IO examples → Code Requires less data than pure neural approaches: Generalizes to unseen concepts: AOgROisS 100 2ur mRGeO % Rf test SrRgrDms sROveG GenerDtRr RnOy (RRbust)iOO) 80 6ynthesizer RnOy (DeeSFRGer) 60 40 SketchAdapt 20 0 2000 4000 6000 8000 79214 (fuOO GDtDset) 1umber Rf trDining SrRgrDms useG

  23. Learning to Infer Program Sketches Maxwell Nye, Luke Hewitt, Josh Tenenbaum, Armando Solar-Lezama Come see our poster: Today (Thurs) 06:30 - 09:00 PM @ Pacific Ballroom #182 input head tail sum +1 -1 .25 .03 .02 .06 .40 .05 ... [1, 3, -4, 3]-> 3 [-3, 0, 2, -1]-> 2 Count >0 (Map (HOLE) ) Count >0 (Map +1 input) [7,-4,-5, 2]-> 2

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend