SELF-PROGRAMMING ARTIFICIAL
INTELLIGENCE
C O M P U T E R P R O G R A M S T H A T W R I T E T H E I R O W N P R O G R A M S
#GHC18
Kory Becker | @primaryobjects
PAGE 2 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
Software Developer at Bloomberg
Author of "Building Voice-Enabled Apps with
Alexa," 2017 Bleeding Edge Press
Web Apps, Artificial Intelligence, Data Science
2
HELLO WORLD, KORY BECKER
#GHC18
PAGE 3 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 3
INFINITE MONKEY THEOREM
#GHC18
Profit!
PAGE 4 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
Automatically construct a computer
program that satisfies a specific goal
Genetic Algorithms
Evolutionary Computation
4
PROGRAM SYNTHESIS
#GHC18
PAGE 5 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
Turing complete
8 instructions, 1 byte each: > < + - . , [ ]
Easy to build an interpreter and expand
5
WRITING CODE
#GHC18
PAGE 6 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
Genome encoded as array of doubles
Fitness based upon program output
Roulette selection, crossover, mutation
6
GENERATING PROGRAMS
#GHC18
PAGE 7 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 7
CONSTRUCTING A GENOME
#GHC18
0.1 0.6 0.3 0.6 0.7 0.2 0.0 0.9 0.1 0.2
[ + - + , ] . > [ ]
PAGE 8 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 8
CROSSOVER & MUTATION
#GHC18
[ + - + , > > < . .
[ + - + , ] . > [ ]
0.9 0.8
PAGE 9 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 9
THE STRONG SURVIVE
#GHC18
, ] + > ] < . . - ]
, [ + > ] < . . - +
This program prints 2 characters from input
Results?
#GHC18
reversing a string
addition
subtraction user input
fibonacci
bottles of beer
multiplication
hello world
PAGE 11 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 11
GENERATED IN 1 MINUTE
#GHC18
PAGE 12 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 12
GENERATED IN 29 MINUTES
#GHC18
PAGE 13 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 13
GENERATED IN 30 MINUTES
#GHC18
PAGE 14 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 14
GENERATED IN 10 HOURS
#GHC18
PAGE 15 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 15
GENERATED IN 33 MINUTES
#GHC18
PAGE 16 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
+-+-+>-<[++++>+++++<+<>++]
>[-[---.--[[-.++++[+++..].]]]]
16
GENERATED IN 29 MINUTES
#GHC18
“hello”
PAGE 17 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
,>,-[-<+>]<+.
17
GENERATED IN 45 MINUTES
#GHC18
Addition
PAGE 18 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
,>,$[!>--$<<a>>]4]+,,-[-<+>]<+.$@
18
GENERATED IN 7 HOURS
#GHC18
Fibonacci
PAGE 19 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
Expand instruction set
Sub-modules to compose larger programs
Developers design. Computers write code.
19
FUTURE
#GHC18
PAGE 20 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 20
GENERATED IN 16 MINUTES
#GHC18
PAGE 21 | GRACE HOPPER CELEBRATION 2018
PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY
Using Artificial Intelligence to Write
Self-Modifying/Improving Programs
http://primaryobjects.com/cms/article149
21
CONCLUSION
#GHC18
http://linkedin.com/in/korybecker
Kory Becker, 2018
@primaryobjects

Self-Programming Artificial Intelligence Grace Hopper GHC 2018 GHC18

  • 1.
    SELF-PROGRAMMING ARTIFICIAL INTELLIGENCE C OM P U T E R P R O G R A M S T H A T W R I T E T H E I R O W N P R O G R A M S #GHC18 Kory Becker | @primaryobjects
  • 2.
    PAGE 2 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY Software Developer at Bloomberg Author of "Building Voice-Enabled Apps with Alexa," 2017 Bleeding Edge Press Web Apps, Artificial Intelligence, Data Science 2 HELLO WORLD, KORY BECKER #GHC18
  • 3.
    PAGE 3 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 3 INFINITE MONKEY THEOREM #GHC18 Profit!
  • 4.
    PAGE 4 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY Automatically construct a computer program that satisfies a specific goal Genetic Algorithms Evolutionary Computation 4 PROGRAM SYNTHESIS #GHC18
  • 5.
    PAGE 5 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY Turing complete 8 instructions, 1 byte each: > < + - . , [ ] Easy to build an interpreter and expand 5 WRITING CODE #GHC18
  • 6.
    PAGE 6 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY Genome encoded as array of doubles Fitness based upon program output Roulette selection, crossover, mutation 6 GENERATING PROGRAMS #GHC18
  • 7.
    PAGE 7 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 7 CONSTRUCTING A GENOME #GHC18 0.1 0.6 0.3 0.6 0.7 0.2 0.0 0.9 0.1 0.2 [ + - + , ] . > [ ]
  • 8.
    PAGE 8 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 8 CROSSOVER & MUTATION #GHC18 [ + - + , > > < . . [ + - + , ] . > [ ] 0.9 0.8
  • 9.
    PAGE 9 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 9 THE STRONG SURVIVE #GHC18 , ] + > ] < . . - ] , [ + > ] < . . - + This program prints 2 characters from input
  • 10.
    Results? #GHC18 reversing a string addition subtractionuser input fibonacci bottles of beer multiplication hello world
  • 11.
    PAGE 11 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 11 GENERATED IN 1 MINUTE #GHC18
  • 12.
    PAGE 12 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 12 GENERATED IN 29 MINUTES #GHC18
  • 13.
    PAGE 13 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 13 GENERATED IN 30 MINUTES #GHC18
  • 14.
    PAGE 14 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 14 GENERATED IN 10 HOURS #GHC18
  • 15.
    PAGE 15 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 15 GENERATED IN 33 MINUTES #GHC18
  • 16.
    PAGE 16 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY +-+-+>-<[++++>+++++<+<>++] >[-[---.--[[-.++++[+++..].]]]] 16 GENERATED IN 29 MINUTES #GHC18 “hello”
  • 17.
    PAGE 17 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY ,>,-[-<+>]<+. 17 GENERATED IN 45 MINUTES #GHC18 Addition
  • 18.
    PAGE 18 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY ,>,$[!>--$<<a>>]4]+,,-[-<+>]<+.$@ 18 GENERATED IN 7 HOURS #GHC18 Fibonacci
  • 19.
    PAGE 19 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY Expand instruction set Sub-modules to compose larger programs Developers design. Computers write code. 19 FUTURE #GHC18
  • 20.
    PAGE 20 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY 20 GENERATED IN 16 MINUTES #GHC18
  • 21.
    PAGE 21 |GRACE HOPPER CELEBRATION 2018 PRESENTED BY ANITAB.ORG AND THE ASSOCIATION FOR COMPUTING MACHINERY Using Artificial Intelligence to Write Self-Modifying/Improving Programs http://primaryobjects.com/cms/article149 21 CONCLUSION #GHC18 http://linkedin.com/in/korybecker Kory Becker, 2018 @primaryobjects

Editor's Notes

  • #2 Hi everyone! I'm really excited to be presenting one of my favorite AI topics on self-programming artificial intelligence. I'd like to start this off with a simple question. Is it possible for a computer program to write its own programs?
  • #3 Before I get started, let me quickly introduce myself. My name is Kory Becker. I'm a software developer at Bloomberg. I design web applications and web services, although my core interest in computing has always been artificial intelligence and data science. I'm also the author of the book, "Building Voice-Enabled Apps with Alexa" http://shop.oreilly.com/product/9781939902443.do, which is my first published book. The book talks all about how to create software for the Amazon Echo. It’s really interesting as the book also goes into the history behind chat bots and conversational UI, starting from some of the earliest examples of chat bots. For example, is anyone familiar with ELIZA the chat bot? ELIZA was a chat bot developed in the 1960’s as a psychoanalyst. It was one of the first chat bots where people actually believed they were talking to a human, rather than a computer. You can check out the book on Amazon or Safari Books. Now to start this off, I consider myself an AI enthusiast. I’ve always been fascinated with artificial intelligence, especially the idea of a computer program being able to create its own computer programs. Now, many of us in this room are in the computer science industry working as software developers or programmers, and you might be thinking, could something like this put me out of a job? Well, that might not necessarily be the case as I’ll discuss later in this presentation. Now, one of the techniques I’ve experimented with that has yielded some amazing results is with genetic algorithms.
  • #4 Genetic algorithms are a branch of AI that deal with simulating evolution among thousands of different genomes to produce the best offspring, most fit to solve a particular task. In the case of self-programming AI, this task is writing its own computer programs! I like to compare the overall idea to the Infinite Monkey Theorem. The idea is that if you have a hundred monkeys banging on a hundred typewriters, given enough time, they'll produce a written work by Shakespeare. I know this seems crazy, but consider it. The monkeys are hitting random keys, of course. However, at some point in an infinite time space, they'll manage to randomly type a real word. Perhaps, a real sentence. And at some point in infinite time, a complete book! Now, consider this difference. What if you gave a banana to the monkeys each time they typed a correct key? Perhaps, you could guide the random key banging into a more structured approach, effectively training the monkeys to write out a work by Shakespeare. This is exactly the idea behind program synthesis.
  • #5 Program synthesis is simply computer programs that can automatically generate their own computer programs for a specific goal. Since the very beginnings of artificial intelligence, this problem has been considered by some to be the holy grail of computer science. Just imagine the capabilities that computers could have if they could write their own programs. It’s an incredible idea that could revolutionize the way computers are used. Program synthesis can be done in different ways, such as neural networks, deep learning, abstract syntax trees, and as we're about to see, genetic algorithms.
  • #6 In the case of using genetic algorithms for an AI to write its own computer programs, a programming language that is easy enough for the AI to manipulate is required. The selected programming language is a very strange and esoteric one. It's very difficult for humans to understand and use. However, it's simple nature makes it perfect for a self-programming AI. First, the programming language is Turing complete. This means that it's theoretically capable of solving any computational problem in the universe. That means, the AI would be theoretically capable of writing its own computer programs for any problem in the universe. Next, it consists of just 8 instructions. This makes it easy for a genetic algorithm to manipulate, as the number of possible instructions are kept to a minimum. Third, it's easy to build an interpreter for and to expand upon. https://goo.gl/GnzaQe
  • #7 To generate a program, we first create a genome. The genome is encoded as an array of doubles (or floating point values). Each value corresponds to a programming instruction in the language. The genomes are converted to a program, executed, and their fitness is ranked according to the output of each program. The closer a generated program comes to solving the task, the more likely it is to continue to the next generation. At each generation epoch, we use roulette selection, crossover, and mutation to create child programs that are slightly different (and hopefully better!) than their parents.
  • #8 Here is an example of constructing a genome from an array of doubles. Notice how each value maps to a specific instruction in the programming language. Initially, these values are all random and the programs won't do much except throw errors and fail. Most likely immediately. However, one or two are bound to run and do, at least, something! It's these that move on to produce offspring with code that gets better and better.
  • #9 To create offspring, a parent genome contributes part of its genome to the child. This is called crossover, and you can see it in action in the slide above. We can also randomly apply a little mutation, which slightly modifies the value of a particular gene, resulting in a change to the resulting programming instruction. These changes copy forward potentially beneficial parts of the parent and mutate certain instructions, which may or may not, end up making the child programs more fit.
  • #10 Finally, the resulting programs that are generated get ranked according to how well they’ve performed. You can see in this slide how the top program fails, and is removed from the pool of genomes. However, the bottom program succeeded and is carried forward to produce child programs. It just so happens, the bottom program is a valid running program that takes 1 byte for input, increments it, and prints it out twice.
  • #11 Now that we're all experts on genetic algorithms and evolutionary computational AI, let's see what the project has produced. The AI has been able to successfully generate programs for "hello world", reversing a string, addition, subtraction, multiplication, reading input from the user, if/then conditions, printing the fibonacci sequence, and even writing a program to output the "Bottles of Beer on the Wall" song!
  • #20 It's pretty amazing how the AI was able to produce these programs, and more! There is certainly some potential in what could be done. I've been writing software for many years and I've always felt that it's just something that humans shouldn't be doing. Humans should be designing the programs. Computers should be writing the code. Consider a future where humans create building blocks of program designs. They give these designs to the computer, which then writes the programs to make these building blocks real software. The human then designs a higher level problem, where the computer can then utilize the building blocks as sub-modules to create even more complex programs, generating software for web applications, databases, games, and much more.
  • #22 If you'd like to learn more about my self-programming AI research, check out my blog at http://primaryobjects.com/cms/article149. I have a full write-up of the details behind the AI, example programs that it's successfully produced, and ideas towards future work. It's really fascinating stuff! Also, be sure to check out my book, "Building Voice-Enabled Apps for Alexa" on Safari Books. Thank you!