Latest / Agentic Conversations (formally mlops.community) / PyTorch's Combined Effort in Large Model Optimization // Michael Gschwind // #274
Transcript
- 0:00My name is Michael Schwimm. I'm an engineer on the Pie Torch
- 0:03team. I help create Torch Chat, which
- 0:07is the Pie Torch library for LLM Large Language Model inference,
- 0:14and my coffee is usually a latte.
- 0:18I take it with a double espresso.
- 0:21I feel honoured that I got to talk to Michael today.
- 0:25This is another episode of the ML OPS Community Podcast.
- 0:28I'm your host, Dimitri OS, and there's one of those times where
- 0:32I almost have to pinch myself. This man has contributed so much
- 0:37and maybe he has been behind the scenes or if you have been in
- 0:42the ecosystem for a few years, you probably know who he is and
- 0:47that's for a good reason. The dude has done a lot and
- 0:51recently with his product or project Torch chat, he talked
- 0:59about how he was able to combined all of these different
- 1:04projects that he's worked on while at Meta in the Pie Torch
- 1:07ecosystem. And really when you talk to him,
- 1:10you can tell that he is all about that optimization.
- 1:14Another thing that became blaringly, blazingly obvious as
- 1:19I spoke with him is he gives a lot of people a lot of credit
- 1:26for everything. He recognises that proverb, if
- 1:31you want to go fast, go alone. If you want to go far, go
- 1:35together. He basically embodies that and I
- 1:39can tell you that because one of the first things that he told me
- 1:41was, OK, I want to give a shout out to that team, but I don't
- 1:44want to talk about anything that team is doing because I want
- 1:47them to come on here and talk about it themselves.
- 1:49I don't want to act like I can take credit for that.
- 1:52So, you know, you've got a gem of a person when that's what
- 1:56they're telling you. Let's get into it with Michael.
- 1:58And as always, if you enjoy this episode, share it with one
- 2:03friend. I'll see you on the other side.
- 2:11Yeah, I've been around the block for a couple of times.
- 2:13I built what arguably the first accelerator that was in the cell
- 2:19PlayStation 3. So if you play PlayStation
- 2:23three, you used my chip. If you used the Xbox three, six,
- 2:28yeah, worked on that one too. So everyone like.
- 2:33Myself who enjoyed Tony Hawk growing up, It was thanks to
- 2:37you. She is it.
- 2:39That sounds exciting. Yeah.
- 2:42And I think there is a path that LED from there.
- 2:46It was terribly hard to programme initially the Gold
- 2:50West, but all the performance that you can get into one chair
- 2:56and to do that we sort of had to make compromises.
- 3:04It's not, you know, the comfort of a traditional CPU where you
- 3:10know you have branch prediction and all those caches, whatever.
- 3:14It was much more like, OK, you want the pure performance.
- 3:17We're going to give you as much performance as possible.
- 3:21But it means there is nothing else, no comfort on this chip.
- 3:24It's all on you to manage that. And so users did find that
- 3:30somewhat hard to programme to say the least.
- 3:33And I ended up spending a good part of my time building
- 3:39software, environments, ecosystems, compilers, and that
- 3:45straight up led to AI, which turned out to be the most
- 3:51voracious, most consumer performance and in the end
- 3:58accelerators, GPUs, etcetera. So that was really cool from
- 4:03enabling accelerators for a broad range of applications
- 4:08within HRB. Accelerators power the first
- 4:11petaflop computer, the first computer delivering petaflop per
- 4:17second. And there is a direct connection
- 4:23from there to the use of accelerators in AI today.
- 4:28They are the largest consumer today of compute performance,
- 4:34and they have a particular affinity to the sorts of things
- 4:43that work well on accelerators, large matrices, very repetitive
- 4:50operations, but many of them similar to what you have for
- 4:55graphics processing, where you want to process a lot of pixels
- 5:00at the same time. Here you're processing a lot of
- 5:03neurons, a lot of layers at the same time with the same general
- 5:09operations, matrix multiplies in particular.
- 5:12And that was a match made in heaven.
- 5:16And so, yeah, the history of accelerators in many ways has
- 5:23become, you know, enabler to AII.
- 5:27Think Jeff Hinton and his team were the first who saw that
- 5:33potential when they trained models for the image net
- 5:38competition and beat the traditional image understanding
- 5:46entrance in the image net competition back in 2012.
- 5:51How time flies. And were you, because you were
- 5:55working on the PlayStation 3 and then the Xbox and mainly in the
- 5:59gaming world I guess, or the chips side of the gaming world?
- 6:04And how did the transition go into AI?
- 6:08Was it fairly straightforward where you recognised OK, this is
- 6:13same chip, it's just different application?
- 6:18So the story is a little bit longer.
- 6:22After Cell and the game computers, I spent a
- 6:30considerable amount of time on supercomputers.
- 6:33So I built three of the world's fastest supercomputers.
- 6:42That was the Roadrunner, the first petaflop supercomputer,
- 6:48then Blue Chain, and at the end the Summit system, which was
- 6:55using GPU's to get about the IB Miss Power architecture to power
- 7:03National Labs applications. And it's from there that I was
- 7:11looking around, hey, what's the next cool thing you could do
- 7:15with this technology? We have the Summit style
- 7:19supercomputers where we connect GPU's with CPU's in a very tight
- 7:30collaborative fashion. This was pre Grace Hopper CPU
- 7:38GPU that NVIDIA later released. We have been working with NVIDIA
- 7:44on printing the NVIDIA GPUs to to the IDM systems.
- 7:50And so as I was looking around back then over 10 years ago,
- 7:56there were these image Med results that Jeff Hinton had and
- 8:01I was like we need to try that. And so we built a system to
- 8:08train what were CNNS that in the Bay, Alexnet in particular.
- 8:15And we trained the first Alexnet model in under an hour.
- 8:23And so that was like, hey, this is this is working.
- 8:27This is a really good direction. Of course, Facebook beat us
- 8:33shortly after that, which you know, as I mentioned,
- 8:36competition is good in our industry.
- 8:38You want to see that because somebody comes and says like
- 8:42what you're doing is cool, but I have these ideas how we can do
- 8:46that even better. So I think this collaborative
- 8:50competitive framework is, is a great way of bringing people and
- 9:01harnessing their ideas, allowing them to build on the ideas of
- 9:06others. And I wish I have to say
- 9:08research is a team sport. So there, there is a lot of
- 9:15wisdom in teams, in collaboration where you might
- 9:19not have all the answers, but you have a part of the answer
- 9:22and some of your colleagues or competitors for that matter, may
- 9:28have the other part of that. And overall, you know, by having
- 9:33that corporation competition, whatever you want to call it, we
- 9:39get an overall better outcome. And I think that was goodness
- 9:46and super exciting to see. So I was really thrilled when I
- 9:53joined Facebook to have the opportunity to work with some of
- 9:59those people that, you know, had built those exciting training
- 10:07systems. And Pythorch was really just
- 10:13coming into its own. And I think Pythorch's
- 10:17commitment to open source to to a community based model has
- 10:22served it super well is the foundation a lot of innovations,
- 10:31improvements that people brought to that ecosystem.
- 10:40Having that openness means you can pursue your own ideas, you
- 10:45can contribute, but you don't have that bank cost of where you
- 10:51first have to build the framework before you can prove
- 10:55that, you know, I have a better whatever it is, a matrix
- 11:00multiply kernel or a better way of doing quantization or
- 11:03whatever. You can build on the work of
- 11:07other you know and focus on your own interests and your own ideas
- 11:17and improvements a while relying on the community of other uses
- 11:24of other contributors to take care of the things that are
- 11:29important but maybe not your core competence.
- 11:34So talk to me a little bit about Torch Chat now, what you've been
- 11:37working on recently and the three goals as to why you
- 11:43created it. So, OK, Torch Chat is in many
- 11:49ways the combination of several development strands or if you
- 11:57will, in the Pythorge ecosystem, in the LLM ecosystem, there was
- 12:05the optimization of Pythorge for LLM.
- 12:10So we've done a lot of investment over the years to
- 12:14optimise high Torch for LLMS. There was better transformer,
- 12:19the initial acceleration for LLM inference, then the accelerated
- 12:26Transformers that brought in flash attention that brought the
- 12:31new scaled up product detention operator, many other
- 12:35infrastructure improvements. There was the Torch compile work
- 12:45that allows you to take those models that you have in pythorge
- 12:50and export them such that you can run them stand alone outside
- 12:55of Python hosted environment like a normal application.
- 13:02And then there was the executorge on device work that
- 13:09brought model inference, LLM inference with LLM optimizations
- 13:17to on device AI. And so one of the thoughts here
- 13:23or one of the goals in building Torch Check was to integrate all
- 13:31of these different development strains, these different silos
- 13:38of optimization, both to show users how these different
- 13:46technologies can be used, but also to integrate them, how you
- 13:50can integrate them. And to build that end to end
- 13:54solution that provides a seamless environment to deploy
- 14:02LLMS for inference from servers on the one side all the way to
- 14:08on the by applications at the other end of the spectrum.
- 14:14So that was the first underlying impetus that was both enabled by
- 14:24these Pythorch developments. Then Korcheck is also a driver
- 14:36for ongoing optimization for LLMS. In pipe words, in exactly
- 14:41court, just by having that integrated environment, you can
- 14:46now benchmark. We know in engineering that if
- 14:51you benchmark something, if you measured regularly, it gets
- 14:55better not by magic, but by some engineer looking at this, this
- 15:01is not good. We can do this way better.
- 15:04You know, if if you don't have those numbers out there that
- 15:09give somebody the hey, I think I can do this twice as fast yes,
- 15:17please come send us your PR. That's exactly what we want,
- 15:21right. So giving giving the platform
- 15:25where people can measure where people can try out their own
- 15:28ideas and measure them and and sort of almost like a dialogue
- 15:33with the community. Now, what can I do here to
- 15:38contribute to bring my ideas to the table?
- 15:45And it's been an important driver for Pythorch
- 15:52optimizations. We found kernels.
- 15:54We found the opportunities for, hey, this should do better by
- 15:59comparing with other inference solutions, by comparing between,
- 16:05say, the math and a Linux platform.
- 16:12ARM code generation hadn't been until very recently a big focus.
- 16:19And so with Torch Chat running on the Mac, people started to
- 16:27ask questions. Hey, why is this performance the
- 16:30way it is? We thought, you know, based on
- 16:34the rating of this machine, you'd get better performance.
- 16:38And so we looked at again, what what gets measured gets
- 16:43improved. We looked at the code, we
- 16:46partnered with the Metazone LLBM team, Metazone compiler teams,
- 16:53like what can we do to generate better code for Arm?
- 16:57We partnered with ARM, we partnered with Apple to bring
- 17:04better kernels. A lot of the performance comes
- 17:07from the BLAST kernels, gem, generalised matrix multiply
- 17:13kernels. And so getting the best kernels,
- 17:20partnering with the community that is most intimately aware of
- 17:30what improvements can you do for that particular platform.
- 17:34And again, bringing that into the common ecosystem gave us
- 17:43gives the community a better outcome by by bringing another
- 17:50set of eyes to the table, another set of ideas into the
- 17:58ecosystem. And it's not just porch chat.
- 18:01It becomes, and I would love for porch chat to be this catalyst
- 18:07in some ways that people can look at it like what are they
- 18:12doing to get performance, whatever.
- 18:16And for people to blatantly plagiarise it for their own
- 18:20application. That's what open source is good
- 18:23for. Hey I saw this idea.
- 18:26I may not be doing LLM inference but this is a cool idea which I
- 18:30can use for my own application over here.
- 18:33So there is some of that were just aggregating all of these
- 18:40that libraries ideas, ways to structure kernel to do things
- 18:47better. Just provides a reference for
- 18:52for others. I'm a really big fan of this.
- 18:55It's to summarise, you were able to leverage many different veins
- 19:01of the pie torch ecosystem that was already there to create a
- 19:04more complete product. We could say in a vague sense, I
- 19:09don't know if product is the right word, but to create
- 19:13something new that is leaning on or standing on the shoulders of
- 19:17giants. And then you recognised, you
- 19:21know what would be really good, As if we can benchmark these,
- 19:25but not just benchmark them for ourselves, benchmark the
- 19:27performance and let everyone see because we want to know and we
- 19:33want the numbers to continuously get better.
- 19:35And I think one thing that I really appreciate about what you
- 19:41just said is the competitiveness.
- 19:45It's almost like, you know that whenever you see a number and
- 19:49you think, how could this be faster?
- 19:53You, you get that itch. And so there's going to be other
- 19:56people that are going to be out there and they're going to get
- 19:58that itch. And if you throw it out and make
- 20:00it public, the numbers are only going to get faster.
- 20:05Exactly. I think that's what good
- 20:07engineering is about, looking at a solution, asking, well this is
- 20:13great. Well, what's the next thing we
- 20:16can do with that? Either how can we use it and
- 20:20give them more value by using it in a different space, or how can
- 20:24we take it in this space and make it more performance, lower
- 20:28power and more reliable. There are so many attributes
- 20:32that people care about where you can't imagine improvements.
- 20:38And hey, I would like to run it without Python because Python is
- 20:42cool, but it's also a very large ecosystem, so it's not going to
- 20:49run on my small own device. We've been running Torch Chat on
- 20:55a Raspberry Pi, which I thought was one of the coolest things
- 21:01ever. That's the other thing in
- 21:03engineering. Every time you achieve something
- 21:06you have like the next goal. So I think the next goal for
- 21:11Twitch chat should be to run a model on an Apple Watch or
- 21:16whatever on the mark watch. Like natively.
- 21:19Not just talk to the Internet and pull down the answer from a
- 21:23server, but run it on the watch. Or device.
- 21:27Wow. Yeah, it it's fascinating you
- 21:30say that too, because we've had conversations in the ML OPS
- 21:33community Slack where folks are saying I need to optimise
- 21:37battery. I need to know how I can put
- 21:40this model on device and make sure that it just doesn't kill
- 21:45the battery right away. So there is, like you say, so
- 21:49many different vectors that you want to optimise for.
- 21:52And it's really cool when you can give that to the community
- 21:55and each different use case is going to have their vector that
- 22:00they're trying to optimise for. And so bind you're able to get
- 22:06to places that you probably wouldn't be able to get to if it
- 22:09was just one team trying to work on their one use case.
- 22:13And I, I'm wondering as I talked to you, what are some things
- 22:18that surprised you that gave you just an enormous amount of lift
- 22:23as you are trying to optimise that either you created or and
- 22:29was because of stuff that you and your team has done or just
- 22:33the community has done and it surprised you because you
- 22:37wouldn't have thought to try and go in that direction.
- 22:41A big shout out to the developers of X&N Pack and to
- 22:47our own team members that are a part of X&N Pack development.
- 22:55One of the engineers on our team developed a really cool 4 bit
- 23:06matrix multiply forearm that uses a instruction that only
- 23:14exists in arm that does like a vector of four bit by 4 bit
- 23:23multiplications and then accumulates.
- 23:26It all integrated into a quantization kernel, but scaling
- 23:32off, but GroupWise quantization but and and the scaling gave a
- 23:40amazing performance that made CPU inference of lens in
- 23:49particular for on device scream in ways that were just amazing.
- 23:59It's another example where if you integrate different
- 24:04technologies or different dimensions, there's the
- 24:07instruction set architectural farm, there is the XNM pack
- 24:13architecture, there is the specific kernel, and that's
- 24:18integrated with the exact torch and comes the torch jet.
- 24:22Just if you look at the steps of how many communities and experts
- 24:28were necessary, it's hard to imagine that you can build that
- 24:34in a clean room without these amazing community that all bring
- 24:42their own ideas to the table. 100% in agreement with
- 24:49everything that you just said. And Speaking of which, you've
- 24:55built products that go on different ships and interface
- 25:01with different ships at the a very low level.
- 25:05Is there tips or tricks that you could give us?
- 25:09Because I, if I was talking to a friend who is working on these
- 25:15very problems and he was saying, man, it's just so hard because
- 25:19GPU's aren't written in CUDA. It's like if I need something to
- 25:24happen with the GPU or if I really want to figure out how to
- 25:27squeeze the most out of it. Like I, I got to read that
- 25:30manual. And sometimes you just got to
- 25:33know somebody at NVIDIA to be able to get that little.
- 25:37I don't want to say trade secret, but you, you want to
- 25:40like figure out or sometimes even it's like petitioning or
- 25:44lobbying so that something can get changed in a GPU.
- 25:48And I wonder if with all your experience you found there are
- 25:53easy ways to do things. There are hard ways to do
- 25:55things. There are tips and tricks that
- 25:57can help us as we're we're trying to squeeze the most that
- 26:00we can out of the juice. I think the number one matching
- 26:05is collaboration. There are a number of open
- 26:12source solutions and teams all around the space, and so
- 26:22deciding to go something completely alone will make it
- 26:30difficult to engage the right people that have the right idea.
- 26:36But you're missing this one thing and you don't know where
- 26:39to get it. Well, somebody else may have
- 26:43that and I'll give you a couple of examples.
- 26:46There is the Cutlass team at NVIDIA and they're producing a
- 26:53amazing library for doing numerically intensive processing
- 27:01on GPU's and that's been an amazing relationship.
- 27:09A lot of capabilities we get from Cutlass.
- 27:15Conversely, we have partnered and contributed optimizations
- 27:20and these guys work at NVIDIA. So if you have your kernel and
- 27:25you contributed to, you know, that library A, you make it
- 27:32available to many more users that might benefit from it, but
- 27:39also might improve it because they have, you know, insights or
- 27:44ideas that build on top of your own solution.
- 27:51And with Catlett being linked to NVIDIA teams that think about
- 28:01how to optimise the architecture, the GPU
- 28:06architecture and the library architecture, you're much more
- 28:11likely to find that person that have either the ability to say,
- 28:21hey, there's this little known approach that you know, if I
- 28:26integrated here improves performance significantly, or
- 28:31hey, this is really good. But if we optimise this or that
- 28:37in our next chair, then we could build something that's even more
- 28:43amazing. So now through these
- 28:46collaborating communities, you get this continuum where they're
- 28:52the chip manufacturers, the vendors, whether that's NVIDIA
- 28:57or ARM or Qualcomm there or Apple on the one hand that build
- 29:05the infrastructure on which you're running all the way to
- 29:10the software end users. And there is the opportunity
- 29:15really to do end to end optimizations that way without
- 29:21needing to own or understand the entire stack because frankly
- 29:28it's it's very unlikely that you're going to find an LLM
- 29:31expert who also happens to do chip design.
- 29:36The other thing that I wanted to talk to you about is this idea
- 29:40of the cloud versus on device. And I know you have some strong
- 29:47thoughts about that and how it's almost like this false dichotomy
- 29:52or false paradigm, In the past maybe it was more valid, but now
- 29:56because of advancements, it is more realistic to be able to do
- 30:03what you want to do on device on device.
- 30:07There are many reasons why on device is exciting and on the
- 30:16brink off a breakout if it hasn't already broken out.
- 30:22On the one hand, there is, well, I want to run in a disconnected
- 30:26environment. Whether it's I want to use the
- 30:29LLM as a translator and I'm in a place where I don't have network
- 30:34access but I still need translations or running in a car
- 30:40and you know, I don't have to write connectivity or I just
- 30:44care about privacy. Get some explanations about
- 30:47something or other that involves data that are private and I
- 30:54don't want to upload them into cloud.
- 30:57There's there's a range of applications.
- 31:00So in the path on device, I have been seen as this special thing
- 31:07on the side where you have to develop a model that are
- 31:15specifically for on device. And that meant that the on
- 31:22device models were, you know, a small set of models like for
- 31:28keyboard prediction or gesture recognition and sort of very
- 31:36niche. Well, you need that on device,
- 31:40but it it wasn't benefiting from the broader research, the
- 31:48broader investment into AI model because they were always the
- 31:55thing on the side. With the release of Executorge
- 32:02and in particular also including LLM optimizations for Executorge
- 32:08and Executorge is by purchase back end for on device embedded
- 32:15edge type applications, it became practical to take models
- 32:24that are channel purpose models and run them on device.
- 32:31Then Twitch chat took that and created this continuum where
- 32:36it's actually the same software infrastructure that you can use
- 32:40to run and export and exercise models, optimise model from
- 32:49server all the way to on device. So there's a consistent model
- 32:54definition that will run on either servers or on device.
- 33:00So you can use the same models and try it out on server.
- 33:07Then ask the question, so how does this run on device?
- 33:10There will be evidently some sort of different goal like you
- 33:17will possibly want to deploy a larger model on the server.
- 33:22On device, you're more memory limited, you're compute
- 33:25constrained, but so Llama 7 billion or Llama 1 billion
- 33:31versus Llama 70 or 405 billion, but it's the same definition.
- 33:38And if you look at some of the challenges that you're facing
- 33:44from server to on device, they're in fact very similar.
- 33:49For example, on device, one of the big challenges is memory
- 33:54footprint, also compute power. And one of the answers to that
- 33:59is quantization, taking the 32 bit or 16 bit floating point
- 34:05values and asking the question, well, how many bit can I get
- 34:10away with? And I mentioned earlier, we have
- 34:13this streamer 4 bit kernel for ARM processors that we use for
- 34:21embedded and that comes that. So that that's called
- 34:27quantization. That quantization allows to get
- 34:31really amazing performance on, on device.
- 34:35But the same approach also applies to servers, to GPU's.
- 34:41GPU's are also memory limited. They have a fixed device memory
- 34:47size on the card and so you're facing some of the same
- 34:54constraints, only with slightly bigger numbers.
- 34:58Plus on GPU's you also find, like on all other platforms,
- 35:03that your bandwidth limited. So quantization helps you not
- 35:08just with your footprint, but also just taking advantage of
- 35:14the bus, which has a limited amount of pins, you know, a
- 35:19limited number of bits that can be simultaneously transmitted.
- 35:24And so if you need to transmit more data, it takes a longer
- 35:29time because you send more of these packets.
- 35:37So if you look at that, you're, you're basically looking for the
- 35:41same sort of basic technologies like quantization.
- 35:46And Torch Chat uses a library called Torchio architecture
- 35:55optimization that one of the pie church teams is developing and
- 36:01that takes a look at your model and finds ways to compress the
- 36:09computation, to compress the weights make computation more
- 36:14efficient. And that applies equally well on
- 36:18the one side hand to servers where you care about the inverts
- 36:22or the amount of memory weights that you can store on a single
- 36:29GPU, because the largest models today are multi GPU inference
- 36:33because you can't fit all the weights on a single device
- 36:38anymore. So you're talking fundamentally
- 36:41about the same constraints that you have with on device.
- 36:45Yeah. And so integrating that for LLMS
- 36:50and Torch Chat and more broadly for AI with libraries such as
- 36:55Torch L really allows different communities or different use
- 37:00cases to benefit from that shared investment.
- 37:05That's an important opportunity. And I think with the Torch Chat
- 37:13library in particular, but more generally, but the Executorage
- 37:19and Pi Torch, creating this community that has a much
- 37:27broader reach enables models that used to be either just, you
- 37:33know, for this one domain or that other domain to cross
- 37:38domains. And will it benefit all the
- 37:40users? There will be differences, for
- 37:43example, in size, if you're going on device, you might pick
- 37:47a smaller Llama model than if you're running on a bigger
- 37:52server. But it's the same technologies
- 37:56and the same primitives and optimizations that you can share
- 38:03between users and get the benefit of shared investment.
- 38:09So users do not have to reinvent or.
- 38:14Recode. The same optimizations, just for
- 38:18different domains. Well, this was the first time
- 38:24that I've heard someone put it like that.
- 38:26Where on device and GPUs or accelerators you're still, you
- 38:33don't have to think of them as two separate things.
- 38:36It's just one has bigger numbers than the other.
- 38:38And so don't get into the trap of thinking that you need to
- 38:43have this one with the bigger numbers in order to do what you
- 38:47want to do. And almost the idea of
- 38:50standardising it across all of the places that you want to run
- 38:55your model is a fascinating way of of abstracting the device and
- 39:05just recognising what am I trying to do and what are my
- 39:09constraints. And then you can talk to the
- 39:13device experts and have a conversation.
- 39:16What else can we do to optimise for that target?
- 39:19There is for example, the GPU mode community that is very
- 39:27focused on optimizations you might do for GPU's and some of
- 39:35the engineers that are very active on that are engineers
- 39:38that work on the Torch AO, the architecture optimization
- 39:44libraries. So you get that benefit there.
- 39:48But we also have for example, engineers that worry and work on
- 39:54on device AI contribute to that library and partnering with ARM
- 39:59and embedded manufacturers. So having that continuum is
- 40:05good. And then once you have that and
- 40:09the same primitives, you can ask, well, what's the best
- 40:12implementation for my device? Or are there additional things I
- 40:17can do for my device that are very specific here?
- 40:21To what this device offers me. Yeah, exactly.
- 40:27It's, it's almost like you don't want to, as you were mentioning
- 40:31before, have to reinvent the wheel or do things very custom
- 40:38for each device that you're on. You want to get 80% of the way
- 40:42there or 90% of the way there, and then make those final tweaks
- 40:46to try and optimise for whatever device you're on if you need it,
- 40:50because some of the time just out-of-the-box will probably be
- 40:54good enough all. Right, Especially if the
- 41:00stakeholder, the developers of a particular device make sure is
- 41:07ARM, is NVIDIA, if increasingly AMD are working, but the the
- 41:15Pytharch community, but other communities to optimise or
- 41:22contribute their specific functions, their specific
- 41:28optimization. So it becomes transparent where
- 41:34the ecosystem basically depending on where it runs can
- 41:40pick the best implementation to solve your problems.
- 41:46There's just one linear operator and pipe porch, but under the
- 41:51hood there are different libraries, from kublas for GPU's
- 41:59to composable kernels on AMD to ARM library, etcetera to X&M
- 42:08pack. Just providing implementations
- 42:17that the Pytorch ecosystem and Torch Chat can rely to to to get
- 42:24the past performance on a particular device.
- 42:29There's one thing that I believe everyone who has ever used
- 42:33Pytorch is in strong agreement with, and that is the developer
- 42:38experience is strong. And thinking about it in that
- 42:42way that you're talking about is one of those reasons where you
- 42:48recognise that, OK, the standard way or the the way that a
- 42:54developer is going to think is along these lines.
- 42:59So let's try and make it as easy as possible for them to go about
- 43:03it and not add unintentionally or intentionally friction to the
- 43:09workflow. And so having the
- 43:12standardizations and having recognising where you can get a
- 43:16little extra oomph out-of-the-box if needed is is
- 43:22great, but if it's not needed, that's even better.
- 43:26Maybe you just transparently get that optimization period.
- 43:31So that's one of the great things I've seen the Torch chat
- 43:38in response to Torch Jack, there've been improvements to
- 43:43high Torch, to Torch Ale to some of these other libraries that
- 43:49have looked at what does a model do here and where the
- 43:56opportunities for further improvement.
- 43:58I mentioned our work with the ARM for on device.
- 44:03There is similar work with the GPU vendors to to create better
- 44:11kernels, either Brittany, CUDA or with Triton, which is the GPU
- 44:23language that's coming out of Open AI that we use for for a
- 44:30lot of applications that we generate code for.
- 44:34When you use the Torch export to export the model, it will
- 44:38generate the Triton code if you're targeting a GPU and then
- 44:43run it through that compiler and you can get a lot of
- 44:49optimization that has been developed for Triton is part of
- 44:55this ecosystem. And there's another of these
- 44:58pillars where it's a parallel community.
- 45:01But by integrating them into this ecosystem, it now offers
- 45:07benefits to all the pipers users that use export and including
- 45:14for Torch chat. If you export that for GPU but
- 45:21the Torch Jet export, it'll generate the Triton code and and
- 45:29built both the model that way. Are there any anti patterns that
- 45:35you've seen recently that are worth talking about I.
- 45:40Think the biggest anti pattern is premature optimization.
- 45:48There is this tendency that people sometimes develop that
- 45:57oh, my problem is so different, whatever is out there won't
- 46:02apply here. And they start to build a very
- 46:10specific, very niche solution. And sometimes that is necessary,
- 46:15like if you have, you know, crazy constraints that just
- 46:21nobody else can satisfy. But you'd be surprised how often
- 46:29you find out that constraints or challenges similar to the ones
- 46:36that you're facing in your application exist in so many
- 46:41other places in the ecosystem. And if you're operating in an
- 46:46environment where you can just turn around and grab that
- 46:51solution and bring it to your problem, it's so much more
- 46:56efficient. So cutting yourself off by
- 47:01premature optimization or oh I can't use general AI framework I
- 47:12think becomes a very limiting anti pattern.
- 47:21At the end of the day you might need some optimization for your
- 47:25target, but it might actually be better to build the overall
- 47:29solution and then ask which parts here do I truly have to
- 47:33optimise for my target and where else can I just get a free ride.
- 47:41I'm often joking that good engineers are lazy and that
- 47:45doesn't mean they don't want to work.
- 47:48It means like, oh, I felt this two times already, why should I
- 47:52implement the same solution for the third time?
- 47:55Let me take this solution over there so now I can spend my
- 47:59engineering time on creating something new of value rather
- 48:04than redoing what already did. Maybe in a slightly different
- 48:09context. So cutting yourself off from
- 48:14from the the broad sharing of code and ideas I think is is one
- 48:24of those and anti patterns that I see people sometimes fall
- 48:31into. So there's a funny thing that
- 48:35you mentioned there with the over optimising too early.
- 48:40And really sometimes I can imagine that you're thinking
- 48:47you're taking 2 steps forward, but really you're taking 2 steps
- 48:51back and you recognise it a little bit later and you
- 48:55recognise wow, if if actually this wasn't optimised, maybe we
- 49:00could do what I'm trying to do a little bit better.
- 49:03How do you know when it is time to optimise?
- 49:07First, get it to run. If it's not running in whatever
- 49:13form, shape or colour, it's probably too early to optimise.
- 49:19And then I would say you want to figure out what the obstacles
- 49:29are to run. I don't know what the
- 49:34performance or the battery life or whatever your constraints are
- 49:41for, for your target and to ask, well, specifically what are the
- 49:46pieces I might optimise to get there so I can focus on those
- 49:53pieces that are that make the difference, that are make or
- 49:58break. And you can still reuse
- 50:03everybody else's work for the rest because that allows you to
- 50:09focus what the real value of your creation is.
- 50:15I can make this run on whatever this device or but that much
- 50:22battery life or whatever. So there is, there is that part.
- 50:28And then there is, well, you know, like I need the gazillion
- 50:33of other things that I need functionally, but like a file
- 50:38system, I'll, I'll not rewrite a file system for LLMS, but yet I,
- 50:47you, you need a file system because you got to store stuff,
- 50:51right? I think everybody will see it
- 50:53for the files in the case of the file system.
- 50:56But there are many other things like quantization algorithms.
- 51:00OK, so I, I want to compress the data.
- 51:04It doesn't actually, you know, matter what device it is.
- 51:08It's the same sort of quantization approaches.
- 51:13Well, if I can go to Torch ALE, the architecture optimization to
- 51:17pick up my quantization algorithm, that's goodness.
- 51:23Maybe I have a RIB 5 and I don't have a RIB 5 kernel yet.
- 51:28Then I can use the quantization algorithm that compresses the
- 51:33way and if my contribution is running the first LLM on the
- 51:41RISC 5 smartwatch, the optimizations or the work that I
- 51:47have to do specific to that are the RISC 5 kernels.
- 51:52XMM pack has some of those already, but I much like for ARM
- 51:59our team working, but XM Pack and ARM teams developed a better
- 52:06matrix multiply form this matrix multiply for ARM.
- 52:10I can see that there is, you know, a similar opportunity say
- 52:15for RISC 5 and that's the contribution that enables us to
- 52:20run to scream on that device, maybe partnering, but RISC five,
- 52:25hey, wouldn't it be cool? There is this instruction that
- 52:28ARM has if you had something similar, but hey, I also have an
- 52:34idea how to do that. Even better if you're building
- 52:37your RISC 5 Smartlatch that speaks LLM that does LLM.
- 52:45It may come down to you just need a few kernels and most of
- 52:48the rest like the quantization algorithms itself, like the LLM,
- 52:56like the model export or the executorch.
- 53:00You can build on all of that and you know, focus on getting your
- 53:08product, your idea out by focusing on on what is needs to
- 53:18be different to enable what you want to do rather than
- 53:23rebuilding the world. Are you bullish on types of new
- 53:32training architectures or or new model architectures for this
- 53:37optimization? Like you said, hopefully we can
- 53:40see the smartwatch, the LLM running natively on a
- 53:42smartwatch. And I feel like it's going to be
- 53:46a little bit of each area that you can as as you've talked
- 53:50about, there's such a Broadway that you can go in so many
- 53:54different vectors where you can optimise.
- 53:56And I wonder if if you're bullish about the model
- 53:59architectures or if there's other places where you're
- 54:01feeling very bullish on that you want to talk about?
- 54:06There are a couple of things that I think looking forward to
- 54:10the next innovations at the model architectural level there
- 54:16Transformers are everywhere and in some form, shape or cola,
- 54:19they're here to stay. But there is a discussion of are
- 54:23there improved transformer implementations, the Amamba
- 54:31architecture. So that'll be exciting.
- 54:34There's, there's definitely more opportunity there, typically
- 54:42more focused on infrastructure. So not there, there's probably
- 54:49more, many more of these out there in research.
- 54:54And having those researches use pipe bridge means that when when
- 55:01they find something, we can bring it in, plug it in very
- 55:05quickly as as a community, because, you know, it might need
- 55:15a couple of new operators or whatever, but it's still the
- 55:19same tokenizers, it's still the same, you know, linear kernels,
- 55:24etcetera. Other areas.
- 55:29I'm definitely excited about numeric, the the whole brand
- 55:36that we've been seeing to exploring numeric format.
- 55:41I mean, we started out with B 3216 brain float 16 FB 8.
- 55:49Now we're down to FB four people looking at 4 bit floating point
- 55:53numbers. So I think there's a lot of just
- 55:59innovation, the experimentation that's going on and the
- 56:09infrastructure and the environment that we have I think
- 56:13is very optimised for that. Typically insights are a
- 56:20function of how many iterations, like a lot of this is very
- 56:25experimental. So if you can run more
- 56:28experiments, you get more insights and you get better
- 56:30results. So the optimising for turn
- 56:34around, for iteration speed, it is something that's been on my
- 56:40mind and I know on other people's minds as well.
- 56:45Andrew and had pointed out how that is critical if you want to
- 56:51drive success in a startup, for example.
- 56:54Like it it duration speed is directly proportional to rate of
- 57:01innovation. Almost so excited about both
- 57:06what we can do with the duration speed, but also what can we do
- 57:11to speed up how long it takes to to run 1 iteration.
- 57:19One experiment so that we might get new insights that that allow
- 57:26us to build better, faster, more reliable, more efficient
- 57:30systems.