Keynote: Writing Code? Pfft... Evolve it Instead!

This video features Emma Gordon at DjangoCon Europe 2018 in Heidelberg, Germany.

Keynote: Writing Code? Pfft... Evolve it Instead!
0:45:06
Published May 23, 2018
603 views

https://media.ccc.de/v/hd-134-keynote-writing-code-pfft-evolve-it-instead-

We’re heading into a future of delivery drones, driverless cars and 3D-printed “hoverboards” …

With machines now able to perform many tasks better than humans, some people are going to be out of a job.

But not software developers, right?! Could a computer generate the code you currently write for a living?

In this talk, we’ll take a look at how technology is changing the work that people do, and think about the implications of that for our society. We'll then take a look at one of the many biologically inspired approaches to AI - Genetic Algorithms, and how they can be used to generate code given a description of the function that that code should perform, rather than having a software developer write it.

Spoiler - you’re probably not out of a job, yet…

Emma Gordon

Summary

Emma Gordon argues that software and other forms of skilled work should be understood as evolving rather than simply being replaced by machines. She explains genetic algorithms by showing how random strings, and then Brainfuck programs, can be selected, crossed over, and mutated toward a desired result, while noting the practical limits of evolving useful code. Using examples including Watson, automated checkouts, self-driving vehicles, elevator operators, and the Luddites, she argues that automation affects individual tasks differently: repetitive tasks are easier to replace, while work involving uncertainty, empathy, creativity, and human interaction is harder. The consequences may include higher productivity and new jobs, but also wage pressure, unemployment, inequality, retraining needs, and changes to education and social policy such as universal basic income.

Key takeaways

  • Genetic algorithms evolve solutions through fitness scoring, selection, crossover, and mutation, and can be applied to programs as well as strings.
  • Programming languages used for code evolution need to produce valid, executable programs; Brainfuck provides a simple, Turing-complete example.
  • A job’s susceptibility to automation depends on its component tasks, with repetitive and predictable work easier to automate than work involving uncertainty, empathy, or creativity.
  • Automation can partially replace workers and increase productivity, or fully replace particular roles, with different effects on wages and employment.
  • Historical examples such as weaving machines and elevator operators show that technological change can create benefits while also reducing skill requirements and wages.
  • Society may need new approaches to lifelong education, retraining, and income support as current jobs change or disappear.

Summarised automatically from the transcript.

Chapters

  1. 0:00 Introduction to Evolving Code Emma Gordon introduces the idea of evolving software and considers how technological change has transformed human work.
  2. 3:15 Automation of Skilled Work Examples including IBM Watson show how machines are beginning to perform tasks associated with doctors, lawyers, and teachers.
  3. 7:56 Genetic Algorithms The talk explains guided random search, natural selection, fitness scores, crossover, and mutation.
  4. 13:20 Evolving Strings A simple genetic algorithm evolves random strings toward the title of the talk.
  5. 15:41 Turing Completeness The talk introduces Turing machines and explains why an evolving language must be Turing complete.
  6. 17:17 Brainfuck as an Evolutionary Language Brainfuck is presented as a tiny, syntactically simple language suitable for evolving code.
  7. 19:44 Program-Evolution Challenges A live demonstration highlights invalid programs, infinite loops, memory limits, selection strategies, and mutation techniques.
  8. 25:09 Automation and Software Careers Predictions about automation are compared for computer programmers and software developers, with attention to the tasks each role contains.
  9. 28:40 Lessons from Industrial Automation The talk examines which tasks are easy or difficult to automate and revisits historical examples such as elevator operators and the Luddites.
  10. 35:32 Social Responses to Automation Different optimistic and pessimistic forecasts lead into questions about universal basic income, education, retraining, and inequality.

Transcript

8,082 words · auto-generated Show

Automatically transcribed, so expect mistakes in names and technical terms.

0:08

Speaker 1: So hi everyone. Thank you for coming to my talk. I know it's the first of the day. I'm going to be talking about evolving code and more generally about how technology is changing the type of work we do and what that might mean for us, both as individuals and as a society at large. So briefly then, who am I? So my name's Emma. I am a senior software engineer and team lead at a company called CMR Surgical. We're developing a next generation platform for surgical robotics, trying to make keyhole surgery more universally accessible and available to all. That's not actually to do with the talk, although I'm going to talk about robots a lot. I actually first gave this talk before I even started working here. So where does the talk come from?

0:53

Speaker 1: So there is uh a local developer group uh where I live called the Cambridge Programmer Study Group where we meet up and we uh study topics in computer science together. And a couple of years ago uh we were looking at machine learning And we studied a range of different um techniques, uh, one of which was uh genetic algorithms, which I'm going to talk about a little bit more in a bit. Um but basically I ended up using these to uh evolve some code So you provide a description of what you'd like your program to do and you go away and you generate that code rather than have to have a human write it. Um so that was really cool was my first impression of having achieved that. Um it was awesome. Um my second impression was Ah, uh, what have I just done for my job security? Um I make a living from writing software, as I'm sure many of you do.

1:41

Speaker 1: Uh it allows me to do useful things like pay my rent or buy food to eat. uh what's it gonna mean for me if a computer can just go away and write that code and I'm not needed. Um because if we think about it um over the course of human history uh Our lives have massively changed and the type of work that we do has drastically changed through uh advances in technology. So it used to be that most people uh worked at agriculture We were out in fields sowing seeds, harvesting crops. It was a pretty full-time job to ensure that we all had enough food to eat. But then we invented tools. We we increasingly automated uh aspects of that work and eventually ended up with things like this. Um now a single human can go away and produce a vast amount of food, not just for themselves. And it frees the rest of us up to specialise in other areas.

2:29

Speaker 1: So it's quite useful that it means that some people can go and build bridges or be doctors. More recently though, perhaps some of the changes in technology have been slightly more controversial in terms of displacing people from jobs. So you used to say walk into a supermarket and uh there were people at the checkouts, or you went to an airport and there were there were people checking you in. Uh now you're equally likely to walk in and see uh see a line of these But you might think, okay, but that's quite sort of repetitive tasks, so repeatedly scanning barcodes, that sort of stuff. Sort of more in-depth, involved skilled work. that that won't be as easy to automate. But actually what we're seeing is increasingly those sort of tasks are coming into the firing line as well.

3:15

Speaker 1: So if we look back a few years then, IBM created this. This is Watson, IBM's supercomputer. They originally created this to compete at a US quiz show called Jeopardy. which if you haven't heard of it uh is sort of the the inverse of a normal quiz. So rather than asking people questions and expecting them to know the answers, you tell them the answer and you ask them what was the question. So to succeed at that you need to be able to do a few different things. First of all, you need to understand words that are said to you. You need to be able to understand they're not just individual words, but they they go together to make a phrase or a sentence and be able to understand that uh put things in context. You need to have some general knowledge to draw on to come up with what what the question might have been.

4:01

Speaker 1: You need to be able to maybe make jumps between concepts or think laterally about things and maybe abstractly to And these are all the sorts of things that we might think that humans would be better at than a machine. But sure enough, uh IBM managed to get Watson to a level where it could not only successfully compete at Jeopardy, but it was beating not just humans, but human champions. And how they did that was a mixture of some natural language processing so that they it would understand the questions posed to it. A huge database populated with a vast amount of data parsed and collected from the internet. some data mining so that they could efficiently get to the bits of information they wanted. And some machine learning to sort of iteratively train this so it came up with better and better solutions until it was

4:49

Speaker 1: the finished product. What makes Watson particularly interesting to me is not the fact that it was able to win at a quiz show called Jeopardy. Because that's sort of old news at this point. We're used to seeing a machine has beat humans at chess, a machine has beat humans at Go. What makes this interesting to me is the applications that they've put it to since So there's lots of real-world problems where you've got a lot of data and you need to go and parse it to come up with some some some thing that you're interested in. So one example of that and where Watson has been used is diagnostic medicine. So there you have a huge volume of data. You've got all of your existing medical knowledge, so the kinds of things you might find in these massive medical textbooks that only cover the very basics.

5:37

Speaker 1: You've got new journal articles being published all the time or research papers, new clinical start trials and studies being published all the time. You have records for an individual patient, their medical history, perhaps the history of their immediate family, or likely sort of statistical outcomes for people from a similar demographic group. This is a huge amount of data that a human doctor can't possibly hope to keep up with. At best, maybe they read a journal paper or two a week alongside their job, and they've certainly forgotten the one that they read ten years ago Whereas Watson can keep up with this data and it doesn't forget things once it's learned them. And that means that it can potentially come up with a more accurate diagnosis, particularly for a rare condition that a doctor may not have ever seen before.

6:24

Speaker 1: in their career. So doctors then, highly skilled professionals, potentially at least some aspect of their work, this now can do better. And there are other areas as well. So legal work, again, huge volumes of data, times and times of law, lots of documents relating to the individual or the case. evidence from sort of uh previous previous cases and precedents have been set, sort of loopholes to be analyzed. Um preparing some casework for a trial or or some legal advice to give to someone is a very time consuming process and that makes it quite expensive. Whereas what IBM have been able to do with Watson is use it to provide a sort of legal advice as a service where Watson's sitting there at the back end And you have uh an internet chatbot out front for the user to interact with.

7:11

Speaker 1: And this has enabled people who otherwise wouldn't be able to afford legal advice to get some sort of quick advice on what they want. Now that's probably not going to replace lawyers. It's not going to be that tailored to them. But it's certainly doing some aspects of that job. You might use it say in the classroom. With its natural language pressing ability, it can understand a question that a student asks and come back to them with the answer. if you you're struggling to recruit enough teachers and this is a way of of kind of improving that sort of teacher to student ratio and getting more individual attention So doctors, lawyers, teachers, um, people we think of as very highly skilled professionals then, uh now with some at least some aspects of their job, uh

7:56

Speaker 1: this can do as well, if not better than them So what about software developers then? Um what about what about our our jobs? So you might think, well, hopefully we're needed to write the code that this sort of technology uses, so we're okay. But as I'm saying, it's looking at ways in which you could generate that code rather than having to have a human write-in So one approach you can take to that is genetic algorithms then. So a genetic algorithm is a guided random search algorithm, by which I mean as opposed to say a systematic search where you've got all your data in order. And you not in order, but in a big line and you start at one end and you keep looking through until you find the thing you're looking for.

8:43

Speaker 1: Uh which will get there and it's simple to reason about, but it might take an impossibly long time if you've got a large amount of data. Um or a random search where you say I'm gonna look over here. Is it there? Nope. Over here, nope. Over there again, nope, still not there. Um which which uh is one way of Looking for a large data set, but again, it might take some time. A guided random search is you pick a random point to look at, and then based on what you find there, you decide where to look next So say I look over here and the thing I find looks nothing like what I'm looking for, then I'm gonna go, well, uh let's try all the way over there instead. Or if the thing I find here is quite close, then I'll go, well look I'll look in the vicinity And that only works with data sets that are in some way sorted so that they're they're continuous, at least around the points of interest.

9:30

Speaker 1: So say you've got um Like a contour thing on a map where you've kind of got things that go like this and you can tell if you've got a point here that the points next to it will be kind of similar, you're not gonna have a sudden sudden jump. And that allows you to infer things of what you found there and what will be around it. And in particular, a genetic algorithm is a guided random search algorithm which takes inspiration from biology, specifically from evolution. where we have this idea of natural selection and and survival of the fittest. So if you've got some uh trait that makes you uh more likely to survive, say you're quicker at running away from tigers or something like that, then you're more likely to live long enough to pass on your genes to the next generation and therefore over time those sort of beneficial traits

10:17

Speaker 1: get selected for and become more prevalent in that population So how on earth does that relate to an algorithm then? So if we take an example of say uh evolving a string, so not programs just yet, just a string. Say I want to get one that contains the title of this talk. What I would do is I would first of all generate a whole population of random strings, so all different lengths, different characters, just completely random strings. Then I'm gonna look through and evaluate those those individuals and assign them a fitness score. Um this point is where my uh analogy of evolution has somewhat completely gone out of the window, um, because in nature there is no end goal in mind, whereas here we are

11:02

Speaker 1: artificially constructing a fitness function to steer our algorithm to converge on the solution that we're looking for. So say I might say, well, I'm going to reward strings that are the same length as what I'm looking for or similar. uh that have the same characters. Um, that have those characters in the right places. So we will we will score uh all of these uh individual strings with fitness score and then we're gonna select some to survive So naively, simplest thing I can do, I'm gonna put all of those strings in in order of fitness and I'm just gonna take the top half. I'm gonna throw the other half away and say this top half will survive to to reproduce and fasten their genes I then have a crossover step, so this is analogous to you getting half your chromosomes from each parent. So again, simplest thing we can do, first

11:49

Speaker 1: off for one string, second off the other, sticking together. We then have uh similarly to how you get new characteristics introduced into the gene pool by uh random mutations in in genes, we're gonna have a sort of mutation step where for those child strings that we've created we're gonna randomly pick a character and swap it out for a different one. I'm then gonna look at the population I've got and decide um Does this contain the string that I was looking for? If so, uh great I can stop. If not, I'm just gonna go back round. I'm gonna evaluate again uh continually do this kind of crossover step. So generation after generation it evolves towards the thing that I'm I'm looking for. So let's give that a go then.

12:35

Speaker 1: Let's see. Text a bit bigger. Um so what we're gonna see when I run this, um is that for each generation we're gonna print out some statistics about that generation. So we're gonna have uh the average fitness school uh the range of fitness scores that we've got. Uh and also going to print out the best string that I've that I've got so far. So to start with that's probably going to be a string of around about the right length because in a in a group of completely random strings, something about the right length is probably our best bet. So over time, uh hopefully we'll get the spaces in the right place, we'll see some features emerging. um characters lined up and we've got to our

13:20

Speaker 1: talk title. So that's well and good. But to be honest, evolving strings isn't particularly interesting. It would have been much quicker for me to just write that string down. And indeed I had to do that in order to define the fitness function anyway. So what about evolving programs? Um so code is a bit more complicated um than just strings. Particularly before I could just dump a load of random characters to make some random strings. They might not have looked anything like the strings that I was trying to get to, but they were still strings. Uh whereas if I just dump a load of random characters into a file, the odds that that's any kind of runnable code uh in in Python or in C or any other language that I want is

14:07

Speaker 1: going to be pretty slim. There's all sorts of rules about structure and syntax and things that logically don't make any sense to do. So how am I gonna how am I gonna generate valid programs? So you might say, well, okay, um let's do something with templates. I'm gonna make a block that looks um sort of like a for loop and it's gonna like fill in the blanks for the variable bits, and I'll make another block that looks Like an if statement, similarly fill in the blanks, and um I'll let people randomly sort of mix these blocks and stick them together And fair enough, you will generate some valid start programs with that. But when you start through the crossover steps, the mutation steps, you're very quickly going to get to something that's no longer valid and won't run.

14:54

Speaker 1: She might go, okay, um let's um I don't know. I'll make my own language. It's gonna consist of really just some simple symbols, and you'll be allowed to combine them in any order that you like. What's probably going to happen there is that you're going to unintentionally uh limit what it is that you can uh write in that language. So we want to be able to evolve code uh that could do anything we could um theoretically write some code ourselves to do. So in order for that to be the case, we need uh the language that we are evolving the code in to be something called Turing complete. So uh briefly what do I mean by that? Um So Alan Turing, a very uh famous uh mathematician and computer scientist, um he did a lot of uh work on the theory of computation, um, and in particular

15:41

Speaker 1: on the idea of reprogramming machines So you don't just program it once and then it always does that thing, you can reprogram it and have it doing something else. And he came up with a mathematical model to help him reason about that. And that model is called a Turing machine. And here we have a sort of mechanical build of one. And what this is, is it's an infinitely long piece of tape divided up into a series of cells. And you have an arrow which points at the cell that you're currently looking at. And in that cell, you can put a symbol in, you can read out the value of the symbol, or you can change the symbol in that cell. You can also move your arrow up and down the tape to point at a different cell. That it that is it. That's the entire machine. And yet you can uh show mathematically uh that anything that it is possible to compute

16:31

Speaker 1: And and not everything is. There are some problems in uh computer science like the halting problem. Um but if it's possible to compute, you can um do so on this machine. And when we say a language is true and complete, it just means that it can be used to simulate one of these machines. Which means if it can be used to simulate a machine which can compute anything that's computable, then you can write code in that language to do anything you like if it's theoretically possible that it can be done. So those are our requirements then. We need an incredibly syntactically simple language, yet which is dure and complete. So what what is that language?

17:17

Speaker 1: So at this point I thought, well, that might already be a solved problem. I'm a software developer, so therefore I'll Google it rather than reinventing the wheel. And I found this site. This is uh Corey Becker 's site, primaryobjects. com. It contains a load of really interesting blog posts and articles on various machine learning topics. Uh highly recommend it if that's the sort of thing you're interested in. And she had in fact looked at exactly this problem, i. e. um evolving code to fulfill um some some need. Um and she'd identified which is a great language to use for that. And this language has only eight characters, and it's pretty much just a model of a Turing machine Now, in the interest of not repeatedly swearing at you for the rest of the talk, um

18:07

Speaker 1: which may happen, I'm sorry if I actually do, um I have uh abbreviated the name or as math textbooks like to say left it as an exercise for the reader. Um so brain F then as we'll call it. Um so this is just a Turing machine uh pretty much. Um so we have the first six symbols are mainly involved with that. So you've got moving the pointer left and right, you've got the plus and minus to change the value that's in the current cell And then the dot and the comma to do with outputting and inputting symbols from that cell. Where it gets interesting and where the language gets its power and its control flow are these square brackets So this is what allows us to look in the value at a cell and decide what to do next.

18:55

Speaker 1: So this allows us to go back and loop around again or to continue on. These are also the only parts of the language of any kind of syntax requirement. So in the normal way that brackets need to match up, so you need to start with the opening one and then end with the closing one. We have that requirement on syntax. That's the only syntax requirement. Other than that, you can just uh dump random characters So what does a program in Brain F look like then? So this is your standard introductory program in most languages. Output hello world to the screen. Yeah. As you can see this is quite an esoteric language. I don't know about you, but I don't want to write code in this. I certainly don't want to debug code written in this.

19:44

Speaker 1: But to a computer, uh this is just as intelligible as code written in Python or whatever language you like. Um and to us, this is just a string of characters And we've already looked at how we might go and generate random strings of characters, how we might cross them over, did the mutation. So we already have techniques that we can reuse. So actually, this is great. So let's try then and evolve some code. Uh RenMbrain F. Um just to the wonder of random demos. This is going to be slightly hair-raising, but we'll give it a go. So what are we going to try and evolve? So I was going to do hello world , but I realized that making you all sit there and watch that converge was perhaps a little cruel. So I've gone with uh slightly abbreviated

20:31

Speaker 1: hi And we're gonna have um some new problems here that we didn't have when we did the string evolution. Um so it's possible to have uh an invalid program. So I said, very few syntax requirements for NF, just the square brackets, but it's still possible to mess that up. We might have a perfectly valid program which just never terminates. Perhaps it contains an infinite loop. So we're gonna have to define some cutoff period after which we go, yep, probably not gonna terminate, let's call that a day and time that one out. The other thing that might happen is that the real world isn't actually like perfect theoretical mathematical models. We don't have an infinitely long piece of tape. Our computer that we're running the program on has a finite amount of memory. And we might go off the end of it. So again, we're gonna need to spot that error.

21:18

Speaker 1: And for all of those things, what we're gonna do is assign uh that individual a very low fitness score so that we can try and as quickly as possible uh weed out things that just don't run and get to if not the program we want, at least something that runs and and we can start evolving. So So what we're going to see this time when I run this is that for each generation we're again going to print out the average fitness score. the range of fitness scores. And I'm going to print out the brain F code of the individual that's currently got the highest fitness. Additionally, I'm going to print out the output of all the programs in that generation.

22:04

Speaker 1: Let's see what happens. So quite quickly uh we get to things uh that are producing output. And we can see we're actually reasonably close. Um most of these are sort of two character outputs. And we're even starting to get sort of some of the letters lined up. It's probably going to take quite a lot longer to get to where we want. And why is that given that we got so close so quickly So the key thing here is that no longer, as we have with the string evolution, are the thing that we're evolving and the thing that we're fitness scoring one and the same. Now we're evolving the brain F code, but we're scoring the fitness of the output. So you might have output, there's only one character off But maybe your code is stuck in some really awkward loop that's really difficult to get out of.

22:50

Speaker 1: And any mutation that gets it out of that initially produces worse output. And so it's going to be selected out. So to counter that, uh we're going to need to change how we're our algorithm works a bit. Um so for instance in the mutation step uh we need to have ability to make bigger jumps, bigger mutations. So instead of just replacing a single character, we might say go over the whole string and have some probability of replacing each one. Or we might add other mutation types, so uh inserting characters, deleting them For our selection, if we just take the top half, um actually that's a bit too elitist. We're gonna really quickly dive towards something that looks promising to the start, um, ignoring something going off in that direction, which Looks worse now, but actually is heading towards the actual solution.

23:36

Speaker 1: So we're going to change to something called roulette wheel selection, where basically you have a big circle. um divided into a wedge for each of the individuals in the population. That wedge is going to be bigger if the individual has a higher fitness score. And then we're going to spin a spinner on it. And it's going to land probably more likely to land on a an individual with high fitness and so they're more likely to make it through, but there's still some chance of the others getting in as well. Nonetheless, this is going to take a while. Yep. You're probably gonna notice uh some things as well. Um like it just does things that you wouldn't uh a human wouldn't like you you've got situations where you've got a load of pluses followed by a load of minuses and they just cancel each of a round. So why would you bother doing that?

24:23

Speaker 1: You might also be thinking that, my goodness, this is taking a long time and frankly I write more interesting code for a living than things that just write hi. I think my job's probably quite safe. Um maybe not. Um But but you can do more interesting things than this. So I mean I was just doing this for fun, uh so I basically stopped here. But um Corey who I mentioned earlier she went on and uh wrote pro evolved programs that did things like take user inputs and then add those numbers together or generate the Fibonacci numbers, which I was pretty impressed by. You could also take other approaches. So this is evolving the program code as a string. You could take the abstract syntax tree and evolve that. Or you could say, well actually, Emma, you only use genetic algorithms because you happen to be studying that at the time.

25:09

Speaker 1: Let's try a neural network instead. Or things like that Um but y still it it to me anyway looks like right now, at least in the next few years, I'm I'm maybe okay. Um so what are the sort of projections then for uh likelihood that um software development and that sort of job will be uh replaced by machines. So there are a few uh predictions being made. One site uh which captures some of that data is uh willrobotstakemyjob. com So this is quite a fun site. It's uh based off some uh paper that was published in 2013, uh which made some predictions about uh for various different uh professions what the odds were that those would be um automated and replaced by robots by 2024.

25:57

Speaker 1: So the first thing to note is that 2013 is five years ago, which is quite a long time in tech terms. And also other projections have been made since. They have differing um sort of predictions depending on what how they decide to break down the jobs, how they define them, what sort of if they consider whole jobs or all the tasks that make the jobs up, and on what kind of underlying assumptions they make. In 2024 we can go and see which one was better for now. But we'll just use this one. So what happens if I put some uh tech jobs into this? Computer programmer, 48 % chance of automation by 2024. Start worrying Whereas, software developer, totally safe.

26:44

Speaker 1: 4. 2%. Um there's something about the phrase totally safe which alarms me far more than start worrying but that's uh um so what why is that? Um why wh why are they come out with such different numbers? Um so we go back and look at uh what definitions they used for these jobs. That might help us see why. So computer programmers then, according to this the definition they used, they create, modify and test code that allow computer applications to run. They work from specifications drawn up by software developers and they may assist software developers analyzing user needs and designing the software So basically that they're doing not something not too dissimilar from what we just looked at. So they're given a requirement specification by someone else and they're told, I need the code to do this, go away and

27:33

Speaker 1: generate it. So you can see that might have a slightly higher chance of automation than say uh software developers, uh which is defined as um develop, create and modify uh general computer applications , analyze user needs and develop software solutions, design software for client use, and with the aim of optimizing uh efficiency. may supervise computer programmers and they work individually or coordinating with others. So we've got tasks in there which we can see why Maybe there's less risk of automation right now. So working with the people, interacting with users, defining those requirements of Star Web and design. So a bit of insight into why the numbers are different. And so it really depends on the odds this site gives

28:20

Speaker 1: for a job being automated in terms of what tasks that job is composed of. And what makes a particular task, say, easy or hard to automate? So things that are very repeatable, um uh uh are easier to automate. So uh clocks, for instance have been sort of chiming on the hour um without someone going up and hitting a bell with a hammer for quite some time now. That sort of thing is quite um easy to automate. Um whereas something more varied and unpredictable is much harder. So say we were to look at self-driving cars and Uh if we wanted to talk about potential for job loss then self-driving cars is probably what we should be talking about because if you think the number of people that are involved in driving vehicles in various forms

29:09

Speaker 1: uh that could potentially be completely replaced, like all aspects of their job by those. But we're not quite there yet. And the reason is it's very different to say have your self-driving car and your test site Uh small area which you've got perfectly mapped out. You understand there aren't other people using that area other other vehicles. Um To make that work um and people have done that. And we have um the reports which are mainly automated now and have um you know self-driving cranes, lifting things off ships and then putting it onto a self-driving lorry. But it's because that port is closed to the outside world. They know exactly the route map. There's never any other people around or any other vehicles. Whereas real-world roads, you might have uh an unannounced uh route diversion

29:55

Speaker 1: that day, some temporary road works. Um you can have changing weather conditions. You uh have uh you know, the standard thing of a football goes into the road and the kid runs out after it. Um you have other drivers doing potentially unpredictable things. Um your your route may not actually bear any resemblance to what the Satinav says it is. This is all much harder to deal with. Other things that are hard tools made involve things which say have an element of human interaction. So jobs that require empathizing with someone. Harder for a machine to do. Things that involve creativity. So this is where at the moment we quite like to think of ourselves as quite separated from machines. Kind of people like to say, well, humans can um compose sonnets or or

30:40

Speaker 1: paint a masterpiece of art. I hope that's not the only distinction we're making, because I can't do any of those things. But we have some advantage in that area for now. Computers are making inroads, so um they have started composing the first bit original pieces of music, uh painting first bits of original artwork. Um but for now um creative tasks are somewhat harder to automate So what's key then to the whether a job will be replaced by machines is sort of what composition of tasks it has, how many of them are easy to automate versus hard. Like if all of the tasks involved in that job are easy to automate, then it can be fully replaced by a machine. If only some of them are, uh then you're in a sort of partial replacement scenario where you're more likely to end up working alongside machines.

31:30

Speaker 1: So perhaps the nature of the work you do changes. So looking back then historically, how many jobs have we previously seen? Completely replaced by machines So if you go and look at uh the 1950 US Censor data, where people say uh what reported what jobs they did, um you see there are a number of professions which no longer exist. Um Most of these are due to things like uh technology becoming obsolete. So we don't need telegraph operators anymore, for example. Um some of them are just demand just isn't there anymore. So uh who needs a boarding housekeeper these days? Um But there was one job um which had been uh replaced but because of automation. So I'll give you a minute while I have a drink to see if you can uh think what you reckon it might be

32:24

Speaker 1: So, um, congratulations if you guessed correctly. Um it is elevator operators. So you used to have a manual lever that you had to pull to put the brakes on. And it was quite a skilled thing actually. You need to make that lift stop at the right floor and line up exactly, otherwise you can only get half out. We just don't have a need for these anymore. We've just automated lifts. That's not quite true. There's a couple skyscrapers left in New York with these, I think, more as a tourist attraction. But basically this this job just doesn't exist anymore. Um and it's not um a new concern I guess thinking about um jobs being replaced by technology. And we maybe want to look back through history and see previous examples to see if we can kind of extrapolate

33:12

Speaker 1: to see Whether we think the rate at which job is being replaced by machines completely might increase or stay the same. What previous examples have we had? So this is sort of a machine for automating production of cloth, so kind of weaving, knitting machine. This is quite a modern example. You can see there's electric lighting in the picture. But the very first one of these, its predecessor, was created nearly 500 years ago now by a man named William Lee, who went to Queen Elizabeth I and asked for a patent. And she shared many of the concerns that people are talking about these days. So she said no to that pattern. She said it will deprive people of work and replace them.

33:57

Speaker 1: I I want those people to have a job and be able to afford things like food. But not having a patent obviously doesn't stop you from deploying this technology. And indeed they did. And it would have made its way into a number of factories. And actually that concern uh about losing jobs, it didn't quite play out that way, at least uh to start with. So what ended up happening? Um was they increased uh dramatically the amount of uh fabric that one individual worker could produce because now they were using this machine And because of that, uh the cost of it decreased, uh demand increased, and it kind of balanced out with the fact that each person was producing more and the number of jobs was actually maintained. That's not to say it wasn't controversial, however. It did have negative effects.

34:44

Speaker 1: So um you now could use these uh machines with less skill than was required to make these materials before. And because of that, wages were hit, right? Wages decreased for people. And without sort of unions back there for people to go to to kind of counter this, there were riots. You may have heard of the Luddites. I think they've got a slightly unfair reputation of history as they've gone down as completely opposed to any new technology. So what they actually wanted was some regulations around its use. They wanted requirements on fair wages for the operators, on people having to do an apprenticeship before they were deemed a skilled enough operator, in order to counter the effects on the wages that they were seeing.

35:32

Speaker 1: So it's not a new topic of concern then, this kind of uh what effect will technology have, what might the outcomes of that be? And there's a wide range of different predictions and projections at the moment, which I'd like to talk about a bit. But I should say at this point the talk stops being kind of many factual and starts being mainly uh a mixture of different predictions, projections, opinions, and that sort of thing. So um I think important to draw the distinction. I'm going to attempt to prevent a sort of balanced view, overview of those. And probably, to be honest, ask you more questions than I answer, because I think it's important that we all start thinking about this something. So what are then some positive and negative outlooks that people have on automation? So um

36:17

Speaker 1: The top two here kind of echo what we've just seen in the previous example with the low lights and these weaving machines of some people argue, well actually automation is good because it will Increased productivity, decreased costs, increased demand, and actually you won't lose any jobs because of how that balances out. And other people will go, well look, we've seen that before and it depresses wages, so it's still a problem. And actually , the argument about uh maintaining jobs due to this economic uh balance uh only holds if you partially replace uh the some tasks for that job. If you can work alongside machines to do your your work more efficiently, then that can be true. If you're completely replaced, then you're in the bottom scenario of just mass unemployment. as might happen uh if we have completely autonomous vehicles.

37:05

Speaker 1: What some people say, well, you will lose jobs, but new jobs will be created. Um for example, um probably none of us have grandparents that were data scientists. This one's quite hard to reason about because just trying to think uh it about things which by their definition don't exist yet is quite difficult. But but new job types will certainly um come about. But what might happen is that the people that lose their jobs aren't necessarily going to be the ones that can pick those jobs up. So there's there's a that would be a skills gap, retraining needed. Um how do you how do you deal with that? Um and this may cause some growing inequality. So um If you've got some people being put out of jobs or on lower wages and you've got other people that have

37:51

Speaker 1: happen to be the lucky ones that have the skills for the new jobs appearing and can demand quite a high wage for their services, you're gonna have a growing gap appearing in society Another thing that you might think about is, well hang on, we've got quite an aging population at the moment. How are we going to help to uh provide the sort of continued level of healthcare that we enjoy at the moment. How are we going to pay for that? Maybe automation can help boost productivity and help increase the amount of economic contribution from each worker. Maybe that that'll help us. Um so yeah, a a lot of potential, different uh upsides, downsides, ranging from um extremes of it's gonna be an amazing utopia where no one needs to work um and we'll all enjoy lots of free time to robot apocalypse. Um

38:37

Speaker 1: most people sit somewhere in between of there'll be a mix of these things all happening at once. So how how do we as society react to some of these challenges then? we're we're gonna need to to do something. There's some things we might want to consider. So universal income has been something that's been talked about for a while, perhaps gaining um more traction recently. We've had a recent referendum in Switzerland uh that was uh rejected. There was a trial in Finland of how this might work. Um are we going to need to change our education model Um, we've got kids starting school now who by the time they leave school the jobs we currently have might not exist anymore. They might need to know how to do new jobs, which we don't even know what they are, let alone what skills they require. And how do we make education more lifelong?

39:24

Speaker 1: Do we need to provide more opportunities for retraining if people might have to change lots of jobs in their lifetime? Um another suggestion that was put out there, um I think by Bill Gates was, well, in the same way that you have income tax at the moment, perhaps we could charge companies a tax on robot productivity to help pay for some of the sort of ideas higher up this list. There's probably other things that we might consider that aren't on this list. And how how those would work is is an interesting question. So um At the moment, uh most people we kind of we need to work, um, so some people argue therefore we shouldn't have universal income yet. Um but then in the in the future maybe we get to a point where we definitely need to happen. Uh what happens in the transition period between those two points? Uh how how on earth will we make that work? Um there are other questions as well.

40:10

Speaker 1: There's moral and legal issues, so we've seen recently a lot in the news about uh privacy concerns, um, as kind of increasing use of um data collection, artificial intelligence means um companies down on a lot more about us. There are legal questions. So who's responsible if a self-driving car is in an accident? Indeed, who writes the algorithm that gets to decide? Um, you know, does it go in a straight line and hit two people, or does it actively swerve out the way and choose to hit one? Who gets to pick that? Is it the developer writing it? Is it the company? Is it government? Lawyers? Is it all of us? We need to start thinking about these things and we need not just technical people to be thinking but but everyone. So on the subject of questions, if you have any for me, I'd be happy to take some.

40:56

Speaker 1: If you're interested in the code for the demos that were run earlier, it's all on GitHub at that link. Thank you.

41:15

Speaker 2: Twenty-five years ago in a uh theory of computation class, I used genetic algorithms to evolve a uh a finite state machine to solve a problem and got in trouble for using up most of the department's computing resources. You've just demonstrated again, uh using a a slightly more complicated dream machine to write a program. Um that's not quite right, but you know what I mean. Are we going to get efficient enough at evolving programs to do something functional, something useful to actually replace ourselves, our programmers?

41:50

Speaker 1: Yep. Um I think potentially um as as you said this kind of the increases in and computer power that we've seen um have been been extraordinary. Um so in terms of resources and and being able to run something in a decent time I can see that being true. Um I think there are other aspects of our work that are harder to replace so the kind of design the the talking to users. So um I'm hopeful that even if computers are writing some of the code that we will still be needed for sort of the architectural aspect um if not kind of the low-level implementations once you kind of get to the function and class level

42:30

Speaker 3: Hello, thank you for the talk. Um when you you uh write a program today A lot of times you have an IDE help you with a lot of things. So part of the automation of writing programs is already happening. But it doesn't use uh genetic algorithms these days mostly. There are specific algorithms written for the analysis of programs, etc. Do you have a prediction about how genetic algorithms will get um um uh involved in that will get um more um used i for for these things and how how the um balance will be between

43:17

Speaker 3: uh machine learning and and uh uh other automatic evolution of of code versus um pre-written uh designed uh elements.

43:31

Speaker 1: Yep. Um so um in terms of uh genetic elements getting more involved in things I think um Perhaps not this problem. So there's lots of situations in physics and chemistry where you've got sort of lots of variables. a space which is it's uh the polynomial is too complex to solve uh analytically um so you need to use this kind of optimization approximation techniques. Um In terms of evolving code, I don't know whether it will be genetic algorithms or some other aspect of machine learning, maybe neural networks instead, potentially.

44:16

Speaker 1: But I think they will be um it depends where we get to with intelligence and creativity, I think, um in terms of artificial intelligence. So i if things can start um designing uh aspects of work, um particularly if we get to levels of user interaction and and being able to converse with machines where they can understand us and potentially they can start taking on with some of those um user requirements gathering bits as well. But I still like to think there's some some role for us in all that. Cool. All right, thank you, Raj. Okay, you have a very

45:04

Speaker 1: good question.

Questions this talk answers

What is a genetic algorithm, and how does it evolve a target string?

A genetic algorithm is a guided random search inspired by evolution. It generates random candidates, scores their fitness, selects some to reproduce, combines and mutates them, and repeats until a candidate matches the target.

Discussed at 9:30

How can genetic algorithms evolve working computer programs?

Programs can be evolved as strings in a syntactically simple but Turing-complete language such as Brainfuck. The algorithm tests each candidate’s output, penalizes invalid, nonterminating, or out-of-memory programs, and uses larger mutations and probabilistic selection to escape local improvements.

Discussed at 13:20

What does Turing-complete mean, and why is it important for evolving code?

A Turing-complete language can simulate a Turing machine, meaning it can express anything that is computable in principle. This is necessary if the evolved language is meant to produce programs capable of doing anything a normal programming language can theoretically do.

Discussed at 14:41

How likely is software development to be replaced by automation?

The talk says the answer depends on how the job is defined and which tasks it includes: one cited estimate gives computer programmers a 48% automation risk but software developers only 4.2%. Development tasks involving requirements, users, collaboration, and design are harder to automate than repetitive code-generation tasks.

Discussed at 25:09

What kinds of work are easiest and hardest for machines to automate?

Highly repeatable tasks are easiest to automate, while varied and unpredictable work is harder. Human interaction, empathy, and creativity remain comparatively difficult for machines, although computers are beginning to make progress in creative tasks.

Discussed at 28:20

Does automation always eliminate jobs?

Not necessarily. Earlier automation sometimes increased each worker’s productivity, lowered prices, and increased demand enough to preserve jobs, but it could still reduce workers’ wages; complete replacement of all tasks in a job is more likely to cause job loss.

Discussed at 33:57

Presenters

Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.

More videos from DjangoCon Europe