ahmedelsayed's picture
commit files to HF hub
2ffb90d
1
00:00:00,480 --> 00:00:06,279
so uh I guess we can get started uh
2
00:00:04,080 --> 00:00:09,880
today I'm going to be talking about code
3
00:00:06,279 --> 00:00:11,719
generation and uh so this is a a
4
00:00:09,880 --> 00:00:13,599
research topic that I've uh worked on
5
00:00:11,719 --> 00:00:15,280
for a long time now I I like a lot it's
6
00:00:13,599 --> 00:00:17,520
become very useful nowadays which is
7
00:00:15,280 --> 00:00:20,960
very exciting um so I'd like to talk
8
00:00:17,520 --> 00:00:23,119
about kind of some of the basics and
9
00:00:20,960 --> 00:00:28,000
Frontiers uh that we're working on right
10
00:00:23,119 --> 00:00:28,000
now in this General uh area
11
00:00:31,719 --> 00:00:36,760
um
12
00:00:33,360 --> 00:00:38,160
so before I get into code generation
13
00:00:36,760 --> 00:00:40,719
specifically one thing I'd like to point
14
00:00:38,160 --> 00:00:43,399
out is for the next four or so classes
15
00:00:40,719 --> 00:00:45,680
I'm going to be talking about tasks and
16
00:00:43,399 --> 00:00:48,680
up until now I've been focusing on a lot
17
00:00:45,680 --> 00:00:52,840
of like General things that weren't as
18
00:00:48,680 --> 00:00:55,199
much about any specific tasks um
19
00:00:52,840 --> 00:00:57,000
and I know that not everybody's going to
20
00:00:55,199 --> 00:00:59,399
be interested in the four tasks that I'm
21
00:00:57,000 --> 00:01:00,960
talking about in the next you know four
22
00:00:59,399 --> 00:01:02,480
lectures
23
00:01:00,960 --> 00:01:04,920
um
24
00:01:02,480 --> 00:01:06,640
but I'm going to be covering various
25
00:01:04,920 --> 00:01:08,680
things about different tasks and
26
00:01:06,640 --> 00:01:10,640
hopefully you can map the same questions
27
00:01:08,680 --> 00:01:12,040
onto whatever task you are interested in
28
00:01:10,640 --> 00:01:14,360
if you're not interested in any of the
29
00:01:12,040 --> 00:01:15,880
ones I talk about here so basically what
30
00:01:14,360 --> 00:01:18,119
I want to talk about is the task
31
00:01:15,880 --> 00:01:21,040
objective like why do we do that task
32
00:01:18,119 --> 00:01:23,479
why is it important um what data sets
33
00:01:21,040 --> 00:01:26,560
can we use to train or test our models
34
00:01:23,479 --> 00:01:28,799
on these tasks evaluation metrics and
35
00:01:26,560 --> 00:01:31,200
how do we evaluate uh both manually and
36
00:01:28,799 --> 00:01:32,079
automatically with respect to how good
37
00:01:31,200 --> 00:01:34,960
we're
38
00:01:32,079 --> 00:01:37,880
doing and finally models and methods so
39
00:01:34,960 --> 00:01:40,720
you know how do we solve the
40
00:01:37,880 --> 00:01:42,479
problem and so for code generation first
41
00:01:40,720 --> 00:01:44,439
I'd like to talk about the overview and
42
00:01:42,479 --> 00:01:47,040
objectives of code generation so
43
00:01:44,439 --> 00:01:48,840
basically code generation is the task of
44
00:01:47,040 --> 00:01:52,439
generating executable code is an
45
00:01:48,840 --> 00:01:54,479
interface to uh a program or to
46
00:01:52,439 --> 00:01:58,320
computers and there's a lot of different
47
00:01:54,479 --> 00:02:01,000
ways we can do this um why do we want to
48
00:01:58,320 --> 00:02:03,159
do this so
49
00:02:01,000 --> 00:02:05,000
the first thing is that software
50
00:02:03,159 --> 00:02:06,759
engineering is really important and
51
00:02:05,000 --> 00:02:09,640
being able to generate code accelerate
52
00:02:06,759 --> 00:02:11,560
software engineering uh now code
53
00:02:09,640 --> 00:02:13,640
generation is practical and I hope that
54
00:02:11,560 --> 00:02:15,599
everybody in the class is using some
55
00:02:13,640 --> 00:02:17,840
sort of you know code generation to
56
00:02:15,599 --> 00:02:20,200
accelerate your own workflow if you're
57
00:02:17,840 --> 00:02:22,599
not I highly encourage you to to try it
58
00:02:20,200 --> 00:02:26,200
because it's very
59
00:02:22,599 --> 00:02:31,040
useful second it also does things like
60
00:02:26,200 --> 00:02:34,239
enabling models to access tools um
61
00:02:31,040 --> 00:02:37,440
and even if you're not specifically
62
00:02:34,239 --> 00:02:39,440
working on a software related task this
63
00:02:37,440 --> 00:02:41,000
can be helpful but I want to talk about
64
00:02:39,440 --> 00:02:42,480
this in a later class when we talk about
65
00:02:41,000 --> 00:02:46,640
llm agents so I'm not going to be
66
00:02:42,480 --> 00:02:48,319
talking about um that as much this time
67
00:02:46,640 --> 00:02:50,159
uh one other thing that I I forgot to
68
00:02:48,319 --> 00:02:52,920
mention here which I'm also going to
69
00:02:50,159 --> 00:02:55,000
talk about in the later class is even if
70
00:02:52,920 --> 00:02:58,120
you're not using code at all training on
71
00:02:55,000 --> 00:03:00,319
code has been shown to cause some
72
00:02:58,120 --> 00:03:01,920
benefits to learning models uh
73
00:03:00,319 --> 00:03:03,799
specifically with respect to learning
74
00:03:01,920 --> 00:03:06,480
like difficult multitask reasoning uh
75
00:03:03,799 --> 00:03:07,599
sorry multi-step reasoning tasks and so
76
00:03:06,480 --> 00:03:09,480
that's another reason why you might want
77
00:03:07,599 --> 00:03:10,840
to worry about codes so I'm going to
78
00:03:09,480 --> 00:03:12,840
mainly talk about the first one this
79
00:03:10,840 --> 00:03:14,560
time and leave the other two uh for
80
00:03:12,840 --> 00:03:17,720
future
81
00:03:14,560 --> 00:03:21,760
lectures so specifically for this task
82
00:03:17,720 --> 00:03:25,200
our input um is some sort of
83
00:03:21,760 --> 00:03:27,360
specification of what we want to do um
84
00:03:25,200 --> 00:03:30,319
and our output is going to be
85
00:03:27,360 --> 00:03:33,000
code so
86
00:03:30,319 --> 00:03:35,920
when you write a
87
00:03:33,000 --> 00:03:37,239
program how do you describe the thing
88
00:03:35,920 --> 00:03:40,239
that you want to implement in the
89
00:03:37,239 --> 00:03:42,000
program before you implement it like uh
90
00:03:40,239 --> 00:03:44,720
yeah what are some of the specifications
91
00:03:42,000 --> 00:03:44,720
that people can give
92
00:03:45,280 --> 00:03:50,720
you what the input and output of the
93
00:03:47,680 --> 00:03:52,360
functions are uh yes uh sorry what what
94
00:03:50,720 --> 00:03:54,400
types the inputs and outputs of the
95
00:03:52,360 --> 00:03:56,239
function are so those would be like type
96
00:03:54,400 --> 00:03:57,760
in in Python for example yeah that
97
00:03:56,239 --> 00:03:59,439
that's a good one it's actually not on
98
00:03:57,760 --> 00:04:02,079
my list of things here but it's it's a
99
00:03:59,439 --> 00:04:06,040
good Point yeah any any other things
100
00:04:02,079 --> 00:04:08,680
yeah complexity requirements complexity
101
00:04:06,040 --> 00:04:11,040
requirements constraints that is also
102
00:04:08,680 --> 00:04:14,840
not on my list of things here uh that's
103
00:04:11,040 --> 00:04:17,040
uh that's a good one too um and any uh
104
00:04:14,840 --> 00:04:20,280
slightly more straight forward
105
00:04:17,040 --> 00:04:24,040
things pseudo code yeah um in pseudo
106
00:04:20,280 --> 00:04:26,720
code uh what what is pseudo code written
107
00:04:24,040 --> 00:04:28,440
in natural natural language yeah so
108
00:04:26,720 --> 00:04:31,199
natural language inputs are are one
109
00:04:28,440 --> 00:04:34,520
thing so I will tell you I want I want a
110
00:04:31,199 --> 00:04:39,160
program that uh I want you to write a
111
00:04:34,520 --> 00:04:41,479
web interface that allows me to um order
112
00:04:39,160 --> 00:04:43,560
pizza or something like that that that
113
00:04:41,479 --> 00:04:46,560
would be one way to do it any other
114
00:04:43,560 --> 00:04:46,560
ideas
115
00:04:51,199 --> 00:04:55,840
yeah this is what I have and this is
116
00:04:53,360 --> 00:04:57,240
what I want yeah so um that's especially
117
00:04:55,840 --> 00:04:59,880
the case if you're like modifying a
118
00:04:57,240 --> 00:05:01,400
program um or something like that so
119
00:04:59,880 --> 00:05:06,280
actually the next one on my list there
120
00:05:01,400 --> 00:05:06,280
so good good point um any other
121
00:05:09,759 --> 00:05:15,720
ideas yeah or or a multimodal person you
122
00:05:12,880 --> 00:05:20,120
know I might say I want a pizza ordering
123
00:05:15,720 --> 00:05:22,039
I want a pizza ordering app and up here
124
00:05:20,120 --> 00:05:24,000
it should have your like username so you
125
00:05:22,039 --> 00:05:25,840
can click through the settings and like
126
00:05:24,000 --> 00:05:27,080
over here you should have the menu and
127
00:05:25,840 --> 00:05:28,680
over here you should have your check out
128
00:05:27,080 --> 00:05:30,400
card or something like that you know
129
00:05:28,680 --> 00:05:32,440
it's something you do for a programmer
130
00:05:30,400 --> 00:05:34,680
as well until recently we couldn't
131
00:05:32,440 --> 00:05:37,680
really use that with like actual models
132
00:05:34,680 --> 00:05:40,560
but um yeah yeah well that was my fourth
133
00:05:37,680 --> 00:05:42,639
one but um and then the other one uh
134
00:05:40,560 --> 00:05:44,960
inputs and outputs this could come in
135
00:05:42,639 --> 00:05:46,560
the form of like unit tests or something
136
00:05:44,960 --> 00:05:49,199
like that where it's like yeah this is
137
00:05:46,560 --> 00:05:51,160
the input this is the expected output so
138
00:05:49,199 --> 00:05:53,240
these are all things we use both as
139
00:05:51,160 --> 00:05:55,639
human programmers and in code generation
140
00:05:53,240 --> 00:05:58,120
models I really like the two other
141
00:05:55,639 --> 00:06:00,440
points though um
142
00:05:58,120 --> 00:06:03,759
because typin
143
00:06:00,440 --> 00:06:05,479
are actually something that you like
144
00:06:03,759 --> 00:06:06,599
writing writing with typ pints is
145
00:06:05,479 --> 00:06:09,240
actually something that you can do with
146
00:06:06,599 --> 00:06:14,120
code generation models and um
147
00:06:09,240 --> 00:06:16,680
constraints such as like it should it
148
00:06:14,120 --> 00:06:20,199
should meet certain speed requirements
149
00:06:16,680 --> 00:06:21,520
or it should um you know use certain
150
00:06:20,199 --> 00:06:22,960
libraries or something like that are
151
00:06:21,520 --> 00:06:24,840
also constraints that you could add I
152
00:06:22,960 --> 00:06:26,120
didn't put that on this slide here that
153
00:06:24,840 --> 00:06:28,319
might come in the natural language
154
00:06:26,120 --> 00:06:30,639
description but it could be something
155
00:06:28,319 --> 00:06:32,759
separate and then you know the output is
156
00:06:30,639 --> 00:06:36,759
whatever code you want
157
00:06:32,759 --> 00:06:38,240
to so um how many people are using like
158
00:06:36,759 --> 00:06:41,000
GitHub
159
00:06:38,240 --> 00:06:46,160
co-pilot like what
160
00:06:41,000 --> 00:06:47,759
percentage maybe about half okay um how
161
00:06:46,160 --> 00:06:49,840
many people are using another like
162
00:06:47,759 --> 00:06:56,080
assisted coding tool other than GitHub
163
00:06:49,840 --> 00:06:57,400
coet yeah g gp4 gp4 is an could be an
164
00:06:56,080 --> 00:06:58,680
assisted coding tool I'm talking more
165
00:06:57,400 --> 00:07:02,400
like something that's actually in your
166
00:06:58,680 --> 00:07:04,759
IDE something yeah anybody
167
00:07:02,400 --> 00:07:07,680
else does anyone use
168
00:07:04,759 --> 00:07:13,639
cursor no
169
00:07:07,680 --> 00:07:18,039
um yeah cursor yeah okay so
170
00:07:13,639 --> 00:07:20,919
yeah Co collab uh Ai and collab yeah so
171
00:07:18,039 --> 00:07:24,080
um so I think there are a lot of these
172
00:07:20,919 --> 00:07:26,879
uh going around I I use co-pilot myself
173
00:07:24,080 --> 00:07:28,639
I have not used cursor I do use GPD 4 um
174
00:07:26,879 --> 00:07:30,599
and I'll I'll show you an example of how
175
00:07:28,639 --> 00:07:32,919
I use them different
176
00:07:30,599 --> 00:07:34,360
um if you haven't used copilot hopefully
177
00:07:32,919 --> 00:07:39,599
this will
178
00:07:34,360 --> 00:07:42,599
work um I just made a a simple
179
00:07:39,599 --> 00:07:42,599
video
180
00:07:43,280 --> 00:07:49,520
oops okay that's not working but anyway
181
00:07:46,159 --> 00:07:51,000
you um you type your uh you know you
182
00:07:49,520 --> 00:07:54,319
type and it basically completes your
183
00:07:51,000 --> 00:07:56,639
code so this is this is an example here
184
00:07:54,319 --> 00:07:58,599
and I didn't write any of this code
185
00:07:56,639 --> 00:08:02,360
actually I just wrote the comments and
186
00:07:58,599 --> 00:08:04,000
then it filled in the the actual C and
187
00:08:02,360 --> 00:08:05,639
also I didn't exactly check if it's
188
00:08:04,000 --> 00:08:08,080
correct or not
189
00:08:05,639 --> 00:08:11,120
so if there's any mistake it's co
190
00:08:08,080 --> 00:08:15,159
Pilot's fault not my fault but um I it
191
00:08:11,120 --> 00:08:15,159
looked correct to me so
192
00:08:15,759 --> 00:08:21,120
um and oh by the way you get to use it
193
00:08:18,120 --> 00:08:22,800
for free with your CMU account so if you
194
00:08:21,120 --> 00:08:24,120
uh if you don't want to use it but don't
195
00:08:22,800 --> 00:08:25,919
want to pay for it you're and left
196
00:08:24,120 --> 00:08:31,639
because you can use
197
00:08:25,919 --> 00:08:36,320
it um another example uh is gd4 or uh
198
00:08:31,639 --> 00:08:38,519
more recently Cloud 3 um and basically
199
00:08:36,320 --> 00:08:40,680
this can do a different variety of
200
00:08:38,519 --> 00:08:43,719
things so we talked about screenshots
201
00:08:40,680 --> 00:08:45,720
and basically I asked Claude to create a
202
00:08:43,719 --> 00:08:48,399
react app that replicates the claw
203
00:08:45,720 --> 00:08:50,240
interface by giving it a screenshot and
204
00:08:48,399 --> 00:08:52,560
asking it create a react app that looks
205
00:08:50,240 --> 00:08:55,200
like the screenshot and then it gave me
206
00:08:52,560 --> 00:09:00,800
a whole bunch of text and in the end it
207
00:08:55,200 --> 00:09:03,320
started um making this uh container here
208
00:09:00,800 --> 00:09:08,040
um
209
00:09:03,320 --> 00:09:11,040
and this uh it basically is skipping
210
00:09:08,040 --> 00:09:12,800
some of the styling stuff uh because
211
00:09:11,040 --> 00:09:14,480
large language models I I think they're
212
00:09:12,800 --> 00:09:16,560
basically trained so that they don't
213
00:09:14,480 --> 00:09:19,959
give really really long responses
214
00:09:16,560 --> 00:09:21,320
because like if you uh asked for
215
00:09:19,959 --> 00:09:23,640
something that would take a really
216
00:09:21,320 --> 00:09:25,519
really long time and then the model just
217
00:09:23,640 --> 00:09:26,880
complied and gave that to you for a
218
00:09:25,519 --> 00:09:29,000
really really long time it would cost
219
00:09:26,880 --> 00:09:30,680
them a lot of money so I feel like they
220
00:09:29,000 --> 00:09:32,440
they B try to train the models to only
221
00:09:30,680 --> 00:09:37,160
out at like a thousand tokens at a time
222
00:09:32,440 --> 00:09:38,959
or something like that so um it it won't
223
00:09:37,160 --> 00:09:40,839
actually go out and program the whole
224
00:09:38,959 --> 00:09:43,120
project for you but with a little
225
00:09:40,839 --> 00:09:44,680
cajoling if you say okay now implement
226
00:09:43,120 --> 00:09:48,519
this part now implement this part now
227
00:09:44,680 --> 00:09:49,959
implement this part um you uh you can
228
00:09:48,519 --> 00:09:53,040
end up with some pretty interesting
229
00:09:49,959 --> 00:09:55,680
stuff and let me
230
00:09:53,040 --> 00:09:57,120
uh let me see if I can I can show you an
231
00:09:55,680 --> 00:10:01,320
example
232
00:09:57,120 --> 00:10:01,320
so I I know a little bit of
233
00:10:01,440 --> 00:10:07,040
react um the front end framework but I
234
00:10:04,240 --> 00:10:09,839
don't know a whole lot but recently
235
00:10:07,040 --> 00:10:14,279
we've been um working on an open-source
236
00:10:09,839 --> 00:10:18,959
assisted coding app and I most of this
237
00:10:14,279 --> 00:10:21,519
was just written by quad um it's uh I I
238
00:10:18,959 --> 00:10:23,079
said I want an app that on the left side
239
00:10:21,519 --> 00:10:26,160
it has a chat window and then on the
240
00:10:23,079 --> 00:10:28,240
right side it has three uh three panes
241
00:10:26,160 --> 00:10:30,120
one is a terminal one is a planner and
242
00:10:28,240 --> 00:10:32,200
one is a code editor
243
00:10:30,120 --> 00:10:33,880
and um so it gave me something it was
244
00:10:32,200 --> 00:10:37,399
kind of ugly so I said okay make the
245
00:10:33,880 --> 00:10:40,639
background black um change the CSS file
246
00:10:37,399 --> 00:10:43,639
so that um you have like a user icon and
247
00:10:40,639 --> 00:10:46,040
a robot icon and stuff like that and
248
00:10:43,639 --> 00:10:49,240
after this I I wrote very little of this
249
00:10:46,040 --> 00:10:51,079
code I wrote like 1% of this code or
250
00:10:49,240 --> 00:10:54,480
something like that and it's able to to
251
00:10:51,079 --> 00:10:57,880
do these sorts of things for you um so
252
00:10:54,480 --> 00:11:01,000
if you don't like writing front ends
253
00:10:57,880 --> 00:11:03,880
good luck uh or good good news that you
254
00:11:01,000 --> 00:11:05,560
uh can come up with a passable front end
255
00:11:03,880 --> 00:11:07,519
without uh without actually having to
256
00:11:05,560 --> 00:11:08,720
write it nonetheless you know good front
257
00:11:07,519 --> 00:11:10,200
end Engineers will come up with
258
00:11:08,720 --> 00:11:13,639
something much more beautiful than that
259
00:11:10,200 --> 00:11:15,880
so um so basically why do I why did I
260
00:11:13,639 --> 00:11:19,959
want to say this I think um GitHub
261
00:11:15,880 --> 00:11:20,839
co-pilot and Pla or gp4 serve very
262
00:11:19,959 --> 00:11:25,200
different
263
00:11:20,839 --> 00:11:27,360
purposes um GitHub co-pilot is code
264
00:11:25,200 --> 00:11:30,160
completion and it mostly works for
265
00:11:27,360 --> 00:11:32,440
shorter things so it's like your next
266
00:11:30,160 --> 00:11:34,760
thought in your code in code that you
267
00:11:32,440 --> 00:11:37,560
know pretty well something like plot or
268
00:11:34,760 --> 00:11:40,639
gp4 is much better for really long
269
00:11:37,560 --> 00:11:44,680
things um where you want to build like a
270
00:11:40,639 --> 00:11:47,040
full class or something like that and I
271
00:11:44,680 --> 00:11:48,480
also have found that if you're coding in
272
00:11:47,040 --> 00:11:50,079
a language that you're very familiar
273
00:11:48,480 --> 00:11:51,560
with copilot might be more useful
274
00:11:50,079 --> 00:11:52,959
because you want fine grain control and
275
00:11:51,560 --> 00:11:55,040
you want it to fill out things to make
276
00:11:52,959 --> 00:11:56,519
it faster whereas if you're coding in a
277
00:11:55,040 --> 00:11:58,040
language that you're not very familiar
278
00:11:56,519 --> 00:11:59,680
with something like Claud is good
279
00:11:58,040 --> 00:12:01,839
because you can write a whole you know
280
00:11:59,680 --> 00:12:04,800
program forties so these are the
281
00:12:01,839 --> 00:12:07,680
differences another thing is GitHub
282
00:12:04,800 --> 00:12:09,240
co-pilot needs to be frighteningly fast
283
00:12:07,680 --> 00:12:10,839
because it needs to move at the speed
284
00:12:09,240 --> 00:12:12,880
that like programmers are thinking in
285
00:12:10,839 --> 00:12:14,920
programming next whereas something like
286
00:12:12,880 --> 00:12:16,800
Claud it doesn't you know using it in
287
00:12:14,920 --> 00:12:18,880
the way that I use cloud here doesn't
288
00:12:16,800 --> 00:12:22,600
really matter because I can say uh
289
00:12:18,880 --> 00:12:24,079
programing me a you know a web app and
290
00:12:22,600 --> 00:12:25,360
then I can go and have dinner and come
291
00:12:24,079 --> 00:12:28,199
back and have a web app and I'd be
292
00:12:25,360 --> 00:12:31,720
perfectly happy with that right so um
293
00:12:28,199 --> 00:12:37,199
the latency request are also
294
00:12:31,720 --> 00:12:37,199
different cool um any any questions here
295
00:12:37,399 --> 00:12:42,600
yeah that debugging code they
296
00:12:43,000 --> 00:12:47,959
are the well so
297
00:12:45,839 --> 00:12:50,760
co-pilot I haven't actually tried it
298
00:12:47,959 --> 00:12:52,480
that much um if I wanted to debug code
299
00:12:50,760 --> 00:12:54,880
I'd probably use something like pla or
300
00:12:52,480 --> 00:12:56,360
gp4 just because actually I'll I'll
301
00:12:54,880 --> 00:12:58,320
mention this in a second but co-pilot's
302
00:12:56,360 --> 00:13:00,360
a much smaller model uh because it needs
303
00:12:58,320 --> 00:13:01,839
to be very fast or what they're using in
304
00:13:00,360 --> 00:13:04,040
copilot is a smaller model because it
305
00:13:01,839 --> 00:13:05,519
needs to be very fast so I would
306
00:13:04,040 --> 00:13:08,360
probably use a bigger model for anything
307
00:13:05,519 --> 00:13:10,120
that required like good understanding I
308
00:13:08,360 --> 00:13:11,480
think it's passable at debugging code
309
00:13:10,120 --> 00:13:13,079
but it won't find the really difficult
310
00:13:11,480 --> 00:13:15,639
things and it probably won't find things
311
00:13:13,079 --> 00:13:18,279
that require spanning across uh multiple
312
00:13:15,639 --> 00:13:21,240
files but I I'm not 100% sure about that
313
00:13:18,279 --> 00:13:25,519
like I think it's worth
314
00:13:21,240 --> 00:13:25,519
testing um any other
315
00:13:25,880 --> 00:13:30,120
questions okay so if I haven't convinced
316
00:13:28,360 --> 00:13:32,360
you that as software developers you
317
00:13:30,120 --> 00:13:34,880
should be using this hopefully this next
318
00:13:32,360 --> 00:13:37,480
uh this next slide will so this was a
319
00:13:34,880 --> 00:13:41,199
study that was run by GitHub uh shortly
320
00:13:37,480 --> 00:13:43,160
after um after co-pilot came out and so
321
00:13:41,199 --> 00:13:45,440
why do we do code generation why are
322
00:13:43,160 --> 00:13:47,240
people very excited about it so the
323
00:13:45,440 --> 00:13:50,240
first is U making software isn't
324
00:13:47,240 --> 00:13:53,480
important um and I recently calculated
325
00:13:50,240 --> 00:13:55,920
what from some Labor Statistics and the
326
00:13:53,480 --> 00:13:59,440
total amount that software developers
327
00:13:55,920 --> 00:14:01,880
make um in a year is $175 billion so
328
00:13:59,440 --> 00:14:05,000
that's providing at least that much you
329
00:14:01,880 --> 00:14:06,800
know value so it's a very high value uh
330
00:14:05,000 --> 00:14:09,079
profession so if we could make it faster
331
00:14:06,800 --> 00:14:11,480
you know it would have even more
332
00:14:09,079 --> 00:14:12,920
value another thing is code generation
333
00:14:11,480 --> 00:14:15,680
leads to large improvements in
334
00:14:12,920 --> 00:14:17,160
productivity so uh get Hub ran this
335
00:14:15,680 --> 00:14:18,680
study where they randomly assigned
336
00:14:17,160 --> 00:14:21,519
developers to groups who would either
337
00:14:18,680 --> 00:14:24,440
use co-pilot or not use co-pilot and
338
00:14:21,519 --> 00:14:26,480
they assigned them the same task and
339
00:14:24,440 --> 00:14:30,759
basically the people who use copilot
340
00:14:26,480 --> 00:14:34,199
their rate of um completion went up by
341
00:14:30,759 --> 00:14:36,320
8% and they finished um in about 40% of
342
00:14:34,199 --> 00:14:39,279
the time of the people who didn't use it
343
00:14:36,320 --> 00:14:43,639
and so I think this
344
00:14:39,279 --> 00:14:45,920
is or uh yeah they say 55% less times so
345
00:14:43,639 --> 00:14:47,759
this is very impressive but it's also
346
00:14:45,920 --> 00:14:50,199
not at all surprising if you're using a
347
00:14:47,759 --> 00:14:52,880
Cod like assisted coding assistant it
348
00:14:50,199 --> 00:14:54,360
just makes you code faster also if you
349
00:14:52,880 --> 00:14:56,040
don't like writing doc strings it's
350
00:14:54,360 --> 00:14:57,519
really good at writing doc strings so
351
00:14:56,040 --> 00:14:59,680
you can write documentation for your
352
00:14:57,519 --> 00:15:00,759
code not wor about so
353
00:14:59,680 --> 00:15:04,399
okay
354
00:15:00,759 --> 00:15:07,000
cool um
355
00:15:04,399 --> 00:15:09,720
so there are differences between code
356
00:15:07,000 --> 00:15:14,000
and natural language uh and I've listed
357
00:15:09,720 --> 00:15:15,560
a few of them here and the differences
358
00:15:14,000 --> 00:15:18,120
between code and natural language also
359
00:15:15,560 --> 00:15:20,160
affect how we build models for this test
360
00:15:18,120 --> 00:15:23,160
so the first one is that code has strict
361
00:15:20,160 --> 00:15:26,000
grammar uh if you make a small mistake
362
00:15:23,160 --> 00:15:27,920
in your code grammar usually it will
363
00:15:26,000 --> 00:15:29,839
just break and your program won't work
364
00:15:27,920 --> 00:15:31,319
so you need to be very careful as
365
00:15:29,839 --> 00:15:32,560
opposed to natural language grammar
366
00:15:31,319 --> 00:15:33,600
where you can make small mistakes and it
367
00:15:32,560 --> 00:15:36,120
doesn't make a
368
00:15:33,600 --> 00:15:40,120
difference another thing is in code you
369
00:15:36,120 --> 00:15:42,720
know the semantic flow of the code and
370
00:15:40,120 --> 00:15:44,160
so we know that certain variables
371
00:15:42,720 --> 00:15:45,560
correspond to each other we know that
372
00:15:44,160 --> 00:15:48,639
they're flowing through the program in a
373
00:15:45,560 --> 00:15:50,880
certain way another thing is code is
374
00:15:48,639 --> 00:15:54,120
executable so we can actually execute it
375
00:15:50,880 --> 00:15:56,199
and observe the result unlike in natural
376
00:15:54,120 --> 00:16:00,000
language and another important thing is
377
00:15:56,199 --> 00:16:03,399
code is created incrementally so code is
378
00:16:00,000 --> 00:16:05,680
not you know unlike text text is also
379
00:16:03,399 --> 00:16:07,399
created incrementally but it's not
380
00:16:05,680 --> 00:16:08,720
usually you write it once you might
381
00:16:07,399 --> 00:16:11,199
revise it a little bit and then you're
382
00:16:08,720 --> 00:16:14,040
done and you you don't need to touch it
383
00:16:11,199 --> 00:16:15,399
again but um in code you touch it over
384
00:16:14,040 --> 00:16:17,800
and over and over again as you develop a
385
00:16:15,399 --> 00:16:17,800
sof
386
00:16:18,040 --> 00:16:23,040
project so if we look at code Generation
387
00:16:21,079 --> 00:16:27,079
Um I would like to talk a little bit
388
00:16:23,040 --> 00:16:29,079
about uh subtasks and data sets next so
389
00:16:27,079 --> 00:16:30,480
the most famous data set for a Cod code
390
00:16:29,079 --> 00:16:34,279
generation nowadays is something called
391
00:16:30,480 --> 00:16:38,680
human ofel um this is a very nice data
392
00:16:34,279 --> 00:16:42,480
set um for a number of reasons uh I
393
00:16:38,680 --> 00:16:44,240
think it is used too much um nonetheless
394
00:16:42,480 --> 00:16:46,759
and I I think there are better data sets
395
00:16:44,240 --> 00:16:51,240
that we maybe should be using more but
396
00:16:46,759 --> 00:16:54,000
basically human ofel is um it has
397
00:16:51,240 --> 00:16:55,920
examples of usage of the Python standard
398
00:16:54,000 --> 00:16:59,360
Library where some are easier some are
399
00:16:55,920 --> 00:17:02,880
harder and just to give some examples
400
00:16:59,360 --> 00:17:06,760
uh we're saying given a nonempty list of
401
00:17:02,880 --> 00:17:10,480
integers return the sum of all the odd
402
00:17:06,760 --> 00:17:12,959
elements that are in even positions so
403
00:17:10,480 --> 00:17:16,079
it's kind of like a elite code
404
00:17:12,959 --> 00:17:19,199
style you know program but maybe one of
405
00:17:16,079 --> 00:17:22,400
the easier ones and then in order to
406
00:17:19,199 --> 00:17:25,240
solve that you find all of the put
407
00:17:22,400 --> 00:17:28,480
elements in even positions and then you
408
00:17:25,240 --> 00:17:29,679
only return them if uh the value itself
409
00:17:28,480 --> 00:17:32,799
is
410
00:17:29,679 --> 00:17:34,200
um so like you can do that in a oneliner
411
00:17:32,799 --> 00:17:36,600
but you need to think about it a little
412
00:17:34,200 --> 00:17:38,919
bit um and then you have
413
00:17:36,600 --> 00:17:43,120
more
414
00:17:38,919 --> 00:17:43,810
um returns encoded uh sorry takes an
415
00:17:43,120 --> 00:17:46,910
input
416
00:17:43,810 --> 00:17:46,910
[Music]
417
00:17:47,160 --> 00:17:50,919
string yeah actually sorry this is from
418
00:17:49,320 --> 00:17:53,600
the paper I didn't read it before I copy
419
00:17:50,919 --> 00:17:57,080
pasted it in here but um yeah that's a
420
00:17:53,600 --> 00:17:58,880
decoding one and one one thing about
421
00:17:57,080 --> 00:18:02,240
this uh that's important to know is it
422
00:17:58,880 --> 00:18:04,200
only has 164 examples so it's actually a
423
00:18:02,240 --> 00:18:07,600
relatively small number of
424
00:18:04,200 --> 00:18:09,440
examples um it's also just the python
425
00:18:07,600 --> 00:18:11,200
standard Library so it's not testing
426
00:18:09,440 --> 00:18:14,960
usage of any other
427
00:18:11,200 --> 00:18:17,520
libraries um so these two things
428
00:18:14,960 --> 00:18:19,720
together make it not the most realistic
429
00:18:17,520 --> 00:18:21,880
you know examination of your programming
430
00:18:19,720 --> 00:18:23,640
skills just like leak code is not the
431
00:18:21,880 --> 00:18:25,640
most realistic examination of your
432
00:18:23,640 --> 00:18:28,240
programming skills but you know I don't
433
00:18:25,640 --> 00:18:31,720
know companies use it anyway so maybe
434
00:18:28,240 --> 00:18:35,159
human devel is reasonable but um so then
435
00:18:31,720 --> 00:18:37,120
we go um into the inputs and outputs uh
436
00:18:35,159 --> 00:18:40,679
the inputs and outputs usually include a
437
00:18:37,120 --> 00:18:43,440
doc string um some input and output
438
00:18:40,679 --> 00:18:47,640
examples and then they have tests to
439
00:18:43,440 --> 00:18:47,640
verify the accuracy of your
440
00:18:47,880 --> 00:18:52,840
outputs so the metric that's used to
441
00:18:50,559 --> 00:18:58,919
evaluate these systems is something
442
00:18:52,840 --> 00:19:01,400
called passet K and the basic idea is um
443
00:18:58,919 --> 00:19:03,400
we generate K examples will at least one
444
00:19:01,400 --> 00:19:06,960
of them pass the unit
445
00:19:03,400 --> 00:19:10,720
tests and the idea here is
446
00:19:06,960 --> 00:19:13,480
that if we have models we might want to
447
00:19:10,720 --> 00:19:14,960
generate like well there there's a
448
00:19:13,480 --> 00:19:17,480
couple reasons why we would care about
449
00:19:14,960 --> 00:19:19,880
this pass it one is kind of obvious
450
00:19:17,480 --> 00:19:23,200
because we generate one and then we
451
00:19:19,880 --> 00:19:26,480
measure how um you know how likely it is
452
00:19:23,200 --> 00:19:29,280
to pass unit tests but pass it five why
453
00:19:26,480 --> 00:19:30,760
would we care about passet five well
454
00:19:29,280 --> 00:19:32,159
number one maybe you could show five
455
00:19:30,760 --> 00:19:34,240
programs to a person and they could
456
00:19:32,159 --> 00:19:37,039
choose the one that they like the best
457
00:19:34,240 --> 00:19:39,919
or maybe you could have unit test write
458
00:19:37,039 --> 00:19:41,720
unit tests in advance and then generate
459
00:19:39,919 --> 00:19:43,880
five programs check which one pass the
460
00:19:41,720 --> 00:19:45,480
unit tests and then use the ones only
461
00:19:43,880 --> 00:19:48,360
that pass the unit test or something
462
00:19:45,480 --> 00:19:51,000
like that so there's also some interest
463
00:19:48,360 --> 00:19:53,320
in uh whether you could generate you
464
00:19:51,000 --> 00:19:54,600
know multiple examples and then pick a
465
00:19:53,320 --> 00:19:56,919
good
466
00:19:54,600 --> 00:19:59,080
one there's a little bit of nuance in
467
00:19:56,919 --> 00:20:02,120
how this is actually calculated so
468
00:19:59,080 --> 00:20:04,240
basically um if you generate only K like
469
00:20:02,120 --> 00:20:05,960
if you if you sample only one example
470
00:20:04,240 --> 00:20:07,400
there's a lot of variance in whether you
471
00:20:05,960 --> 00:20:10,159
get it right or not so what they
472
00:20:07,400 --> 00:20:13,440
actually do is they generate like 10
473
00:20:10,159 --> 00:20:15,600
outputs or 200 outputs and then they
474
00:20:13,440 --> 00:20:18,159
calculate the expected number of those
475
00:20:15,600 --> 00:20:20,320
that the expected number of cases where
476
00:20:18,159 --> 00:20:23,280
that would pass by just doing a little
477
00:20:20,320 --> 00:20:25,440
bit of uh like math calculating the
478
00:20:23,280 --> 00:20:28,679
number of combinations where one passes
479
00:20:25,440 --> 00:20:30,720
or one doesn't and here k n is the total
480
00:20:28,679 --> 00:20:34,240
number you generate C is the number of
481
00:20:30,720 --> 00:20:36,520
correct ansers and K is uh your passive
482
00:20:34,240 --> 00:20:36,520
K
483
00:20:37,159 --> 00:20:43,360
value
484
00:20:38,919 --> 00:20:46,280
cool um so any any questions about
485
00:20:43,360 --> 00:20:47,880
these you'll you'll see a bunch of uh
486
00:20:46,280 --> 00:20:50,520
people evaluating on this human ofel
487
00:20:47,880 --> 00:20:52,760
with passive K including all of the you
488
00:20:50,520 --> 00:20:57,520
know new llms that come out it's a very
489
00:20:52,760 --> 00:20:57,520
standard Edge yeah
490
00:21:01,760 --> 00:21:06,039
is yeah that that's a good um question I
491
00:21:04,919 --> 00:21:07,840
think I'm going to cover that a little
492
00:21:06,039 --> 00:21:11,039
bit later but I might as well say it now
493
00:21:07,840 --> 00:21:13,640
so llms
494
00:21:11,039 --> 00:21:15,080
are llms are good at code because they
495
00:21:13,640 --> 00:21:16,880
intentionally include a lot of code
496
00:21:15,080 --> 00:21:19,520
training data in LL training and the
497
00:21:16,880 --> 00:21:22,679
reason for that is twofold um the first
498
00:21:19,520 --> 00:21:25,320
one is that code generation is a huge
499
00:21:22,679 --> 00:21:26,960
application of llms right now and like
500
00:21:25,320 --> 00:21:28,679
if you had an llm that couldn't do code
501
00:21:26,960 --> 00:21:32,320
generation it'd be kind of embarrassing
502
00:21:28,679 --> 00:21:33,960
so um Everybody includes this number two
503
00:21:32,320 --> 00:21:36,600
uh code has been shown to improve kind
504
00:21:33,960 --> 00:21:38,080
of the reasoning abilities of llms and
505
00:21:36,600 --> 00:21:41,640
because of that people include code for
506
00:21:38,080 --> 00:21:43,440
that purpose so yeah um it's not that
507
00:21:41,640 --> 00:21:45,600
LMS are inherently good at code or
508
00:21:43,440 --> 00:21:48,840
anything it's that they have lots of
509
00:21:45,600 --> 00:21:51,640
lots of code TR and I'll I'll explain
510
00:21:48,840 --> 00:21:54,279
exactly how they construct this
511
00:21:51,640 --> 00:21:57,200
St and actually if you remember last
512
00:21:54,279 --> 00:21:59,640
time uh I talked about the pile which
513
00:21:57,200 --> 00:22:01,039
was or not last time but uh when I
514
00:21:59,640 --> 00:22:03,159
talked about the tour of large language
515
00:22:01,039 --> 00:22:06,360
models I talked about the pile and the
516
00:22:03,159 --> 00:22:09,799
pile is almost half toe for
517
00:22:06,360 --> 00:22:12,000
example cool any other
518
00:22:09,799 --> 00:22:17,240
questions
519
00:22:12,000 --> 00:22:19,320
okay so another uh a first Improvement
520
00:22:17,240 --> 00:22:22,080
or at least change that we can make to
521
00:22:19,320 --> 00:22:23,880
human ofel is uh going to broader
522
00:22:22,080 --> 00:22:26,720
domains and covering a broader variety
523
00:22:23,880 --> 00:22:28,559
of libraries and this is a data set that
524
00:22:26,720 --> 00:22:30,880
we created actually a long time ago but
525
00:22:28,559 --> 00:22:33,799
but we recently added execution based
526
00:22:30,880 --> 00:22:36,159
evaluation to it it's called konola and
527
00:22:33,799 --> 00:22:36,919
the execution based uh evaluation one is
528
00:22:36,159 --> 00:22:40,360
called
529
00:22:36,919 --> 00:22:43,039
odex and basically what we did here is
530
00:22:40,360 --> 00:22:45,720
we scraped data from stack Overflow
531
00:22:43,039 --> 00:22:48,039
including uh inputs and output uh
532
00:22:45,720 --> 00:22:50,559
Solutions and then based on this scraped
533
00:22:48,039 --> 00:22:54,240
data we uh did some manual curation to
534
00:22:50,559 --> 00:22:57,640
turn these into like actual questions um
535
00:22:54,240 --> 00:22:59,640
and answers about how you could write uh
536
00:22:57,640 --> 00:23:01,799
solve programming
537
00:22:59,640 --> 00:23:04,080
problems and
538
00:23:01,799 --> 00:23:05,600
um because this is scraped from stack
539
00:23:04,080 --> 00:23:09,159
Overflow there's no restriction that
540
00:23:05,600 --> 00:23:10,520
this is from the python standard Library
541
00:23:09,159 --> 00:23:13,200
which also means that it can cover a
542
00:23:10,520 --> 00:23:14,919
very wide variety of libraries and it's
543
00:23:13,200 --> 00:23:16,760
approximately according to the
544
00:23:14,919 --> 00:23:20,320
popularity of the libraries because we
545
00:23:16,760 --> 00:23:24,159
took popular posts so um that's a a good
546
00:23:20,320 --> 00:23:25,400
thing uh you know it it is a reasonable
547
00:23:24,159 --> 00:23:26,559
way to come up with a realistic
548
00:23:25,400 --> 00:23:29,520
distribution of libraries that you
549
00:23:26,559 --> 00:23:31,799
should be looking at um odex adds
550
00:23:29,520 --> 00:23:34,159
execution based evaluation previously
551
00:23:31,799 --> 00:23:36,679
what we had was we only had the snippet
552
00:23:34,159 --> 00:23:40,600
that was able to solve the problem as
553
00:23:36,679 --> 00:23:42,360
opposed to um as opposed to being able
554
00:23:40,600 --> 00:23:46,880
to execute unit
555
00:23:42,360 --> 00:23:49,440
tests and just to show how this has a
556
00:23:46,880 --> 00:23:52,000
broader variety of libraries on the top
557
00:23:49,440 --> 00:23:53,919
we have the distribution of odex
558
00:23:52,000 --> 00:23:57,320
libraries and we can see about half of
559
00:23:53,919 --> 00:23:59,600
them use libraries and this includes a
560
00:23:57,320 --> 00:24:01,279
variety of things including pandas
561
00:23:59,600 --> 00:24:04,799
numpy
562
00:24:01,279 --> 00:24:06,400
um reg o selections you know all of
563
00:24:04,799 --> 00:24:09,279
these should be libraries that look
564
00:24:06,400 --> 00:24:14,559
familiar to you um in contrast if we
565
00:24:09,279 --> 00:24:17,200
look at human eval human eval is right
566
00:24:14,559 --> 00:24:18,840
here so you can see almost all of the
567
00:24:17,200 --> 00:24:20,600
questions require no libraries and all
568
00:24:18,840 --> 00:24:22,120
of the other ones require libraries that
569
00:24:20,600 --> 00:24:24,360
were included in the pipe onstead
570
00:24:22,120 --> 00:24:27,640
libraries so
571
00:24:24,360 --> 00:24:29,120
um in reality this is probably more what
572
00:24:27,640 --> 00:24:30,120
your program in queries are going to
573
00:24:29,120 --> 00:24:31,240
look like they're not going to look like
574
00:24:30,120 --> 00:24:33,600
lead code they're going to look like
575
00:24:31,240 --> 00:24:33,600
using
576
00:24:35,360 --> 00:24:42,080
APS so um originally when we did conal
577
00:24:40,039 --> 00:24:44,200
we didn't use execution based evaluation
578
00:24:42,080 --> 00:24:47,480
because creating unit tests uh for lots
579
00:24:44,200 --> 00:24:51,360
of stack Overflow posts is hard
580
00:24:47,480 --> 00:24:53,640
um specifically there's two issues the
581
00:24:51,360 --> 00:24:55,000
first one is that it requires that code
582
00:24:53,640 --> 00:24:58,880
be easily
583
00:24:55,000 --> 00:25:02,320
executable um now think about
584
00:24:58,880 --> 00:25:04,559
how you would do that for Matt plot lib
585
00:25:02,320 --> 00:25:06,200
for example how would you create a unit
586
00:25:04,559 --> 00:25:08,080
test to test whether Matt plot lib
587
00:25:06,200 --> 00:25:10,760
successfully created a bar chart for
588
00:25:08,080 --> 00:25:12,440
something it's kind of tough right you
589
00:25:10,760 --> 00:25:13,840
like you would have to get the image and
590
00:25:12,440 --> 00:25:16,919
you'd have to confirm that the image was
591
00:25:13,840 --> 00:25:21,200
a bar chart and uh other things like
592
00:25:16,919 --> 00:25:22,720
that um even worse what if it was uh
593
00:25:21,200 --> 00:25:25,600
kind of like a server framework like
594
00:25:22,720 --> 00:25:27,440
ajango how would you confirm that ajango
595
00:25:25,600 --> 00:25:30,559
you know server is working appropriately
596
00:25:27,440 --> 00:25:32,600
and that's kind of tricky so um actually
597
00:25:30,559 --> 00:25:34,480
coming up with realistic unit tests for
598
00:25:32,600 --> 00:25:36,919
real programs can be
599
00:25:34,480 --> 00:25:38,840
difficult um another problem with
600
00:25:36,919 --> 00:25:41,640
execution based evaluation is it ignores
601
00:25:38,840 --> 00:25:45,320
stylistic considerations so I could
602
00:25:41,640 --> 00:25:48,279
write very spaghetti like very spaghetti
603
00:25:45,320 --> 00:25:50,200
code and as long as it executed properly
604
00:25:48,279 --> 00:25:52,559
it would still be judged as correct and
605
00:25:50,200 --> 00:25:54,399
sometimes that's actually an issue so
606
00:25:52,559 --> 00:25:56,360
usually it's not a problem because
607
00:25:54,399 --> 00:25:58,600
language models write reasonably good
608
00:25:56,360 --> 00:26:00,600
code but sometimes you want to match the
609
00:25:58,600 --> 00:26:05,039
or other things like that
610
00:26:00,600 --> 00:26:06,559
so some alternatives are blue score
611
00:26:05,039 --> 00:26:09,000
which we've talked about before it's
612
00:26:06,559 --> 00:26:12,679
basically count calculating the engram
613
00:26:09,000 --> 00:26:16,919
overlap between a gold standard human uh
614
00:26:12,679 --> 00:26:20,440
implementation and a uh in the system
615
00:26:16,919 --> 00:26:24,000
output and there's also specifically
616
00:26:20,440 --> 00:26:26,480
adapted methods for evaluating code and
617
00:26:24,000 --> 00:26:29,080
so there's a method called code blue and
618
00:26:26,480 --> 00:26:31,360
basically the way code blue works is it
619
00:26:29,080 --> 00:26:35,240
also considers the syntax and semantic
620
00:26:31,360 --> 00:26:37,080
flow of the code so it measures overlap
621
00:26:35,240 --> 00:26:40,120
between
622
00:26:37,080 --> 00:26:42,120
strings in the original code but it also
623
00:26:40,120 --> 00:26:48,640
considers overlap between the syntax
624
00:26:42,120 --> 00:26:53,000
trees of the code and uh whether the
625
00:26:48,640 --> 00:26:56,320
um these like semantic information flow
626
00:26:53,000 --> 00:26:57,919
graphs look similar so uh all all of
627
00:26:56,320 --> 00:26:59,440
these things work together to calculate
628
00:26:57,919 --> 00:27:02,720
the C
629
00:26:59,440 --> 00:27:04,480
St one thing I I should mention is how
630
00:27:02,720 --> 00:27:06,840
do we get these syntax trees in the
631
00:27:04,480 --> 00:27:09,039
first place um for example if we're
632
00:27:06,840 --> 00:27:12,919
talking about python there's a python
633
00:27:09,039 --> 00:27:14,760
Library uh for ab abstract syntax tree
634
00:27:12,919 --> 00:27:16,559
it's just part of the standard library
635
00:27:14,760 --> 00:27:18,320
and it's necessary to run the python
636
00:27:16,559 --> 00:27:20,559
interpreter so you can just get these
637
00:27:18,320 --> 00:27:24,320
trees directly from the python ASD
638
00:27:20,559 --> 00:27:25,880
Library uh not hard to do uh for this I
639
00:27:24,320 --> 00:27:27,840
forget what they did in the code blue
640
00:27:25,880 --> 00:27:30,679
thing but there are uh analyzers that
641
00:27:27,840 --> 00:27:32,120
allow you to analyze this control FL so
642
00:27:30,679 --> 00:27:34,159
this is taking advantage of the fact
643
00:27:32,120 --> 00:27:37,440
that code is you know predictable it has
644
00:27:34,159 --> 00:27:41,480
predictable syntax and you can you
645
00:27:37,440 --> 00:27:43,960
can6 um one disadvantage of blue and
646
00:27:41,480 --> 00:27:45,799
code blue of course is that you know you
647
00:27:43,960 --> 00:27:47,679
can write two very different looking
648
00:27:45,799 --> 00:27:49,559
programs that actually are both correct
649
00:27:47,679 --> 00:27:51,799
and blue will underestimate the goodness
650
00:27:49,559 --> 00:27:54,440
of those programs so maybe using both of
651
00:27:51,799 --> 00:27:57,159
them together is uh is
652
00:27:54,440 --> 00:28:00,120
appropriate uh if if you can write unit
653
00:27:57,159 --> 00:28:00,120
Test please
654
00:28:00,559 --> 00:28:04,279
um another one which I'll just cover
655
00:28:02,600 --> 00:28:05,399
very briefly we talked about BT score
656
00:28:04,279 --> 00:28:08,159
before when I was talking about
657
00:28:05,399 --> 00:28:11,120
evaluation of uh you know generated text
658
00:28:08,159 --> 00:28:13,480
and there's also code BT score which um
659
00:28:11,120 --> 00:28:15,799
we uh we created here at
660
00:28:13,480 --> 00:28:20,080
CMU and it's basically an embedding
661
00:28:15,799 --> 00:28:21,760
based metric uh to compare code and so
662
00:28:20,080 --> 00:28:23,399
Bert score if you remember basically
663
00:28:21,760 --> 00:28:25,679
what it did is it calculated the coign
664
00:28:23,399 --> 00:28:27,840
similarity between each of the tokens uh
665
00:28:25,679 --> 00:28:30,159
between a generated text and a reference
666
00:28:27,840 --> 00:28:34,279
text we do exactly the same thing for
667
00:28:30,159 --> 00:28:36,080
code um so we calculate the Sim cosine
668
00:28:34,279 --> 00:28:39,200
similarity between tokens for a
669
00:28:36,080 --> 00:28:42,960
reference code and generated
670
00:28:39,200 --> 00:28:45,000
code and we released a model called
671
00:28:42,960 --> 00:28:46,559
codir which was basically Bert but
672
00:28:45,000 --> 00:28:49,440
continued trained on lots and lots of
673
00:28:46,559 --> 00:28:51,840
code uh that allowed us to do that and
674
00:28:49,440 --> 00:28:55,480
um basically we were able to demonstrate
675
00:28:51,840 --> 00:28:59,200
that this gave better correlation both
676
00:28:55,480 --> 00:29:01,480
with final execution accuracy and with
677
00:28:59,200 --> 00:29:05,200
human judgments of whether the the code
678
00:29:01,480 --> 00:29:08,000
was correct and so um some people uh
679
00:29:05,200 --> 00:29:09,559
created a data set of human correctness
680
00:29:08,000 --> 00:29:12,559
judgments and we were able to put a
681
00:29:09,559 --> 00:29:14,240
little better with that as well um why
682
00:29:12,559 --> 00:29:15,640
do we care about correlation with
683
00:29:14,240 --> 00:29:17,399
execution
684
00:29:15,640 --> 00:29:20,200
accuracy
685
00:29:17,399 --> 00:29:22,320
um this is important in the cases when
686
00:29:20,200 --> 00:29:23,559
we can't create unit tests or when
687
00:29:22,320 --> 00:29:26,120
creating unit test would be too
688
00:29:23,559 --> 00:29:27,519
expensive so this gives us a better
689
00:29:26,120 --> 00:29:30,640
approximation for what we would get if
690
00:29:27,519 --> 00:29:30,640
we ran tests
691
00:29:39,840 --> 00:29:45,000
in yeah so we did not we did not
692
00:29:42,600 --> 00:29:46,799
consider code structure here uh would
693
00:29:45,000 --> 00:29:48,480
different variable names affect it yes
694
00:29:46,799 --> 00:29:50,159
different variable names would affect it
695
00:29:48,480 --> 00:29:51,799
but not as much as the other metrics
696
00:29:50,159 --> 00:29:53,960
which is why it's better why it has
697
00:29:51,799 --> 00:29:56,720
better
698
00:29:53,960 --> 00:30:00,000
correlations and like for example
699
00:29:56,720 --> 00:30:03,679
codir I imagine probably gives very
700
00:30:00,000 --> 00:30:05,120
similar representations to I and J just
701
00:30:03,679 --> 00:30:07,960
because they're both used in iterators
702
00:30:05,120 --> 00:30:09,039
all the time whereas uh a normal Burt
703
00:30:07,960 --> 00:30:10,960
model would give very different
704
00:30:09,039 --> 00:30:12,760
representations to I and J right because
705
00:30:10,960 --> 00:30:14,960
I is like a personal pronoun and J is
706
00:30:12,760 --> 00:30:17,200
not so um that's the reason why
707
00:30:14,960 --> 00:30:20,399
continued training would
708
00:30:17,200 --> 00:30:24,799
help cool any other
709
00:30:20,399 --> 00:30:26,640
things okay so another um another place
710
00:30:24,799 --> 00:30:29,480
where code generation can be useful uh
711
00:30:26,640 --> 00:30:33,440
we had the example of collab uh is in
712
00:30:29,480 --> 00:30:36,200
collab notebooks and this or in uh data
713
00:30:33,440 --> 00:30:38,519
science notebooks this paper was by uh
714
00:30:36,200 --> 00:30:41,440
Google so this might actually even be
715
00:30:38,519 --> 00:30:43,960
used in the collab thing because collab
716
00:30:41,440 --> 00:30:45,640
is a Google thing um but data data
717
00:30:43,960 --> 00:30:47,320
science notebooks allow for incremental
718
00:30:45,640 --> 00:30:50,519
implementation I'm sure a lot of people
719
00:30:47,320 --> 00:30:53,559
here or almost everybody here uses them
720
00:30:50,519 --> 00:30:55,279
um and another interesting thing is say
721
00:30:53,559 --> 00:30:57,519
allow for evaluation of code generation
722
00:30:55,279 --> 00:30:58,960
in context uh or incremental code
723
00:30:57,519 --> 00:31:00,639
generation
724
00:30:58,960 --> 00:31:02,720
and so you start out with like a
725
00:31:00,639 --> 00:31:04,880
notebook and then you have AAL
726
00:31:02,720 --> 00:31:06,600
languageand and then youate the output
727
00:31:04,880 --> 00:31:09,240
AAL language command you generate the
728
00:31:06,600 --> 00:31:10,799
output etc etc so this is an extal
729
00:31:09,240 --> 00:31:14,519
example from the STA
730
00:31:10,799 --> 00:31:17,519
set um so this paper is very nice it it
731
00:31:14,519 --> 00:31:20,320
has a lot of uh you know it's a nice
732
00:31:17,519 --> 00:31:21,720
data set one other thing that was really
733
00:31:20,320 --> 00:31:24,200
interesting from this paper is it
734
00:31:21,720 --> 00:31:27,919
demonstrated the problem of data leakage
735
00:31:24,200 --> 00:31:29,679
in evaluating models and this is a Rel
736
00:31:27,919 --> 00:31:32,440
relatively large problem I don't know if
737
00:31:29,679 --> 00:31:33,799
we have a silver bullet solution for
738
00:31:32,440 --> 00:31:36,120
this but it's an important thing to be
739
00:31:33,799 --> 00:31:38,120
aware of uh not just for code generation
740
00:31:36,120 --> 00:31:39,639
but these are examples from code
741
00:31:38,120 --> 00:31:43,519
generation
742
00:31:39,639 --> 00:31:45,679
so here um in the arcade data set they
743
00:31:43,519 --> 00:31:48,519
basically both evaluated existing
744
00:31:45,679 --> 00:31:51,720
notebooks and they evaluated notebooks
745
00:31:48,519 --> 00:31:53,279
that um existing notebooks that they got
746
00:31:51,720 --> 00:31:55,960
from the web and they evaluated
747
00:31:53,279 --> 00:31:59,000
notebooks that they actually created
748
00:31:55,960 --> 00:32:00,399
themselves and there's very very Stark
749
00:31:59,000 --> 00:32:02,600
difference between the notebooks that
750
00:32:00,399 --> 00:32:04,440
were created on the web and the
751
00:32:02,600 --> 00:32:07,399
notebooks that they evaluated themselves
752
00:32:04,440 --> 00:32:10,159
so like most of the code generation
753
00:32:07,399 --> 00:32:11,679
models except for Palm uh which was the
754
00:32:10,159 --> 00:32:14,760
best model when they created this data
755
00:32:11,679 --> 00:32:17,360
set did really poorly or did really well
756
00:32:14,760 --> 00:32:21,120
on the existing data and quite poorly on
757
00:32:17,360 --> 00:32:25,279
the new data um which is probably an
758
00:32:21,120 --> 00:32:28,159
indication of um probably an indication
759
00:32:25,279 --> 00:32:29,720
of the fact that you know this is to
760
00:32:28,159 --> 00:32:32,240
some extent leaked into the training
761
00:32:29,720 --> 00:32:35,320
data of the language models there was
762
00:32:32,240 --> 00:32:37,760
also a very recent
763
00:32:35,320 --> 00:32:40,240
um paper actually I think this might be
764
00:32:37,760 --> 00:32:43,159
2024 there was a very recent paper that
765
00:32:40,240 --> 00:32:45,880
did a similar thing uh where they
766
00:32:43,159 --> 00:32:48,440
evaluated on human ofel and then their
767
00:32:45,880 --> 00:32:52,000
live codebench in live codebench
768
00:32:48,440 --> 00:32:55,639
basically what they did is they tried to
769
00:32:52,000 --> 00:32:58,519
pick problems from Le code and other
770
00:32:55,639 --> 00:33:00,519
websites that were more recent versus
771
00:32:58,519 --> 00:33:01,960
less recent and they have some really
772
00:33:00,519 --> 00:33:04,880
nice graphs in their paper where they
773
00:33:01,960 --> 00:33:06,519
demonstrate that the less recent ones
774
00:33:04,880 --> 00:33:08,159
before the training cut off have like a
775
00:33:06,519 --> 00:33:10,080
high accuracy and then suddenly it drops
776
00:33:08,159 --> 00:33:12,639
right at the trading C off of the the
777
00:33:10,080 --> 00:33:13,480
models so this is something to to be
778
00:33:12,639 --> 00:33:17,360
aware
779
00:33:13,480 --> 00:33:20,519
of and what this figure is showing here
780
00:33:17,360 --> 00:33:24,039
is this figure is showing on the xaxis
781
00:33:20,519 --> 00:33:26,840
pass it one on the Live code bench easy
782
00:33:24,039 --> 00:33:28,679
and then pass it one on human ofel so we
783
00:33:26,840 --> 00:33:31,480
see this kn
784
00:33:28,679 --> 00:33:34,039
correlation between
785
00:33:31,480 --> 00:33:35,919
essentially like passing on life code
786
00:33:34,039 --> 00:33:37,399
bench easy and passing on human ofel
787
00:33:35,919 --> 00:33:40,000
then we have this group of models that
788
00:33:37,399 --> 00:33:42,159
are kind of like up here and these are
789
00:33:40,000 --> 00:33:43,960
ones where basically it's likely that
790
00:33:42,159 --> 00:33:46,480
human ofel leaked into the training data
791
00:33:43,960 --> 00:33:48,840
because they're getting better scores on
792
00:33:46,480 --> 00:33:50,919
human ofel than you would expect that
793
00:33:48,840 --> 00:33:53,360
they get uh you know just looking at
794
00:33:50,919 --> 00:33:55,360
their uh you know performance on another
795
00:33:53,360 --> 00:33:57,320
data set there's also a nice like
796
00:33:55,360 --> 00:34:00,000
analogous one for math reasoning
797
00:33:57,320 --> 00:34:01,519
problems um like this so this is
798
00:34:00,000 --> 00:34:03,039
definitely something to be aware of if
799
00:34:01,519 --> 00:34:04,559
you're looking only at like very
800
00:34:03,039 --> 00:34:06,200
standard benchmarks that people are
801
00:34:04,559 --> 00:34:11,159
trading
802
00:34:06,200 --> 00:34:11,159
in cool um any questions about
803
00:34:12,119 --> 00:34:19,240
this okay um another data set uh that I
804
00:34:17,720 --> 00:34:20,599
I really like the concept of and
805
00:34:19,240 --> 00:34:22,919
recently it's gotten a little bit of
806
00:34:20,599 --> 00:34:25,399
Buzz because it was used in a um an
807
00:34:22,919 --> 00:34:28,399
evaluation of a new coding assistant
808
00:34:25,399 --> 00:34:30,480
called Devon but this is um
809
00:34:28,399 --> 00:34:32,240
something called sbench and it's issues
810
00:34:30,480 --> 00:34:34,639
from GitHub and code
811
00:34:32,240 --> 00:34:37,119
bases uh is the input and you want to
812
00:34:34,639 --> 00:34:39,480
generate a poll request to basically uh
813
00:34:37,119 --> 00:34:42,919
solve these issues and so your input is
814
00:34:39,480 --> 00:34:45,800
like data leak in gbdt due to warm start
815
00:34:42,919 --> 00:34:48,800
this is about non standard then you have
816
00:34:45,800 --> 00:34:51,159
the code base um it generates a PR for
817
00:34:48,800 --> 00:34:53,079
you and then it's run through the unit
818
00:34:51,159 --> 00:34:55,919
tests to see if it passes all the unit
819
00:34:53,079 --> 00:34:57,160
test post PRS so it's very similar to
820
00:34:55,919 --> 00:34:59,240
you know what you would be doing in a
821
00:34:57,160 --> 00:35:01,280
well Main software project you open a
822
00:34:59,240 --> 00:35:05,240
issue and then you open a poll request
823
00:35:01,280 --> 00:35:07,800
to fix an issue um this requires things
824
00:35:05,240 --> 00:35:10,240
like long context understanding um being
825
00:35:07,800 --> 00:35:13,200
able to do very precise implementations
826
00:35:10,240 --> 00:35:14,720
based on large software projects and
827
00:35:13,200 --> 00:35:17,920
right now the state-of-the-art on this
828
00:35:14,720 --> 00:35:20,680
is at about 14% so it's definitely not a
829
00:35:17,920 --> 00:35:23,119
solv problem at all um in the original
830
00:35:20,680 --> 00:35:27,920
paper uh the the state-of-the-art method
831
00:35:23,119 --> 00:35:29,400
was like 6% or something like that so um
832
00:35:27,920 --> 00:35:32,079
I imagine that we're not going to get up
833
00:35:29,400 --> 00:35:33,880
to 90% anytime soon because it's
834
00:35:32,079 --> 00:35:35,720
probably solving the easier ones and the
835
00:35:33,880 --> 00:35:37,280
harder ones are you know far beyond the
836
00:35:35,720 --> 00:35:39,920
ability of any language model we have at
837
00:35:37,280 --> 00:35:42,320
the moment um but I I really like this
838
00:35:39,920 --> 00:35:43,960
Benchmark one caveat if you really like
839
00:35:42,320 --> 00:35:45,520
this Benchmark is that it's kind of
840
00:35:43,960 --> 00:35:47,760
heavy to run so you need to be a little
841
00:35:45,520 --> 00:35:51,000
bit careful uh because you need to pull
842
00:35:47,760 --> 00:35:54,280
in like full repositories to um to run
843
00:35:51,000 --> 00:35:56,319
on so yeah be a little
844
00:35:54,280 --> 00:35:57,920
bit sorry there's so many like
845
00:35:56,319 --> 00:35:59,640
interesting data sets recently in this
846
00:35:57,920 --> 00:36:01,079
area that I I spent a lot of time on
847
00:35:59,640 --> 00:36:04,240
data set so I'll try to go a little bit
848
00:36:01,079 --> 00:36:06,200
more quickly but um uh a final one is
849
00:36:04,240 --> 00:36:09,359
design to code and this is also a very
850
00:36:06,200 --> 00:36:11,520
recent data set um basically the idea is
851
00:36:09,359 --> 00:36:16,359
code generation from websites so your
852
00:36:11,520 --> 00:36:18,119
input is a website and your output is uh
853
00:36:16,359 --> 00:36:22,520
like JavaScript code that implements
854
00:36:18,119 --> 00:36:24,960
that website and or or css or HTML code
855
00:36:22,520 --> 00:36:26,880
that implements the website so I I
856
00:36:24,960 --> 00:36:30,119
really like this because you know it's a
857
00:36:26,880 --> 00:36:32,280
good test bed for multi modal models and
858
00:36:30,119 --> 00:36:34,040
there aren't a whole lot of strong open
859
00:36:32,280 --> 00:36:36,160
source multimodal models that can solve
860
00:36:34,040 --> 00:36:36,960
this at the moment so I think it's kind
861
00:36:36,160 --> 00:36:39,720
of
862
00:36:36,960 --> 00:36:41,480
cool um they also proposed a design to
863
00:36:39,720 --> 00:36:43,480
code model that does the best on this
864
00:36:41,480 --> 00:36:47,119
data set out of uh you know any of the
865
00:36:43,480 --> 00:36:47,119
open source models but it's still far
866
00:36:47,400 --> 00:36:53,040
from and then the question becomes how
867
00:36:50,680 --> 00:36:56,079
do they um evaluate this in the first
868
00:36:53,040 --> 00:36:59,440
place and basically the idea is that
869
00:36:56,079 --> 00:37:01,400
they do highle visual similarity and so
870
00:36:59,440 --> 00:37:03,920
they calculate visual embeddings of the
871
00:37:01,400 --> 00:37:06,119
generated sites and then they also do
872
00:37:03,920 --> 00:37:08,240
lowl element similarity so they try to
873
00:37:06,119 --> 00:37:10,440
identify all of the elements in the
874
00:37:08,240 --> 00:37:12,119
generated web page and make sure that uh
875
00:37:10,440 --> 00:37:15,720
they recall all of the generated
876
00:37:12,119 --> 00:37:18,760
elements so um I think this is nice one
877
00:37:15,720 --> 00:37:21,000
thing if you notice um if you use even
878
00:37:18,760 --> 00:37:25,960
state-ofthe-art like closed models like
879
00:37:21,000 --> 00:37:28,040
CLA 3 or um GPD 4 is they're really bad
880
00:37:25,960 --> 00:37:29,440
at this recall they it can generate
881
00:37:28,040 --> 00:37:31,800
something that looks like maybe a little
882
00:37:29,440 --> 00:37:33,839
bit similar but it will be missing like
883
00:37:31,800 --> 00:37:35,720
the elements the design will be off you
884
00:37:33,839 --> 00:37:37,720
know other stuff like that so I think
885
00:37:35,720 --> 00:37:41,079
even in the closed like strong models
886
00:37:37,720 --> 00:37:41,079
this is not a Sol
887
00:37:41,319 --> 00:37:47,079
problem cool uh
888
00:37:45,000 --> 00:37:49,880
yeah
889
00:37:47,079 --> 00:37:51,880
problem um so why is that a hard problem
890
00:37:49,880 --> 00:37:54,200
for the models I don't actually have a
891
00:37:51,880 --> 00:37:57,200
really confident answer to that but I
892
00:37:54,200 --> 00:37:57,200
think
893
00:38:00,240 --> 00:38:05,200
so one thing I can tell you is that they
894
00:38:02,839 --> 00:38:08,839
are able to
895
00:38:05,200 --> 00:38:12,000
improve um so they're able to generate
896
00:38:08,839 --> 00:38:14,720
something and then I say no that's bad
897
00:38:12,000 --> 00:38:16,160
please like make it better and it's
898
00:38:14,720 --> 00:38:17,800
generally better the second time
899
00:38:16,160 --> 00:38:19,920
especially if you give specific things
900
00:38:17,800 --> 00:38:22,319
like oh uh but the background on the
901
00:38:19,920 --> 00:38:25,160
generated site is white but actually it
902
00:38:22,319 --> 00:38:27,599
should be black and if you think about
903
00:38:25,160 --> 00:38:31,480
like even a skilled human programmer do
904
00:38:27,599 --> 00:38:35,119
you think you could write like website
905
00:38:31,480 --> 00:38:37,680
code and then view it once and then it
906
00:38:35,119 --> 00:38:40,319
would be correct I think you probably
907
00:38:37,680 --> 00:38:42,160
couldn't right and so like we're asking
908
00:38:40,319 --> 00:38:44,040
models to do essentially the same thing
909
00:38:42,160 --> 00:38:46,920
except they're like even worse than us
910
00:38:44,040 --> 00:38:48,560
and you know keeping track of all the V
911
00:38:46,920 --> 00:38:50,720
visual elements and stuff so I think
912
00:38:48,560 --> 00:38:52,480
it's more like this problem probably
913
00:38:50,720 --> 00:38:54,720
just needs iterative refinement
914
00:38:52,480 --> 00:38:58,839
otherwise it's like asking too much of a
915
00:38:54,720 --> 00:39:02,640
model maybe I don't know
916
00:38:58,839 --> 00:39:04,520
cool okay so um let's go into methods
917
00:39:02,640 --> 00:39:06,920
and code generation has some unique
918
00:39:04,520 --> 00:39:09,400
things um the basic method that you can
919
00:39:06,920 --> 00:39:11,240
always use is a code generating LM and
920
00:39:09,400 --> 00:39:13,040
so you feed in previous code or you feed
921
00:39:11,240 --> 00:39:16,040
in whatever context you have into the LM
922
00:39:13,040 --> 00:39:18,079
and you generate um uh from it and
923
00:39:16,040 --> 00:39:20,079
virtually all Serius LMS are trained on
924
00:39:18,079 --> 00:39:23,079
code nowadays like I I just mentioned
925
00:39:20,079 --> 00:39:23,079
before
926
00:39:23,119 --> 00:39:29,920
um one one important thing here is uh
927
00:39:28,560 --> 00:39:31,240
when you're generating if you're
928
00:39:29,920 --> 00:39:33,040
generating for something like code
929
00:39:31,240 --> 00:39:34,480
generation I definitely suggest that you
930
00:39:33,040 --> 00:39:36,119
modify your temperature settings
931
00:39:34,480 --> 00:39:38,359
appropriately and set it to a low
932
00:39:36,119 --> 00:39:42,160
temperature um otherwise you'll get kind
933
00:39:38,359 --> 00:39:45,079
of crazy uh code but if you set it to a
934
00:39:42,160 --> 00:39:45,079
low temperature you can get
935
00:39:46,440 --> 00:39:52,160
better anyway um one really core
936
00:39:49,640 --> 00:39:54,240
capability of code LMS especially ones
937
00:39:52,160 --> 00:39:55,599
that you use in your IDE like uh
938
00:39:54,240 --> 00:39:58,160
co-pilot is
939
00:39:55,599 --> 00:40:00,000
infilling and um
940
00:39:58,160 --> 00:40:03,680
the the paper that proposed this is
941
00:40:00,000 --> 00:40:05,920
actually by Daniel Freed at LTI here and
942
00:40:03,680 --> 00:40:09,160
um
943
00:40:05,920 --> 00:40:11,240
the basically what you want to do often
944
00:40:09,160 --> 00:40:13,000
is you have previous code you have next
945
00:40:11,240 --> 00:40:14,680
code and you want to just fill in like a
946
00:40:13,000 --> 00:40:17,960
line that's missing like you want to add
947
00:40:14,680 --> 00:40:19,040
an extra you know if statement or or
948
00:40:17,960 --> 00:40:22,720
some sort of
949
00:40:19,040 --> 00:40:24,880
modification and so the way that at
950
00:40:22,720 --> 00:40:27,000
least this paper proposed it and the way
951
00:40:24,880 --> 00:40:29,800
that I think most LMS are actually doing
952
00:40:27,000 --> 00:40:30,640
this is they take a standard left to
953
00:40:29,800 --> 00:40:33,200
right
954
00:40:30,640 --> 00:40:36,040
LM and what they want to do is they want
955
00:40:33,200 --> 00:40:39,040
to infill this code chunk and so what
956
00:40:36,040 --> 00:40:40,440
they do is they put a mask in the place
957
00:40:39,040 --> 00:40:42,119
where they want to fill the chunk which
958
00:40:40,440 --> 00:40:46,280
would also be where your cursor is in
959
00:40:42,119 --> 00:40:49,960
your IDE right uh at that point and then
960
00:40:46,280 --> 00:40:52,680
they have Mas to zero and then at the
961
00:40:49,960 --> 00:40:57,400
end they put mask to zero again and then
962
00:40:52,680 --> 00:40:59,000
they output the like you know all of the
963
00:40:57,400 --> 00:41:01,040
code that you want to generate there and
964
00:40:59,000 --> 00:41:02,839
so you can just kind of arbitrarily
965
00:41:01,040 --> 00:41:05,480
generate these trunks by pulling you
966
00:41:02,839 --> 00:41:07,000
know masking out chunks uh putting in
967
00:41:05,480 --> 00:41:08,960
The Mask token and then moving it to the
968
00:41:07,000 --> 00:41:10,440
end of the sequence and then you can
969
00:41:08,960 --> 00:41:13,160
just use a standard left to right Auto
970
00:41:10,440 --> 00:41:15,359
regressive language model to solve this
971
00:41:13,160 --> 00:41:17,040
problem so this is really important if
972
00:41:15,359 --> 00:41:18,520
you want to build like a co-pilot style
973
00:41:17,040 --> 00:41:20,160
thing and all of the code language
974
00:41:18,520 --> 00:41:23,680
models that I talk about at the end of
975
00:41:20,160 --> 00:41:23,680
this class uh use this
976
00:41:24,800 --> 00:41:30,440
technique um another thing is there's
977
00:41:28,160 --> 00:41:33,760
lots of available information uh for
978
00:41:30,440 --> 00:41:36,040
learning coding things um or for solving
979
00:41:33,760 --> 00:41:38,880
coding tasks this includes you know the
980
00:41:36,040 --> 00:41:40,440
current code context of course um also
981
00:41:38,880 --> 00:41:41,920
the description of the issue that you
982
00:41:40,440 --> 00:41:45,160
want to be fixing like if you're solving
983
00:41:41,920 --> 00:41:49,240
a poll request um repo context from
984
00:41:45,160 --> 00:41:51,880
other files um what tabs you have open
985
00:41:49,240 --> 00:41:55,920
uh so that that's also an important
986
00:41:51,880 --> 00:41:58,599
thing and when GitHub co-pilot came out
987
00:41:55,920 --> 00:42:01,960
they didn't really tell you the details
988
00:41:58,599 --> 00:42:04,480
of how they were doing this but um
989
00:42:01,960 --> 00:42:09,079
GitHub co-pilot is written in JavaScript
990
00:42:04,480 --> 00:42:11,839
and uh there was a p PhD student I think
991
00:42:09,079 --> 00:42:14,000
from maybe Georgia Tech or something uh
992
00:42:11,839 --> 00:42:16,839
who or Master student who basically went
993
00:42:14,000 --> 00:42:19,160
in and took the JavaScript and like Dem
994
00:42:16,839 --> 00:42:21,839
minified it and like reverse engineered
995
00:42:19,160 --> 00:42:23,640
what was actually happening um and uh
996
00:42:21,839 --> 00:42:26,680
wrote A Blog about it and this blog is
997
00:42:23,640 --> 00:42:28,800
is great uh so basically what uh
998
00:42:26,680 --> 00:42:32,200
co-pilot was doing which also kind of
999
00:42:28,800 --> 00:42:33,839
gives you a gold standard um way of uh
1000
00:42:32,200 --> 00:42:36,920
looking
1001
00:42:33,839 --> 00:42:39,440
at uh you know what kind of information
1002
00:42:36,920 --> 00:42:43,440
is necessary to create a good model is
1003
00:42:39,440 --> 00:42:45,240
first they extract um information for
1004
00:42:43,440 --> 00:42:47,400
the prompt given the current document
1005
00:42:45,240 --> 00:42:49,240
and the cursor position so they take the
1006
00:42:47,400 --> 00:42:51,720
current document where is the cursor and
1007
00:42:49,240 --> 00:42:54,640
what is before this and what is after
1008
00:42:51,720 --> 00:42:56,960
this um they identify the relative path
1009
00:42:54,640 --> 00:42:59,960
of the file and what language it's in so
1010
00:42:56,960 --> 00:43:01,760
they they identifi python files or
1011
00:42:59,960 --> 00:43:04,240
JavaScript files or
1012
00:43:01,760 --> 00:43:07,440
whatever they find the most recently
1013
00:43:04,240 --> 00:43:09,800
accessed 20 files in the same language
1014
00:43:07,440 --> 00:43:12,599
so like if you've opened 20 tabs they
1015
00:43:09,800 --> 00:43:15,559
keep track of which tab you had
1016
00:43:12,599 --> 00:43:18,280
open um and then the actual prompt that
1017
00:43:15,559 --> 00:43:22,119
they send over includes text that is
1018
00:43:18,280 --> 00:43:23,640
before text that's after um similar
1019
00:43:22,119 --> 00:43:26,520
files out of the 20 files that you've
1020
00:43:23,640 --> 00:43:29,480
opened recently um also information from
1021
00:43:26,520 --> 00:43:31,760
imported files and metadata about the
1022
00:43:29,480 --> 00:43:33,079
language and the path so all of this is
1023
00:43:31,760 --> 00:43:37,079
sent to the
1024
00:43:33,079 --> 00:43:38,720
model um and so this is just basically
1025
00:43:37,079 --> 00:43:40,160
it's really good prompt engineering
1026
00:43:38,720 --> 00:43:41,760
right they're figuring out a good way to
1027
00:43:40,160 --> 00:43:44,200
get all of the information that would be
1028
00:43:41,760 --> 00:43:45,680
useful uh for getting this model to work
1029
00:43:44,200 --> 00:43:49,559
into the
1030
00:43:45,680 --> 00:43:50,920
prompt um so I there's much much more
1031
00:43:49,559 --> 00:43:52,839
information in this plug it's a really
1032
00:43:50,920 --> 00:43:57,400
nice blog if you uh if you want to see
1033
00:43:52,839 --> 00:43:57,400
about it but um that's the basic
1034
00:43:57,640 --> 00:44:00,240
any any
1035
00:44:01,240 --> 00:44:07,160
questions okay
1036
00:44:03,520 --> 00:44:11,240
cool yeah is this just what gets sent
1037
00:44:07,160 --> 00:44:13,520
over to theot server or does
1038
00:44:11,240 --> 00:44:15,240
copilot this is what gets sent over to
1039
00:44:13,520 --> 00:44:17,920
the co-pilot server but the way they're
1040
00:44:15,240 --> 00:44:20,960
sending it makes me guess that like all
1041
00:44:17,920 --> 00:44:22,839
of this is red so like they also are
1042
00:44:20,960 --> 00:44:24,559
considering I didn't mention it here but
1043
00:44:22,839 --> 00:44:26,000
they're considering the token limit and
1044
00:44:24,559 --> 00:44:27,599
other stuff like that so that kind of
1045
00:44:26,000 --> 00:44:30,760
makes me feel like this is
1046
00:44:27,599 --> 00:44:30,760
actually the
1047
00:44:32,240 --> 00:44:38,440
pr uh cool
1048
00:44:35,359 --> 00:44:41,040
so another uh thing that you can do is
1049
00:44:38,440 --> 00:44:42,520
retrieval based code generation and
1050
00:44:41,040 --> 00:44:45,640
retrieval based code
1051
00:44:42,520 --> 00:44:47,599
generation uh basically what it does is
1052
00:44:45,640 --> 00:44:50,920
it's like rag for code
1053
00:44:47,599 --> 00:44:53,240
Generation Um and this has been around
1054
00:44:50,920 --> 00:44:55,640
for a while including our work that I
1055
00:44:53,240 --> 00:44:57,680
cited here and a few more in in
1056
00:44:55,640 --> 00:44:59,960
2018 um
1057
00:44:57,680 --> 00:45:03,000
and so one way you can do this is you
1058
00:44:59,960 --> 00:45:07,160
can retrieve similar code from online
1059
00:45:03,000 --> 00:45:09,720
and then use it to basically prompt a
1060
00:45:07,160 --> 00:45:11,920
retrieval augmented language model uh
1061
00:45:09,720 --> 00:45:14,480
this is good if you have a model that's
1062
00:45:11,920 --> 00:45:16,920
not super good at code in the first
1063
00:45:14,480 --> 00:45:19,920
place or you know it's making mistakes
1064
00:45:16,920 --> 00:45:21,680
it's also good if you have a large code
1065
00:45:19,920 --> 00:45:23,040
base like that's inter internal and you
1066
00:45:21,680 --> 00:45:24,200
know the language model was not trained
1067
00:45:23,040 --> 00:45:26,359
on it but you still want to use that
1068
00:45:24,200 --> 00:45:27,559
code base for code generation so it's
1069
00:45:26,359 --> 00:45:29,599
really good if you're working at like a
1070
00:45:27,559 --> 00:45:32,160
big company for example that has a very
1071
00:45:29,599 --> 00:45:33,319
constant coding style but hasn't trained
1072
00:45:32,160 --> 00:45:37,160
its own
1073
00:45:33,319 --> 00:45:39,720
LM um also particularly in code there's
1074
00:45:37,160 --> 00:45:43,559
also documentation uh which can be
1075
00:45:39,720 --> 00:45:46,920
retrieved and so we have new libraries
1076
00:45:43,559 --> 00:45:51,359
all the time right and one frustrating
1077
00:45:46,920 --> 00:45:53,119
thing when using like uh chat jpt or CLA
1078
00:45:51,359 --> 00:45:57,400
or something like that when you're
1079
00:45:53,119 --> 00:45:59,559
writing programs is that it can use old
1080
00:45:57,400 --> 00:46:03,480
versions of libraries that are no longer
1081
00:45:59,559 --> 00:46:05,359
compatible and so um in this paper uh
1082
00:46:03,480 --> 00:46:08,359
which this is one of our papers too we
1083
00:46:05,359 --> 00:46:10,079
called it DOC prompting um basically the
1084
00:46:08,359 --> 00:46:13,720
idea is that
1085
00:46:10,079 --> 00:46:17,440
you have your natural language input and
1086
00:46:13,720 --> 00:46:20,119
then you look up uh similar thing
1087
00:46:17,440 --> 00:46:23,240
similar documentation so you find like
1088
00:46:20,119 --> 00:46:25,319
pigment is a general syntax highlighter
1089
00:46:23,240 --> 00:46:28,160
uh so you can uh find syntax
1090
00:46:25,319 --> 00:46:31,160
highlighting um you can also look up the
1091
00:46:28,160 --> 00:46:32,640
lexer you can look up the HTML formatter
1092
00:46:31,160 --> 00:46:35,119
and then all of the things that have
1093
00:46:32,640 --> 00:46:37,000
similar documentation then you can uh
1094
00:46:35,119 --> 00:46:39,480
append that to the prompt and then have
1095
00:46:37,000 --> 00:46:41,680
that Genera output and we demonstrate
1096
00:46:39,480 --> 00:46:43,200
that this is good both in general but
1097
00:46:41,680 --> 00:46:44,800
also it's particularly good when you're
1098
00:46:43,200 --> 00:46:46,240
dealing with new libraries that haven't
1099
00:46:44,800 --> 00:46:48,280
been seen before or libraries that have
1100
00:46:46,240 --> 00:46:50,119
been updated so this is another thing
1101
00:46:48,280 --> 00:46:53,000
that you can
1102
00:46:50,119 --> 00:46:55,720
do
1103
00:46:53,000 --> 00:46:57,520
cool um another thing that you can do
1104
00:46:55,720 --> 00:47:00,040
with code that you can't do easily with
1105
00:46:57,520 --> 00:47:04,040
natural language is execution
1106
00:47:00,040 --> 00:47:06,119
feedback and so this is a a paper where
1107
00:47:04,040 --> 00:47:09,359
basically they do something that's
1108
00:47:06,119 --> 00:47:10,319
rather simple but they generate multiple
1109
00:47:09,359 --> 00:47:13,359
types of
1110
00:47:10,319 --> 00:47:14,559
code or multiple instances of code so
1111
00:47:13,359 --> 00:47:16,880
they basically sample different
1112
00:47:14,559 --> 00:47:19,960
varieties of code and I was talking
1113
00:47:16,880 --> 00:47:22,720
about like casset K right uh before
1114
00:47:19,960 --> 00:47:25,000
casset K is good if you have some way to
1115
00:47:22,720 --> 00:47:26,520
confirm which output is correct like you
1116
00:47:25,000 --> 00:47:28,040
already have unit tests and you can run
1117
00:47:26,520 --> 00:47:29,440
the unit test and identify which one
1118
00:47:28,040 --> 00:47:31,839
passes the unit test or you can have a
1119
00:47:29,440 --> 00:47:34,160
human check it but in the case when you
1120
00:47:31,839 --> 00:47:35,640
can't do that what can you do and
1121
00:47:34,160 --> 00:47:38,079
basically what you can do is you can
1122
00:47:35,640 --> 00:47:40,800
execute all of the code Snippets that
1123
00:47:38,079 --> 00:47:43,839
the model generated and check if the
1124
00:47:40,800 --> 00:47:48,520
outputs overlap with each other and if
1125
00:47:43,839 --> 00:47:50,680
you have um you know 30 programs that
1126
00:47:48,520 --> 00:47:53,680
all generate very similar outputs then
1127
00:47:50,680 --> 00:47:55,079
those outputs you know then that program
1128
00:47:53,680 --> 00:47:56,520
is probably correct and then you can
1129
00:47:55,079 --> 00:48:00,000
just pick one of them according to some
1130
00:47:56,520 --> 00:48:02,160
criteria Ian specifically in this case
1131
00:48:00,000 --> 00:48:03,960
they picked the program that has the
1132
00:48:02,160 --> 00:48:05,599
lowest base risk like when we talked
1133
00:48:03,960 --> 00:48:09,040
about minimum base risk and the decoding
1134
00:48:05,599 --> 00:48:10,839
much so um they they basically execute a
1135
00:48:09,040 --> 00:48:12,800
lot and then calculate the base risk of
1136
00:48:10,839 --> 00:48:17,000
that
1137
00:48:12,800 --> 00:48:17,000
that cool um
1138
00:48:17,680 --> 00:48:24,440
yeah yeah and so like self consistency
1139
00:48:21,599 --> 00:48:26,079
is a variety of Base risk um and they're
1140
00:48:24,440 --> 00:48:27,640
using base risk here because outputs
1141
00:48:26,079 --> 00:48:30,720
might not be exact the same but being
1142
00:48:27,640 --> 00:48:30,720
closer is probably better
1143
00:48:34,160 --> 00:48:39,040
than
1144
00:48:36,760 --> 00:48:40,559
comp comparison of the code yeah that's
1145
00:48:39,040 --> 00:48:42,880
a good question especially if you use
1146
00:48:40,559 --> 00:48:44,319
something good like uh code BT score to
1147
00:48:42,880 --> 00:48:46,280
do that comparison you might not even
1148
00:48:44,319 --> 00:48:50,280
need to that's
1149
00:48:46,280 --> 00:48:50,280
that I don't think they did that in
1150
00:48:50,559 --> 00:48:57,240
this cool um another interesting thing
1151
00:48:54,920 --> 00:48:59,760
um is there's
1152
00:48:57,240 --> 00:49:04,119
several lines of work on fixing based on
1153
00:48:59,760 --> 00:49:06,720
eror messages so the basic idea is you
1154
00:49:04,119 --> 00:49:08,160
generate code you try to run it you get
1155
00:49:06,720 --> 00:49:13,280
an airor message from it and then you
1156
00:49:08,160 --> 00:49:16,200
feed that back to the llm um in order to
1157
00:49:13,280 --> 00:49:17,520
you know correct the error and like llms
1158
00:49:16,200 --> 00:49:19,119
if you give them an err and you give
1159
00:49:17,520 --> 00:49:20,839
them buggy code they do have some
1160
00:49:19,119 --> 00:49:24,599
capacity to do that especially as you
1161
00:49:20,839 --> 00:49:28,839
get to theer llm so uh this is kind of a
1162
00:49:24,599 --> 00:49:31,200
a nice uh paradigm this paper intercode
1163
00:49:28,839 --> 00:49:33,880
actually generalizes this a bit and it's
1164
00:49:31,200 --> 00:49:38,359
more recent that's why I cited it here
1165
00:49:33,880 --> 00:49:40,000
and uh so this also um like says you can
1166
00:49:38,359 --> 00:49:42,640
do single turn code generation you can
1167
00:49:40,000 --> 00:49:44,960
also say oh could you please try again
1168
00:49:42,640 --> 00:49:46,400
um you can also uh do planning and
1169
00:49:44,960 --> 00:49:48,160
solving and other stuff like that so
1170
00:49:46,400 --> 00:49:49,960
this is a good kind of like environment
1171
00:49:48,160 --> 00:49:52,079
if you're interested in making these
1172
00:49:49,960 --> 00:49:56,720
more like interactive coding assistance
1173
00:49:52,079 --> 00:49:56,720
for example so you could take a look bre
1174
00:49:58,359 --> 00:50:03,359
cool
1175
00:50:00,119 --> 00:50:07,119
um another important topic is code
1176
00:50:03,359 --> 00:50:08,880
synthesis from input output examples so
1177
00:50:07,119 --> 00:50:12,319
actually when you said code generation
1178
00:50:08,880 --> 00:50:14,760
or code synthesis like five years ago or
1179
00:50:12,319 --> 00:50:17,440
10 years ago a lot of people would think
1180
00:50:14,760 --> 00:50:19,440
about this uh so this is actually this
1181
00:50:17,440 --> 00:50:22,440
has been around a lot longer than code
1182
00:50:19,440 --> 00:50:24,160
synthesis um than serious inquiries into
1183
00:50:22,440 --> 00:50:27,680
code synthesis from natural
1184
00:50:24,160 --> 00:50:30,680
language um
1185
00:50:27,680 --> 00:50:33,839
so basically the way this works is it
1186
00:50:30,680 --> 00:50:35,319
can have no natural language whatsoever
1187
00:50:33,839 --> 00:50:39,119
um but you still can try to guess the
1188
00:50:35,319 --> 00:50:42,000
input from uh input output examples when
1189
00:50:39,119 --> 00:50:44,319
would you want to do this so one example
1190
00:50:42,000 --> 00:50:45,839
of this is something called flashfill
1191
00:50:44,319 --> 00:50:48,599
which has been around for a very long
1192
00:50:45,839 --> 00:50:51,839
time in Microsoft Excel and basically
1193
00:50:48,599 --> 00:50:55,400
the way it works is you have one column
1194
00:50:51,839 --> 00:50:58,640
and um the column might be
1195
00:50:55,400 --> 00:50:58,640
like uh
1196
00:50:59,559 --> 00:51:02,880
R new
1197
00:51:03,040 --> 00:51:12,799
big and uh
1198
00:51:06,559 --> 00:51:12,799
else just pick on three because he also
1199
00:51:14,040 --> 00:51:19,599
up and so we have this column and then
1200
00:51:17,160 --> 00:51:19,599
we have like
1201
00:51:20,400 --> 00:51:26,760
gig um and from like one or a couple
1202
00:51:25,160 --> 00:51:28,400
examples basically what it does is it
1203
00:51:26,760 --> 00:51:30,319
tries to induce a program that can
1204
00:51:28,400 --> 00:51:33,319
generate all the other examples properly
1205
00:51:30,319 --> 00:51:35,599
so in this particular case that would be
1206
00:51:33,319 --> 00:51:38,440
um you know like
1207
00:51:35,599 --> 00:51:40,480
split take the first character from the
1208
00:51:38,440 --> 00:51:43,280
first one and all of the last one and
1209
00:51:40,480 --> 00:51:45,280
then concatenate and then M or something
1210
00:51:43,280 --> 00:51:48,280
like that right
1211
00:51:45,280 --> 00:51:50,079
um and so this is useful in some cases
1212
00:51:48,280 --> 00:51:51,599
like you know in Excel when you have
1213
00:51:50,079 --> 00:51:53,359
this long sheet and you want to fill in
1214
00:51:51,599 --> 00:51:56,160
the rest of it and this has actually
1215
00:51:53,359 --> 00:51:57,720
been deployed uh you know in Excel in
1216
00:51:56,160 --> 00:52:00,960
white
1217
00:51:57,720 --> 00:52:02,559
used um if you're interested in this
1218
00:52:00,960 --> 00:52:06,040
topic there's a fair amount of work in
1219
00:52:02,559 --> 00:52:08,839
it um my there's a little bit less work
1220
00:52:06,040 --> 00:52:10,240
now because most people are focusing on
1221
00:52:08,839 --> 00:52:12,400
uh learning programs from natural
1222
00:52:10,240 --> 00:52:14,839
language and other stuff like this but
1223
00:52:12,400 --> 00:52:16,480
uh this slightly older Pap paper called
1224
00:52:14,839 --> 00:52:19,359
interpret explains a bunch of the
1225
00:52:16,480 --> 00:52:22,880
different methods that people used and
1226
00:52:19,359 --> 00:52:25,920
um how you uh like how they compare and
1227
00:52:22,880 --> 00:52:28,119
stuff and also um Joshua ten and bums
1228
00:52:25,920 --> 00:52:29,880
group from MI has done a lot on program
1229
00:52:28,119 --> 00:52:31,319
synthesis from input output examples so
1230
00:52:29,880 --> 00:52:32,359
you could also take a look at that that
1231
00:52:31,319 --> 00:52:35,079
sounds
1232
00:52:32,359 --> 00:52:38,240
interesting um one thing about this is
1233
00:52:35,079 --> 00:52:40,280
these generally are mostly done on
1234
00:52:38,240 --> 00:52:43,319
domain specific languages so they're
1235
00:52:40,280 --> 00:52:46,839
mostly done like only for reg X's or
1236
00:52:43,319 --> 00:52:48,480
they're done only for you know SQL or
1237
00:52:46,839 --> 00:52:50,079
something like that not for the more
1238
00:52:48,480 --> 00:52:51,960
general purpose languages just because
1239
00:52:50,079 --> 00:52:54,079
the problem without any natural language
1240
00:52:51,960 --> 00:52:56,520
specification is harder and so you need
1241
00:52:54,079 --> 00:52:57,520
to like make the search space smaller or
1242
00:52:56,520 --> 00:53:01,559
Additionally you needed to make the
1243
00:52:57,520 --> 00:53:04,440
search small for theable so um that's a
1244
00:53:01,559 --> 00:53:04,440
another thing to know
1245
00:53:04,799 --> 00:53:09,440
about cool um any questions about
1246
00:53:09,480 --> 00:53:14,440
these nice okay so finally in the the
1247
00:53:12,559 --> 00:53:15,599
last few minutes I'd like to talk about
1248
00:53:14,440 --> 00:53:18,480
um code
1249
00:53:15,599 --> 00:53:22,880
LMS and I'm going to go through about
1250
00:53:18,480 --> 00:53:24,599
four of them the first one is codex and
1251
00:53:22,880 --> 00:53:26,200
so yeah actually what I should mention
1252
00:53:24,599 --> 00:53:28,079
is all of the LMS that I talked about up
1253
00:53:26,200 --> 00:53:30,640
until this point are code LMS because
1254
00:53:28,079 --> 00:53:31,680
every LM trains on code so I'm mainly
1255
00:53:30,640 --> 00:53:36,119
going to be talking about one
1256
00:53:31,680 --> 00:53:39,200
specifically for code this time um so
1257
00:53:36,119 --> 00:53:42,480
codex is the first and kind of like
1258
00:53:39,200 --> 00:53:45,880
first really big impact Cod LM um it was
1259
00:53:42,480 --> 00:53:47,720
created by open AI um originally I don't
1260
00:53:45,880 --> 00:53:49,079
know about the deployed model now
1261
00:53:47,720 --> 00:53:51,599
because you know they don't release the
1262
00:53:49,079 --> 00:53:53,799
details of it but originally this was
1263
00:53:51,599 --> 00:53:57,920
trained by continued training from
1264
00:53:53,799 --> 00:53:59,799
gpt3 so they had a text M and then they
1265
00:53:57,920 --> 00:54:03,079
just continued training it on lots and
1266
00:53:59,799 --> 00:54:05,680
lots of code from GitHub um so yeah the
1267
00:54:03,079 --> 00:54:08,799
data was lots of data from GitHub um if
1268
00:54:05,680 --> 00:54:11,280
you did anything on GitHub at any point
1269
00:54:08,799 --> 00:54:14,119
in your life uh you might be uh
1270
00:54:11,280 --> 00:54:17,720
contributing to codep so thank you on
1271
00:54:14,119 --> 00:54:22,440
behalf of open AI a 80 billion dollar
1272
00:54:17,720 --> 00:54:24,599
company and uh importantly it Powers I
1273
00:54:22,440 --> 00:54:27,599
believe it still Powers GitHub
1274
00:54:24,599 --> 00:54:31,160
co-pilot one interesting thing is they
1275
00:54:27,599 --> 00:54:33,119
had a large version of codex um and then
1276
00:54:31,160 --> 00:54:35,799
they had a smaller version of codex
1277
00:54:33,119 --> 00:54:38,359
called code kushman and the thing
1278
00:54:35,799 --> 00:54:40,040
actually powering GitHub co-pilot is not
1279
00:54:38,359 --> 00:54:42,839
the the largest version it's not code Da
1280
00:54:40,040 --> 00:54:46,359
Vinci it's code kushman which is uh
1281
00:54:42,839 --> 00:54:48,680
smaller and much faster and the reason
1282
00:54:46,359 --> 00:54:50,640
why is probably twofold number one um
1283
00:54:48,680 --> 00:54:54,160
you need really fast responses when
1284
00:54:50,640 --> 00:54:55,760
you're you know working on code and
1285
00:54:54,160 --> 00:54:57,440
there's actually in co-pilot there's
1286
00:54:55,760 --> 00:55:00,280
some cach and other stuff like that to
1287
00:54:57,440 --> 00:55:01,960
make your responses very fast as well um
1288
00:55:00,280 --> 00:55:03,400
the second reason is probably it' just
1289
00:55:01,960 --> 00:55:05,040
be too expensive for them to run Da
1290
00:55:03,400 --> 00:55:06,760
Vinci over all the code bases for how
1291
00:55:05,040 --> 00:55:10,400
much they're charging you for co-pilot
1292
00:55:06,760 --> 00:55:12,119
so like every single time you like
1293
00:55:10,400 --> 00:55:14,280
change something in one of your files if
1294
00:55:12,119 --> 00:55:17,079
you're using copilot it's rerunning in
1295
00:55:14,280 --> 00:55:19,359
llm and that would become very expensive
1296
00:55:17,079 --> 00:55:20,599
if you look look at the token count so I
1297
00:55:19,359 --> 00:55:21,839
think they're using a smaller model
1298
00:55:20,599 --> 00:55:22,920
because of that but nonetheless it's
1299
00:55:21,839 --> 00:55:27,039
very
1300
00:55:22,920 --> 00:55:28,640
good um cool
1301
00:55:27,039 --> 00:55:30,680
so now I want to get into some more
1302
00:55:28,640 --> 00:55:33,880
modern models uh the first one I want to
1303
00:55:30,680 --> 00:55:35,520
get into is uh star coder 2 and the
1304
00:55:33,880 --> 00:55:38,359
reason why I want to talk about this
1305
00:55:35,520 --> 00:55:40,160
first is because uh not necessarily that
1306
00:55:38,359 --> 00:55:41,880
it's like absolutely the best one
1307
00:55:40,160 --> 00:55:43,400
although it's very good but it's one of
1308
00:55:41,880 --> 00:55:45,319
the models that actually tells us
1309
00:55:43,400 --> 00:55:47,240
everything about their training data and
1310
00:55:45,319 --> 00:55:50,400
training process and stuff so we know uh
1311
00:55:47,240 --> 00:55:53,039
everything about them so the creator of
1312
00:55:50,400 --> 00:55:54,440
This was um the big science project
1313
00:55:53,039 --> 00:55:56,880
which was led by hugging face and
1314
00:55:54,440 --> 00:55:58,680
service now um
1315
00:55:56,880 --> 00:56:02,079
and includes lots and lots of people
1316
00:55:58,680 --> 00:56:04,960
from various universities and things um
1317
00:56:02,079 --> 00:56:09,319
the architecture is mostly llama style
1318
00:56:04,960 --> 00:56:11,960
it has 3B 7B and 15b variants um one
1319
00:56:09,319 --> 00:56:15,480
interesting thing about all code LMS is
1320
00:56:11,960 --> 00:56:17,680
that they all do long context they all
1321
00:56:15,480 --> 00:56:20,359
do longer context and they all
1322
00:56:17,680 --> 00:56:23,200
reconfigure rope for longer context
1323
00:56:20,359 --> 00:56:25,280
specifically so you know rope has a
1324
00:56:23,200 --> 00:56:28,599
Theta parameter that allows you to tell
1325
00:56:25,280 --> 00:56:31,720
how long the um like sign sine waves and
1326
00:56:28,599 --> 00:56:33,720
stuff like that are and they all always
1327
00:56:31,720 --> 00:56:36,079
um change the parameters so that the
1328
00:56:33,720 --> 00:56:38,599
context is longer so that's another good
1329
00:56:36,079 --> 00:56:38,599
thing to know
1330
00:56:38,640 --> 00:56:44,559
about the the training data section of
1331
00:56:42,000 --> 00:56:48,799
this paper is really fascinating I can
1332
00:56:44,559 --> 00:56:51,240
like it it's a really good way to look
1333
00:56:48,799 --> 00:56:54,160
at you know how much data engineering
1334
00:56:51,240 --> 00:56:55,960
goes into making a good model um and
1335
00:56:54,160 --> 00:56:57,960
just very shortly they give a lot more
1336
00:56:55,960 --> 00:57:00,640
detail in the paper but it's trained on
1337
00:56:57,960 --> 00:57:04,839
code uh including the stack which is
1338
00:57:00,640 --> 00:57:06,920
just a huge uh amount like repository of
1339
00:57:04,839 --> 00:57:08,359
code that I'll talk about in a second
1340
00:57:06,920 --> 00:57:10,559
separately from that it was trained on
1341
00:57:08,359 --> 00:57:13,079
GitHub issues it was trained on poll
1342
00:57:10,559 --> 00:57:16,000
requests Jupiter notebooks keggle
1343
00:57:13,079 --> 00:57:18,319
notebooks documentation and also
1344
00:57:16,000 --> 00:57:23,440
intermediate representations from uh
1345
00:57:18,319 --> 00:57:26,440
llvm so llvm is a uh you know like
1346
00:57:23,440 --> 00:57:28,920
intermediate uh compiler style thing
1347
00:57:26,440 --> 00:57:30,839
that is used for compiling code and it
1348
00:57:28,920 --> 00:57:34,400
was also trained on a few code relevant
1349
00:57:30,839 --> 00:57:38,440
natural language data sets
1350
00:57:34,400 --> 00:57:39,960
um so for pre-processing they do
1351
00:57:38,440 --> 00:57:42,640
something pretty interesting which is
1352
00:57:39,960 --> 00:57:44,240
they add metadata tags such as the repo
1353
00:57:42,640 --> 00:57:48,119
name and the file name and other stuff
1354
00:57:44,240 --> 00:57:49,799
like this uh 50% of the time and they do
1355
00:57:48,119 --> 00:57:51,599
this 50% of the time because they want
1356
00:57:49,799 --> 00:57:54,400
the model to work with them but also be
1357
00:57:51,599 --> 00:57:57,079
robust without them um and so you can
1358
00:57:54,400 --> 00:57:59,839
either add them or not add them at test
1359
00:57:57,079 --> 00:58:03,079
time uh they also do infilling every
1360
00:57:59,839 --> 00:58:05,960
serus code LM does infilling Based
1361
00:58:03,079 --> 00:58:07,480
training um one interesting thing about
1362
00:58:05,960 --> 00:58:08,960
this from the training perspective is
1363
00:58:07,480 --> 00:58:12,000
they actually trained it for four to
1364
00:58:08,960 --> 00:58:14,359
five epochs um which is much more than
1365
00:58:12,000 --> 00:58:17,160
we normally do so normally we only train
1366
00:58:14,359 --> 00:58:18,359
for like one Epoch over you know all of
1367
00:58:17,160 --> 00:58:20,079
the data we have but here they were
1368
00:58:18,359 --> 00:58:21,319
training for monger and that's just
1369
00:58:20,079 --> 00:58:23,359
because the amount of data they can get
1370
00:58:21,319 --> 00:58:24,400
for code is less than the amount of data
1371
00:58:23,359 --> 00:58:27,200
they can get for all the national
1372
00:58:24,400 --> 00:58:30,039
language I
1373
00:58:27,200 --> 00:58:33,200
so the data set that they created is uh
1374
00:58:30,039 --> 00:58:36,119
the stack 2 and this is a code
1375
00:58:33,200 --> 00:58:37,839
pre-training data set um one interesting
1376
00:58:36,119 --> 00:58:40,039
thing that they thought about was uh
1377
00:58:37,839 --> 00:58:42,960
license considerations so I talked about
1378
00:58:40,039 --> 00:58:44,480
the um how copyright is a problem when
1379
00:58:42,960 --> 00:58:46,640
trading large language models two
1380
00:58:44,480 --> 00:58:48,880
classes ago and so here they
1381
00:58:46,640 --> 00:58:50,119
specifically tried to find things with
1382
00:58:48,880 --> 00:58:52,520
permissive
1383
00:58:50,119 --> 00:58:53,880
licenses and so what they did is they
1384
00:58:52,520 --> 00:58:57,000
basically looked at the license on
1385
00:58:53,880 --> 00:58:59,520
GitHub um and if the GitHub license was
1386
00:58:57,000 --> 00:59:01,440
permissive they marked it as permissive
1387
00:58:59,520 --> 00:59:02,880
um then they tried to detect licenses
1388
00:59:01,440 --> 00:59:05,720
and then um if all of them were
1389
00:59:02,880 --> 00:59:08,000
permissive they marked it as
1390
00:59:05,720 --> 00:59:10,480
permissive this is a huge table that
1391
00:59:08,000 --> 00:59:14,160
they have in the paper of all of the
1392
00:59:10,480 --> 00:59:15,480
data that they have and um you know I'm
1393
00:59:14,160 --> 00:59:16,920
not going to go through all of this
1394
00:59:15,480 --> 00:59:18,920
obviously but what you can see is some
1395
00:59:16,920 --> 00:59:22,480
of the biggest data sets are like
1396
00:59:18,920 --> 00:59:26,280
Java um
1397
00:59:22,480 --> 00:59:28,640
PHP markdown
1398
00:59:26,280 --> 00:59:30,039
and uh Python and other stuff like that
1399
00:59:28,640 --> 00:59:32,240
so you can see the major programming
1400
00:59:30,039 --> 00:59:35,559
languages have lots of data but there's
1401
00:59:32,240 --> 00:59:38,400
also a long tail so if you like your uh
1402
00:59:35,559 --> 00:59:40,440
you know more esoteric uh but cool
1403
00:59:38,400 --> 00:59:43,960
programming languages like rust yes it
1404
00:59:40,440 --> 00:59:46,160
has rust too so um we can do all all of
1405
00:59:43,960 --> 00:59:46,160
those
1406
00:59:46,480 --> 00:59:53,079
things so the next model that I'd like
1407
00:59:49,799 --> 00:59:55,200
to talk about is cod llama and cod llama
1408
00:59:53,079 --> 00:59:57,920
is another competitive model it came out
1409
00:59:55,200 --> 00:59:59,480
a little bit before star coder and star
1410
00:59:57,920 --> 01:00:02,680
coder 2 and deep sea coder which I'm
1411
00:59:59,480 --> 01:00:04,079
going to talk about um this is a created
1412
01:00:02,680 --> 01:00:08,319
by
1413
01:00:04,079 --> 01:00:11,160
meta and um the architecture is the same
1414
01:00:08,319 --> 01:00:14,280
as llama 2 uh basically and they did
1415
01:00:11,160 --> 01:00:16,400
continued training from llama 2 um but
1416
01:00:14,280 --> 01:00:18,000
they trained it on longer input contexts
1417
01:00:16,400 --> 01:00:21,720
and they also extended the length of
1418
01:00:18,000 --> 01:00:23,559
rope so uh those are you know standard
1419
01:00:21,720 --> 01:00:26,680
things for code language
1420
01:00:23,559 --> 01:00:28,680
models it was trained on DED code and
1421
01:00:26,680 --> 01:00:30,400
also synthetically created instruction
1422
01:00:28,680 --> 01:00:33,280
data so they created like instruction
1423
01:00:30,400 --> 01:00:37,920
tuning data specifically for
1424
01:00:33,280 --> 01:00:39,480
code um and the training was incremental
1425
01:00:37,920 --> 01:00:42,559
with various data sets and what I mean
1426
01:00:39,480 --> 01:00:45,599
by this is they trained on 500 billion
1427
01:00:42,559 --> 01:00:47,599
uh I believe tokens of code and then
1428
01:00:45,599 --> 01:00:50,400
they did long context fine tuning on 20
1429
01:00:47,599 --> 01:00:52,599
billion tokens and then they also did
1430
01:00:50,400 --> 01:00:55,400
instruction tuning they also have a
1431
01:00:52,599 --> 01:00:57,079
python specific one and the reason why
1432
01:00:55,400 --> 01:00:59,640
they have a p specific one is not
1433
01:00:57,079 --> 01:01:02,319
because python is more import important
1434
01:00:59,640 --> 01:01:03,839
uh uh necessarily but because a lot of
1435
01:01:02,319 --> 01:01:05,559
the benchmarks are in Python because
1436
01:01:03,839 --> 01:01:06,920
machine learning people like who are
1437
01:01:05,559 --> 01:01:09,240
creating benchmarks they also like
1438
01:01:06,920 --> 01:01:11,200
python so python is more common in the
1439
01:01:09,240 --> 01:01:14,240
benchmarks so they basically wanted to
1440
01:01:11,200 --> 01:01:15,720
do well on the benchmarks I think uh and
1441
01:01:14,240 --> 01:01:17,920
and created a data set that does well in
1442
01:01:15,720 --> 01:01:19,240
the benchmarks but um if you are
1443
01:01:17,920 --> 01:01:23,160
creating python you can use the code
1444
01:01:19,240 --> 01:01:25,280
llama python it's better at pipelines so
1445
01:01:23,160 --> 01:01:28,000
um and then the final one I'd like to
1446
01:01:25,280 --> 01:01:29,839
talk about is is a deep seek coder uh
1447
01:01:28,000 --> 01:01:32,079
this is notable because it's a very
1448
01:01:29,839 --> 01:01:34,599
strong model it it's maybe the strongest
1449
01:01:32,079 --> 01:01:38,799
model on average over all the code
1450
01:01:34,599 --> 01:01:41,599
models um they did 87% the data is not
1451
01:01:38,799 --> 01:01:44,640
super clear but they did 87% source code
1452
01:01:41,599 --> 01:01:46,359
10% English um from markdown in stock
1453
01:01:44,640 --> 01:01:51,160
exchange and 3% Chinese because it's
1454
01:01:46,359 --> 01:01:53,559
from a Chinese company deep seek um and
1455
01:01:51,160 --> 01:01:54,960
they did standard prepr uh but one
1456
01:01:53,559 --> 01:01:57,319
interesting thing they did is they
1457
01:01:54,960 --> 01:01:59,200
included Library dependencies so they
1458
01:01:57,319 --> 01:02:01,799
basically crawled the dependency graph
1459
01:01:59,200 --> 01:02:03,640
of libraries pulled out files from the
1460
01:02:01,799 --> 01:02:06,000
libraries that were referenced and then
1461
01:02:03,640 --> 01:02:07,440
used them in training and so that's
1462
01:02:06,000 --> 01:02:09,319
particularly useful if you want the
1463
01:02:07,440 --> 01:02:12,920
model to be able to reference external
1464
01:02:09,319 --> 01:02:14,039
libraries well um so that's kind of an
1465
01:02:12,920 --> 01:02:17,279
interesting
1466
01:02:14,039 --> 01:02:19,599
thing um the architecture is pretty
1467
01:02:17,279 --> 01:02:22,960
standard it's llama likee with 1.3
1468
01:02:19,599 --> 01:02:24,599
billion 6.7 billion in 33b variants and
1469
01:02:22,960 --> 01:02:27,279
it has a reconfigured work like the
1470
01:02:24,599 --> 01:02:30,520
others and they on two trillion
1471
01:02:27,279 --> 01:02:34,200
tokens um so then a question becomes
1472
01:02:30,520 --> 01:02:36,680
which one to use um and I created a
1473
01:02:34,200 --> 01:02:39,160
summary here um all of them have
1474
01:02:36,680 --> 01:02:40,760
somewhat similar performance uh this is
1475
01:02:39,160 --> 01:02:42,760
they're compared in the star coder 2
1476
01:02:40,760 --> 01:02:45,640
paper so you can go in and look at
1477
01:02:42,760 --> 01:02:48,160
details at the starcode to paper um
1478
01:02:45,640 --> 01:02:51,119
deeps coder seems to be strong on
1479
01:02:48,160 --> 01:02:52,799
standard programming tasks um whereas
1480
01:02:51,119 --> 01:02:54,799
star coder seems to be strong on data
1481
01:02:52,799 --> 01:02:56,680
science notebooks so like on average
1482
01:02:54,799 --> 01:02:59,160
it's better at kind of sound notebooks
1483
01:02:56,680 --> 01:03:02,079
but all of them are good models um all
1484
01:02:59,160 --> 01:03:05,440
of them are not quite as good as uh like
1485
01:03:02,079 --> 01:03:08,920
gp4 quad on like they're very uh you
1486
01:03:05,440 --> 01:03:10,799
know more complex tasks but uh they're
1487
01:03:08,920 --> 01:03:12,359
available and you can find to them and
1488
01:03:10,799 --> 01:03:16,880
do other things like that as
1489
01:03:12,359 --> 01:03:21,599
well one caveat about the Deep seek
1490
01:03:16,880 --> 01:03:24,640
thing is actually if I go back to this
1491
01:03:21,599 --> 01:03:27,559
slide um a lot of the models up here are
1492
01:03:24,640 --> 01:03:29,640
deep seek um so you do need to be a
1493
01:03:27,559 --> 01:03:31,400
little bit careful about like
1494
01:03:29,640 --> 01:03:34,400
interpreting their human Evel results
1495
01:03:31,400 --> 01:03:36,319
because it's possible that the model uh
1496
01:03:34,400 --> 01:03:38,799
was trained on data very similar to
1497
01:03:36,319 --> 01:03:40,279
human eval or something like that so do
1498
01:03:38,799 --> 01:03:42,880
take that with a grain of salt but even
1499
01:03:40,279 --> 01:03:44,520
on other data sets where presumably the
1500
01:03:42,880 --> 01:03:46,760
model has not seen those data sets it
1501
01:03:44,520 --> 01:03:49,920
still does very well so it's not like
1502
01:03:46,760 --> 01:03:51,480
it's um you know as you can see it's
1503
01:03:49,920 --> 01:03:54,640
still one of the most competitive code
1504
01:03:51,480 --> 01:03:57,680
models even on this new LCB um data set
1505
01:03:54,640 --> 01:04:01,359
so uh that's want into the
1506
01:03:57,680 --> 01:04:03,000
a cool um that's all I have for today I
1507
01:04:01,359 --> 01:04:04,359
you know I love to talk about this topic
1508
01:04:03,000 --> 01:04:06,480
I've done a lot of research on it so I'm
1509
01:04:04,359 --> 01:04:11,200
happy to discuss any questions if people
1510
01:04:06,480 --> 01:04:14,720
have them either in front of everyone or
1511
01:04:11,200 --> 01:04:14,720
after any any
1512
01:04:16,480 --> 01:04:24,160
questions uh yeah just wondering there a
1513
01:04:20,359 --> 01:04:27,720
like enfor the outut during using things
1514
01:04:24,160 --> 01:04:27,720
other than models
1515
01:04:30,599 --> 01:04:36,599
yeah great question is there a way to
1516
01:04:33,640 --> 01:04:38,200
enforce uh restrictions at decoding time
1517
01:04:36,599 --> 01:04:39,760
other than using the model's uh
1518
01:04:38,200 --> 01:04:42,240
probabilities because this is code and
1519
01:04:39,760 --> 01:04:42,240
we know the
1520
01:04:42,440 --> 01:04:51,079
syntax yes and no um there
1521
01:04:46,319 --> 01:04:53,200
are for code it's not always immediately
1522
01:04:51,079 --> 01:04:54,400
obvious like I mean one one thing you
1523
01:04:53,200 --> 01:04:55,960
could do is just generate a bunch of
1524
01:04:54,400 --> 01:04:58,520
results and throw out all the syntax
1525
01:04:55,960 --> 01:04:59,480
incorrect on that's easy right um but if
1526
01:04:58,520 --> 01:05:02,520
you don't want to do that and you want
1527
01:04:59,480 --> 01:05:04,839
to do it at decoding time it's dependent
1528
01:05:02,520 --> 01:05:07,480
on you being able to have an incremental
1529
01:05:04,839 --> 01:05:09,079
syntax parser that allows you to like
1530
01:05:07,480 --> 01:05:12,400
throw out bad
1531
01:05:09,079 --> 01:05:14,160
hypotheses like incrementally and that's
1532
01:05:12,400 --> 01:05:16,240
possible that's very easy for some
1533
01:05:14,160 --> 01:05:17,200
languages and not possible not as easy
1534
01:05:16,240 --> 01:05:20,559
for other
1535
01:05:17,200 --> 01:05:23,720
languages um one really big thing right
1536
01:05:20,559 --> 01:05:26,599
now is Json so like a lot of the time
1537
01:05:23,720 --> 01:05:28,319
people want to Output Json uh in you
1538
01:05:26,599 --> 01:05:31,559
know then par the Json and use it in
1539
01:05:28,319 --> 01:05:36,640
some Downstream test and there actually
1540
01:05:31,559 --> 01:05:36,640
are libraries um just to give a
1541
01:05:38,559 --> 01:05:45,839
few um here's one this Library called
1542
01:05:42,640 --> 01:05:48,799
outlines um is one that basically allows
1543
01:05:45,839 --> 01:05:50,440
you to incorporate syntactic constraints
1544
01:05:48,799 --> 01:05:53,240
through like weighted finite State
1545
01:05:50,440 --> 01:05:55,160
automata and other stuff like this um to
1546
01:05:53,240 --> 01:05:57,680
allow you to throw away anything that
1547
01:05:55,160 --> 01:06:02,039
doesn't here to your grammar another
1548
01:05:57,680 --> 01:06:02,039
popular one which
1549
01:06:02,720 --> 01:06:06,880
is nice but a little bit more
1550
01:06:07,160 --> 01:06:12,760
complicated is
1551
01:06:09,799 --> 01:06:15,160
um this one uh
1552
01:06:12,760 --> 01:06:17,200
guidance so if you want to look at like
1553
01:06:15,160 --> 01:06:19,720
constrained generation of outputs I
1554
01:06:17,200 --> 01:06:21,640
would definitely recommend uh looking at
1555
01:06:19,720 --> 01:06:22,839
one of these two either outlines or or
1556
01:06:21,640 --> 01:06:24,440
guidance and they both give you
1557
01:06:22,839 --> 01:06:26,520
different ways to add constraints to
1558
01:06:24,440 --> 01:06:29,079
Output um we did actually talk about
1559
01:06:26,520 --> 01:06:31,200
outlines a little bit during the like uh
1560
01:06:29,079 --> 01:06:34,599
generation class but um we didn't go
1561
01:06:31,200 --> 01:06:35,760
into a lot of details so uh yeah but I I
1562
01:06:34,599 --> 01:06:39,559
would recommend
1563
01:06:35,760 --> 01:06:39,559
this cool any other
1564
01:06:39,599 --> 01:06:43,920
questions okay if not uh I guess we can
1565
01:06:42,079 --> 01:06:47,880
finish up and I'm happy to talk we have
1566
01:06:43,920 --> 01:06:47,880
a little bit of extra time