diff --git "a/CMU Advanced NLP 2024 (17) Code Generation/transcript.vtt" "b/CMU Advanced NLP 2024 (17) Code Generation/transcript.vtt" new file mode 100644--- /dev/null +++ "b/CMU Advanced NLP 2024 (17) Code Generation/transcript.vtt" @@ -0,0 +1,4699 @@ +WEBVTT + +00:00:00.480 --> 00:00:06.279 +so uh I guess we can get started uh + +00:00:04.080 --> 00:00:09.880 +today I'm going to be talking about code + +00:00:06.279 --> 00:00:11.719 +generation and uh so this is a a + +00:00:09.880 --> 00:00:13.599 +research topic that I've uh worked on + +00:00:11.719 --> 00:00:15.280 +for a long time now I I like a lot it's + +00:00:13.599 --> 00:00:17.520 +become very useful nowadays which is + +00:00:15.280 --> 00:00:20.960 +very exciting um so I'd like to talk + +00:00:17.520 --> 00:00:23.119 +about kind of some of the basics and + +00:00:20.960 --> 00:00:28.000 +Frontiers uh that we're working on right + +00:00:23.119 --> 00:00:28.000 +now in this General uh area + +00:00:31.719 --> 00:00:36.760 +um + +00:00:33.360 --> 00:00:38.160 +so before I get into code generation + +00:00:36.760 --> 00:00:40.719 +specifically one thing I'd like to point + +00:00:38.160 --> 00:00:43.399 +out is for the next four or so classes + +00:00:40.719 --> 00:00:45.680 +I'm going to be talking about tasks and + +00:00:43.399 --> 00:00:48.680 +up until now I've been focusing on a lot + +00:00:45.680 --> 00:00:52.840 +of like General things that weren't as + +00:00:48.680 --> 00:00:55.199 +much about any specific tasks um + +00:00:52.840 --> 00:00:57.000 +and I know that not everybody's going to + +00:00:55.199 --> 00:00:59.399 +be interested in the four tasks that I'm + +00:00:57.000 --> 00:01:00.960 +talking about in the next you know four + +00:00:59.399 --> 00:01:02.480 +lectures + +00:01:00.960 --> 00:01:04.920 +um + +00:01:02.480 --> 00:01:06.640 +but I'm going to be covering various + +00:01:04.920 --> 00:01:08.680 +things about different tasks and + +00:01:06.640 --> 00:01:10.640 +hopefully you can map the same questions + +00:01:08.680 --> 00:01:12.040 +onto whatever task you are interested in + +00:01:10.640 --> 00:01:14.360 +if you're not interested in any of the + +00:01:12.040 --> 00:01:15.880 +ones I talk about here so basically what + +00:01:14.360 --> 00:01:18.119 +I want to talk about is the task + +00:01:15.880 --> 00:01:21.040 +objective like why do we do that task + +00:01:18.119 --> 00:01:23.479 +why is it important um what data sets + +00:01:21.040 --> 00:01:26.560 +can we use to train or test our models + +00:01:23.479 --> 00:01:28.799 +on these tasks evaluation metrics and + +00:01:26.560 --> 00:01:31.200 +how do we evaluate uh both manually and + +00:01:28.799 --> 00:01:32.079 +automatically with respect to how good + +00:01:31.200 --> 00:01:34.960 +we're + +00:01:32.079 --> 00:01:37.880 +doing and finally models and methods so + +00:01:34.960 --> 00:01:40.720 +you know how do we solve the + +00:01:37.880 --> 00:01:42.479 +problem and so for code generation first + +00:01:40.720 --> 00:01:44.439 +I'd like to talk about the overview and + +00:01:42.479 --> 00:01:47.040 +objectives of code generation so + +00:01:44.439 --> 00:01:48.840 +basically code generation is the task of + +00:01:47.040 --> 00:01:52.439 +generating executable code is an + +00:01:48.840 --> 00:01:54.479 +interface to uh a program or to + +00:01:52.439 --> 00:01:58.320 +computers and there's a lot of different + +00:01:54.479 --> 00:02:01.000 +ways we can do this um why do we want to + +00:01:58.320 --> 00:02:03.159 +do this so + +00:02:01.000 --> 00:02:05.000 +the first thing is that software + +00:02:03.159 --> 00:02:06.759 +engineering is really important and + +00:02:05.000 --> 00:02:09.640 +being able to generate code accelerate + +00:02:06.759 --> 00:02:11.560 +software engineering uh now code + +00:02:09.640 --> 00:02:13.640 +generation is practical and I hope that + +00:02:11.560 --> 00:02:15.599 +everybody in the class is using some + +00:02:13.640 --> 00:02:17.840 +sort of you know code generation to + +00:02:15.599 --> 00:02:20.200 +accelerate your own workflow if you're + +00:02:17.840 --> 00:02:22.599 +not I highly encourage you to to try it + +00:02:20.200 --> 00:02:26.200 +because it's very + +00:02:22.599 --> 00:02:31.040 +useful second it also does things like + +00:02:26.200 --> 00:02:34.239 +enabling models to access tools um + +00:02:31.040 --> 00:02:37.440 +and even if you're not specifically + +00:02:34.239 --> 00:02:39.440 +working on a software related task this + +00:02:37.440 --> 00:02:41.000 +can be helpful but I want to talk about + +00:02:39.440 --> 00:02:42.480 +this in a later class when we talk about + +00:02:41.000 --> 00:02:46.640 +llm agents so I'm not going to be + +00:02:42.480 --> 00:02:48.319 +talking about um that as much this time + +00:02:46.640 --> 00:02:50.159 +uh one other thing that I I forgot to + +00:02:48.319 --> 00:02:52.920 +mention here which I'm also going to + +00:02:50.159 --> 00:02:55.000 +talk about in the later class is even if + +00:02:52.920 --> 00:02:58.120 +you're not using code at all training on + +00:02:55.000 --> 00:03:00.319 +code has been shown to cause some + +00:02:58.120 --> 00:03:01.920 +benefits to learning models uh + +00:03:00.319 --> 00:03:03.799 +specifically with respect to learning + +00:03:01.920 --> 00:03:06.480 +like difficult multitask reasoning uh + +00:03:03.799 --> 00:03:07.599 +sorry multi-step reasoning tasks and so + +00:03:06.480 --> 00:03:09.480 +that's another reason why you might want + +00:03:07.599 --> 00:03:10.840 +to worry about codes so I'm going to + +00:03:09.480 --> 00:03:12.840 +mainly talk about the first one this + +00:03:10.840 --> 00:03:14.560 +time and leave the other two uh for + +00:03:12.840 --> 00:03:17.720 +future + +00:03:14.560 --> 00:03:21.760 +lectures so specifically for this task + +00:03:17.720 --> 00:03:25.200 +our input um is some sort of + +00:03:21.760 --> 00:03:27.360 +specification of what we want to do um + +00:03:25.200 --> 00:03:30.319 +and our output is going to be + +00:03:27.360 --> 00:03:33.000 +code so + +00:03:30.319 --> 00:03:35.920 +when you write a + +00:03:33.000 --> 00:03:37.239 +program how do you describe the thing + +00:03:35.920 --> 00:03:40.239 +that you want to implement in the + +00:03:37.239 --> 00:03:42.000 +program before you implement it like uh + +00:03:40.239 --> 00:03:44.720 +yeah what are some of the specifications + +00:03:42.000 --> 00:03:44.720 +that people can give + +00:03:45.280 --> 00:03:50.720 +you what the input and output of the + +00:03:47.680 --> 00:03:52.360 +functions are uh yes uh sorry what what + +00:03:50.720 --> 00:03:54.400 +types the inputs and outputs of the + +00:03:52.360 --> 00:03:56.239 +function are so those would be like type + +00:03:54.400 --> 00:03:57.760 +in in Python for example yeah that + +00:03:56.239 --> 00:03:59.439 +that's a good one it's actually not on + +00:03:57.760 --> 00:04:02.079 +my list of things here but it's it's a + +00:03:59.439 --> 00:04:06.040 +good Point yeah any any other things + +00:04:02.079 --> 00:04:08.680 +yeah complexity requirements complexity + +00:04:06.040 --> 00:04:11.040 +requirements constraints that is also + +00:04:08.680 --> 00:04:14.840 +not on my list of things here uh that's + +00:04:11.040 --> 00:04:17.040 +uh that's a good one too um and any uh + +00:04:14.840 --> 00:04:20.280 +slightly more straight forward + +00:04:17.040 --> 00:04:24.040 +things pseudo code yeah um in pseudo + +00:04:20.280 --> 00:04:26.720 +code uh what what is pseudo code written + +00:04:24.040 --> 00:04:28.440 +in natural natural language yeah so + +00:04:26.720 --> 00:04:31.199 +natural language inputs are are one + +00:04:28.440 --> 00:04:34.520 +thing so I will tell you I want I want a + +00:04:31.199 --> 00:04:39.160 +program that uh I want you to write a + +00:04:34.520 --> 00:04:41.479 +web interface that allows me to um order + +00:04:39.160 --> 00:04:43.560 +pizza or something like that that that + +00:04:41.479 --> 00:04:46.560 +would be one way to do it any other + +00:04:43.560 --> 00:04:46.560 +ideas + +00:04:51.199 --> 00:04:55.840 +yeah this is what I have and this is + +00:04:53.360 --> 00:04:57.240 +what I want yeah so um that's especially + +00:04:55.840 --> 00:04:59.880 +the case if you're like modifying a + +00:04:57.240 --> 00:05:01.400 +program um or something like that so + +00:04:59.880 --> 00:05:06.280 +actually the next one on my list there + +00:05:01.400 --> 00:05:06.280 +so good good point um any other + +00:05:09.759 --> 00:05:15.720 +ideas yeah or or a multimodal person you + +00:05:12.880 --> 00:05:20.120 +know I might say I want a pizza ordering + +00:05:15.720 --> 00:05:22.039 +I want a pizza ordering app and up here + +00:05:20.120 --> 00:05:24.000 +it should have your like username so you + +00:05:22.039 --> 00:05:25.840 +can click through the settings and like + +00:05:24.000 --> 00:05:27.080 +over here you should have the menu and + +00:05:25.840 --> 00:05:28.680 +over here you should have your check out + +00:05:27.080 --> 00:05:30.400 +card or something like that you know + +00:05:28.680 --> 00:05:32.440 +it's something you do for a programmer + +00:05:30.400 --> 00:05:34.680 +as well until recently we couldn't + +00:05:32.440 --> 00:05:37.680 +really use that with like actual models + +00:05:34.680 --> 00:05:40.560 +but um yeah yeah well that was my fourth + +00:05:37.680 --> 00:05:42.639 +one but um and then the other one uh + +00:05:40.560 --> 00:05:44.960 +inputs and outputs this could come in + +00:05:42.639 --> 00:05:46.560 +the form of like unit tests or something + +00:05:44.960 --> 00:05:49.199 +like that where it's like yeah this is + +00:05:46.560 --> 00:05:51.160 +the input this is the expected output so + +00:05:49.199 --> 00:05:53.240 +these are all things we use both as + +00:05:51.160 --> 00:05:55.639 +human programmers and in code generation + +00:05:53.240 --> 00:05:58.120 +models I really like the two other + +00:05:55.639 --> 00:06:00.440 +points though um + +00:05:58.120 --> 00:06:03.759 +because typin + +00:06:00.440 --> 00:06:05.479 +are actually something that you like + +00:06:03.759 --> 00:06:06.599 +writing writing with typ pints is + +00:06:05.479 --> 00:06:09.240 +actually something that you can do with + +00:06:06.599 --> 00:06:14.120 +code generation models and um + +00:06:09.240 --> 00:06:16.680 +constraints such as like it should it + +00:06:14.120 --> 00:06:20.199 +should meet certain speed requirements + +00:06:16.680 --> 00:06:21.520 +or it should um you know use certain + +00:06:20.199 --> 00:06:22.960 +libraries or something like that are + +00:06:21.520 --> 00:06:24.840 +also constraints that you could add I + +00:06:22.960 --> 00:06:26.120 +didn't put that on this slide here that + +00:06:24.840 --> 00:06:28.319 +might come in the natural language + +00:06:26.120 --> 00:06:30.639 +description but it could be something + +00:06:28.319 --> 00:06:32.759 +separate and then you know the output is + +00:06:30.639 --> 00:06:36.759 +whatever code you want + +00:06:32.759 --> 00:06:38.240 +to so um how many people are using like + +00:06:36.759 --> 00:06:41.000 +GitHub + +00:06:38.240 --> 00:06:46.160 +co-pilot like what + +00:06:41.000 --> 00:06:47.759 +percentage maybe about half okay um how + +00:06:46.160 --> 00:06:49.840 +many people are using another like + +00:06:47.759 --> 00:06:56.080 +assisted coding tool other than GitHub + +00:06:49.840 --> 00:06:57.400 +coet yeah g gp4 gp4 is an could be an + +00:06:56.080 --> 00:06:58.680 +assisted coding tool I'm talking more + +00:06:57.400 --> 00:07:02.400 +like something that's actually in your + +00:06:58.680 --> 00:07:04.759 +IDE something yeah anybody + +00:07:02.400 --> 00:07:07.680 +else does anyone use + +00:07:04.759 --> 00:07:13.639 +cursor no + +00:07:07.680 --> 00:07:18.039 +um yeah cursor yeah okay so + +00:07:13.639 --> 00:07:20.919 +yeah Co collab uh Ai and collab yeah so + +00:07:18.039 --> 00:07:24.080 +um so I think there are a lot of these + +00:07:20.919 --> 00:07:26.879 +uh going around I I use co-pilot myself + +00:07:24.080 --> 00:07:28.639 +I have not used cursor I do use GPD 4 um + +00:07:26.879 --> 00:07:30.599 +and I'll I'll show you an example of how + +00:07:28.639 --> 00:07:32.919 +I use them different + +00:07:30.599 --> 00:07:34.360 +um if you haven't used copilot hopefully + +00:07:32.919 --> 00:07:39.599 +this will + +00:07:34.360 --> 00:07:42.599 +work um I just made a a simple + +00:07:39.599 --> 00:07:42.599 +video + +00:07:43.280 --> 00:07:49.520 +oops okay that's not working but anyway + +00:07:46.159 --> 00:07:51.000 +you um you type your uh you know you + +00:07:49.520 --> 00:07:54.319 +type and it basically completes your + +00:07:51.000 --> 00:07:56.639 +code so this is this is an example here + +00:07:54.319 --> 00:07:58.599 +and I didn't write any of this code + +00:07:56.639 --> 00:08:02.360 +actually I just wrote the comments and + +00:07:58.599 --> 00:08:04.000 +then it filled in the the actual C and + +00:08:02.360 --> 00:08:05.639 +also I didn't exactly check if it's + +00:08:04.000 --> 00:08:08.080 +correct or not + +00:08:05.639 --> 00:08:11.120 +so if there's any mistake it's co + +00:08:08.080 --> 00:08:15.159 +Pilot's fault not my fault but um I it + +00:08:11.120 --> 00:08:15.159 +looked correct to me so + +00:08:15.759 --> 00:08:21.120 +um and oh by the way you get to use it + +00:08:18.120 --> 00:08:22.800 +for free with your CMU account so if you + +00:08:21.120 --> 00:08:24.120 +uh if you don't want to use it but don't + +00:08:22.800 --> 00:08:25.919 +want to pay for it you're and left + +00:08:24.120 --> 00:08:31.639 +because you can use + +00:08:25.919 --> 00:08:36.320 +it um another example uh is gd4 or uh + +00:08:31.639 --> 00:08:38.519 +more recently Cloud 3 um and basically + +00:08:36.320 --> 00:08:40.680 +this can do a different variety of + +00:08:38.519 --> 00:08:43.719 +things so we talked about screenshots + +00:08:40.680 --> 00:08:45.720 +and basically I asked Claude to create a + +00:08:43.719 --> 00:08:48.399 +react app that replicates the claw + +00:08:45.720 --> 00:08:50.240 +interface by giving it a screenshot and + +00:08:48.399 --> 00:08:52.560 +asking it create a react app that looks + +00:08:50.240 --> 00:08:55.200 +like the screenshot and then it gave me + +00:08:52.560 --> 00:09:00.800 +a whole bunch of text and in the end it + +00:08:55.200 --> 00:09:03.320 +started um making this uh container here + +00:09:00.800 --> 00:09:08.040 +um + +00:09:03.320 --> 00:09:11.040 +and this uh it basically is skipping + +00:09:08.040 --> 00:09:12.800 +some of the styling stuff uh because + +00:09:11.040 --> 00:09:14.480 +large language models I I think they're + +00:09:12.800 --> 00:09:16.560 +basically trained so that they don't + +00:09:14.480 --> 00:09:19.959 +give really really long responses + +00:09:16.560 --> 00:09:21.320 +because like if you uh asked for + +00:09:19.959 --> 00:09:23.640 +something that would take a really + +00:09:21.320 --> 00:09:25.519 +really long time and then the model just + +00:09:23.640 --> 00:09:26.880 +complied and gave that to you for a + +00:09:25.519 --> 00:09:29.000 +really really long time it would cost + +00:09:26.880 --> 00:09:30.680 +them a lot of money so I feel like they + +00:09:29.000 --> 00:09:32.440 +they B try to train the models to only + +00:09:30.680 --> 00:09:37.160 +out at like a thousand tokens at a time + +00:09:32.440 --> 00:09:38.959 +or something like that so um it it won't + +00:09:37.160 --> 00:09:40.839 +actually go out and program the whole + +00:09:38.959 --> 00:09:43.120 +project for you but with a little + +00:09:40.839 --> 00:09:44.680 +cajoling if you say okay now implement + +00:09:43.120 --> 00:09:48.519 +this part now implement this part now + +00:09:44.680 --> 00:09:49.959 +implement this part um you uh you can + +00:09:48.519 --> 00:09:53.040 +end up with some pretty interesting + +00:09:49.959 --> 00:09:55.680 +stuff and let me + +00:09:53.040 --> 00:09:57.120 +uh let me see if I can I can show you an + +00:09:55.680 --> 00:10:01.320 +example + +00:09:57.120 --> 00:10:01.320 +so I I know a little bit of + +00:10:01.440 --> 00:10:07.040 +react um the front end framework but I + +00:10:04.240 --> 00:10:09.839 +don't know a whole lot but recently + +00:10:07.040 --> 00:10:14.279 +we've been um working on an open-source + +00:10:09.839 --> 00:10:18.959 +assisted coding app and I most of this + +00:10:14.279 --> 00:10:21.519 +was just written by quad um it's uh I I + +00:10:18.959 --> 00:10:23.079 +said I want an app that on the left side + +00:10:21.519 --> 00:10:26.160 +it has a chat window and then on the + +00:10:23.079 --> 00:10:28.240 +right side it has three uh three panes + +00:10:26.160 --> 00:10:30.120 +one is a terminal one is a planner and + +00:10:28.240 --> 00:10:32.200 +one is a code editor + +00:10:30.120 --> 00:10:33.880 +and um so it gave me something it was + +00:10:32.200 --> 00:10:37.399 +kind of ugly so I said okay make the + +00:10:33.880 --> 00:10:40.639 +background black um change the CSS file + +00:10:37.399 --> 00:10:43.639 +so that um you have like a user icon and + +00:10:40.639 --> 00:10:46.040 +a robot icon and stuff like that and + +00:10:43.639 --> 00:10:49.240 +after this I I wrote very little of this + +00:10:46.040 --> 00:10:51.079 +code I wrote like 1% of this code or + +00:10:49.240 --> 00:10:54.480 +something like that and it's able to to + +00:10:51.079 --> 00:10:57.880 +do these sorts of things for you um so + +00:10:54.480 --> 00:11:01.000 +if you don't like writing front ends + +00:10:57.880 --> 00:11:03.880 +good luck uh or good good news that you + +00:11:01.000 --> 00:11:05.560 +uh can come up with a passable front end + +00:11:03.880 --> 00:11:07.519 +without uh without actually having to + +00:11:05.560 --> 00:11:08.720 +write it nonetheless you know good front + +00:11:07.519 --> 00:11:10.200 +end Engineers will come up with + +00:11:08.720 --> 00:11:13.639 +something much more beautiful than that + +00:11:10.200 --> 00:11:15.880 +so um so basically why do I why did I + +00:11:13.639 --> 00:11:19.959 +want to say this I think um GitHub + +00:11:15.880 --> 00:11:20.839 +co-pilot and Pla or gp4 serve very + +00:11:19.959 --> 00:11:25.200 +different + +00:11:20.839 --> 00:11:27.360 +purposes um GitHub co-pilot is code + +00:11:25.200 --> 00:11:30.160 +completion and it mostly works for + +00:11:27.360 --> 00:11:32.440 +shorter things so it's like your next + +00:11:30.160 --> 00:11:34.760 +thought in your code in code that you + +00:11:32.440 --> 00:11:37.560 +know pretty well something like plot or + +00:11:34.760 --> 00:11:40.639 +gp4 is much better for really long + +00:11:37.560 --> 00:11:44.680 +things um where you want to build like a + +00:11:40.639 --> 00:11:47.040 +full class or something like that and I + +00:11:44.680 --> 00:11:48.480 +also have found that if you're coding in + +00:11:47.040 --> 00:11:50.079 +a language that you're very familiar + +00:11:48.480 --> 00:11:51.560 +with copilot might be more useful + +00:11:50.079 --> 00:11:52.959 +because you want fine grain control and + +00:11:51.560 --> 00:11:55.040 +you want it to fill out things to make + +00:11:52.959 --> 00:11:56.519 +it faster whereas if you're coding in a + +00:11:55.040 --> 00:11:58.040 +language that you're not very familiar + +00:11:56.519 --> 00:11:59.680 +with something like Claud is good + +00:11:58.040 --> 00:12:01.839 +because you can write a whole you know + +00:11:59.680 --> 00:12:04.800 +program forties so these are the + +00:12:01.839 --> 00:12:07.680 +differences another thing is GitHub + +00:12:04.800 --> 00:12:09.240 +co-pilot needs to be frighteningly fast + +00:12:07.680 --> 00:12:10.839 +because it needs to move at the speed + +00:12:09.240 --> 00:12:12.880 +that like programmers are thinking in + +00:12:10.839 --> 00:12:14.920 +programming next whereas something like + +00:12:12.880 --> 00:12:16.800 +Claud it doesn't you know using it in + +00:12:14.920 --> 00:12:18.880 +the way that I use cloud here doesn't + +00:12:16.800 --> 00:12:22.600 +really matter because I can say uh + +00:12:18.880 --> 00:12:24.079 +programing me a you know a web app and + +00:12:22.600 --> 00:12:25.360 +then I can go and have dinner and come + +00:12:24.079 --> 00:12:28.199 +back and have a web app and I'd be + +00:12:25.360 --> 00:12:31.720 +perfectly happy with that right so um + +00:12:28.199 --> 00:12:37.199 +the latency request are also + +00:12:31.720 --> 00:12:37.199 +different cool um any any questions here + +00:12:37.399 --> 00:12:42.600 +yeah that debugging code they + +00:12:43.000 --> 00:12:47.959 +are the well so + +00:12:45.839 --> 00:12:50.760 +co-pilot I haven't actually tried it + +00:12:47.959 --> 00:12:52.480 +that much um if I wanted to debug code + +00:12:50.760 --> 00:12:54.880 +I'd probably use something like pla or + +00:12:52.480 --> 00:12:56.360 +gp4 just because actually I'll I'll + +00:12:54.880 --> 00:12:58.320 +mention this in a second but co-pilot's + +00:12:56.360 --> 00:13:00.360 +a much smaller model uh because it needs + +00:12:58.320 --> 00:13:01.839 +to be very fast or what they're using in + +00:13:00.360 --> 00:13:04.040 +copilot is a smaller model because it + +00:13:01.839 --> 00:13:05.519 +needs to be very fast so I would + +00:13:04.040 --> 00:13:08.360 +probably use a bigger model for anything + +00:13:05.519 --> 00:13:10.120 +that required like good understanding I + +00:13:08.360 --> 00:13:11.480 +think it's passable at debugging code + +00:13:10.120 --> 00:13:13.079 +but it won't find the really difficult + +00:13:11.480 --> 00:13:15.639 +things and it probably won't find things + +00:13:13.079 --> 00:13:18.279 +that require spanning across uh multiple + +00:13:15.639 --> 00:13:21.240 +files but I I'm not 100% sure about that + +00:13:18.279 --> 00:13:25.519 +like I think it's worth + +00:13:21.240 --> 00:13:25.519 +testing um any other + +00:13:25.880 --> 00:13:30.120 +questions okay so if I haven't convinced + +00:13:28.360 --> 00:13:32.360 +you that as software developers you + +00:13:30.120 --> 00:13:34.880 +should be using this hopefully this next + +00:13:32.360 --> 00:13:37.480 +uh this next slide will so this was a + +00:13:34.880 --> 00:13:41.199 +study that was run by GitHub uh shortly + +00:13:37.480 --> 00:13:43.160 +after um after co-pilot came out and so + +00:13:41.199 --> 00:13:45.440 +why do we do code generation why are + +00:13:43.160 --> 00:13:47.240 +people very excited about it so the + +00:13:45.440 --> 00:13:50.240 +first is U making software isn't + +00:13:47.240 --> 00:13:53.480 +important um and I recently calculated + +00:13:50.240 --> 00:13:55.920 +what from some Labor Statistics and the + +00:13:53.480 --> 00:13:59.440 +total amount that software developers + +00:13:55.920 --> 00:14:01.880 +make um in a year is $175 billion so + +00:13:59.440 --> 00:14:05.000 +that's providing at least that much you + +00:14:01.880 --> 00:14:06.800 +know value so it's a very high value uh + +00:14:05.000 --> 00:14:09.079 +profession so if we could make it faster + +00:14:06.800 --> 00:14:11.480 +you know it would have even more + +00:14:09.079 --> 00:14:12.920 +value another thing is code generation + +00:14:11.480 --> 00:14:15.680 +leads to large improvements in + +00:14:12.920 --> 00:14:17.160 +productivity so uh get Hub ran this + +00:14:15.680 --> 00:14:18.680 +study where they randomly assigned + +00:14:17.160 --> 00:14:21.519 +developers to groups who would either + +00:14:18.680 --> 00:14:24.440 +use co-pilot or not use co-pilot and + +00:14:21.519 --> 00:14:26.480 +they assigned them the same task and + +00:14:24.440 --> 00:14:30.759 +basically the people who use copilot + +00:14:26.480 --> 00:14:34.199 +their rate of um completion went up by + +00:14:30.759 --> 00:14:36.320 +8% and they finished um in about 40% of + +00:14:34.199 --> 00:14:39.279 +the time of the people who didn't use it + +00:14:36.320 --> 00:14:43.639 +and so I think this + +00:14:39.279 --> 00:14:45.920 +is or uh yeah they say 55% less times so + +00:14:43.639 --> 00:14:47.759 +this is very impressive but it's also + +00:14:45.920 --> 00:14:50.199 +not at all surprising if you're using a + +00:14:47.759 --> 00:14:52.880 +Cod like assisted coding assistant it + +00:14:50.199 --> 00:14:54.360 +just makes you code faster also if you + +00:14:52.880 --> 00:14:56.040 +don't like writing doc strings it's + +00:14:54.360 --> 00:14:57.519 +really good at writing doc strings so + +00:14:56.040 --> 00:14:59.680 +you can write documentation for your + +00:14:57.519 --> 00:15:00.759 +code not wor about so + +00:14:59.680 --> 00:15:04.399 +okay + +00:15:00.759 --> 00:15:07.000 +cool um + +00:15:04.399 --> 00:15:09.720 +so there are differences between code + +00:15:07.000 --> 00:15:14.000 +and natural language uh and I've listed + +00:15:09.720 --> 00:15:15.560 +a few of them here and the differences + +00:15:14.000 --> 00:15:18.120 +between code and natural language also + +00:15:15.560 --> 00:15:20.160 +affect how we build models for this test + +00:15:18.120 --> 00:15:23.160 +so the first one is that code has strict + +00:15:20.160 --> 00:15:26.000 +grammar uh if you make a small mistake + +00:15:23.160 --> 00:15:27.920 +in your code grammar usually it will + +00:15:26.000 --> 00:15:29.839 +just break and your program won't work + +00:15:27.920 --> 00:15:31.319 +so you need to be very careful as + +00:15:29.839 --> 00:15:32.560 +opposed to natural language grammar + +00:15:31.319 --> 00:15:33.600 +where you can make small mistakes and it + +00:15:32.560 --> 00:15:36.120 +doesn't make a + +00:15:33.600 --> 00:15:40.120 +difference another thing is in code you + +00:15:36.120 --> 00:15:42.720 +know the semantic flow of the code and + +00:15:40.120 --> 00:15:44.160 +so we know that certain variables + +00:15:42.720 --> 00:15:45.560 +correspond to each other we know that + +00:15:44.160 --> 00:15:48.639 +they're flowing through the program in a + +00:15:45.560 --> 00:15:50.880 +certain way another thing is code is + +00:15:48.639 --> 00:15:54.120 +executable so we can actually execute it + +00:15:50.880 --> 00:15:56.199 +and observe the result unlike in natural + +00:15:54.120 --> 00:16:00.000 +language and another important thing is + +00:15:56.199 --> 00:16:03.399 +code is created incrementally so code is + +00:16:00.000 --> 00:16:05.680 +not you know unlike text text is also + +00:16:03.399 --> 00:16:07.399 +created incrementally but it's not + +00:16:05.680 --> 00:16:08.720 +usually you write it once you might + +00:16:07.399 --> 00:16:11.199 +revise it a little bit and then you're + +00:16:08.720 --> 00:16:14.040 +done and you you don't need to touch it + +00:16:11.199 --> 00:16:15.399 +again but um in code you touch it over + +00:16:14.040 --> 00:16:17.800 +and over and over again as you develop a + +00:16:15.399 --> 00:16:17.800 +sof + +00:16:18.040 --> 00:16:23.040 +project so if we look at code Generation + +00:16:21.079 --> 00:16:27.079 +Um I would like to talk a little bit + +00:16:23.040 --> 00:16:29.079 +about uh subtasks and data sets next so + +00:16:27.079 --> 00:16:30.480 +the most famous data set for a Cod code + +00:16:29.079 --> 00:16:34.279 +generation nowadays is something called + +00:16:30.480 --> 00:16:38.680 +human ofel um this is a very nice data + +00:16:34.279 --> 00:16:42.480 +set um for a number of reasons uh I + +00:16:38.680 --> 00:16:44.240 +think it is used too much um nonetheless + +00:16:42.480 --> 00:16:46.759 +and I I think there are better data sets + +00:16:44.240 --> 00:16:51.240 +that we maybe should be using more but + +00:16:46.759 --> 00:16:54.000 +basically human ofel is um it has + +00:16:51.240 --> 00:16:55.920 +examples of usage of the Python standard + +00:16:54.000 --> 00:16:59.360 +Library where some are easier some are + +00:16:55.920 --> 00:17:02.880 +harder and just to give some examples + +00:16:59.360 --> 00:17:06.760 +uh we're saying given a nonempty list of + +00:17:02.880 --> 00:17:10.480 +integers return the sum of all the odd + +00:17:06.760 --> 00:17:12.959 +elements that are in even positions so + +00:17:10.480 --> 00:17:16.079 +it's kind of like a elite code + +00:17:12.959 --> 00:17:19.199 +style you know program but maybe one of + +00:17:16.079 --> 00:17:22.400 +the easier ones and then in order to + +00:17:19.199 --> 00:17:25.240 +solve that you find all of the put + +00:17:22.400 --> 00:17:28.480 +elements in even positions and then you + +00:17:25.240 --> 00:17:29.679 +only return them if uh the value itself + +00:17:28.480 --> 00:17:32.799 +is + +00:17:29.679 --> 00:17:34.200 +um so like you can do that in a oneliner + +00:17:32.799 --> 00:17:36.600 +but you need to think about it a little + +00:17:34.200 --> 00:17:38.919 +bit um and then you have + +00:17:36.600 --> 00:17:43.120 +more + +00:17:38.919 --> 00:17:43.810 +um returns encoded uh sorry takes an + +00:17:43.120 --> 00:17:46.910 +input + +00:17:43.810 --> 00:17:46.910 +[Music] + +00:17:47.160 --> 00:17:50.919 +string yeah actually sorry this is from + +00:17:49.320 --> 00:17:53.600 +the paper I didn't read it before I copy + +00:17:50.919 --> 00:17:57.080 +pasted it in here but um yeah that's a + +00:17:53.600 --> 00:17:58.880 +decoding one and one one thing about + +00:17:57.080 --> 00:18:02.240 +this uh that's important to know is it + +00:17:58.880 --> 00:18:04.200 +only has 164 examples so it's actually a + +00:18:02.240 --> 00:18:07.600 +relatively small number of + +00:18:04.200 --> 00:18:09.440 +examples um it's also just the python + +00:18:07.600 --> 00:18:11.200 +standard Library so it's not testing + +00:18:09.440 --> 00:18:14.960 +usage of any other + +00:18:11.200 --> 00:18:17.520 +libraries um so these two things + +00:18:14.960 --> 00:18:19.720 +together make it not the most realistic + +00:18:17.520 --> 00:18:21.880 +you know examination of your programming + +00:18:19.720 --> 00:18:23.640 +skills just like leak code is not the + +00:18:21.880 --> 00:18:25.640 +most realistic examination of your + +00:18:23.640 --> 00:18:28.240 +programming skills but you know I don't + +00:18:25.640 --> 00:18:31.720 +know companies use it anyway so maybe + +00:18:28.240 --> 00:18:35.159 +human devel is reasonable but um so then + +00:18:31.720 --> 00:18:37.120 +we go um into the inputs and outputs uh + +00:18:35.159 --> 00:18:40.679 +the inputs and outputs usually include a + +00:18:37.120 --> 00:18:43.440 +doc string um some input and output + +00:18:40.679 --> 00:18:47.640 +examples and then they have tests to + +00:18:43.440 --> 00:18:47.640 +verify the accuracy of your + +00:18:47.880 --> 00:18:52.840 +outputs so the metric that's used to + +00:18:50.559 --> 00:18:58.919 +evaluate these systems is something + +00:18:52.840 --> 00:19:01.400 +called passet K and the basic idea is um + +00:18:58.919 --> 00:19:03.400 +we generate K examples will at least one + +00:19:01.400 --> 00:19:06.960 +of them pass the unit + +00:19:03.400 --> 00:19:10.720 +tests and the idea here is + +00:19:06.960 --> 00:19:13.480 +that if we have models we might want to + +00:19:10.720 --> 00:19:14.960 +generate like well there there's a + +00:19:13.480 --> 00:19:17.480 +couple reasons why we would care about + +00:19:14.960 --> 00:19:19.880 +this pass it one is kind of obvious + +00:19:17.480 --> 00:19:23.200 +because we generate one and then we + +00:19:19.880 --> 00:19:26.480 +measure how um you know how likely it is + +00:19:23.200 --> 00:19:29.280 +to pass unit tests but pass it five why + +00:19:26.480 --> 00:19:30.760 +would we care about passet five well + +00:19:29.280 --> 00:19:32.159 +number one maybe you could show five + +00:19:30.760 --> 00:19:34.240 +programs to a person and they could + +00:19:32.159 --> 00:19:37.039 +choose the one that they like the best + +00:19:34.240 --> 00:19:39.919 +or maybe you could have unit test write + +00:19:37.039 --> 00:19:41.720 +unit tests in advance and then generate + +00:19:39.919 --> 00:19:43.880 +five programs check which one pass the + +00:19:41.720 --> 00:19:45.480 +unit tests and then use the ones only + +00:19:43.880 --> 00:19:48.360 +that pass the unit test or something + +00:19:45.480 --> 00:19:51.000 +like that so there's also some interest + +00:19:48.360 --> 00:19:53.320 +in uh whether you could generate you + +00:19:51.000 --> 00:19:54.600 +know multiple examples and then pick a + +00:19:53.320 --> 00:19:56.919 +good + +00:19:54.600 --> 00:19:59.080 +one there's a little bit of nuance in + +00:19:56.919 --> 00:20:02.120 +how this is actually calculated so + +00:19:59.080 --> 00:20:04.240 +basically um if you generate only K like + +00:20:02.120 --> 00:20:05.960 +if you if you sample only one example + +00:20:04.240 --> 00:20:07.400 +there's a lot of variance in whether you + +00:20:05.960 --> 00:20:10.159 +get it right or not so what they + +00:20:07.400 --> 00:20:13.440 +actually do is they generate like 10 + +00:20:10.159 --> 00:20:15.600 +outputs or 200 outputs and then they + +00:20:13.440 --> 00:20:18.159 +calculate the expected number of those + +00:20:15.600 --> 00:20:20.320 +that the expected number of cases where + +00:20:18.159 --> 00:20:23.280 +that would pass by just doing a little + +00:20:20.320 --> 00:20:25.440 +bit of uh like math calculating the + +00:20:23.280 --> 00:20:28.679 +number of combinations where one passes + +00:20:25.440 --> 00:20:30.720 +or one doesn't and here k n is the total + +00:20:28.679 --> 00:20:34.240 +number you generate C is the number of + +00:20:30.720 --> 00:20:36.520 +correct ansers and K is uh your passive + +00:20:34.240 --> 00:20:36.520 +K + +00:20:37.159 --> 00:20:43.360 +value + +00:20:38.919 --> 00:20:46.280 +cool um so any any questions about + +00:20:43.360 --> 00:20:47.880 +these you'll you'll see a bunch of uh + +00:20:46.280 --> 00:20:50.520 +people evaluating on this human ofel + +00:20:47.880 --> 00:20:52.760 +with passive K including all of the you + +00:20:50.520 --> 00:20:57.520 +know new llms that come out it's a very + +00:20:52.760 --> 00:20:57.520 +standard Edge yeah + +00:21:01.760 --> 00:21:06.039 +is yeah that that's a good um question I + +00:21:04.919 --> 00:21:07.840 +think I'm going to cover that a little + +00:21:06.039 --> 00:21:11.039 +bit later but I might as well say it now + +00:21:07.840 --> 00:21:13.640 +so llms + +00:21:11.039 --> 00:21:15.080 +are llms are good at code because they + +00:21:13.640 --> 00:21:16.880 +intentionally include a lot of code + +00:21:15.080 --> 00:21:19.520 +training data in LL training and the + +00:21:16.880 --> 00:21:22.679 +reason for that is twofold um the first + +00:21:19.520 --> 00:21:25.320 +one is that code generation is a huge + +00:21:22.679 --> 00:21:26.960 +application of llms right now and like + +00:21:25.320 --> 00:21:28.679 +if you had an llm that couldn't do code + +00:21:26.960 --> 00:21:32.320 +generation it'd be kind of embarrassing + +00:21:28.679 --> 00:21:33.960 +so um Everybody includes this number two + +00:21:32.320 --> 00:21:36.600 +uh code has been shown to improve kind + +00:21:33.960 --> 00:21:38.080 +of the reasoning abilities of llms and + +00:21:36.600 --> 00:21:41.640 +because of that people include code for + +00:21:38.080 --> 00:21:43.440 +that purpose so yeah um it's not that + +00:21:41.640 --> 00:21:45.600 +LMS are inherently good at code or + +00:21:43.440 --> 00:21:48.840 +anything it's that they have lots of + +00:21:45.600 --> 00:21:51.640 +lots of code TR and I'll I'll explain + +00:21:48.840 --> 00:21:54.279 +exactly how they construct this + +00:21:51.640 --> 00:21:57.200 +St and actually if you remember last + +00:21:54.279 --> 00:21:59.640 +time uh I talked about the pile which + +00:21:57.200 --> 00:22:01.039 +was or not last time but uh when I + +00:21:59.640 --> 00:22:03.159 +talked about the tour of large language + +00:22:01.039 --> 00:22:06.360 +models I talked about the pile and the + +00:22:03.159 --> 00:22:09.799 +pile is almost half toe for + +00:22:06.360 --> 00:22:12.000 +example cool any other + +00:22:09.799 --> 00:22:17.240 +questions + +00:22:12.000 --> 00:22:19.320 +okay so another uh a first Improvement + +00:22:17.240 --> 00:22:22.080 +or at least change that we can make to + +00:22:19.320 --> 00:22:23.880 +human ofel is uh going to broader + +00:22:22.080 --> 00:22:26.720 +domains and covering a broader variety + +00:22:23.880 --> 00:22:28.559 +of libraries and this is a data set that + +00:22:26.720 --> 00:22:30.880 +we created actually a long time ago but + +00:22:28.559 --> 00:22:33.799 +but we recently added execution based + +00:22:30.880 --> 00:22:36.159 +evaluation to it it's called konola and + +00:22:33.799 --> 00:22:36.919 +the execution based uh evaluation one is + +00:22:36.159 --> 00:22:40.360 +called + +00:22:36.919 --> 00:22:43.039 +odex and basically what we did here is + +00:22:40.360 --> 00:22:45.720 +we scraped data from stack Overflow + +00:22:43.039 --> 00:22:48.039 +including uh inputs and output uh + +00:22:45.720 --> 00:22:50.559 +Solutions and then based on this scraped + +00:22:48.039 --> 00:22:54.240 +data we uh did some manual curation to + +00:22:50.559 --> 00:22:57.640 +turn these into like actual questions um + +00:22:54.240 --> 00:22:59.640 +and answers about how you could write uh + +00:22:57.640 --> 00:23:01.799 +solve programming + +00:22:59.640 --> 00:23:04.080 +problems and + +00:23:01.799 --> 00:23:05.600 +um because this is scraped from stack + +00:23:04.080 --> 00:23:09.159 +Overflow there's no restriction that + +00:23:05.600 --> 00:23:10.520 +this is from the python standard Library + +00:23:09.159 --> 00:23:13.200 +which also means that it can cover a + +00:23:10.520 --> 00:23:14.919 +very wide variety of libraries and it's + +00:23:13.200 --> 00:23:16.760 +approximately according to the + +00:23:14.919 --> 00:23:20.320 +popularity of the libraries because we + +00:23:16.760 --> 00:23:24.159 +took popular posts so um that's a a good + +00:23:20.320 --> 00:23:25.400 +thing uh you know it it is a reasonable + +00:23:24.159 --> 00:23:26.559 +way to come up with a realistic + +00:23:25.400 --> 00:23:29.520 +distribution of libraries that you + +00:23:26.559 --> 00:23:31.799 +should be looking at um odex adds + +00:23:29.520 --> 00:23:34.159 +execution based evaluation previously + +00:23:31.799 --> 00:23:36.679 +what we had was we only had the snippet + +00:23:34.159 --> 00:23:40.600 +that was able to solve the problem as + +00:23:36.679 --> 00:23:42.360 +opposed to um as opposed to being able + +00:23:40.600 --> 00:23:46.880 +to execute unit + +00:23:42.360 --> 00:23:49.440 +tests and just to show how this has a + +00:23:46.880 --> 00:23:52.000 +broader variety of libraries on the top + +00:23:49.440 --> 00:23:53.919 +we have the distribution of odex + +00:23:52.000 --> 00:23:57.320 +libraries and we can see about half of + +00:23:53.919 --> 00:23:59.600 +them use libraries and this includes a + +00:23:57.320 --> 00:24:01.279 +variety of things including pandas + +00:23:59.600 --> 00:24:04.799 +numpy + +00:24:01.279 --> 00:24:06.400 +um reg o selections you know all of + +00:24:04.799 --> 00:24:09.279 +these should be libraries that look + +00:24:06.400 --> 00:24:14.559 +familiar to you um in contrast if we + +00:24:09.279 --> 00:24:17.200 +look at human eval human eval is right + +00:24:14.559 --> 00:24:18.840 +here so you can see almost all of the + +00:24:17.200 --> 00:24:20.600 +questions require no libraries and all + +00:24:18.840 --> 00:24:22.120 +of the other ones require libraries that + +00:24:20.600 --> 00:24:24.360 +were included in the pipe onstead + +00:24:22.120 --> 00:24:27.640 +libraries so + +00:24:24.360 --> 00:24:29.120 +um in reality this is probably more what + +00:24:27.640 --> 00:24:30.120 +your program in queries are going to + +00:24:29.120 --> 00:24:31.240 +look like they're not going to look like + +00:24:30.120 --> 00:24:33.600 +lead code they're going to look like + +00:24:31.240 --> 00:24:33.600 +using + +00:24:35.360 --> 00:24:42.080 +APS so um originally when we did conal + +00:24:40.039 --> 00:24:44.200 +we didn't use execution based evaluation + +00:24:42.080 --> 00:24:47.480 +because creating unit tests uh for lots + +00:24:44.200 --> 00:24:51.360 +of stack Overflow posts is hard + +00:24:47.480 --> 00:24:53.640 +um specifically there's two issues the + +00:24:51.360 --> 00:24:55.000 +first one is that it requires that code + +00:24:53.640 --> 00:24:58.880 +be easily + +00:24:55.000 --> 00:25:02.320 +executable um now think about + +00:24:58.880 --> 00:25:04.559 +how you would do that for Matt plot lib + +00:25:02.320 --> 00:25:06.200 +for example how would you create a unit + +00:25:04.559 --> 00:25:08.080 +test to test whether Matt plot lib + +00:25:06.200 --> 00:25:10.760 +successfully created a bar chart for + +00:25:08.080 --> 00:25:12.440 +something it's kind of tough right you + +00:25:10.760 --> 00:25:13.840 +like you would have to get the image and + +00:25:12.440 --> 00:25:16.919 +you'd have to confirm that the image was + +00:25:13.840 --> 00:25:21.200 +a bar chart and uh other things like + +00:25:16.919 --> 00:25:22.720 +that um even worse what if it was uh + +00:25:21.200 --> 00:25:25.600 +kind of like a server framework like + +00:25:22.720 --> 00:25:27.440 +ajango how would you confirm that ajango + +00:25:25.600 --> 00:25:30.559 +you know server is working appropriately + +00:25:27.440 --> 00:25:32.600 +and that's kind of tricky so um actually + +00:25:30.559 --> 00:25:34.480 +coming up with realistic unit tests for + +00:25:32.600 --> 00:25:36.919 +real programs can be + +00:25:34.480 --> 00:25:38.840 +difficult um another problem with + +00:25:36.919 --> 00:25:41.640 +execution based evaluation is it ignores + +00:25:38.840 --> 00:25:45.320 +stylistic considerations so I could + +00:25:41.640 --> 00:25:48.279 +write very spaghetti like very spaghetti + +00:25:45.320 --> 00:25:50.200 +code and as long as it executed properly + +00:25:48.279 --> 00:25:52.559 +it would still be judged as correct and + +00:25:50.200 --> 00:25:54.399 +sometimes that's actually an issue so + +00:25:52.559 --> 00:25:56.360 +usually it's not a problem because + +00:25:54.399 --> 00:25:58.600 +language models write reasonably good + +00:25:56.360 --> 00:26:00.600 +code but sometimes you want to match the + +00:25:58.600 --> 00:26:05.039 +or other things like that + +00:26:00.600 --> 00:26:06.559 +so some alternatives are blue score + +00:26:05.039 --> 00:26:09.000 +which we've talked about before it's + +00:26:06.559 --> 00:26:12.679 +basically count calculating the engram + +00:26:09.000 --> 00:26:16.919 +overlap between a gold standard human uh + +00:26:12.679 --> 00:26:20.440 +implementation and a uh in the system + +00:26:16.919 --> 00:26:24.000 +output and there's also specifically + +00:26:20.440 --> 00:26:26.480 +adapted methods for evaluating code and + +00:26:24.000 --> 00:26:29.080 +so there's a method called code blue and + +00:26:26.480 --> 00:26:31.360 +basically the way code blue works is it + +00:26:29.080 --> 00:26:35.240 +also considers the syntax and semantic + +00:26:31.360 --> 00:26:37.080 +flow of the code so it measures overlap + +00:26:35.240 --> 00:26:40.120 +between + +00:26:37.080 --> 00:26:42.120 +strings in the original code but it also + +00:26:40.120 --> 00:26:48.640 +considers overlap between the syntax + +00:26:42.120 --> 00:26:53.000 +trees of the code and uh whether the + +00:26:48.640 --> 00:26:56.320 +um these like semantic information flow + +00:26:53.000 --> 00:26:57.919 +graphs look similar so uh all all of + +00:26:56.320 --> 00:26:59.440 +these things work together to calculate + +00:26:57.919 --> 00:27:02.720 +the C + +00:26:59.440 --> 00:27:04.480 +St one thing I I should mention is how + +00:27:02.720 --> 00:27:06.840 +do we get these syntax trees in the + +00:27:04.480 --> 00:27:09.039 +first place um for example if we're + +00:27:06.840 --> 00:27:12.919 +talking about python there's a python + +00:27:09.039 --> 00:27:14.760 +Library uh for ab abstract syntax tree + +00:27:12.919 --> 00:27:16.559 +it's just part of the standard library + +00:27:14.760 --> 00:27:18.320 +and it's necessary to run the python + +00:27:16.559 --> 00:27:20.559 +interpreter so you can just get these + +00:27:18.320 --> 00:27:24.320 +trees directly from the python ASD + +00:27:20.559 --> 00:27:25.880 +Library uh not hard to do uh for this I + +00:27:24.320 --> 00:27:27.840 +forget what they did in the code blue + +00:27:25.880 --> 00:27:30.679 +thing but there are uh analyzers that + +00:27:27.840 --> 00:27:32.120 +allow you to analyze this control FL so + +00:27:30.679 --> 00:27:34.159 +this is taking advantage of the fact + +00:27:32.120 --> 00:27:37.440 +that code is you know predictable it has + +00:27:34.159 --> 00:27:41.480 +predictable syntax and you can you + +00:27:37.440 --> 00:27:43.960 +can6 um one disadvantage of blue and + +00:27:41.480 --> 00:27:45.799 +code blue of course is that you know you + +00:27:43.960 --> 00:27:47.679 +can write two very different looking + +00:27:45.799 --> 00:27:49.559 +programs that actually are both correct + +00:27:47.679 --> 00:27:51.799 +and blue will underestimate the goodness + +00:27:49.559 --> 00:27:54.440 +of those programs so maybe using both of + +00:27:51.799 --> 00:27:57.159 +them together is uh is + +00:27:54.440 --> 00:28:00.120 +appropriate uh if if you can write unit + +00:27:57.159 --> 00:28:00.120 +Test please + +00:28:00.559 --> 00:28:04.279 +um another one which I'll just cover + +00:28:02.600 --> 00:28:05.399 +very briefly we talked about BT score + +00:28:04.279 --> 00:28:08.159 +before when I was talking about + +00:28:05.399 --> 00:28:11.120 +evaluation of uh you know generated text + +00:28:08.159 --> 00:28:13.480 +and there's also code BT score which um + +00:28:11.120 --> 00:28:15.799 +we uh we created here at + +00:28:13.480 --> 00:28:20.080 +CMU and it's basically an embedding + +00:28:15.799 --> 00:28:21.760 +based metric uh to compare code and so + +00:28:20.080 --> 00:28:23.399 +Bert score if you remember basically + +00:28:21.760 --> 00:28:25.679 +what it did is it calculated the coign + +00:28:23.399 --> 00:28:27.840 +similarity between each of the tokens uh + +00:28:25.679 --> 00:28:30.159 +between a generated text and a reference + +00:28:27.840 --> 00:28:34.279 +text we do exactly the same thing for + +00:28:30.159 --> 00:28:36.080 +code um so we calculate the Sim cosine + +00:28:34.279 --> 00:28:39.200 +similarity between tokens for a + +00:28:36.080 --> 00:28:42.960 +reference code and generated + +00:28:39.200 --> 00:28:45.000 +code and we released a model called + +00:28:42.960 --> 00:28:46.559 +codir which was basically Bert but + +00:28:45.000 --> 00:28:49.440 +continued trained on lots and lots of + +00:28:46.559 --> 00:28:51.840 +code uh that allowed us to do that and + +00:28:49.440 --> 00:28:55.480 +um basically we were able to demonstrate + +00:28:51.840 --> 00:28:59.200 +that this gave better correlation both + +00:28:55.480 --> 00:29:01.480 +with final execution accuracy and with + +00:28:59.200 --> 00:29:05.200 +human judgments of whether the the code + +00:29:01.480 --> 00:29:08.000 +was correct and so um some people uh + +00:29:05.200 --> 00:29:09.559 +created a data set of human correctness + +00:29:08.000 --> 00:29:12.559 +judgments and we were able to put a + +00:29:09.559 --> 00:29:14.240 +little better with that as well um why + +00:29:12.559 --> 00:29:15.640 +do we care about correlation with + +00:29:14.240 --> 00:29:17.399 +execution + +00:29:15.640 --> 00:29:20.200 +accuracy + +00:29:17.399 --> 00:29:22.320 +um this is important in the cases when + +00:29:20.200 --> 00:29:23.559 +we can't create unit tests or when + +00:29:22.320 --> 00:29:26.120 +creating unit test would be too + +00:29:23.559 --> 00:29:27.519 +expensive so this gives us a better + +00:29:26.120 --> 00:29:30.640 +approximation for what we would get if + +00:29:27.519 --> 00:29:30.640 +we ran tests + +00:29:39.840 --> 00:29:45.000 +in yeah so we did not we did not + +00:29:42.600 --> 00:29:46.799 +consider code structure here uh would + +00:29:45.000 --> 00:29:48.480 +different variable names affect it yes + +00:29:46.799 --> 00:29:50.159 +different variable names would affect it + +00:29:48.480 --> 00:29:51.799 +but not as much as the other metrics + +00:29:50.159 --> 00:29:53.960 +which is why it's better why it has + +00:29:51.799 --> 00:29:56.720 +better + +00:29:53.960 --> 00:30:00.000 +correlations and like for example + +00:29:56.720 --> 00:30:03.679 +codir I imagine probably gives very + +00:30:00.000 --> 00:30:05.120 +similar representations to I and J just + +00:30:03.679 --> 00:30:07.960 +because they're both used in iterators + +00:30:05.120 --> 00:30:09.039 +all the time whereas uh a normal Burt + +00:30:07.960 --> 00:30:10.960 +model would give very different + +00:30:09.039 --> 00:30:12.760 +representations to I and J right because + +00:30:10.960 --> 00:30:14.960 +I is like a personal pronoun and J is + +00:30:12.760 --> 00:30:17.200 +not so um that's the reason why + +00:30:14.960 --> 00:30:20.399 +continued training would + +00:30:17.200 --> 00:30:24.799 +help cool any other + +00:30:20.399 --> 00:30:26.640 +things okay so another um another place + +00:30:24.799 --> 00:30:29.480 +where code generation can be useful uh + +00:30:26.640 --> 00:30:33.440 +we had the example of collab uh is in + +00:30:29.480 --> 00:30:36.200 +collab notebooks and this or in uh data + +00:30:33.440 --> 00:30:38.519 +science notebooks this paper was by uh + +00:30:36.200 --> 00:30:41.440 +Google so this might actually even be + +00:30:38.519 --> 00:30:43.960 +used in the collab thing because collab + +00:30:41.440 --> 00:30:45.640 +is a Google thing um but data data + +00:30:43.960 --> 00:30:47.320 +science notebooks allow for incremental + +00:30:45.640 --> 00:30:50.519 +implementation I'm sure a lot of people + +00:30:47.320 --> 00:30:53.559 +here or almost everybody here uses them + +00:30:50.519 --> 00:30:55.279 +um and another interesting thing is say + +00:30:53.559 --> 00:30:57.519 +allow for evaluation of code generation + +00:30:55.279 --> 00:30:58.960 +in context uh or incremental code + +00:30:57.519 --> 00:31:00.639 +generation + +00:30:58.960 --> 00:31:02.720 +and so you start out with like a + +00:31:00.639 --> 00:31:04.880 +notebook and then you have AAL + +00:31:02.720 --> 00:31:06.600 +languageand and then youate the output + +00:31:04.880 --> 00:31:09.240 +AAL language command you generate the + +00:31:06.600 --> 00:31:10.799 +output etc etc so this is an extal + +00:31:09.240 --> 00:31:14.519 +example from the STA + +00:31:10.799 --> 00:31:17.519 +set um so this paper is very nice it it + +00:31:14.519 --> 00:31:20.320 +has a lot of uh you know it's a nice + +00:31:17.519 --> 00:31:21.720 +data set one other thing that was really + +00:31:20.320 --> 00:31:24.200 +interesting from this paper is it + +00:31:21.720 --> 00:31:27.919 +demonstrated the problem of data leakage + +00:31:24.200 --> 00:31:29.679 +in evaluating models and this is a Rel + +00:31:27.919 --> 00:31:32.440 +relatively large problem I don't know if + +00:31:29.679 --> 00:31:33.799 +we have a silver bullet solution for + +00:31:32.440 --> 00:31:36.120 +this but it's an important thing to be + +00:31:33.799 --> 00:31:38.120 +aware of uh not just for code generation + +00:31:36.120 --> 00:31:39.639 +but these are examples from code + +00:31:38.120 --> 00:31:43.519 +generation + +00:31:39.639 --> 00:31:45.679 +so here um in the arcade data set they + +00:31:43.519 --> 00:31:48.519 +basically both evaluated existing + +00:31:45.679 --> 00:31:51.720 +notebooks and they evaluated notebooks + +00:31:48.519 --> 00:31:53.279 +that um existing notebooks that they got + +00:31:51.720 --> 00:31:55.960 +from the web and they evaluated + +00:31:53.279 --> 00:31:59.000 +notebooks that they actually created + +00:31:55.960 --> 00:32:00.399 +themselves and there's very very Stark + +00:31:59.000 --> 00:32:02.600 +difference between the notebooks that + +00:32:00.399 --> 00:32:04.440 +were created on the web and the + +00:32:02.600 --> 00:32:07.399 +notebooks that they evaluated themselves + +00:32:04.440 --> 00:32:10.159 +so like most of the code generation + +00:32:07.399 --> 00:32:11.679 +models except for Palm uh which was the + +00:32:10.159 --> 00:32:14.760 +best model when they created this data + +00:32:11.679 --> 00:32:17.360 +set did really poorly or did really well + +00:32:14.760 --> 00:32:21.120 +on the existing data and quite poorly on + +00:32:17.360 --> 00:32:25.279 +the new data um which is probably an + +00:32:21.120 --> 00:32:28.159 +indication of um probably an indication + +00:32:25.279 --> 00:32:29.720 +of the fact that you know this is to + +00:32:28.159 --> 00:32:32.240 +some extent leaked into the training + +00:32:29.720 --> 00:32:35.320 +data of the language models there was + +00:32:32.240 --> 00:32:37.760 +also a very recent + +00:32:35.320 --> 00:32:40.240 +um paper actually I think this might be + +00:32:37.760 --> 00:32:43.159 +2024 there was a very recent paper that + +00:32:40.240 --> 00:32:45.880 +did a similar thing uh where they + +00:32:43.159 --> 00:32:48.440 +evaluated on human ofel and then their + +00:32:45.880 --> 00:32:52.000 +live codebench in live codebench + +00:32:48.440 --> 00:32:55.639 +basically what they did is they tried to + +00:32:52.000 --> 00:32:58.519 +pick problems from Le code and other + +00:32:55.639 --> 00:33:00.519 +websites that were more recent versus + +00:32:58.519 --> 00:33:01.960 +less recent and they have some really + +00:33:00.519 --> 00:33:04.880 +nice graphs in their paper where they + +00:33:01.960 --> 00:33:06.519 +demonstrate that the less recent ones + +00:33:04.880 --> 00:33:08.159 +before the training cut off have like a + +00:33:06.519 --> 00:33:10.080 +high accuracy and then suddenly it drops + +00:33:08.159 --> 00:33:12.639 +right at the trading C off of the the + +00:33:10.080 --> 00:33:13.480 +models so this is something to to be + +00:33:12.639 --> 00:33:17.360 +aware + +00:33:13.480 --> 00:33:20.519 +of and what this figure is showing here + +00:33:17.360 --> 00:33:24.039 +is this figure is showing on the xaxis + +00:33:20.519 --> 00:33:26.840 +pass it one on the Live code bench easy + +00:33:24.039 --> 00:33:28.679 +and then pass it one on human ofel so we + +00:33:26.840 --> 00:33:31.480 +see this kn + +00:33:28.679 --> 00:33:34.039 +correlation between + +00:33:31.480 --> 00:33:35.919 +essentially like passing on life code + +00:33:34.039 --> 00:33:37.399 +bench easy and passing on human ofel + +00:33:35.919 --> 00:33:40.000 +then we have this group of models that + +00:33:37.399 --> 00:33:42.159 +are kind of like up here and these are + +00:33:40.000 --> 00:33:43.960 +ones where basically it's likely that + +00:33:42.159 --> 00:33:46.480 +human ofel leaked into the training data + +00:33:43.960 --> 00:33:48.840 +because they're getting better scores on + +00:33:46.480 --> 00:33:50.919 +human ofel than you would expect that + +00:33:48.840 --> 00:33:53.360 +they get uh you know just looking at + +00:33:50.919 --> 00:33:55.360 +their uh you know performance on another + +00:33:53.360 --> 00:33:57.320 +data set there's also a nice like + +00:33:55.360 --> 00:34:00.000 +analogous one for math reasoning + +00:33:57.320 --> 00:34:01.519 +problems um like this so this is + +00:34:00.000 --> 00:34:03.039 +definitely something to be aware of if + +00:34:01.519 --> 00:34:04.559 +you're looking only at like very + +00:34:03.039 --> 00:34:06.200 +standard benchmarks that people are + +00:34:04.559 --> 00:34:11.159 +trading + +00:34:06.200 --> 00:34:11.159 +in cool um any questions about + +00:34:12.119 --> 00:34:19.240 +this okay um another data set uh that I + +00:34:17.720 --> 00:34:20.599 +I really like the concept of and + +00:34:19.240 --> 00:34:22.919 +recently it's gotten a little bit of + +00:34:20.599 --> 00:34:25.399 +Buzz because it was used in a um an + +00:34:22.919 --> 00:34:28.399 +evaluation of a new coding assistant + +00:34:25.399 --> 00:34:30.480 +called Devon but this is um + +00:34:28.399 --> 00:34:32.240 +something called sbench and it's issues + +00:34:30.480 --> 00:34:34.639 +from GitHub and code + +00:34:32.240 --> 00:34:37.119 +bases uh is the input and you want to + +00:34:34.639 --> 00:34:39.480 +generate a poll request to basically uh + +00:34:37.119 --> 00:34:42.919 +solve these issues and so your input is + +00:34:39.480 --> 00:34:45.800 +like data leak in gbdt due to warm start + +00:34:42.919 --> 00:34:48.800 +this is about non standard then you have + +00:34:45.800 --> 00:34:51.159 +the code base um it generates a PR for + +00:34:48.800 --> 00:34:53.079 +you and then it's run through the unit + +00:34:51.159 --> 00:34:55.919 +tests to see if it passes all the unit + +00:34:53.079 --> 00:34:57.160 +test post PRS so it's very similar to + +00:34:55.919 --> 00:34:59.240 +you know what you would be doing in a + +00:34:57.160 --> 00:35:01.280 +well Main software project you open a + +00:34:59.240 --> 00:35:05.240 +issue and then you open a poll request + +00:35:01.280 --> 00:35:07.800 +to fix an issue um this requires things + +00:35:05.240 --> 00:35:10.240 +like long context understanding um being + +00:35:07.800 --> 00:35:13.200 +able to do very precise implementations + +00:35:10.240 --> 00:35:14.720 +based on large software projects and + +00:35:13.200 --> 00:35:17.920 +right now the state-of-the-art on this + +00:35:14.720 --> 00:35:20.680 +is at about 14% so it's definitely not a + +00:35:17.920 --> 00:35:23.119 +solv problem at all um in the original + +00:35:20.680 --> 00:35:27.920 +paper uh the the state-of-the-art method + +00:35:23.119 --> 00:35:29.400 +was like 6% or something like that so um + +00:35:27.920 --> 00:35:32.079 +I imagine that we're not going to get up + +00:35:29.400 --> 00:35:33.880 +to 90% anytime soon because it's + +00:35:32.079 --> 00:35:35.720 +probably solving the easier ones and the + +00:35:33.880 --> 00:35:37.280 +harder ones are you know far beyond the + +00:35:35.720 --> 00:35:39.920 +ability of any language model we have at + +00:35:37.280 --> 00:35:42.320 +the moment um but I I really like this + +00:35:39.920 --> 00:35:43.960 +Benchmark one caveat if you really like + +00:35:42.320 --> 00:35:45.520 +this Benchmark is that it's kind of + +00:35:43.960 --> 00:35:47.760 +heavy to run so you need to be a little + +00:35:45.520 --> 00:35:51.000 +bit careful uh because you need to pull + +00:35:47.760 --> 00:35:54.280 +in like full repositories to um to run + +00:35:51.000 --> 00:35:56.319 +on so yeah be a little + +00:35:54.280 --> 00:35:57.920 +bit sorry there's so many like + +00:35:56.319 --> 00:35:59.640 +interesting data sets recently in this + +00:35:57.920 --> 00:36:01.079 +area that I I spent a lot of time on + +00:35:59.640 --> 00:36:04.240 +data set so I'll try to go a little bit + +00:36:01.079 --> 00:36:06.200 +more quickly but um uh a final one is + +00:36:04.240 --> 00:36:09.359 +design to code and this is also a very + +00:36:06.200 --> 00:36:11.520 +recent data set um basically the idea is + +00:36:09.359 --> 00:36:16.359 +code generation from websites so your + +00:36:11.520 --> 00:36:18.119 +input is a website and your output is uh + +00:36:16.359 --> 00:36:22.520 +like JavaScript code that implements + +00:36:18.119 --> 00:36:24.960 +that website and or or css or HTML code + +00:36:22.520 --> 00:36:26.880 +that implements the website so I I + +00:36:24.960 --> 00:36:30.119 +really like this because you know it's a + +00:36:26.880 --> 00:36:32.280 +good test bed for multi modal models and + +00:36:30.119 --> 00:36:34.040 +there aren't a whole lot of strong open + +00:36:32.280 --> 00:36:36.160 +source multimodal models that can solve + +00:36:34.040 --> 00:36:36.960 +this at the moment so I think it's kind + +00:36:36.160 --> 00:36:39.720 +of + +00:36:36.960 --> 00:36:41.480 +cool um they also proposed a design to + +00:36:39.720 --> 00:36:43.480 +code model that does the best on this + +00:36:41.480 --> 00:36:47.119 +data set out of uh you know any of the + +00:36:43.480 --> 00:36:47.119 +open source models but it's still far + +00:36:47.400 --> 00:36:53.040 +from and then the question becomes how + +00:36:50.680 --> 00:36:56.079 +do they um evaluate this in the first + +00:36:53.040 --> 00:36:59.440 +place and basically the idea is that + +00:36:56.079 --> 00:37:01.400 +they do highle visual similarity and so + +00:36:59.440 --> 00:37:03.920 +they calculate visual embeddings of the + +00:37:01.400 --> 00:37:06.119 +generated sites and then they also do + +00:37:03.920 --> 00:37:08.240 +lowl element similarity so they try to + +00:37:06.119 --> 00:37:10.440 +identify all of the elements in the + +00:37:08.240 --> 00:37:12.119 +generated web page and make sure that uh + +00:37:10.440 --> 00:37:15.720 +they recall all of the generated + +00:37:12.119 --> 00:37:18.760 +elements so um I think this is nice one + +00:37:15.720 --> 00:37:21.000 +thing if you notice um if you use even + +00:37:18.760 --> 00:37:25.960 +state-ofthe-art like closed models like + +00:37:21.000 --> 00:37:28.040 +CLA 3 or um GPD 4 is they're really bad + +00:37:25.960 --> 00:37:29.440 +at this recall they it can generate + +00:37:28.040 --> 00:37:31.800 +something that looks like maybe a little + +00:37:29.440 --> 00:37:33.839 +bit similar but it will be missing like + +00:37:31.800 --> 00:37:35.720 +the elements the design will be off you + +00:37:33.839 --> 00:37:37.720 +know other stuff like that so I think + +00:37:35.720 --> 00:37:41.079 +even in the closed like strong models + +00:37:37.720 --> 00:37:41.079 +this is not a Sol + +00:37:41.319 --> 00:37:47.079 +problem cool uh + +00:37:45.000 --> 00:37:49.880 +yeah + +00:37:47.079 --> 00:37:51.880 +problem um so why is that a hard problem + +00:37:49.880 --> 00:37:54.200 +for the models I don't actually have a + +00:37:51.880 --> 00:37:57.200 +really confident answer to that but I + +00:37:54.200 --> 00:37:57.200 +think + +00:38:00.240 --> 00:38:05.200 +so one thing I can tell you is that they + +00:38:02.839 --> 00:38:08.839 +are able to + +00:38:05.200 --> 00:38:12.000 +improve um so they're able to generate + +00:38:08.839 --> 00:38:14.720 +something and then I say no that's bad + +00:38:12.000 --> 00:38:16.160 +please like make it better and it's + +00:38:14.720 --> 00:38:17.800 +generally better the second time + +00:38:16.160 --> 00:38:19.920 +especially if you give specific things + +00:38:17.800 --> 00:38:22.319 +like oh uh but the background on the + +00:38:19.920 --> 00:38:25.160 +generated site is white but actually it + +00:38:22.319 --> 00:38:27.599 +should be black and if you think about + +00:38:25.160 --> 00:38:31.480 +like even a skilled human programmer do + +00:38:27.599 --> 00:38:35.119 +you think you could write like website + +00:38:31.480 --> 00:38:37.680 +code and then view it once and then it + +00:38:35.119 --> 00:38:40.319 +would be correct I think you probably + +00:38:37.680 --> 00:38:42.160 +couldn't right and so like we're asking + +00:38:40.319 --> 00:38:44.040 +models to do essentially the same thing + +00:38:42.160 --> 00:38:46.920 +except they're like even worse than us + +00:38:44.040 --> 00:38:48.560 +and you know keeping track of all the V + +00:38:46.920 --> 00:38:50.720 +visual elements and stuff so I think + +00:38:48.560 --> 00:38:52.480 +it's more like this problem probably + +00:38:50.720 --> 00:38:54.720 +just needs iterative refinement + +00:38:52.480 --> 00:38:58.839 +otherwise it's like asking too much of a + +00:38:54.720 --> 00:39:02.640 +model maybe I don't know + +00:38:58.839 --> 00:39:04.520 +cool okay so um let's go into methods + +00:39:02.640 --> 00:39:06.920 +and code generation has some unique + +00:39:04.520 --> 00:39:09.400 +things um the basic method that you can + +00:39:06.920 --> 00:39:11.240 +always use is a code generating LM and + +00:39:09.400 --> 00:39:13.040 +so you feed in previous code or you feed + +00:39:11.240 --> 00:39:16.040 +in whatever context you have into the LM + +00:39:13.040 --> 00:39:18.079 +and you generate um uh from it and + +00:39:16.040 --> 00:39:20.079 +virtually all Serius LMS are trained on + +00:39:18.079 --> 00:39:23.079 +code nowadays like I I just mentioned + +00:39:20.079 --> 00:39:23.079 +before + +00:39:23.119 --> 00:39:29.920 +um one one important thing here is uh + +00:39:28.560 --> 00:39:31.240 +when you're generating if you're + +00:39:29.920 --> 00:39:33.040 +generating for something like code + +00:39:31.240 --> 00:39:34.480 +generation I definitely suggest that you + +00:39:33.040 --> 00:39:36.119 +modify your temperature settings + +00:39:34.480 --> 00:39:38.359 +appropriately and set it to a low + +00:39:36.119 --> 00:39:42.160 +temperature um otherwise you'll get kind + +00:39:38.359 --> 00:39:45.079 +of crazy uh code but if you set it to a + +00:39:42.160 --> 00:39:45.079 +low temperature you can get + +00:39:46.440 --> 00:39:52.160 +better anyway um one really core + +00:39:49.640 --> 00:39:54.240 +capability of code LMS especially ones + +00:39:52.160 --> 00:39:55.599 +that you use in your IDE like uh + +00:39:54.240 --> 00:39:58.160 +co-pilot is + +00:39:55.599 --> 00:40:00.000 +infilling and um + +00:39:58.160 --> 00:40:03.680 +the the paper that proposed this is + +00:40:00.000 --> 00:40:05.920 +actually by Daniel Freed at LTI here and + +00:40:03.680 --> 00:40:09.160 +um + +00:40:05.920 --> 00:40:11.240 +the basically what you want to do often + +00:40:09.160 --> 00:40:13.000 +is you have previous code you have next + +00:40:11.240 --> 00:40:14.680 +code and you want to just fill in like a + +00:40:13.000 --> 00:40:17.960 +line that's missing like you want to add + +00:40:14.680 --> 00:40:19.040 +an extra you know if statement or or + +00:40:17.960 --> 00:40:22.720 +some sort of + +00:40:19.040 --> 00:40:24.880 +modification and so the way that at + +00:40:22.720 --> 00:40:27.000 +least this paper proposed it and the way + +00:40:24.880 --> 00:40:29.800 +that I think most LMS are actually doing + +00:40:27.000 --> 00:40:30.640 +this is they take a standard left to + +00:40:29.800 --> 00:40:33.200 +right + +00:40:30.640 --> 00:40:36.040 +LM and what they want to do is they want + +00:40:33.200 --> 00:40:39.040 +to infill this code chunk and so what + +00:40:36.040 --> 00:40:40.440 +they do is they put a mask in the place + +00:40:39.040 --> 00:40:42.119 +where they want to fill the chunk which + +00:40:40.440 --> 00:40:46.280 +would also be where your cursor is in + +00:40:42.119 --> 00:40:49.960 +your IDE right uh at that point and then + +00:40:46.280 --> 00:40:52.680 +they have Mas to zero and then at the + +00:40:49.960 --> 00:40:57.400 +end they put mask to zero again and then + +00:40:52.680 --> 00:40:59.000 +they output the like you know all of the + +00:40:57.400 --> 00:41:01.040 +code that you want to generate there and + +00:40:59.000 --> 00:41:02.839 +so you can just kind of arbitrarily + +00:41:01.040 --> 00:41:05.480 +generate these trunks by pulling you + +00:41:02.839 --> 00:41:07.000 +know masking out chunks uh putting in + +00:41:05.480 --> 00:41:08.960 +The Mask token and then moving it to the + +00:41:07.000 --> 00:41:10.440 +end of the sequence and then you can + +00:41:08.960 --> 00:41:13.160 +just use a standard left to right Auto + +00:41:10.440 --> 00:41:15.359 +regressive language model to solve this + +00:41:13.160 --> 00:41:17.040 +problem so this is really important if + +00:41:15.359 --> 00:41:18.520 +you want to build like a co-pilot style + +00:41:17.040 --> 00:41:20.160 +thing and all of the code language + +00:41:18.520 --> 00:41:23.680 +models that I talk about at the end of + +00:41:20.160 --> 00:41:23.680 +this class uh use this + +00:41:24.800 --> 00:41:30.440 +technique um another thing is there's + +00:41:28.160 --> 00:41:33.760 +lots of available information uh for + +00:41:30.440 --> 00:41:36.040 +learning coding things um or for solving + +00:41:33.760 --> 00:41:38.880 +coding tasks this includes you know the + +00:41:36.040 --> 00:41:40.440 +current code context of course um also + +00:41:38.880 --> 00:41:41.920 +the description of the issue that you + +00:41:40.440 --> 00:41:45.160 +want to be fixing like if you're solving + +00:41:41.920 --> 00:41:49.240 +a poll request um repo context from + +00:41:45.160 --> 00:41:51.880 +other files um what tabs you have open + +00:41:49.240 --> 00:41:55.920 +uh so that that's also an important + +00:41:51.880 --> 00:41:58.599 +thing and when GitHub co-pilot came out + +00:41:55.920 --> 00:42:01.960 +they didn't really tell you the details + +00:41:58.599 --> 00:42:04.480 +of how they were doing this but um + +00:42:01.960 --> 00:42:09.079 +GitHub co-pilot is written in JavaScript + +00:42:04.480 --> 00:42:11.839 +and uh there was a p PhD student I think + +00:42:09.079 --> 00:42:14.000 +from maybe Georgia Tech or something uh + +00:42:11.839 --> 00:42:16.839 +who or Master student who basically went + +00:42:14.000 --> 00:42:19.160 +in and took the JavaScript and like Dem + +00:42:16.839 --> 00:42:21.839 +minified it and like reverse engineered + +00:42:19.160 --> 00:42:23.640 +what was actually happening um and uh + +00:42:21.839 --> 00:42:26.680 +wrote A Blog about it and this blog is + +00:42:23.640 --> 00:42:28.800 +is great uh so basically what uh + +00:42:26.680 --> 00:42:32.200 +co-pilot was doing which also kind of + +00:42:28.800 --> 00:42:33.839 +gives you a gold standard um way of uh + +00:42:32.200 --> 00:42:36.920 +looking + +00:42:33.839 --> 00:42:39.440 +at uh you know what kind of information + +00:42:36.920 --> 00:42:43.440 +is necessary to create a good model is + +00:42:39.440 --> 00:42:45.240 +first they extract um information for + +00:42:43.440 --> 00:42:47.400 +the prompt given the current document + +00:42:45.240 --> 00:42:49.240 +and the cursor position so they take the + +00:42:47.400 --> 00:42:51.720 +current document where is the cursor and + +00:42:49.240 --> 00:42:54.640 +what is before this and what is after + +00:42:51.720 --> 00:42:56.960 +this um they identify the relative path + +00:42:54.640 --> 00:42:59.960 +of the file and what language it's in so + +00:42:56.960 --> 00:43:01.760 +they they identifi python files or + +00:42:59.960 --> 00:43:04.240 +JavaScript files or + +00:43:01.760 --> 00:43:07.440 +whatever they find the most recently + +00:43:04.240 --> 00:43:09.800 +accessed 20 files in the same language + +00:43:07.440 --> 00:43:12.599 +so like if you've opened 20 tabs they + +00:43:09.800 --> 00:43:15.559 +keep track of which tab you had + +00:43:12.599 --> 00:43:18.280 +open um and then the actual prompt that + +00:43:15.559 --> 00:43:22.119 +they send over includes text that is + +00:43:18.280 --> 00:43:23.640 +before text that's after um similar + +00:43:22.119 --> 00:43:26.520 +files out of the 20 files that you've + +00:43:23.640 --> 00:43:29.480 +opened recently um also information from + +00:43:26.520 --> 00:43:31.760 +imported files and metadata about the + +00:43:29.480 --> 00:43:33.079 +language and the path so all of this is + +00:43:31.760 --> 00:43:37.079 +sent to the + +00:43:33.079 --> 00:43:38.720 +model um and so this is just basically + +00:43:37.079 --> 00:43:40.160 +it's really good prompt engineering + +00:43:38.720 --> 00:43:41.760 +right they're figuring out a good way to + +00:43:40.160 --> 00:43:44.200 +get all of the information that would be + +00:43:41.760 --> 00:43:45.680 +useful uh for getting this model to work + +00:43:44.200 --> 00:43:49.559 +into the + +00:43:45.680 --> 00:43:50.920 +prompt um so I there's much much more + +00:43:49.559 --> 00:43:52.839 +information in this plug it's a really + +00:43:50.920 --> 00:43:57.400 +nice blog if you uh if you want to see + +00:43:52.839 --> 00:43:57.400 +about it but um that's the basic + +00:43:57.640 --> 00:44:00.240 +any any + +00:44:01.240 --> 00:44:07.160 +questions okay + +00:44:03.520 --> 00:44:11.240 +cool yeah is this just what gets sent + +00:44:07.160 --> 00:44:13.520 +over to theot server or does + +00:44:11.240 --> 00:44:15.240 +copilot this is what gets sent over to + +00:44:13.520 --> 00:44:17.920 +the co-pilot server but the way they're + +00:44:15.240 --> 00:44:20.960 +sending it makes me guess that like all + +00:44:17.920 --> 00:44:22.839 +of this is red so like they also are + +00:44:20.960 --> 00:44:24.559 +considering I didn't mention it here but + +00:44:22.839 --> 00:44:26.000 +they're considering the token limit and + +00:44:24.559 --> 00:44:27.599 +other stuff like that so that kind of + +00:44:26.000 --> 00:44:30.760 +makes me feel like this is + +00:44:27.599 --> 00:44:30.760 +actually the + +00:44:32.240 --> 00:44:38.440 +pr uh cool + +00:44:35.359 --> 00:44:41.040 +so another uh thing that you can do is + +00:44:38.440 --> 00:44:42.520 +retrieval based code generation and + +00:44:41.040 --> 00:44:45.640 +retrieval based code + +00:44:42.520 --> 00:44:47.599 +generation uh basically what it does is + +00:44:45.640 --> 00:44:50.920 +it's like rag for code + +00:44:47.599 --> 00:44:53.240 +Generation Um and this has been around + +00:44:50.920 --> 00:44:55.640 +for a while including our work that I + +00:44:53.240 --> 00:44:57.680 +cited here and a few more in in + +00:44:55.640 --> 00:44:59.960 +2018 um + +00:44:57.680 --> 00:45:03.000 +and so one way you can do this is you + +00:44:59.960 --> 00:45:07.160 +can retrieve similar code from online + +00:45:03.000 --> 00:45:09.720 +and then use it to basically prompt a + +00:45:07.160 --> 00:45:11.920 +retrieval augmented language model uh + +00:45:09.720 --> 00:45:14.480 +this is good if you have a model that's + +00:45:11.920 --> 00:45:16.920 +not super good at code in the first + +00:45:14.480 --> 00:45:19.920 +place or you know it's making mistakes + +00:45:16.920 --> 00:45:21.680 +it's also good if you have a large code + +00:45:19.920 --> 00:45:23.040 +base like that's inter internal and you + +00:45:21.680 --> 00:45:24.200 +know the language model was not trained + +00:45:23.040 --> 00:45:26.359 +on it but you still want to use that + +00:45:24.200 --> 00:45:27.559 +code base for code generation so it's + +00:45:26.359 --> 00:45:29.599 +really good if you're working at like a + +00:45:27.559 --> 00:45:32.160 +big company for example that has a very + +00:45:29.599 --> 00:45:33.319 +constant coding style but hasn't trained + +00:45:32.160 --> 00:45:37.160 +its own + +00:45:33.319 --> 00:45:39.720 +LM um also particularly in code there's + +00:45:37.160 --> 00:45:43.559 +also documentation uh which can be + +00:45:39.720 --> 00:45:46.920 +retrieved and so we have new libraries + +00:45:43.559 --> 00:45:51.359 +all the time right and one frustrating + +00:45:46.920 --> 00:45:53.119 +thing when using like uh chat jpt or CLA + +00:45:51.359 --> 00:45:57.400 +or something like that when you're + +00:45:53.119 --> 00:45:59.559 +writing programs is that it can use old + +00:45:57.400 --> 00:46:03.480 +versions of libraries that are no longer + +00:45:59.559 --> 00:46:05.359 +compatible and so um in this paper uh + +00:46:03.480 --> 00:46:08.359 +which this is one of our papers too we + +00:46:05.359 --> 00:46:10.079 +called it DOC prompting um basically the + +00:46:08.359 --> 00:46:13.720 +idea is that + +00:46:10.079 --> 00:46:17.440 +you have your natural language input and + +00:46:13.720 --> 00:46:20.119 +then you look up uh similar thing + +00:46:17.440 --> 00:46:23.240 +similar documentation so you find like + +00:46:20.119 --> 00:46:25.319 +pigment is a general syntax highlighter + +00:46:23.240 --> 00:46:28.160 +uh so you can uh find syntax + +00:46:25.319 --> 00:46:31.160 +highlighting um you can also look up the + +00:46:28.160 --> 00:46:32.640 +lexer you can look up the HTML formatter + +00:46:31.160 --> 00:46:35.119 +and then all of the things that have + +00:46:32.640 --> 00:46:37.000 +similar documentation then you can uh + +00:46:35.119 --> 00:46:39.480 +append that to the prompt and then have + +00:46:37.000 --> 00:46:41.680 +that Genera output and we demonstrate + +00:46:39.480 --> 00:46:43.200 +that this is good both in general but + +00:46:41.680 --> 00:46:44.800 +also it's particularly good when you're + +00:46:43.200 --> 00:46:46.240 +dealing with new libraries that haven't + +00:46:44.800 --> 00:46:48.280 +been seen before or libraries that have + +00:46:46.240 --> 00:46:50.119 +been updated so this is another thing + +00:46:48.280 --> 00:46:53.000 +that you can + +00:46:50.119 --> 00:46:55.720 +do + +00:46:53.000 --> 00:46:57.520 +cool um another thing that you can do + +00:46:55.720 --> 00:47:00.040 +with code that you can't do easily with + +00:46:57.520 --> 00:47:04.040 +natural language is execution + +00:47:00.040 --> 00:47:06.119 +feedback and so this is a a paper where + +00:47:04.040 --> 00:47:09.359 +basically they do something that's + +00:47:06.119 --> 00:47:10.319 +rather simple but they generate multiple + +00:47:09.359 --> 00:47:13.359 +types of + +00:47:10.319 --> 00:47:14.559 +code or multiple instances of code so + +00:47:13.359 --> 00:47:16.880 +they basically sample different + +00:47:14.559 --> 00:47:19.960 +varieties of code and I was talking + +00:47:16.880 --> 00:47:22.720 +about like casset K right uh before + +00:47:19.960 --> 00:47:25.000 +casset K is good if you have some way to + +00:47:22.720 --> 00:47:26.520 +confirm which output is correct like you + +00:47:25.000 --> 00:47:28.040 +already have unit tests and you can run + +00:47:26.520 --> 00:47:29.440 +the unit test and identify which one + +00:47:28.040 --> 00:47:31.839 +passes the unit test or you can have a + +00:47:29.440 --> 00:47:34.160 +human check it but in the case when you + +00:47:31.839 --> 00:47:35.640 +can't do that what can you do and + +00:47:34.160 --> 00:47:38.079 +basically what you can do is you can + +00:47:35.640 --> 00:47:40.800 +execute all of the code Snippets that + +00:47:38.079 --> 00:47:43.839 +the model generated and check if the + +00:47:40.800 --> 00:47:48.520 +outputs overlap with each other and if + +00:47:43.839 --> 00:47:50.680 +you have um you know 30 programs that + +00:47:48.520 --> 00:47:53.680 +all generate very similar outputs then + +00:47:50.680 --> 00:47:55.079 +those outputs you know then that program + +00:47:53.680 --> 00:47:56.520 +is probably correct and then you can + +00:47:55.079 --> 00:48:00.000 +just pick one of them according to some + +00:47:56.520 --> 00:48:02.160 +criteria Ian specifically in this case + +00:48:00.000 --> 00:48:03.960 +they picked the program that has the + +00:48:02.160 --> 00:48:05.599 +lowest base risk like when we talked + +00:48:03.960 --> 00:48:09.040 +about minimum base risk and the decoding + +00:48:05.599 --> 00:48:10.839 +much so um they they basically execute a + +00:48:09.040 --> 00:48:12.800 +lot and then calculate the base risk of + +00:48:10.839 --> 00:48:17.000 +that + +00:48:12.800 --> 00:48:17.000 +that cool um + +00:48:17.680 --> 00:48:24.440 +yeah yeah and so like self consistency + +00:48:21.599 --> 00:48:26.079 +is a variety of Base risk um and they're + +00:48:24.440 --> 00:48:27.640 +using base risk here because outputs + +00:48:26.079 --> 00:48:30.720 +might not be exact the same but being + +00:48:27.640 --> 00:48:30.720 +closer is probably better + +00:48:34.160 --> 00:48:39.040 +than + +00:48:36.760 --> 00:48:40.559 +comp comparison of the code yeah that's + +00:48:39.040 --> 00:48:42.880 +a good question especially if you use + +00:48:40.559 --> 00:48:44.319 +something good like uh code BT score to + +00:48:42.880 --> 00:48:46.280 +do that comparison you might not even + +00:48:44.319 --> 00:48:50.280 +need to that's + +00:48:46.280 --> 00:48:50.280 +that I don't think they did that in + +00:48:50.559 --> 00:48:57.240 +this cool um another interesting thing + +00:48:54.920 --> 00:48:59.760 +um is there's + +00:48:57.240 --> 00:49:04.119 +several lines of work on fixing based on + +00:48:59.760 --> 00:49:06.720 +eror messages so the basic idea is you + +00:49:04.119 --> 00:49:08.160 +generate code you try to run it you get + +00:49:06.720 --> 00:49:13.280 +an airor message from it and then you + +00:49:08.160 --> 00:49:16.200 +feed that back to the llm um in order to + +00:49:13.280 --> 00:49:17.520 +you know correct the error and like llms + +00:49:16.200 --> 00:49:19.119 +if you give them an err and you give + +00:49:17.520 --> 00:49:20.839 +them buggy code they do have some + +00:49:19.119 --> 00:49:24.599 +capacity to do that especially as you + +00:49:20.839 --> 00:49:28.839 +get to theer llm so uh this is kind of a + +00:49:24.599 --> 00:49:31.200 +a nice uh paradigm this paper intercode + +00:49:28.839 --> 00:49:33.880 +actually generalizes this a bit and it's + +00:49:31.200 --> 00:49:38.359 +more recent that's why I cited it here + +00:49:33.880 --> 00:49:40.000 +and uh so this also um like says you can + +00:49:38.359 --> 00:49:42.640 +do single turn code generation you can + +00:49:40.000 --> 00:49:44.960 +also say oh could you please try again + +00:49:42.640 --> 00:49:46.400 +um you can also uh do planning and + +00:49:44.960 --> 00:49:48.160 +solving and other stuff like that so + +00:49:46.400 --> 00:49:49.960 +this is a good kind of like environment + +00:49:48.160 --> 00:49:52.079 +if you're interested in making these + +00:49:49.960 --> 00:49:56.720 +more like interactive coding assistance + +00:49:52.079 --> 00:49:56.720 +for example so you could take a look bre + +00:49:58.359 --> 00:50:03.359 +cool + +00:50:00.119 --> 00:50:07.119 +um another important topic is code + +00:50:03.359 --> 00:50:08.880 +synthesis from input output examples so + +00:50:07.119 --> 00:50:12.319 +actually when you said code generation + +00:50:08.880 --> 00:50:14.760 +or code synthesis like five years ago or + +00:50:12.319 --> 00:50:17.440 +10 years ago a lot of people would think + +00:50:14.760 --> 00:50:19.440 +about this uh so this is actually this + +00:50:17.440 --> 00:50:22.440 +has been around a lot longer than code + +00:50:19.440 --> 00:50:24.160 +synthesis um than serious inquiries into + +00:50:22.440 --> 00:50:27.680 +code synthesis from natural + +00:50:24.160 --> 00:50:30.680 +language um + +00:50:27.680 --> 00:50:33.839 +so basically the way this works is it + +00:50:30.680 --> 00:50:35.319 +can have no natural language whatsoever + +00:50:33.839 --> 00:50:39.119 +um but you still can try to guess the + +00:50:35.319 --> 00:50:42.000 +input from uh input output examples when + +00:50:39.119 --> 00:50:44.319 +would you want to do this so one example + +00:50:42.000 --> 00:50:45.839 +of this is something called flashfill + +00:50:44.319 --> 00:50:48.599 +which has been around for a very long + +00:50:45.839 --> 00:50:51.839 +time in Microsoft Excel and basically + +00:50:48.599 --> 00:50:55.400 +the way it works is you have one column + +00:50:51.839 --> 00:50:58.640 +and um the column might be + +00:50:55.400 --> 00:50:58.640 +like uh + +00:50:59.559 --> 00:51:02.880 +R new + +00:51:03.040 --> 00:51:12.799 +big and uh + +00:51:06.559 --> 00:51:12.799 +else just pick on three because he also + +00:51:14.040 --> 00:51:19.599 +up and so we have this column and then + +00:51:17.160 --> 00:51:19.599 +we have like + +00:51:20.400 --> 00:51:26.760 +gig um and from like one or a couple + +00:51:25.160 --> 00:51:28.400 +examples basically what it does is it + +00:51:26.760 --> 00:51:30.319 +tries to induce a program that can + +00:51:28.400 --> 00:51:33.319 +generate all the other examples properly + +00:51:30.319 --> 00:51:35.599 +so in this particular case that would be + +00:51:33.319 --> 00:51:38.440 +um you know like + +00:51:35.599 --> 00:51:40.480 +split take the first character from the + +00:51:38.440 --> 00:51:43.280 +first one and all of the last one and + +00:51:40.480 --> 00:51:45.280 +then concatenate and then M or something + +00:51:43.280 --> 00:51:48.280 +like that right + +00:51:45.280 --> 00:51:50.079 +um and so this is useful in some cases + +00:51:48.280 --> 00:51:51.599 +like you know in Excel when you have + +00:51:50.079 --> 00:51:53.359 +this long sheet and you want to fill in + +00:51:51.599 --> 00:51:56.160 +the rest of it and this has actually + +00:51:53.359 --> 00:51:57.720 +been deployed uh you know in Excel in + +00:51:56.160 --> 00:52:00.960 +white + +00:51:57.720 --> 00:52:02.559 +used um if you're interested in this + +00:52:00.960 --> 00:52:06.040 +topic there's a fair amount of work in + +00:52:02.559 --> 00:52:08.839 +it um my there's a little bit less work + +00:52:06.040 --> 00:52:10.240 +now because most people are focusing on + +00:52:08.839 --> 00:52:12.400 +uh learning programs from natural + +00:52:10.240 --> 00:52:14.839 +language and other stuff like this but + +00:52:12.400 --> 00:52:16.480 +uh this slightly older Pap paper called + +00:52:14.839 --> 00:52:19.359 +interpret explains a bunch of the + +00:52:16.480 --> 00:52:22.880 +different methods that people used and + +00:52:19.359 --> 00:52:25.920 +um how you uh like how they compare and + +00:52:22.880 --> 00:52:28.119 +stuff and also um Joshua ten and bums + +00:52:25.920 --> 00:52:29.880 +group from MI has done a lot on program + +00:52:28.119 --> 00:52:31.319 +synthesis from input output examples so + +00:52:29.880 --> 00:52:32.359 +you could also take a look at that that + +00:52:31.319 --> 00:52:35.079 +sounds + +00:52:32.359 --> 00:52:38.240 +interesting um one thing about this is + +00:52:35.079 --> 00:52:40.280 +these generally are mostly done on + +00:52:38.240 --> 00:52:43.319 +domain specific languages so they're + +00:52:40.280 --> 00:52:46.839 +mostly done like only for reg X's or + +00:52:43.319 --> 00:52:48.480 +they're done only for you know SQL or + +00:52:46.839 --> 00:52:50.079 +something like that not for the more + +00:52:48.480 --> 00:52:51.960 +general purpose languages just because + +00:52:50.079 --> 00:52:54.079 +the problem without any natural language + +00:52:51.960 --> 00:52:56.520 +specification is harder and so you need + +00:52:54.079 --> 00:52:57.520 +to like make the search space smaller or + +00:52:56.520 --> 00:53:01.559 +Additionally you needed to make the + +00:52:57.520 --> 00:53:04.440 +search small for theable so um that's a + +00:53:01.559 --> 00:53:04.440 +another thing to know + +00:53:04.799 --> 00:53:09.440 +about cool um any questions about + +00:53:09.480 --> 00:53:14.440 +these nice okay so finally in the the + +00:53:12.559 --> 00:53:15.599 +last few minutes I'd like to talk about + +00:53:14.440 --> 00:53:18.480 +um code + +00:53:15.599 --> 00:53:22.880 +LMS and I'm going to go through about + +00:53:18.480 --> 00:53:24.599 +four of them the first one is codex and + +00:53:22.880 --> 00:53:26.200 +so yeah actually what I should mention + +00:53:24.599 --> 00:53:28.079 +is all of the LMS that I talked about up + +00:53:26.200 --> 00:53:30.640 +until this point are code LMS because + +00:53:28.079 --> 00:53:31.680 +every LM trains on code so I'm mainly + +00:53:30.640 --> 00:53:36.119 +going to be talking about one + +00:53:31.680 --> 00:53:39.200 +specifically for code this time um so + +00:53:36.119 --> 00:53:42.480 +codex is the first and kind of like + +00:53:39.200 --> 00:53:45.880 +first really big impact Cod LM um it was + +00:53:42.480 --> 00:53:47.720 +created by open AI um originally I don't + +00:53:45.880 --> 00:53:49.079 +know about the deployed model now + +00:53:47.720 --> 00:53:51.599 +because you know they don't release the + +00:53:49.079 --> 00:53:53.799 +details of it but originally this was + +00:53:51.599 --> 00:53:57.920 +trained by continued training from + +00:53:53.799 --> 00:53:59.799 +gpt3 so they had a text M and then they + +00:53:57.920 --> 00:54:03.079 +just continued training it on lots and + +00:53:59.799 --> 00:54:05.680 +lots of code from GitHub um so yeah the + +00:54:03.079 --> 00:54:08.799 +data was lots of data from GitHub um if + +00:54:05.680 --> 00:54:11.280 +you did anything on GitHub at any point + +00:54:08.799 --> 00:54:14.119 +in your life uh you might be uh + +00:54:11.280 --> 00:54:17.720 +contributing to codep so thank you on + +00:54:14.119 --> 00:54:22.440 +behalf of open AI a 80 billion dollar + +00:54:17.720 --> 00:54:24.599 +company and uh importantly it Powers I + +00:54:22.440 --> 00:54:27.599 +believe it still Powers GitHub + +00:54:24.599 --> 00:54:31.160 +co-pilot one interesting thing is they + +00:54:27.599 --> 00:54:33.119 +had a large version of codex um and then + +00:54:31.160 --> 00:54:35.799 +they had a smaller version of codex + +00:54:33.119 --> 00:54:38.359 +called code kushman and the thing + +00:54:35.799 --> 00:54:40.040 +actually powering GitHub co-pilot is not + +00:54:38.359 --> 00:54:42.839 +the the largest version it's not code Da + +00:54:40.040 --> 00:54:46.359 +Vinci it's code kushman which is uh + +00:54:42.839 --> 00:54:48.680 +smaller and much faster and the reason + +00:54:46.359 --> 00:54:50.640 +why is probably twofold number one um + +00:54:48.680 --> 00:54:54.160 +you need really fast responses when + +00:54:50.640 --> 00:54:55.760 +you're you know working on code and + +00:54:54.160 --> 00:54:57.440 +there's actually in co-pilot there's + +00:54:55.760 --> 00:55:00.280 +some cach and other stuff like that to + +00:54:57.440 --> 00:55:01.960 +make your responses very fast as well um + +00:55:00.280 --> 00:55:03.400 +the second reason is probably it' just + +00:55:01.960 --> 00:55:05.040 +be too expensive for them to run Da + +00:55:03.400 --> 00:55:06.760 +Vinci over all the code bases for how + +00:55:05.040 --> 00:55:10.400 +much they're charging you for co-pilot + +00:55:06.760 --> 00:55:12.119 +so like every single time you like + +00:55:10.400 --> 00:55:14.280 +change something in one of your files if + +00:55:12.119 --> 00:55:17.079 +you're using copilot it's rerunning in + +00:55:14.280 --> 00:55:19.359 +llm and that would become very expensive + +00:55:17.079 --> 00:55:20.599 +if you look look at the token count so I + +00:55:19.359 --> 00:55:21.839 +think they're using a smaller model + +00:55:20.599 --> 00:55:22.920 +because of that but nonetheless it's + +00:55:21.839 --> 00:55:27.039 +very + +00:55:22.920 --> 00:55:28.640 +good um cool + +00:55:27.039 --> 00:55:30.680 +so now I want to get into some more + +00:55:28.640 --> 00:55:33.880 +modern models uh the first one I want to + +00:55:30.680 --> 00:55:35.520 +get into is uh star coder 2 and the + +00:55:33.880 --> 00:55:38.359 +reason why I want to talk about this + +00:55:35.520 --> 00:55:40.160 +first is because uh not necessarily that + +00:55:38.359 --> 00:55:41.880 +it's like absolutely the best one + +00:55:40.160 --> 00:55:43.400 +although it's very good but it's one of + +00:55:41.880 --> 00:55:45.319 +the models that actually tells us + +00:55:43.400 --> 00:55:47.240 +everything about their training data and + +00:55:45.319 --> 00:55:50.400 +training process and stuff so we know uh + +00:55:47.240 --> 00:55:53.039 +everything about them so the creator of + +00:55:50.400 --> 00:55:54.440 +This was um the big science project + +00:55:53.039 --> 00:55:56.880 +which was led by hugging face and + +00:55:54.440 --> 00:55:58.680 +service now um + +00:55:56.880 --> 00:56:02.079 +and includes lots and lots of people + +00:55:58.680 --> 00:56:04.960 +from various universities and things um + +00:56:02.079 --> 00:56:09.319 +the architecture is mostly llama style + +00:56:04.960 --> 00:56:11.960 +it has 3B 7B and 15b variants um one + +00:56:09.319 --> 00:56:15.480 +interesting thing about all code LMS is + +00:56:11.960 --> 00:56:17.680 +that they all do long context they all + +00:56:15.480 --> 00:56:20.359 +do longer context and they all + +00:56:17.680 --> 00:56:23.200 +reconfigure rope for longer context + +00:56:20.359 --> 00:56:25.280 +specifically so you know rope has a + +00:56:23.200 --> 00:56:28.599 +Theta parameter that allows you to tell + +00:56:25.280 --> 00:56:31.720 +how long the um like sign sine waves and + +00:56:28.599 --> 00:56:33.720 +stuff like that are and they all always + +00:56:31.720 --> 00:56:36.079 +um change the parameters so that the + +00:56:33.720 --> 00:56:38.599 +context is longer so that's another good + +00:56:36.079 --> 00:56:38.599 +thing to know + +00:56:38.640 --> 00:56:44.559 +about the the training data section of + +00:56:42.000 --> 00:56:48.799 +this paper is really fascinating I can + +00:56:44.559 --> 00:56:51.240 +like it it's a really good way to look + +00:56:48.799 --> 00:56:54.160 +at you know how much data engineering + +00:56:51.240 --> 00:56:55.960 +goes into making a good model um and + +00:56:54.160 --> 00:56:57.960 +just very shortly they give a lot more + +00:56:55.960 --> 00:57:00.640 +detail in the paper but it's trained on + +00:56:57.960 --> 00:57:04.839 +code uh including the stack which is + +00:57:00.640 --> 00:57:06.920 +just a huge uh amount like repository of + +00:57:04.839 --> 00:57:08.359 +code that I'll talk about in a second + +00:57:06.920 --> 00:57:10.559 +separately from that it was trained on + +00:57:08.359 --> 00:57:13.079 +GitHub issues it was trained on poll + +00:57:10.559 --> 00:57:16.000 +requests Jupiter notebooks keggle + +00:57:13.079 --> 00:57:18.319 +notebooks documentation and also + +00:57:16.000 --> 00:57:23.440 +intermediate representations from uh + +00:57:18.319 --> 00:57:26.440 +llvm so llvm is a uh you know like + +00:57:23.440 --> 00:57:28.920 +intermediate uh compiler style thing + +00:57:26.440 --> 00:57:30.839 +that is used for compiling code and it + +00:57:28.920 --> 00:57:34.400 +was also trained on a few code relevant + +00:57:30.839 --> 00:57:38.440 +natural language data sets + +00:57:34.400 --> 00:57:39.960 +um so for pre-processing they do + +00:57:38.440 --> 00:57:42.640 +something pretty interesting which is + +00:57:39.960 --> 00:57:44.240 +they add metadata tags such as the repo + +00:57:42.640 --> 00:57:48.119 +name and the file name and other stuff + +00:57:44.240 --> 00:57:49.799 +like this uh 50% of the time and they do + +00:57:48.119 --> 00:57:51.599 +this 50% of the time because they want + +00:57:49.799 --> 00:57:54.400 +the model to work with them but also be + +00:57:51.599 --> 00:57:57.079 +robust without them um and so you can + +00:57:54.400 --> 00:57:59.839 +either add them or not add them at test + +00:57:57.079 --> 00:58:03.079 +time uh they also do infilling every + +00:57:59.839 --> 00:58:05.960 +serus code LM does infilling Based + +00:58:03.079 --> 00:58:07.480 +training um one interesting thing about + +00:58:05.960 --> 00:58:08.960 +this from the training perspective is + +00:58:07.480 --> 00:58:12.000 +they actually trained it for four to + +00:58:08.960 --> 00:58:14.359 +five epochs um which is much more than + +00:58:12.000 --> 00:58:17.160 +we normally do so normally we only train + +00:58:14.359 --> 00:58:18.359 +for like one Epoch over you know all of + +00:58:17.160 --> 00:58:20.079 +the data we have but here they were + +00:58:18.359 --> 00:58:21.319 +training for monger and that's just + +00:58:20.079 --> 00:58:23.359 +because the amount of data they can get + +00:58:21.319 --> 00:58:24.400 +for code is less than the amount of data + +00:58:23.359 --> 00:58:27.200 +they can get for all the national + +00:58:24.400 --> 00:58:30.039 +language I + +00:58:27.200 --> 00:58:33.200 +so the data set that they created is uh + +00:58:30.039 --> 00:58:36.119 +the stack 2 and this is a code + +00:58:33.200 --> 00:58:37.839 +pre-training data set um one interesting + +00:58:36.119 --> 00:58:40.039 +thing that they thought about was uh + +00:58:37.839 --> 00:58:42.960 +license considerations so I talked about + +00:58:40.039 --> 00:58:44.480 +the um how copyright is a problem when + +00:58:42.960 --> 00:58:46.640 +trading large language models two + +00:58:44.480 --> 00:58:48.880 +classes ago and so here they + +00:58:46.640 --> 00:58:50.119 +specifically tried to find things with + +00:58:48.880 --> 00:58:52.520 +permissive + +00:58:50.119 --> 00:58:53.880 +licenses and so what they did is they + +00:58:52.520 --> 00:58:57.000 +basically looked at the license on + +00:58:53.880 --> 00:58:59.520 +GitHub um and if the GitHub license was + +00:58:57.000 --> 00:59:01.440 +permissive they marked it as permissive + +00:58:59.520 --> 00:59:02.880 +um then they tried to detect licenses + +00:59:01.440 --> 00:59:05.720 +and then um if all of them were + +00:59:02.880 --> 00:59:08.000 +permissive they marked it as + +00:59:05.720 --> 00:59:10.480 +permissive this is a huge table that + +00:59:08.000 --> 00:59:14.160 +they have in the paper of all of the + +00:59:10.480 --> 00:59:15.480 +data that they have and um you know I'm + +00:59:14.160 --> 00:59:16.920 +not going to go through all of this + +00:59:15.480 --> 00:59:18.920 +obviously but what you can see is some + +00:59:16.920 --> 00:59:22.480 +of the biggest data sets are like + +00:59:18.920 --> 00:59:26.280 +Java um + +00:59:22.480 --> 00:59:28.640 +PHP markdown + +00:59:26.280 --> 00:59:30.039 +and uh Python and other stuff like that + +00:59:28.640 --> 00:59:32.240 +so you can see the major programming + +00:59:30.039 --> 00:59:35.559 +languages have lots of data but there's + +00:59:32.240 --> 00:59:38.400 +also a long tail so if you like your uh + +00:59:35.559 --> 00:59:40.440 +you know more esoteric uh but cool + +00:59:38.400 --> 00:59:43.960 +programming languages like rust yes it + +00:59:40.440 --> 00:59:46.160 +has rust too so um we can do all all of + +00:59:43.960 --> 00:59:46.160 +those + +00:59:46.480 --> 00:59:53.079 +things so the next model that I'd like + +00:59:49.799 --> 00:59:55.200 +to talk about is cod llama and cod llama + +00:59:53.079 --> 00:59:57.920 +is another competitive model it came out + +00:59:55.200 --> 00:59:59.480 +a little bit before star coder and star + +00:59:57.920 --> 01:00:02.680 +coder 2 and deep sea coder which I'm + +00:59:59.480 --> 01:00:04.079 +going to talk about um this is a created + +01:00:02.680 --> 01:00:08.319 +by + +01:00:04.079 --> 01:00:11.160 +meta and um the architecture is the same + +01:00:08.319 --> 01:00:14.280 +as llama 2 uh basically and they did + +01:00:11.160 --> 01:00:16.400 +continued training from llama 2 um but + +01:00:14.280 --> 01:00:18.000 +they trained it on longer input contexts + +01:00:16.400 --> 01:00:21.720 +and they also extended the length of + +01:00:18.000 --> 01:00:23.559 +rope so uh those are you know standard + +01:00:21.720 --> 01:00:26.680 +things for code language + +01:00:23.559 --> 01:00:28.680 +models it was trained on DED code and + +01:00:26.680 --> 01:00:30.400 +also synthetically created instruction + +01:00:28.680 --> 01:00:33.280 +data so they created like instruction + +01:00:30.400 --> 01:00:37.920 +tuning data specifically for + +01:00:33.280 --> 01:00:39.480 +code um and the training was incremental + +01:00:37.920 --> 01:00:42.559 +with various data sets and what I mean + +01:00:39.480 --> 01:00:45.599 +by this is they trained on 500 billion + +01:00:42.559 --> 01:00:47.599 +uh I believe tokens of code and then + +01:00:45.599 --> 01:00:50.400 +they did long context fine tuning on 20 + +01:00:47.599 --> 01:00:52.599 +billion tokens and then they also did + +01:00:50.400 --> 01:00:55.400 +instruction tuning they also have a + +01:00:52.599 --> 01:00:57.079 +python specific one and the reason why + +01:00:55.400 --> 01:00:59.640 +they have a p specific one is not + +01:00:57.079 --> 01:01:02.319 +because python is more import important + +01:00:59.640 --> 01:01:03.839 +uh uh necessarily but because a lot of + +01:01:02.319 --> 01:01:05.559 +the benchmarks are in Python because + +01:01:03.839 --> 01:01:06.920 +machine learning people like who are + +01:01:05.559 --> 01:01:09.240 +creating benchmarks they also like + +01:01:06.920 --> 01:01:11.200 +python so python is more common in the + +01:01:09.240 --> 01:01:14.240 +benchmarks so they basically wanted to + +01:01:11.200 --> 01:01:15.720 +do well on the benchmarks I think uh and + +01:01:14.240 --> 01:01:17.920 +and created a data set that does well in + +01:01:15.720 --> 01:01:19.240 +the benchmarks but um if you are + +01:01:17.920 --> 01:01:23.160 +creating python you can use the code + +01:01:19.240 --> 01:01:25.280 +llama python it's better at pipelines so + +01:01:23.160 --> 01:01:28.000 +um and then the final one I'd like to + +01:01:25.280 --> 01:01:29.839 +talk about is is a deep seek coder uh + +01:01:28.000 --> 01:01:32.079 +this is notable because it's a very + +01:01:29.839 --> 01:01:34.599 +strong model it it's maybe the strongest + +01:01:32.079 --> 01:01:38.799 +model on average over all the code + +01:01:34.599 --> 01:01:41.599 +models um they did 87% the data is not + +01:01:38.799 --> 01:01:44.640 +super clear but they did 87% source code + +01:01:41.599 --> 01:01:46.359 +10% English um from markdown in stock + +01:01:44.640 --> 01:01:51.160 +exchange and 3% Chinese because it's + +01:01:46.359 --> 01:01:53.559 +from a Chinese company deep seek um and + +01:01:51.160 --> 01:01:54.960 +they did standard prepr uh but one + +01:01:53.559 --> 01:01:57.319 +interesting thing they did is they + +01:01:54.960 --> 01:01:59.200 +included Library dependencies so they + +01:01:57.319 --> 01:02:01.799 +basically crawled the dependency graph + +01:01:59.200 --> 01:02:03.640 +of libraries pulled out files from the + +01:02:01.799 --> 01:02:06.000 +libraries that were referenced and then + +01:02:03.640 --> 01:02:07.440 +used them in training and so that's + +01:02:06.000 --> 01:02:09.319 +particularly useful if you want the + +01:02:07.440 --> 01:02:12.920 +model to be able to reference external + +01:02:09.319 --> 01:02:14.039 +libraries well um so that's kind of an + +01:02:12.920 --> 01:02:17.279 +interesting + +01:02:14.039 --> 01:02:19.599 +thing um the architecture is pretty + +01:02:17.279 --> 01:02:22.960 +standard it's llama likee with 1.3 + +01:02:19.599 --> 01:02:24.599 +billion 6.7 billion in 33b variants and + +01:02:22.960 --> 01:02:27.279 +it has a reconfigured work like the + +01:02:24.599 --> 01:02:30.520 +others and they on two trillion + +01:02:27.279 --> 01:02:34.200 +tokens um so then a question becomes + +01:02:30.520 --> 01:02:36.680 +which one to use um and I created a + +01:02:34.200 --> 01:02:39.160 +summary here um all of them have + +01:02:36.680 --> 01:02:40.760 +somewhat similar performance uh this is + +01:02:39.160 --> 01:02:42.760 +they're compared in the star coder 2 + +01:02:40.760 --> 01:02:45.640 +paper so you can go in and look at + +01:02:42.760 --> 01:02:48.160 +details at the starcode to paper um + +01:02:45.640 --> 01:02:51.119 +deeps coder seems to be strong on + +01:02:48.160 --> 01:02:52.799 +standard programming tasks um whereas + +01:02:51.119 --> 01:02:54.799 +star coder seems to be strong on data + +01:02:52.799 --> 01:02:56.680 +science notebooks so like on average + +01:02:54.799 --> 01:02:59.160 +it's better at kind of sound notebooks + +01:02:56.680 --> 01:03:02.079 +but all of them are good models um all + +01:02:59.160 --> 01:03:05.440 +of them are not quite as good as uh like + +01:03:02.079 --> 01:03:08.920 +gp4 quad on like they're very uh you + +01:03:05.440 --> 01:03:10.799 +know more complex tasks but uh they're + +01:03:08.920 --> 01:03:12.359 +available and you can find to them and + +01:03:10.799 --> 01:03:16.880 +do other things like that as + +01:03:12.359 --> 01:03:21.599 +well one caveat about the Deep seek + +01:03:16.880 --> 01:03:24.640 +thing is actually if I go back to this + +01:03:21.599 --> 01:03:27.559 +slide um a lot of the models up here are + +01:03:24.640 --> 01:03:29.640 +deep seek um so you do need to be a + +01:03:27.559 --> 01:03:31.400 +little bit careful about like + +01:03:29.640 --> 01:03:34.400 +interpreting their human Evel results + +01:03:31.400 --> 01:03:36.319 +because it's possible that the model uh + +01:03:34.400 --> 01:03:38.799 +was trained on data very similar to + +01:03:36.319 --> 01:03:40.279 +human eval or something like that so do + +01:03:38.799 --> 01:03:42.880 +take that with a grain of salt but even + +01:03:40.279 --> 01:03:44.520 +on other data sets where presumably the + +01:03:42.880 --> 01:03:46.760 +model has not seen those data sets it + +01:03:44.520 --> 01:03:49.920 +still does very well so it's not like + +01:03:46.760 --> 01:03:51.480 +it's um you know as you can see it's + +01:03:49.920 --> 01:03:54.640 +still one of the most competitive code + +01:03:51.480 --> 01:03:57.680 +models even on this new LCB um data set + +01:03:54.640 --> 01:04:01.359 +so uh that's want into the + +01:03:57.680 --> 01:04:03.000 +a cool um that's all I have for today I + +01:04:01.359 --> 01:04:04.359 +you know I love to talk about this topic + +01:04:03.000 --> 01:04:06.480 +I've done a lot of research on it so I'm + +01:04:04.359 --> 01:04:11.200 +happy to discuss any questions if people + +01:04:06.480 --> 01:04:14.720 +have them either in front of everyone or + +01:04:11.200 --> 01:04:14.720 +after any any + +01:04:16.480 --> 01:04:24.160 +questions uh yeah just wondering there a + +01:04:20.359 --> 01:04:27.720 +like enfor the outut during using things + +01:04:24.160 --> 01:04:27.720 +other than models + +01:04:30.599 --> 01:04:36.599 +yeah great question is there a way to + +01:04:33.640 --> 01:04:38.200 +enforce uh restrictions at decoding time + +01:04:36.599 --> 01:04:39.760 +other than using the model's uh + +01:04:38.200 --> 01:04:42.240 +probabilities because this is code and + +01:04:39.760 --> 01:04:42.240 +we know the + +01:04:42.440 --> 01:04:51.079 +syntax yes and no um there + +01:04:46.319 --> 01:04:53.200 +are for code it's not always immediately + +01:04:51.079 --> 01:04:54.400 +obvious like I mean one one thing you + +01:04:53.200 --> 01:04:55.960 +could do is just generate a bunch of + +01:04:54.400 --> 01:04:58.520 +results and throw out all the syntax + +01:04:55.960 --> 01:04:59.480 +incorrect on that's easy right um but if + +01:04:58.520 --> 01:05:02.520 +you don't want to do that and you want + +01:04:59.480 --> 01:05:04.839 +to do it at decoding time it's dependent + +01:05:02.520 --> 01:05:07.480 +on you being able to have an incremental + +01:05:04.839 --> 01:05:09.079 +syntax parser that allows you to like + +01:05:07.480 --> 01:05:12.400 +throw out bad + +01:05:09.079 --> 01:05:14.160 +hypotheses like incrementally and that's + +01:05:12.400 --> 01:05:16.240 +possible that's very easy for some + +01:05:14.160 --> 01:05:17.200 +languages and not possible not as easy + +01:05:16.240 --> 01:05:20.559 +for other + +01:05:17.200 --> 01:05:23.720 +languages um one really big thing right + +01:05:20.559 --> 01:05:26.599 +now is Json so like a lot of the time + +01:05:23.720 --> 01:05:28.319 +people want to Output Json uh in you + +01:05:26.599 --> 01:05:31.559 +know then par the Json and use it in + +01:05:28.319 --> 01:05:36.640 +some Downstream test and there actually + +01:05:31.559 --> 01:05:36.640 +are libraries um just to give a + +01:05:38.559 --> 01:05:45.839 +few um here's one this Library called + +01:05:42.640 --> 01:05:48.799 +outlines um is one that basically allows + +01:05:45.839 --> 01:05:50.440 +you to incorporate syntactic constraints + +01:05:48.799 --> 01:05:53.240 +through like weighted finite State + +01:05:50.440 --> 01:05:55.160 +automata and other stuff like this um to + +01:05:53.240 --> 01:05:57.680 +allow you to throw away anything that + +01:05:55.160 --> 01:06:02.039 +doesn't here to your grammar another + +01:05:57.680 --> 01:06:02.039 +popular one which + +01:06:02.720 --> 01:06:06.880 +is nice but a little bit more + +01:06:07.160 --> 01:06:12.760 +complicated is + +01:06:09.799 --> 01:06:15.160 +um this one uh + +01:06:12.760 --> 01:06:17.200 +guidance so if you want to look at like + +01:06:15.160 --> 01:06:19.720 +constrained generation of outputs I + +01:06:17.200 --> 01:06:21.640 +would definitely recommend uh looking at + +01:06:19.720 --> 01:06:22.839 +one of these two either outlines or or + +01:06:21.640 --> 01:06:24.440 +guidance and they both give you + +01:06:22.839 --> 01:06:26.520 +different ways to add constraints to + +01:06:24.440 --> 01:06:29.079 +Output um we did actually talk about + +01:06:26.520 --> 01:06:31.200 +outlines a little bit during the like uh + +01:06:29.079 --> 01:06:34.599 +generation class but um we didn't go + +01:06:31.200 --> 01:06:35.760 +into a lot of details so uh yeah but I I + +01:06:34.599 --> 01:06:39.559 +would recommend + +01:06:35.760 --> 01:06:39.559 +this cool any other + +01:06:39.599 --> 01:06:43.920 +questions okay if not uh I guess we can + +01:06:42.079 --> 01:06:47.880 +finish up and I'm happy to talk we have + +01:06:43.920 --> 01:06:47.880 +a little bit of extra time