TRASCRIZIONE 🔗
WEBVTT
1
00:00:00.060 --> 00:00:16.320
[ on-hold music] Hey everyone, welcome to the Latent Space Podcast. This is Alessio, partner and CTO in residence at Decibel Partners.
2
00:00:16.920 --> 00:00:27.060
Today we have no Swix, um, because he's in, he's in Singapore, so, uh, it's a, it's a one-on-one discussion with, uh, Tri Dao. Welcome. Hi everyone. I'm, I'm Tri Dao. Excited to be here.
3
00:00:27.420 --> 00:00:38.920
Tri just completed his PhD at Stanford a month ago. You might not remember his name, but he's one of the main authors in the Flash Attention paper, which is one of the seminal work in, uh, the Transformer era.
4
00:00:39.420 --> 00:00:50.960
He's got a lot of interest from efficient transformer training and inference, long range sequence model, a lot of interesting stuff and now you're gonna be a assistant professor in CS at Princeton next year.
5
00:00:51.160 --> 00:01:01.280
Yeah, that's right. Yeah. And in the meantime, just to get, you know, a low pressure thing, you're a chief scientist at, at Together as well, which, uh, is the company behind the Red Pajama. Yeah, yeah.
6
00:01:01.340 --> 00:01:10.080
So I just, uh, joined this week actually, and it's been really exciting. So what's something that is not on the internet that people should know about you? Hmm. Let's see.
7
00:01:10.660 --> 00:01:15.040
When I started college, I was gonna be an economist, so- Hmm... I was, uh, fully on board.
8
00:01:15.120 --> 00:01:28.220
I was gonna major in economics, but the first week I was at, at Stanford undergrad, I took a few math classes and I immediately decided that I was gonna be a math major, and that kind of changed the course of my career.
9
00:01:28.660 --> 00:01:39.740
So now I'm doing kind of math, computer science, AI research. I had a similar thing. I started with, uh, with physics and then I took like a programming course- Mm-hmm... and I was like, "I gotta do computer science."
10
00:01:39.780 --> 00:01:47.800
Yeah. [laughs] "I don't wanna do physics." So Flash Attention is definitely, everybody's using this, everybody loves it. You just released Flash Attention 2- Yeah, that's right... last week.
11
00:01:48.120 --> 00:01:55.400
Um- Um, yeah, early this week on Monday. Yeah. Yeah. Yeah. You know, AI time. Things- Yeah. Things move fast. Yeah. Four days ago is one week ago- [laughs]... in, in AI.
12
00:01:56.060 --> 00:02:03.080
So maybe let's run through some of the Flash Attention highlights. Mm-hmm. Some of the innovation there. Yeah, for sure. And then we can dive into Flash Attention 2.
13
00:02:03.600 --> 00:02:12.800
So the core improvement in Flash Attention is that traditional attention is a quadratic- Mm-hmm... sequence length. Yeah. So it's m to the, to the two.
14
00:02:13.360 --> 00:02:25.220
Flash Attention is linear, which obviously helps with, uh, with scaling some of these models. The two factors, um, there, so of course the goal has been to make attention go faster- Mm-hmm... or more memory efficient.
Load full transcript
15
00:02:25.680 --> 00:02:37.960
And ever since attention became popular in 2017 with the Transformer paper, lots and lots of folks have been working on this, and a lot of approaches has been focusing on approximating attention. Mm-hmm.
16
00:02:37.980 --> 00:02:45.880
The goal is you wanna scale to longer sequences. There are tons of applications where you wanna do that, but scaling to longer sequences is, is difficult 'cause attention- Mm-hmm...
17
00:02:45.900 --> 00:02:50.260
scale quadratically in sequence length on both runtime and memory, as you, as you mentioned.
18
00:02:50.880 --> 00:02:59.240
So instead of trying to approximate attention, we, we were trying to figure out, you know, can we do the same computation and maybe be more memory efficient?
19
00:02:59.320 --> 00:03:03.320
So in the end, we ended up being, the memory is linear in sequence length. Mm-hmm.
20
00:03:03.700 --> 00:03:12.020
In terms of computation, it's still quadratic, but we managed to make it much more hardware friendly, and as a result we do get wall clock speed up on the order- Mm-hmm...
21
00:03:12.040 --> 00:03:21.840
of 2 to 4X, um, which really helps 'cause that, that just means that you'll be able to train with 2 to 4X longer sequence length for the same cost without doing any approximations. Right.
22
00:03:21.880 --> 00:03:31.340
As a result, lots of folks have been using this. Um, I think it's available in a lot of, um, libraries that train, um, that train, do, um, language model training or fine-tuning. Mm-hmm.
23
00:03:31.640 --> 00:03:41.660
Yeah, and the approximation thing is important because this is a exact thing versus- Yes... like a sparse. Yeah. Um, so maybe explain a little bit the difference there. For sure. For sure. Yeah.
24
00:03:42.160 --> 00:03:48.900
Attention, essentially you compute pairwise similarity between every single element in a sequence- Mm-hmm... against each other.
25
00:03:49.400 --> 00:04:04.960
So there's been other approaches where, um, instead of doing all that kind of pairwise computation, you only compute similarity for, you know, some pairs of elements in the sequence, so you don't do kind of quadratic number of comparison, and this can be seen as a, as some form of sparsity.
26
00:04:05.000 --> 00:04:11.940
Mm-hmm. Es- essentially, you're, you're ignoring some of the elements. When you write down the matrix, you essentially say, "Okay, I'm gonna pretend they're zero." Yep.
27
00:04:12.260 --> 00:04:23.520
That has some benefits in terms of runtime and memory, but the trade-off is that it tends to do worse in terms of quality- Mm-hmm... 'cause you're essentially approximating or ignoring some, some elements.
28
00:04:24.020 --> 00:04:48.340
And I personally have worked on, on this as well for, uh, a few years, but when we talk to, uh, practitioners who actually train models, especially at large scale, they say, tend not to use these approximate attention methods because turns out, this, this was surprising to me at
the time, was that, um, these approximation methods, even though they perform fewer computation, they tend to not be faster- Hmm...
29
00:04:48.420 --> 00:04:55.740
in wall clock time. So this is, it was pretty surprising because back then I was, um... I think my background was more, uh, on the theoretical side. Uh-huh.
30
00:04:55.740 --> 00:05:02.500
So obviously thinking of, oh, how many FLOPS or floating point operations are you performing? And, and hopefully that correlates well with wall clock time.
31
00:05:02.960 --> 00:05:12.240
But I realized that I was missing a bunch of ideas from the system side, where turns out FLOPS or floating point operations don't necessarily correlate with runtime.
32
00:05:12.560 --> 00:05:16.400
There are other factors like memory reading and writing- Mm-hmm... parallelism and so on.
33
00:05:16.500 --> 00:05:24.520
So I learned a ton from just talking to systems people because they, they kind of figured this, this stuff out, you know, a while ago. So that was really eye-opening.
34
00:05:24.640 --> 00:05:34.440
And then we, we ended up focusing a lot more on memory reading and writing- Mm-hmm... because that turned out to be the majority of time when you're doing attention is, uh, reading and writing memory.
35
00:05:34.940 --> 00:05:39.420
Yeah, the IO awareness- Yes... is probably like one of the biggest- Mm-hmm... innovation here.
36
00:05:39.920 --> 00:05:47.400
And the idea behind it is, like you mentioned, the, the FLOPS growth of the cars have been going up, but like the, the memory bandwidth not as much so. Yes.
37
00:05:47.420 --> 00:05:56.360
Um, I think like maybe that was one of the assumptions that the original attention paper had. Yeah. So talk a bit about- How that came to be as an idea.
38
00:05:56.640 --> 00:06:05.720
You know, it's one of those things that like an insight is like, obviously why are we, like, rewriting- Mm-hmm... the, like, HBM every time. Yes. You know? Yeah. And, like, once you, once you change it, it's clear.
39
00:06:05.820 --> 00:06:08.600
Mm-hmm. But what was that discovery process? Yeah.
40
00:06:08.640 --> 00:06:21.600
In hindsight, a lot of the ideas have already been there in the literature, and I would say is it was somehow at the intersection of both machine learning and systems, and you kinda needed ideas from both, both sides.
41
00:06:22.020 --> 00:06:28.960
So on one hand, on the system side, so lots of systems folks have, have known that, oh, you, you know, kernel fusion is, is great.
42
00:06:29.380 --> 00:06:42.540
Uh, kernel fusion just means that instead of performing, you know, loading the same element, instead of performing an operation, write it down, load it back up, and perform the second operation, you just load it once, perform two operations, and then write it down again.
43
00:06:42.920 --> 00:06:49.160
So that saves you- Mm-hmm... kind of, uh, memory read and write in the middle there. So kernel fusion has been, a classic.
44
00:06:49.600 --> 00:07:00.360
There's been other techniques from the system side, like, um, tiling, where you perform things in, in, in, uh, perform computations in block, again, so that you can load it into a really fast memory.
45
00:07:00.480 --> 00:07:06.060
Think of it as, as a cache. Um, and this is again, classical computer science ideas. Mm-hmm. Right? You wanna use the cache.
46
00:07:06.600 --> 00:07:12.380
So the system folks have been thinking about these ideas for a long time, and they've, they apply to, uh, attention as well.
47
00:07:12.780 --> 00:07:27.900
But there were certain things in attention that made it difficult to do in a complete kernel fusion, one of which is there is this softmax operation in the middle, which requires you to essentially sum across the, the row of the attention matrix.
48
00:07:28.220 --> 00:07:33.900
Mm-hmm. So it, it makes it difficult to kind of break it because there's this dependency, so it makes it difficult to break things into block.
49
00:07:34.300 --> 00:07:41.200
So on the system side, it's been-- people have been thinking about these ideas, but it's been difficult to kind of do kernel fusion for the entire- Mm-hmm... operation.
50
00:07:41.900 --> 00:07:45.520
On the machine learning side, people have been thinking more algorithmically.
51
00:07:45.700 --> 00:08:01.580
They say, "Okay, either we can change the, uh-- we, we can approximate attention, or there's this trick called the online softmax trick," which says that you can, 'cause of softmax, um, the way it's written mathematically, you can actually break it up into smaller pieces- Mm-hmm...
52
00:08:01.620 --> 00:08:07.360
do some rescaling, and still get the right answer. So this online softmax t- trick has been around for a while.
53
00:08:07.380 --> 00:08:16.100
I think there was a paper from NVIDIA folks back in 20, um, 18 about this, and then there was a paper from, um, Google.
54
00:08:16.520 --> 00:08:28.140
So, um, Marcus, Schrap, and, and, and, and, and Stotz wrote a paper late 20, um, 21 on using this online softmax trick to break attention up into smaller pieces.
55
00:08:28.520 --> 00:08:35.100
So a lot of the ideas were already there, but turns out, um, you kinda need to combine ideas from both sides.
56
00:08:35.520 --> 00:08:44.000
So you need to understand that, hey, we wanna do kernel fusion to reduce memory reads and writes, but we also need this online softmax trick to be able to- Mm-hmm...
57
00:08:44.040 --> 00:08:52.200
break the softmax into smaller pieces so that a lot of the systems tricks, uh, kinda carry through. You know, we, we, we saw that, and, and it was kind of a natural idea- Mm-hmm...
58
00:08:52.220 --> 00:09:00.180
that we, we ended up using ideas from both sides, and it ended up, uh, working pretty well. Yeah. Are there any downsides to kernel fusion?
59
00:09:00.540 --> 00:09:09.920
If I think about databases and the reasons why we have, um, atomic operations, you know, it's like you have observability and
fallback in between them. How does that work with, with attention?
60
00:09:10.080 --> 00:09:13.540
Like, is there anything that we lose by, by fusing the operations? Yeah.
61
00:09:13.600 --> 00:09:26.120
I think mostly on the, kinda on the practical side is that you lose a little bit of flexibility in the sense that, hey, now you have, for example, it's, uh, fast attention is just a subroutine that you would call to do attention.
62
00:09:26.660 --> 00:09:34.500
Um, but as a researcher, let's say you don't want that exact thing, right? Mm-hmm. You don't want just attention. Let's say you want some modification to attention.
63
00:09:34.540 --> 00:09:41.500
You wanna do, hey, I'm gonna multiply the query and key, but then I'm gonna do this extra thing before I, you know, carry on.
64
00:09:42.000 --> 00:09:54.100
And so kernel fusion just means that, okay, and we have a subroutine that does the entire thing, but if you wanna ex- experiment with, uh, with things, you, you won't be able to use that fused kernel.
65
00:09:54.580 --> 00:10:08.900
And the answer is, can we have a compiler that then automatically does a lot of this, uh, this kernel fusion? Lots of compiler folks are thinking about this, either with a, a new language, or you can embed it in PyTorch.
66
00:10:09.160 --> 00:10:19.600
So the PyTorch folks have been working on this as well. So if you write just your code in PyTorch, and they can capture the graph, can they generate code that will- Mm... kinda fuse everything together?
67
00:10:20.020 --> 00:10:28.580
And that's still un- ongoing, and they-- it works for some cases. But for attention, because of this kinda softmax rewriting stuff, it's been a little bit more difficult.
68
00:10:28.660 --> 00:10:39.200
So maybe in a year or two, we'll, we'll have compilers that are able to- Mm-hmm... do a lot of these, uh, optimizations for you, and you don't have to, for example, spend a couple months writing CUDA- [laughs]...
69
00:10:39.240 --> 00:10:49.220
to get this stuff to work. Awesome. And just to make it clear for listeners, when we say we're not writing it to memory, we are storing it, but just in a faster memory. Yeah.
70
00:10:49.240 --> 00:10:57.000
So instead of the HBM, we're putting it in the, in the SRAM. Yeah. Yeah, maybe explain just a little bit the, the difference there. Yeah, for sure.
71
00:10:57.360 --> 00:11:08.660
This is, um, kind of a caricature of how you, you think about accelerators or, or GPUs in particular, is that they have a large pool of memory, usually called HBM, a high bandwidth memory.
72
00:11:08.800 --> 00:11:18.740
So this is what you think of as GPU memory. Mm-hmm. So, you know, you're using A100 and you, you list the GPU memory is, like, forty gigs or eighty gigs. So that's, that's the, that's the HBM.
73
00:11:19.220 --> 00:11:28.700
And then when you perform any operation, you need to move data from the HBM to the compute unit, so the, the actual hardware unit that does the, the computation.
74
00:11:29.160 --> 00:11:41.760
And next to the, these compute units, there are on-chip memory or, or SRAM, which are much, much smaller than HBM, but much faster. So the analogy there is if you're familiar with, say, CPU and RAM and so on.
75
00:11:41.820 --> 00:11:50.280
So you have a large pool of RAM, and then you have the CPU performing the computation. But next to the CPU you have, you know, L1 cache and L2 cache- Mm-hmm...
76
00:11:50.280 --> 00:12:02.320
which are much smaller than, than, than DRAM and much, but much faster. So you can think of SRAM as, like, small and fast cache that's, uh, stays close to the compute unit. Like, physically it's, it's- Mm-hmm...
77
00:12:02.460 --> 00:12:09.728
it's closer. There is some kind of asymmetry here. So HBM is much larger and SRAM is much smaller, but much faster.
78
00:12:10.268 --> 00:12:16.288
One way of thinking about it is how can we design algorithms that take advantage of this, uh, asymmetric memory hierarchy?
79
00:12:16.488 --> 00:12:25.868
And of course, like lots of folks have been thinking about this, but, uh, these ideas are pretty old. So ba- I think back in the 1980s, the primary concerns were, uh, sorting. Mm-hmm.
80
00:12:25.908 --> 00:12:37.828
How can we sort numbers as efficiently as possible? And the motivating example was banks were trying to sort their transactions, and that needs to happen overnight so that the next day they can- Right...
81
00:12:38.088 --> 00:12:48.408
they can be ready. And so the same idea apply, which is that they have slow memory, which is was, uh, which was, uh, disk, like hard disk, and they have fast memory, which was DRAM. Mm-hmm.
82
00:12:48.508 --> 00:13:00.168
And people had to design, uh, sorting algorithms that kind of take advantage of this, um, asymmetry. And turns out, you know, these same ideas kind of applied today, which is different kinds of memory. Yeah.
83
00:13:00.648 --> 00:13:10.328
In your paper you have kind of like the pyramid of memory. And just to give people a- an idea, when, when he says smaller, it's like HBM is like 40 gig and then SRAM is like 20 megabytes. Yeah, yeah.
84
00:13:10.368 --> 00:13:23.008
So it's not like a little smaller- Mm-hmm... it's like much smaller, but the throughput on card is like 1.5 terabytes a second for HBM and like 19 terabytes a second for SRAM, which is a, a lot larger. Yeah.
85
00:13:23.228 --> 00:13:35.228
How do you think that evolves? So TSMC said they hit the scaling limits for SRAM. Mm-hmm. They just cannot grow that, that much more. Yeah. Um, HBM keeps growing. HBM3 is gonna be 2X faster than- Mm-hmm...
86
00:13:35.328 --> 00:13:42.928
HBM2, I think- Yeah... the, the latest NVIDIA thing as a- Yeah... HBM3. Yes. How do you think about the future of like flash attention?
87
00:13:42.988 --> 00:13:51.568
Like do you think HBM is gonna get faster enough when like maybe it's not as, uh, as useful to use the SRAM, or? That's right. I think it's, it comes down to physics when- Mm-hmm...
88
00:13:51.668 --> 00:14:03.948
you know, when you design hardware, it's just, um, literally SRAM stays very close to compute units, and so you don't have that much area to essentially put the transistors and you can't shrink these things too much.
89
00:14:04.328 --> 00:14:16.348
So just physics, like in terms of area, um, you don't have that much area for the SRAM. The HBM is off chip, so there is, um, some kind of bus that essentially- Mm-hmm... transfer data from HBM to, to the compute unit.
90
00:14:16.428 --> 00:14:25.828
So you have more area to essentially put these, uh, memory units. And so yeah, I think in the future SRAM probably won't get that much larger because you don't have that much area.
91
00:14:26.308 --> 00:14:35.208
HBM will get larger and, and, and faster. And so I think it becomes more important to design algorithms that take advantage of this memory as- asymmetry.
92
00:14:35.328 --> 00:14:45.468
It's the same thing when in, in CPU where the cache is really small, the DRAM is growing larger and larger. DRAM could get to, I don't know, two terabytes- Mm-hmm... six terabytes or something.
93
00:14:46.028 --> 00:14:55.848
Um, whereas the cache stay at like, I don't know, 50 megabytes or something like that. I think maybe the algorithm design becomes more and, more and more important. There's still ways to take advantage of, of this.
94
00:14:56.308 --> 00:15:00.388
I think so in the future, I think flash attention, you know, right now is, is being used.
95
00:15:00.648 --> 00:15:10.008
I don't know if in the next couple years some, you know, some arc- some new architecture will, will come in and, and whatnot, but attention seems to be still important. Mm-hmm.
96
00:15:10.028 --> 00:15:20.068
For the next couple years I, I still expect some of these idea to be useful, not necessarily like, you know, the exact code that, that's out there, but I think these, these ideas have kind of stood the test of time.
97
00:15:20.108 --> 00:15:29.028
The ideas like IO awareness from back in the, uh, 1980s, ideas like kernel fusions, tiling, these are classical ideas that have stood the, the test of time.
98
00:15:29.548 --> 00:15:40.868
And so I think in the future these ideas will become more and more important as we, uh, scale models to be larger, as we have more kinds of devices, um, where performance and efficiency become much, much more important.
99
00:15:40.968 --> 00:15:51.988
Mm-hmm. Yeah. And we had, uh, Jonathan Frankel on the podcast, and if you go to isattentionallyouneed.com, he has an outstanding bet, and he does believe that attention will be the, the state-of-the-art- Yeah...
100
00:15:52.048 --> 00:15:57.188
um, architecture still in a few years. Did you think flash attention would be this popular?
101
00:15:57.468 --> 00:16:05.668
Like, I'm always curious on the research side, you know, you publish a paper and obviously, you know, it's great work, but sometimes it just kind of falls flat in the industry.
102
00:16:06.028 --> 00:16:14.488
Could you see everybody just like just starting to use this, or was that a surprise to you? Certainly, I didn't anticipate the level of, of, uh, popularity.
103
00:16:14.548 --> 00:16:22.148
Of course, we- we're extremely happy to, to have people using this stuff and giving us feedback and, and so on and, and help us improve, um, things.
104
00:16:22.528 --> 00:16:28.868
I think when we were writing the, the paper, I remember sending an email to, to, to one of my advisors.
105
00:16:29.068 --> 00:16:37.428
I'm like, "Uh, hey, I'm excited about this paper, but I think the most important thing will be the artifact, which is the code." Mm. Um, so I, I knew that like the code will be valuable.
106
00:16:38.008 --> 00:16:43.628
So we kind of focus a lot on, on the code and make sure that, you know, the code is, is usable and, and as fast as can be.
107
00:16:43.928 --> 00:16:51.348
Of course, the idea, the paper presents, um, the, the ideas and ex- explain it and have experiments that validates, um, the idea.
108
00:16:51.768 --> 00:17:03.848
But I can knew that the artifact or, or the code was the, um, was also pretty important, and that turned out to be the right focus, which is, you know, we, we put out the paper, we released the code, and continue working on the code.
109
00:17:04.208 --> 00:17:11.868
So it's a team effort with my, my co-authors as well. Yeah. We mentioned Hazy Research a bunch of times on the- Mm... podcast before. Mm-hmm.
110
00:17:12.028 --> 00:17:21.588
I would love for you to spend five minutes just talking about how does the group work. You know- Sure... how do people get together? Like how do you like bounce ideas off of each other? Mm-hmm. Yeah. Yeah.
111
00:17:21.668 --> 00:17:30.828
So Hazy Research is a, is a research group at, at, uh, Stanford led by one of my advisors, Chris Re. I love the people there. It was one of the best experience I, I had.
112
00:17:30.888 --> 00:17:40.008
Like, they, they've made my PhD so much more enjoyable, and I think, uh, there are a couple of, um, a couple ways that the group has been working pretty well.
113
00:17:40.108 --> 00:17:53.008
So one is I think there's a diverse pool of, of, of people who either, you know, some of them focus on algorithms and theory, some of them focus on building systems, some of them focus on applications.
114
00:17:53.328 --> 00:17:56.488
And as a result, there is this flow of idea.
115
00:17:56.888 --> 00:18:07.468
So as an example, some of us were working on like more algorithms and, and theory and then we can, we can talk to the folks building system and say, "Hey, let's try it out and let's, let's put it in the systems- Mm...
116
00:18:07.508 --> 00:18:16.184
and, and see how it is." And there you will get feedback from systems folks. They will say, like, "Hey, we implemented this," or like, "We tried this, and, you know, this is where it doesn't work." Mm-hmm.
117
00:18:16.204 --> 00:18:26.024
Something like that. And
once we put it in the systems, like the application folks can, can use the algorithm or new methods or, or new models, and we again get great feedback from them.
118
00:18:26.144 --> 00:18:35.624
Because the application folks, for example, um, you know, so- some of my good friends, they focus on medical imaging or seizure detection, and that is the problem they care about, right?
119
00:18:35.884 --> 00:18:39.904
And if your method doesn't work on the task they care about, they will tell you.
120
00:18:40.464 --> 00:18:47.844
Whereas I think a lot of, um, people in machine learning, they're a little bit more flexible, so they will be like, "Hey, it doesn't work on seizure detection. Let's try some other task." Mm-hmm. Right?
121
00:18:48.364 --> 00:18:51.404
But having that direct feedback of like, "Hey, it doesn't work there.
122
00:18:51.464 --> 00:19:07.304
Let's figure out why," I think that that feedback allows to do better work, and I think, you know, that kind of process of exchanging ideas, validating it in a real system so that applications folks can try it out and, and give you feedback, I think that that cycle has been very, very useful.
123
00:19:07.784 --> 00:19:18.944
And so that's, that's one, you know, having a diverse group of, of people. The other one is, um, and this is, uh, something I really appreciate from advice from Chris, was try to understand the fundamental, right?
124
00:19:18.984 --> 00:19:33.984
And then he's happy letting me go, go off and read some textbooks and, and playing with things because I think a lot of research, uh, ideas come from understanding the old literature and see how it fits with the, with the new kind of landscape.
125
00:19:34.424 --> 00:19:39.644
And so if you just need archive papers every day, you know, that's, that's great, but you also need to read textbooks.
126
00:19:39.684 --> 00:19:49.324
And, and that's one advice I, I got from Chris, which is understand the fundamentals, and I think that allows to do, you know, more impactful work. How do you think about, um, academia versus industry?
127
00:19:49.544 --> 00:20:01.804
I feel like, uh, AI machine learning has been an area where up until three, four years ago, most of, like, the cutting-edge work was being done in academia, and now there's all these big, um, industry research labs.
128
00:20:02.024 --> 00:20:10.164
Um, you're obviously going to, to Princeton, so you're a academia believer. Mm-hmm. Uh, how should people think about where to go? Say I'm like, uh, you know, I'm doing my master's.
129
00:20:10.664 --> 00:20:19.844
Uh, I have to decide between doing a PhD and, like, going into OpenAI Anthropic. How should I decide? I think they kind of play a complementary role, in my opinion.
130
00:20:20.144 --> 00:20:33.724
Of course, like I was so-- uh, was considering different paths as, as well. So I think right now scaling matters a lot, es- especially when you talk about language models and generative AI and, and so on.
131
00:20:34.404 --> 00:20:42.424
Scaling matters a lot, and that, that means that you need compute resources, and you need kind of, um, infrastructure, and you need engineers TAM.
132
00:20:42.704 --> 00:20:51.484
And, and so, uh, industry tend to have an advantage when it comes to just, you know, scaling things. But a lot of the ideas actually came from academia.
133
00:20:51.584 --> 00:21:00.724
So let's take attention, which got popular with the transformer in 20, um, 17. You know, attention actually was, has, has been around for a while.
134
00:21:01.204 --> 00:21:12.484
Um, so I think the first mention was in 2014, a paper from Banerjee and others and, and Yoshua Bengio, which is coming from, from academia. You know, a lot of ideas did come from, from academia.
135
00:21:13.004 --> 00:21:23.744
And scaling things up, of course, has been-- I think OpenAI has been, been great at, at, um, scaling things up. Like that's, that, that was the bet that they, they, they made, you know, after I think GPT-2.
136
00:21:23.884 --> 00:21:33.584
So they saw that scaling these things up to, back then was one point-- uh, one point five billion parameter, like, seemed to give you amazing capabilities. So they really committed to that.
137
00:21:33.604 --> 00:21:38.584
They really committed to scaling things, and that turned out to be, uh, has been a pretty successful bet.
138
00:21:39.044 --> 00:21:50.964
I think for, for academia, you know, we're still trying to figure out exactly what we're, we're doing in this shifting landscape. And so lots of folks have been focusing on, for example, evaluation. Mm-hmm.
139
00:21:51.184 --> 00:21:58.384
So I know the Stanford Center for Foundation Model, led by Percy, they have this benchmark called HELM, which is this holistic benchmark.
140
00:21:58.844 --> 00:22:09.824
So trying to figure out, okay, characterizing the l- the, the landscape of different kinds of models, what people should evaluate, what people should measure, and things like that. So evaluation is, is one role.
141
00:22:10.344 --> 00:22:20.004
The other one is understanding. So this, uh, has happened historically, where there's been some development in, in the industry and, and academia can play a role in explaining, understanding.
142
00:22:20.364 --> 00:22:29.623
Kind of they have the luxury to slow down trying to understand stuff, right? So, um, lots of paper on understanding what's really going on, probing these models, and, and so on.
143
00:22:29.704 --> 00:22:42.064
I think I'm not as familiar with the NLP literature, but my impression is there's, there's a lot of that going on in the, um, kind of NLP, um, conferences, which is understanding what these models are doing, what capabilities they have and s- and so on.
144
00:22:42.704 --> 00:22:52.424
And the third one I, I could see is that they-- academia can take more risky bets in the sense that, um, we can work on stuff that quite different from, from industry.
145
00:22:52.484 --> 00:23:03.504
I think industry, my, my impression is you have some objective. You're trying to say, "Hey, for this quarter, we wanna scale the model in this particular way. Next quarter, we want the model to have these capabilities."
146
00:23:03.904 --> 00:23:11.444
You're trying to get objectives that maybe, I don't know, seventy percent that will, will work out- Mm-hmm... and, you know, because it's important for, for the company's direction.
147
00:23:11.924 --> 00:23:28.564
I think for academia, the way things work is like, you know, you have many, many researchers or, or PhD students, and they're kind of pursuing independent directions, and they have a little bit more flexibility on, "Hey, I'm gonna try out this, you know, seemingly crazy idea and see."
148
00:23:29.444 --> 00:23:39.844
Let's say there's a thirty percent chance of success or something, right? And however you, you define success. Mm-hmm. For, for academia, a lot of the time success just means like, "Hey, we found something interesting."
149
00:23:40.284 --> 00:23:49.064
That could eventually go into industry through collaboration and, and so on. So I, I do see academia and, and industry kind of playing complementary roles.
150
00:23:49.424 --> 00:24:00.684
And as for s- for someone choosing a, a career, I think just more, more generally, industry would be probably better in terms of compensation- Mm-hmm... in terms of, uh, probably work-life balance.
151
00:24:01.224 --> 00:24:10.464
But my biased perspective is that maybe academia gives you a little bit more freedom to think and understand things. So, you know, it, it probably comes down to personal choice.
152
00:24:11.044 --> 00:24:19.272
Um, I end up choosing to be a professor next year at, at Princeton. But of course, like, I wanna maintain relationship with industry folks.
153
00:24:19.332 --> 00:24:36.292
I think industry folks can provide very valuable feedback to what we're doing in academia so that we, we understand where the field is, is moving because, uh, you know, some of the directions are very much the influence by what, for example, OpenAI or Google is, is doing, right?
154
00:24:36.352 --> 00:24:47.532
So we wanna understand where the field is moving, what are some promising applications, and try to anticipate, okay, if the field is moving like this, these applications are gonna be popular, what problems will be important in two, three years?
155
00:24:47.812 --> 00:24:57.252
Mm-hmm. Right? And then we try to start thinking about those problems, so that hopefully in two, three years, like, we have some of the answers to some of these, uh, problems in two, three years.
156
00:24:57.712 --> 00:25:06.672
Sometimes it, it works out, sometimes it, it doesn't, you know, but as long as we do interesting things in, in academia, you know, that's, that's the goal. Yeah. And you mentioned the eval side.
157
00:25:06.752 --> 00:25:16.672
So we did a benchmarks 101 episode, and one of the things we were seeing is, like, sometimes the
benchmarks really influence the model development, you know?
158
00:25:16.752 --> 00:25:23.832
Because obviously if you don't score well on the benchmarks, you're not gonna get published- Mm-hmm. Yeah... and you're not gonna- Yeah... get funded. Um, how do you think about that?
159
00:25:23.872 --> 00:25:31.932
Like, how do you think that's gonna change now that a lot of the applications of these models, again, is in more, like, narrow industry use cases?
160
00:25:32.012 --> 00:25:41.332
Like, do you think the goal of, like, the academia evals is to like, to be very broad and then industry can do their own evals, or what's the relationship there? Yeah.
161
00:25:41.392 --> 00:25:45.452
So I think evaluation is important and often a little bit underrated.
162
00:25:45.712 --> 00:25:58.332
So it's not, you know, as flashy as, uh, oh, we have, uh, we have a new model that, uh, you know, can do such and such, but I think evaluation, you know, what you don't measure, you can't make progress on essentially.
163
00:25:58.772 --> 00:26:08.672
So I think industry folks, like, of, of course they have specific use cases that, that their models need to do well on and, you know, that's what they care about. Not just academia, but other groups as, as well.
164
00:26:09.172 --> 00:26:17.452
People do understand what are some of the emerging use cases. So for example, you know, now one of the most popular use case is, is, um, is chatbot, right?
165
00:26:17.492 --> 00:26:26.332
And then I think folks from Berkeley, uh, some of them are from Berkeley called MLSys. They set up this kind of chatbot arena to essentially benchmark different models.
166
00:26:26.511 --> 00:26:32.632
So people do understand what are some of the emerging use cases. People do contribute to, like, evaluation and measurement.
167
00:26:32.672 --> 00:26:46.652
And a- as a whole, I think people try to contribute to the field and move the field forward, albeit at, you know, maybe slightly different directions, but we're making progress and, and definitely evaluation and, and measurement is one of the ways you, you, you make progress.
168
00:26:47.092 --> 00:26:56.292
So I think going forward, there's still gonna be just more models, more evaluation. We'll just have better understanding of what these, these models are doing and, and what capabilities they have.
169
00:26:56.712 --> 00:27:03.332
I like that your work has been focused on not making benchmarks better, but it's like, let's just make everything faster. [laughs] Like, let's-- So it's very horizontal.
170
00:27:03.852 --> 00:27:13.572
So FlashAttention 2, you just released that on, on Monday. I read in the blog post that, um, a lot of the work was, like, also related to, like, some of the NVIDIA library updates. Mm-hmm.
171
00:27:13.592 --> 00:27:24.212
Yeah, maybe run a bit-- run us through some of those changes and some of the innovations there. Yeah, yeah, for sure. So FlashAttention 2 is something I've been work- working on for
the past couple of months.
172
00:27:24.772 --> 00:27:37.352
So the story is the NVIDIA Cutlass team, they released a new version of their library, which contains all these primitives to allow you to do, like, you know, matrix multiply or memory loading on, on GPU efficiently.
173
00:27:37.452 --> 00:27:47.392
So it's a great library, and I, I, I built on that. Um, so they, they released their version three back in January, and I, I got really excited and I wanted to play with that library. Mm-hmm.
174
00:27:47.452 --> 00:27:54.592
So as an excuse, I was just like, "Okay, I'm gonna refactor my code and, and use this library." So that was, that was kind of the start of the project.
175
00:27:55.172 --> 00:28:02.212
By the end, and like, I just ended up working with the code a whole lot more and I realized that, hey, there are these, uh, inefficiencies- Mm-hmm... still in Flash Attention.
176
00:28:02.652 --> 00:28:15.992
We could change this way or that way and make it in the end twice as fast. But of course, use, uh, building on the library that the NVIDIA folks released. So that was a kind of a really fun exercise. Mm-hmm.
177
00:28:16.012 --> 00:28:20.472
I would say, you know, it started out as just like it's just an excuse for myself to play with- [laughs]... with a new library.
178
00:28:20.852 --> 00:28:38.512
What ended up was like a month, several months, uh, of, like, improvement, improving Flash Attention, discovering new ideas, and in the end, we, we managed to make it two x faster, and now it's pretty close to probably the efficiency of things like matrix multiply, which probably is the most optimized subroutine- Mm-hmm...
179
00:28:38.652 --> 00:28:47.932
on the planet. So we're really happy about it. The NVIDIA Cutlass team has been very supportive, and hopefully in the future, we're, we're gonna collaborate more. Yeah. Yeah.
180
00:28:47.992 --> 00:28:58.912
And since it's a NVIDIA library, can you only run this on, like, CUDA runtime? So, like, could you use this and then run it on, like, a AMD GPU? Mm-hmm. Yeah, yeah. So it's an NVIDIA library.
181
00:28:59.012 --> 00:29:09.312
So right now, kind of the code we release runs on NVIDIA GPUs, which is, uh- Mm-hmm... which is what most people are using- Yep... to train models. Of course, they're emerging other hardware as well.
182
00:29:09.392 --> 00:29:18.132
So the AMD folks did implement a version of Flash Attention, I think, last year as well, and that's, that's also available. I think there's some implementation on CPU as well.
183
00:29:18.192 --> 00:29:27.372
For example, there's this library, GGML- Mm-hmm... where they implemented the same idea running on Mac and CPU. So I think that kinda broadly the idea would, would apply.
184
00:29:27.852 --> 00:29:37.552
The current implementation ended up using NVIDIA's library or primitives, but I, I expect these ideas to be broadly applicable to different hardware.
185
00:29:37.612 --> 00:29:46.092
As long as-- I think the main idea
is you have, like, asymmetry in memory hierarchy, which tends to be everywhere- Mm-hmm... in, you know, in a lot of accelerators.
186
00:29:46.612 --> 00:29:50.652
Yeah, it kinda reminds me of, um, Sarah Hooker's- Mm-hmm... post, like, the hardware lottery. Yes.
187
00:29:50.952 --> 00:30:00.772
It's, uh, there could be all these things that are much better, like ar- architectures that are better, but they're not better on NVIDIA, [laughs] so we're never gonna know if they're actually improved.
188
00:30:01.052 --> 00:30:10.252
H-how does that play into, like, some of the research- Yeah... that you all do too? Yeah. So absolutely, yeah. I think, uh, Sarah Hookor, um, the-- she, she wrote this, this piece on hardware lottery, and that's...
189
00:30:10.792 --> 00:30:28.292
I think she captured really well of what a lot of people have been thinking about this, and, and I certainly think about hardware lottery- Quite a bit, given that, you know, I does, I do some of the work that's kind of really low level at the, of, "Hey, we're optimizing for GPUs or NVIDIA GPUs and optimizing for attention itself."
190
00:30:28.852 --> 00:30:40.232
And at the same time I also work on algorithms and, and methods and transformer alternatives. And we do see this effect in play, not just hardware lottery, but also kind of software framework lottery. Mm-hmm.
191
00:30:40.792 --> 00:30:53.632
You know, attention has been popular for six years now, and so many kind of, uh, engineer hours has been spent on making it as easy and efficient as possible to run transformer, right?
192
00:30:54.232 --> 00:31:05.792
There's libraries to do all kind of tensor parallel, PyTorch parallel- Mm-hmm... if you use transformer. Let's say someone else develop alternatives, or let's just take recurrent neurons, like LSTM, GRU.
193
00:31:06.332 --> 00:31:14.112
If we wanna do that and run that efficiently on current hardware with current software framework, that's, uh, quite a bit harder. Mm-hmm.
194
00:31:14.732 --> 00:31:29.592
So in some sense, there is this feedback loop where somehow the, uh, model architectures that take advantage of hardware become popular, and the hardware will also kind of evolve to optimize a little bit- Yeah...
195
00:31:29.592 --> 00:31:39.752
for that kind of architecture, and software framework will also evolve to optimize for that particular architecture. Right now, transformer is the dominant architecture.
196
00:31:40.412 --> 00:31:44.312
So, yeah, I, I'm not sure if there is a good way out of this.
197
00:31:44.372 --> 00:31:55.712
Of course, there's a lot of development, things like com- I think compilers will, you know, play a role, because compilers allow you to maybe still be much more efficient across different kinds of hardware.
198
00:31:56.072 --> 00:32:04.592
'Cause essentially you, you write the same code and compiler will be able to, to make it run efficiently different kinds of hardware. So for example, there's this, um, language Mojo. Mm-hmm.
199
00:32:04.832 --> 00:32:11.112
They're compiler experts, right? And, and their bet is, AI models will run, will be running on different kinds of devices.
200
00:32:11.392 --> 00:32:20.292
So let's make sure that, um, we have really good compilers with a, a good language that then, um, the compiler can do a good job optimizing for all kinds of, of devices.
201
00:32:20.332 --> 00:32:30.072
So, like that's maybe one way that you can get out of this, this cycle. But yeah, I, I, I'm not sure of a, a good way. You know, in my own research, like I have to think about both the- Yeah...
202
00:32:30.092 --> 00:32:40.132
kind of new algorithm, new model, and how it maps to hardware. So they're, you know, they're crazy ideas that seem really good, but will be really, really difficult to run efficiently.
203
00:32:40.172 --> 00:32:50.392
And so as a result, for example, we can't really scale some of the architectures up simply because they, they're not hardware friendly. Mm-hmm. I have to think about both sides when I'm working on, on, on, on new models.
204
00:32:50.772 --> 00:32:59.092
Yeah. Have you spent any time looking at some of the new kinda like AI chips companies, so to speak, like the Cerebras of the world?
205
00:32:59.212 --> 00:33:06.972
Like, one of their innovations like, you know, collocating everything on the chip- Mm-hmm... so you kinda remove some of this, like a memory bandwidth issue. Yeah. How do you think about that?
206
00:33:07.272 --> 00:33:11.232
Yeah, I think that's, that's an interesting bet. I think Tesla also has this, uh, Dojo- Mm-hmm...
207
00:33:11.352 --> 00:33:22.892
supercomputer, where they try to have as essentially as fast, um, on-chip memory as, as possible and re- re- removing some of these data transfer back and forth. I think that's a promising direction.
208
00:33:23.412 --> 00:33:32.752
The issues I could see, you know, I'm definitely not a hardware expert. One issue is, uh, the on-chip memory tend to be really expensive to manufacture, much more expensive per gigabyte- Mm-hmm...
209
00:33:32.772 --> 00:33:43.392
compared to off-chip memory. So, um, I talked to, you know, some of my friends are at, uh, Cerebras, and you know, they, they have their own, own stack and compiler and, and, and so on, and they can make it work.
210
00:33:43.832 --> 00:33:54.272
Uh, the other kind of obstacle is, again, with compiler and, and software framework and, and so on. You know, for example, if you can run PyTorch on, on this stuff, like, you know, lots of people will be- Mm-hmm...
211
00:33:54.532 --> 00:34:02.152
will be using it. But, you know, supporting all the operations in, in PyTorch would take, would take a long time to implement. Of course, you know, people are working on this.
212
00:34:02.372 --> 00:34:11.032
So I think, yeah, we kinda need these different bets on the, the hardware side as well. Um, hardware has, my understanding, is has a kind of a longer timescale.
213
00:34:11.332 --> 00:34:17.012
So you need
to design hardware, you need to manufacture it, you know, maybe on the order of three to five years or something like that.
214
00:34:17.632 --> 00:34:28.872
So people are taking different bets, but the AI landscape is changing so fast that it's hard to predict, okay, what kind of models will be dominant in, let's say, three or five years?
215
00:34:29.432 --> 00:34:36.032
Or thinking back five years ago, would we have known- Mm-hmm... that transformer would've been the, the dominant architecture? Maybe, maybe not, right?
216
00:34:36.152 --> 00:34:47.252
And so different people will make different bets on, on the hardware side. Yeah. Does the pace of the industry and the research also influence the PhD research itself?
217
00:34:47.312 --> 00:34:55.292
So like, for example, in, in your case, you know, you're working on improving attention. It probably took you quite a while to, like, write the paper and everything. Yeah.
218
00:34:55.312 --> 00:35:03.612
But like in the meantime, you could have had a new model architecture come out- Right, right... and then it's like nobody cares about attention anymore. Yeah. How do people balance that? Yeah.
219
00:35:03.692 --> 00:35:10.552
So I think it's, it's tough. It's definitely tough for PhD students, for researchers, given that the field is moving really, really fast.
220
00:35:11.212 --> 00:35:20.812
I think it, it, you know, comes down to understanding fundamentals, because that's essentially, for example, what the PhD allows you to do. It's been a couple years understanding the fundamentals.
221
00:35:20.872 --> 00:35:31.532
So for example, when I started my, my PhD, I was working on understanding matrix, uh, vector multiply, which is, you know, uh, is a very, it's been a concept that's been around for hundreds of, hundreds of years.
222
00:35:31.912 --> 00:35:36.972
We were trying to characterize what kind of matrices would have theoretically fast, uh, multiplication algorithm.
223
00:35:37.452 --> 00:35:47.412
That seems to have nothing to do with, you know, AI or anything, but I think that was a time when kinda I d- I developed kind of, um, mathematical maturity and research taste and research skill.
224
00:35:47.832 --> 00:35:55.572
The research topic at that point didn't have to be, like, super trendy or anything, as long as I'm developing skills as a researcher, I'm, I'm making progress.
225
00:35:56.132 --> 00:36:01.792
And eventually I've gotten, uh, you know, quite a bit better in terms of, like, research skills, right?
226
00:36:01.992 --> 00:36:10.232
And that allows, for example, PhD students later in their, their career to quickly develop solutions to whatever, you know, problems they're, they're facing.
227
00:36:10.692 --> 00:36:15.072
So I think that's just the na- natural arc of how you're being trained as a, as a researcher.
228
00:36:15.592 --> 00:36:24.596
For a lot of PhD students, I think given the pace is, is so fast, maybe- It's harder to justify spending a lot of time on the fundamental. And, and, you know, it's, it's tough.
229
00:36:24.636 --> 00:36:32.136
Like, what is-- It's kind of explore, exploit kind of, kind of, uh, dilemma, and I don't think there's a universal answer.
230
00:36:32.516 --> 00:36:44.996
So I personally spend some time doing this kind of exploration, you know, reading random textbooks or, or lecture notes, and I spend some time just, like, keeping up with the latest architecture or methods and, and, and so on.
231
00:36:45.296 --> 00:36:49.696
I don't know if there's a right balance. It depends on-- It varies from person to, to person.
232
00:36:49.916 --> 00:36:59.136
But if you only spend one hundred percent on one, um, you know, either you only do exploration or only do exploitation, I think it probably won't work in the long term.
233
00:36:59.176 --> 00:37:12.816
It's probably gonna have to be a, a mix, and you have to just experiment and kind of, uh, be introspective and say, "Hey, I, I tried this kind of mixture of, I don't know, one exploration paper and one exploitation paper.
234
00:37:12.896 --> 00:37:22.856
Like, how did that work out for me? Should I..." You know, having conversation with, with, for example, my advisor about, like, "Hey, did that work out? You know, should I shift-- I focus more on, on one or the other?"
235
00:37:22.896 --> 00:37:27.696
Like, I think quickly adjusting and focusing on the process, I think that's probably the right way.
236
00:37:27.756 --> 00:37:36.036
I don't have, like, a specific recommendation that, Hey, you focus, I don't know, sixty percent on, on lecture notes and forty percent on archive papers or anything like that.
237
00:37:36.036 --> 00:37:46.776
[laughs] Let's talk about some transformer alternatives. You know, say Jonathan Frankle loses his bet- Yeah... and, uh, transformer is not the state-of-the-art architecture. Mm-hmm.
238
00:37:46.776 --> 00:37:56.356
What are some of the candidates to take over? Yeah. So this bet is, is quite fun. So this-- I, I-- my understanding is this is a bet between, um, Jonathan Frankle and, uh, Sasha Rush, right?
239
00:37:56.996 --> 00:38:05.176
I've talked to-- to Sasha a bunch, and I think he recently gave an excellent tutorial on kind of transformer alternatives as well, so I would recommend that.
240
00:38:05.656 --> 00:38:16.416
So just to quickly recap, I think there's been quite a bit of, uh, of, uh, development more recently about transformer alternatives. So architectures that are not transformer, right?
241
00:38:16.536 --> 00:38:25.396
Um, and the question is, can they do well on, for example, language modeling, which is kind of the, the application that a lot of people care about these days.
242
00:38:25.836 --> 00:38:43.956
So there are methods based on kinda state space methods like, um, that came out in twenty twenty-one from, from Albert Gu, and Curran, and, and, and, and Chris Rae that are-- presumably could do much better in terms of capturing long-range information while not
scaling quadratically.
243
00:38:44.016 --> 00:38:53.436
They, they scale sub-quadratically in terms of sequence length. So potentially you could have a much more efficient architecture when sequence length gets, uh, really long. Mm-hmm.
244
00:38:53.716 --> 00:39:04.756
The other ones has been focusing more on, um, recurrent neural nets, which is, you know, again, an old idea, but, you know, adapting to the, the kind of the new landscape, so things like RWKV.
245
00:39:05.016 --> 00:39:11.256
We've also per-- uh, yeah, I've also personally worked in this space as, as well. So there's been some promising results.
246
00:39:11.556 --> 00:39:24.256
So there's been some results here and there that show that, hey, we, um, these alternatives, either RNN or state space methods, can match the, um, you know, the performance of transformer on language modeling, so that's really exciting.
247
00:39:24.296 --> 00:39:31.316
And we're starting to understand on the academic research side, we, we understand, like, do we really need attention? Mm-hmm. Right?
248
00:39:31.336 --> 00:39:37.416
And that's-- I think that's a valuable kind of intellectual thing to understand, and maybe we do, maybe we don't.
249
00:39:37.776 --> 00:39:44.096
If we wanna know, we need to spend se-serious effort on trying the alternatives, and there's been folks pushing on this direction.
250
00:39:44.216 --> 00:39:54.116
I think RWKV scale up to-- They have a model at fourteen billion that seems pretty competitive with Transformer, so that's really exciting. You know, that's kind of an intellectual thing.
251
00:39:54.176 --> 00:40:04.776
We wanna figure out if attention is necessary. So that's one motivation. The other motivation is transformer alternative could have an advantage in practice in some of the use cases.
252
00:40:05.116 --> 00:40:11.476
So one use case is really long sequences. The other is, um, really high throughput of generation.
253
00:40:12.116 --> 00:40:20.276
So for really long sequences, when you train with Transformer, you know, with flash attention and so on, the computation is still quadratic in the sequence length.
254
00:40:20.696 --> 00:40:34.216
So if your sequence length is on the order of, I don't know, sixteen K, thirty-two K, a hundred K or something, which some of these models have sequence length a hundred K, then you do get significantly slower in terms of training, uh, also in terms of inference.
255
00:40:34.416 --> 00:40:39.036
So maybe these alternative architectures could scale better in terms of sequence length.
256
00:40:39.536 --> 00:40:48.836
I haven't seen actual validation on this as in, like, let's say an, an RNN model release with context length, I don't know, a hundred K or something. I haven't really seen that.
257
00:40:49.536 --> 00:40:55.656
But the hope could be that as we scale to long sequences, these alternative architecture could be more well suited. Mm-hmm.
258
00:40:55.856 --> 00:41:05.296
Not just text, but things like high-resolution images, audio, video, and, and so on, which are, you know, emerging applications. So that's one, uh, long sequences.
259
00:41:05.696 --> 00:41:20.236
Number two is a high throughput generation, where I can imagine scenarios where the application isn't like a, an interactive chatbot, but let's say a company wants to batch as many requests as, as, as possible on their, on their server, or, like, they're doing offline processing.
260
00:41:20.296 --> 00:41:26.836
They're, you know, generating stuff based on their internal documents that you need to process in, in batch, right?
261
00:41:26.916 --> 00:41:34.836
And the issue with Transformer is that to-- during generation, it essentially needs to keep around all the previous history. Mm-hmm. It's the-- called the KV cache.
262
00:41:35.216 --> 00:41:44.536
And that could take a significant amount of memory, so you can't really batch too much because you, you run out of memory. For other-- I, I am personally bullish on RNNs.
263
00:41:44.716 --> 00:41:52.396
I think RNNs, um, they don't-- they essentially summarize the past into a, a state vector. They have fixed size, so the size doesn't grow with the history.
264
00:41:52.956 --> 00:42:10.856
So that means that you don't need as much memory to keep around all the previous, um, tokens, and as a result, I think you can scale to much higher batch sizes, and as a result, you can much-- make much more efficient use of the, of the GPUs or the, the accelerator, and you can have much higher, um, generation throughput.
265
00:42:11.216 --> 00:42:14.736
Now, this has-- I don't think has been validated, uh, at scale.
266
00:42:14.836 --> 00:42:24.196
So as a researcher, you know, I'm bullish on, on this stuff because I think in the next couple years, like, these, these are use cases where these alternatives could have an advantage.
267
00:42:24.632 --> 00:42:32.092
We'll just kinda, uh, have to, to, to wait and see, to, to see if these, you know, these, uh, these things will happen. I am personally bullish on this stuff.
268
00:42:32.372 --> 00:42:39.832
At the same time, I also like spend a bunch of time with making attention- Mm-hmm... as, as fast as possible. So maybe hedging and playing both sides. Yeah.
269
00:42:40.352 --> 00:42:51.832
Ultimately, we wanna understand, as a researcher, we wanna understand what works, why do the model, why do the models, um, have these capabilities? And one way is, let's push attention to be as efficient as possible.
270
00:42:52.292 --> 00:43:01.912
On the other hand, let's push other alternatives to be as efficient as, as, uh, we can scale as big as possible and so that we can kind of compare them- Mm-hmm... and understand. Yeah. Awesome.
271
00:43:01.972 --> 00:43:11.872
And I think as long as all of this work happens in the open, it's, you know, a net positive for everybody to explore all the- Right... all the paths. Uh, yeah, let's talk about open source AI.
272
00:43:12.012 --> 00:43:25.672
Obviously, Together, you know, when Red Pajama came out, which was a, an open clone of like the Llama One- Mm-hmm. Yeah... um, pre-training data set, it was a, a big thing in the industry. Llama Two came out on Tuesday?
273
00:43:25.832 --> 00:43:31.952
I forget. Man, this week there's been a lot of things going on which, you know, they call open source, but it's not really open source.
274
00:43:32.332 --> 00:43:42.192
Actually, we wrote a post about it that was on the front page of Hacker News before this podcast- Okay... I was frantically responding. Okay. Mm-hmm. How do you think about what open source AI really is, you know?
275
00:43:42.292 --> 00:43:53.312
Like, in my mind, there's, in open source software, we have different levels of open. So there's like free software that's like the GPL license. There's open source, which is, uh, Apache, MIT.
276
00:43:53.792 --> 00:43:59.092
And then there's kinda like restricted open source, which is the SSPL and some of these other licenses.
277
00:43:59.632 --> 00:44:07.712
In AI, you have the open models, so Red Pajama is an open model because you have the pre-training data set, you have the training runs and everything.
278
00:44:08.172 --> 00:44:18.572
And then there's obviously Random Less that doesn't make it one-to-one if you retrain it. Then you have the open weights model that's kinda like Stable LM, where the weights are open, but the data set is not open. Right.
279
00:44:18.732 --> 00:44:27.572
And then you have, um, Llama Two, which is the data set is not open. The weights are restricted. It's kinda like not really open source, you know, but open enough.
280
00:44:27.712 --> 00:44:34.772
I think it's net positive because it's like $3 million of flops- Mm-hmm... like donated to the public. Yeah, yeah. Yeah. You know? How do you think about that?
281
00:44:34.792 --> 00:44:40.572
And also like, as you work with Together, you know, what is, uh, your philosophy with open source AI? Right. Right.
282
00:44:40.732 --> 00:44:46.672
Yeah, that, I think that, that's, that's a great question, and I think about it on maybe more practical terms.
283
00:44:46.792 --> 00:45:04.632
So of course, Meta has done an amazing job training Llama One, Llama Two, and for Llama Two, they, um, kind of make it much less restrictive compar- compared to Llama One's, where now you can use it for businesses unless you are, however, you know- Seven hundred million monthly active users...
284
00:45:04.632 --> 00:45:05.572
active user or something like that.
285
00:45:06.092 --> 00:45:19.232
I think just this change will have a very significant impact in the kind of landscape of, of open source AI, where now lots of businesses, lots of companies will be using, I expect, will be using things like Llama Two.
286
00:45:19.612 --> 00:45:26.972
They will fine-tune on their own data set. They will be serving variants or derivatives of, of Llama Two.
287
00:45:27.652 --> 00:45:34.392
Um, whereas before, you know, with Llama One, it was a als- still a really good model, but your business, uh, companies weren't allowed to do that.
288
00:45:34.812 --> 00:45:45.052
So I think on more practical term, it's kind of shifting the balance between kinda closed source model like OpenAI and, and, and Anthropic and Google, where you're making API calls, right?
289
00:45:45.072 --> 00:45:50.772
And you, maybe you don't understand as much of what the model is doing, how the model is changing and, and so on.
290
00:45:51.392 --> 00:46:00.252
Versus now, we have a model with open weight that is, uh, you know, pretty competitive from what I've seen in terms of benchmarks. It's pretty competitive with GPT 3.5, right?
291
00:46:00.312 --> 00:46:04.312
And if you fine-tune it on your own data, maybe it's more, more well-suited for your own data.
292
00:46:04.892 --> 00:46:16.232
And I, I do see that's gonna shift the balance of, like, more and more folks are gonna be using, let's say, derivatives of Llama Two. More folks are gonna fine-tune and serve their own model instead of calling an API.
293
00:46:16.892 --> 00:46:26.892
So that shifting of balance is important because in one way, we don't want a, just a concentration of decision-making power in the hands of, you know, a few, a few companies.
294
00:46:27.412 --> 00:46:30.552
So I think that's a really positive development from, from Meta.
295
00:46:30.632 --> 00:46:40.092
Of course, training the model takes a couple millions of dollars, but like, you know, engineers have and they've, they've-- I'm sure they, you know, they spend tons of time trying to, trying many, many different things.
296
00:46:40.272 --> 00:46:50.252
So the actual cost is probably way more than that, and they make the weights available and, and, um, they allow probably a lot of companies are gonna be using this. So I think that's a really positive development.
297
00:46:50.672 --> 00:47:01.272
And we've also seen amazing progress on the, you know, open source community where they would take these models and they either fine-tune on different kinds of data sets or even make changes to the, to the model.
298
00:47:01.452 --> 00:47:13.152
So as an example, I think for Llama One, the context length was limited to two K. Mm-hmm. Like a bunch of folks figuring out some really simple methods to scale up to like eight K. Yeah, like the row. Yes.
299
00:47:13.552 --> 00:47:17.532
I think the open source community is like very creative, right? And, you know, lots of people.
300
00:47:18.052 --> 00:47:24.512
Llama Two will again kind of accelerate this, where more people will try it out, more people will make tweaks to it and make a contribution, and then so on.
301
00:47:24.932 --> 00:47:28.772
So overall, I think I see that as still a, a very positive development for, for the field.
302
00:47:29.412 --> 00:47:37.252
And there's been lots of libraries that will allow you to host or fine-tune these, these models, like even with quantization- Mm-hmm... and, and so on.
303
00:47:37.672 --> 00:47:47.572
Yeah, just a couple hours after Llama Two was released, like tons of companies announcing that, "Hey, it's on our API or hosting," and then so on, and, and Together did, did the same.
304
00:47:48.032 --> 00:47:59.992
So it's a very fast-paced development and just kind of a model with, with available weights that business are allowed to use. I think that alone is already very, um, positive development.
305
00:48:00.332 --> 00:48:09.292
At the same time, yeah, we, we can do much better in terms of releasing data set. I think data set tend to be, somehow people are not incentivized to release data set. Right. Yeah, yeah.
306
00:48:09.332 --> 00:48:18.392
So, you know, philosophically, yeah, you wanna be as open as possible, but on practical term, I think it's a little bit harder for companies to release data set, you know, legal issues.
307
00:48:18.892 --> 00:48:27.292
The data set released tend to be not as, uh, eye-catchy- Mm-hmm. Yep... as the model release, so maybe people are less incentivized to do that.
308
00:48:27.684 --> 00:48:33.784
We've seen some, you know, uh, quite a few companies releasing this, you know, Together released, uh, RedPajama dataset.
309
00:48:34.044 --> 00:48:45.024
I think Cerebras then worked on that and, you know, deduplicate and clean it up and release Slim Pajama and, and so on. So we're also seeing positive development on that front, kind of on the pre-training dataset.
310
00:48:45.084 --> 00:48:54.804
So I, I do expect that to continue. And then on the fine-tuning dataset or instruction fin-tuning dataset, I think we now have quite a few open datasets on, on instruction-tuning and, and fine-tuning.
311
00:48:55.504 --> 00:49:04.044
But, you know, these companies still, they do pay, uh, for human labelers- Mm-hmm... to annotate these, uh, instruction-tuning dataset, and that is expensive. Right.
312
00:49:04.324 --> 00:49:12.204
And maybe, you know, they will see that as their competitive advantage. And so it's harder to incentivize these companies to, to release these dataset.
313
00:49:12.444 --> 00:49:21.824
So I think on practical term, we're still gonna make pro- a lot of progress in, on open source AI on both the model development, on both model hosting, on pre-training dataset and, and fine-tuning dataset.
314
00:49:22.204 --> 00:49:28.604
You know, right now, maybe we don't have kind of the perfect open source model- Mm-hmm... since the, oh, all the datasets are available.
315
00:49:28.684 --> 00:49:39.904
Maybe we don't have such a thing yet, but we've seen very fast development on the, on the open source side, right? I think just maybe this time last year, there weren't as- Right. Yeah, yeah...
316
00:49:40.004 --> 00:49:49.864
many models as are competitive with, let's say, ChatGPT. Yeah, I think the open datasets, they have so much more impact, you know, than open models.
317
00:49:49.924 --> 00:50:00.164
If you think about Eleuther and, like, the work that they've done, GPT-J was, like, great, and, like, the Pythia models are great. But, like, the Pile and, like, the Stack are like- Absolutely. Yes...
318
00:50:00.184 --> 00:50:01.924
you know, everybody uses them. Mm-hmm. You know?
319
00:50:02.084 --> 00:50:14.584
So hopefully we get more, more people to contribute time to work on datasets, you know, instead of doing the 100th open model that, like, performs worse than all the other one, but they wanna say they released the model.
320
00:50:14.904 --> 00:50:15.064
Yeah.
321
00:50:15.404 --> 00:50:32.864
Maybe, like, the, the question is how do we figure out a kind of incentive structure so that companies are willing to, uh, release, uh, op- uh, datasets and, and for example, it could be like, I think some of the organizations are now doing this where they are kind of asking volunteers to like, you know, annotate and, and, and so on.
322
00:50:32.884 --> 00:50:43.644
And, and kinda maybe the Wikipedia model of dataset, or especially for sh- instruction tuning, could be, could be interesting, where people actually volunteer their time and instead of editing Wikipedia- Mm-hmm...
323
00:50:43.884 --> 00:50:53.684
like, you know, add annotation. And somehow they, they acknowledge and, and, and feel incentivized to do so. Hopefully we get to that, that kind of level of in terms of data would be like, kind of like, uh, Wikipedia.
324
00:50:53.944 --> 00:51:00.404
Mm-hmm. And in terms of model development, it's kinda like Linux, where people are contributing patches and, and improving the model in some way.
325
00:51:00.744 --> 00:51:09.404
I don't know exactly how that's gonna happen, but based on history, I think there is a way to get there. Yeah. I think the DALL-E 15K dataset is, like, a good example- Yes. Yeah...
326
00:51:09.424 --> 00:51:17.324
of a company saying, "Hey, let's do this smaller thing. Just make sure we make it open." And it came out very-- We had Mike Conover from Databricks- Yeah...
327
00:51:17.364 --> 00:51:26.624
on the podcast, and he was like, "People just bought into it, and, like, leadership was bought into it." And, you know, you have companies out there with like, you know, two, 300,000 employees.
328
00:51:26.824 --> 00:51:34.924
It's like, just put some of them to label some data [laughs], you know? Like, it's gonna be helpful. So I'm curious to see how that evolves. What made you decide to join Together?
329
00:51:35.424 --> 00:51:42.844
For Together, the focus has been focusing a lot on open source model, and then I think that aligns quite well with what I, I care about, of course.
330
00:51:43.224 --> 00:51:48.184
And I also know a bunch of people there that, and I, that I, I know and trust, and I'm excited to work with them.
331
00:51:48.604 --> 00:51:53.984
Philosophically, the way they've been really open with, like, dataset and, and model release, I like that a lot.
332
00:51:54.404 --> 00:52:06.144
Personally, I've, you know, uh, for, for the stuff, for example, the
research that I've developed, like we try, we also try to make, you know, code available free to use and modify and, and then so on, con-contributing to the, the community.
333
00:52:06.624 --> 00:52:16.744
You know, that has given us really valuable feedback from the community in improving our, our, our work. So philosophically, I like the way, uh, Together has been focusing on open source model.
334
00:52:17.224 --> 00:52:27.484
And the nice thing is we're also gonna be kinda at the forefront of, of research and the, uh, the kind of research areas that I'm really excited about, things like efficient training and inference- Mm-hmm...
335
00:52:27.524 --> 00:52:33.644
aligns quite well with, uh, what the company is, is doing. We'll, we'll try our best to make things open and available to, to everyone.
336
00:52:34.044 --> 00:52:44.944
Yeah, but it's gonna be fun being at, at the, the company doing, you know, leading a team, doing research on the topic that I really care about, and hopefully, we'll, we'll make things open to, to benefit kind of community.
337
00:52:45.523 --> 00:52:54.384
Awesome. Let's jump into the lightning round. Okay. We usually have three questions. So one is on acceleration, one on exploration, and then a takeaway.
338
00:52:55.204 --> 00:53:05.364
So the first one is, what's something that already happened in AI machine learning that you thought would take much longer than it has? I think understanding jokes. Mm-hmm.
339
00:53:05.384 --> 00:53:13.224
I, [laughs] I didn't expect, uh, that to happen, but, uh, you know, it turns out scaling model up and training lots of data, the model can now understand jokes.
340
00:53:13.704 --> 00:53:22.644
Maybe it's a, it's a small, small thing, but, like, that was amazing to me. What about, um, the exploration side? What are some of the most interesting unsolved questions in the space?
341
00:53:23.264 --> 00:53:32.844
I would say reasoning in a broad term. We don't really know how these models are do-- Essentially, you know, they do something that looks like reasoning. We don't know how they're doing it.
342
00:53:33.344 --> 00:53:44.404
We have some ideas, and in the future, I think we will need to design architecture that kind of explicitly have some kind of reasoning module in it if we wanna have much more capable models. Mm-hmm.
343
00:53:44.964 --> 00:53:53.944
What's one message you want everyone to remember today? I would say try to understand both the algorithm and the systems that these algorithms run on.
344
00:53:54.064 --> 00:54:00.824
I think the, at the intersection of machine learning system has been really exciting, and there's been a lot of amazing results at this intersection.
345
00:54:01.224 --> 00:54:09.864
And then when you, you know, scale models to, to large scale, both the machine learning side and the system side really matter. Awesome. Well, thank you so much for coming on, Tri. Yeah. This was great.
346
00:54:09.904 --> 00:54:10.824
Yeah, this has been really fun.
347
00:54:10.824 --> 00:54:30.524
[outro music]