Latest / Agentic Conversations (formally mlops.community) / The Variational Book // Yuri Plotkin // #253
Transcript
- 0:00My name is Yuri Plotkin. I'm the author of the
- 0:02Variational book. You could find more at the
- 0:06variationalbook.com or at the Variational on X.
- 0:10And I like my coffee. I'm pretty simple.
- 0:12Just black. Just black.
- 0:15It doesn't even have to be good coffee, it just has to be black.
- 0:19I drink all types of coffee. What is happening ML OPS
- 0:24community, we are back for another podcast.
- 0:26As usual, I am your host Demetrios.
- 0:28And today, talking with Yuri, we got into the pedigree of models,
- 0:34specifically all of these image generation models, and I really
- 0:38appreciated how he broke down the lineage, opening my eyes to
- 0:44the fact that there is a bit of standing on the shoulders of
- 0:50giants. We knew it, but here he talks
- 0:53about it very clearly, how one model inspired the next.
- 0:58And it left us with being able to use text to video where we
- 1:04are at today in this day and age.
- 1:07So cool to see he's got a book out.
- 1:09As he mentioned in the intro, go check it out if you want to
- 1:14start getting into the architecture and understanding
- 1:20of these models. He talks about how he was
- 1:25inspired to write the book after just diving into reading so many
- 1:29different papers and then seeing this thread, the common thread
- 1:33they went through them and understanding the math and
- 1:36understanding why things were the way they were.
- 1:40A big caveat to this is that his book does not talk at all about
- 1:45LLMS. He said there's enough conversation and literature out
- 1:49there on those specific types of models, so he hit the other
- 1:54ones. Hope you enjoy it.
- 1:55And before we get in to our little conversation, I figured
- 2:01I'd keep doing what I've been doing.
- 2:03I'm going to start a habit of it and share with you one of my
- 2:06favourite songs that I've been listening to these days.
- 2:09I will say that this song 100% you got to watch on YouTube.
- 2:15I'm a huge Spotify fan, I usually get all my music from
- 2:18Spotify. But this is a live version of
- 2:21the song called Hideout by Parcels and it is from their
- 2:272022 concert in Paris. Now let's have a listen.
- 2:34Y'all can hear it That riff.
- 3:16I don't know how you can listen to this and not start moving.
- 3:20It's just too good. So there it is, folks.
- 3:36Let's rock on in to the conversation.
- 3:40Here we go. Right now.
- 3:50Let's start with this though, I think that you've got an
- 3:55interesting background. I want to get into some of it
- 3:58because you were in biology, right?
- 4:02And. Then.
- 4:03You jumped into the AI scene. Can you talk to me about the
- 4:07switch and what made you want to go from being a biologist to
- 4:14generative AI ologist? Yeah, it's a great question.
- 4:18People ask me, I think all the time, and I, I, I, I don't have
- 4:22a clear answer, but I'll tell you, kind of as a kid, I always
- 4:26loved biology. It was always something
- 4:28fascinating about it. This is a personal kind of
- 4:33story. When I was a kid, I used to love
- 4:35ketchup and I haven't really shared it outside the family
- 4:40circle, but I used to ask my grandparents if ketchup kills
- 4:45germs and they would just lie to me to have me eat the food.
- 4:48So yeah, I always had this like fascination or there's interest
- 4:52in the, the biology side of things.
- 4:56I, I really don't know where that comes from.
- 4:58It's kind of like AI think it's just a little bit intrinsic, a
- 5:01little bit curiosity. So that kind of manifested into
- 5:06into me studying biomedical engineering for my undergraduate
- 5:10and masters. And I loved it because it was a
- 5:13good kind of hybrid between learning the biology and an
- 5:18application and how it transfers to solving real world problems
- 5:22from medical devices or nowadays it's a very computational.
- 5:27So there's a lot of like problem solving analytics, as you could
- 5:32imagine from the engineering side.
- 5:33So I, I really enjoyed that because that was kind of
- 5:37critical thinking aspect. At some point I transitioned to
- 5:41the wet lab research and I really enjoyed that.
- 5:43And yeah, there was kind of like a switch where I, I maybe got
- 5:48back to some roots or got back to some math and started
- 5:51studying computer science. And yeah, honestly, I haven't
- 5:55looked back. It's been a very fascinating
- 5:58topic. I love I, I think the, the
- 6:02thread through kind of my trajectory in life, it's
- 6:05learning. So the ability to learn and the
- 6:08ability to develop new skills. I, I think in, in this context,
- 6:14their heart skills, you know, the science, understanding the
- 6:17science and, and yeah, there's just some something amazing
- 6:22about I, I think the science is where, you know, it's like the
- 6:25scientific method where you could test something and, you
- 6:27know, it follows or, or some, some laws or, or some
- 6:32observations or it's, it's very kind of systematic and I love
- 6:36that reproducibility about the science.
- 6:38So I think I'm digressing. But yeah, I, I, I think just
- 6:45curiosity kind of led me to computer science.
- 6:48And the more I started to learn, the more I kind of loved it and
- 6:54the more it was just kind of, yeah, it took over, I suppose.
- 6:58And, and, and the more you learn, the more you want to
- 7:02know, the more you learn, the more you realise, you know, the
- 7:05less you know. So I, I think it's just, it's
- 7:10been kind of a natural evolution.
- 7:12I, I, I think for me to get into the field.
- 7:15So you have been writing a book recently, the Variational Book.
- 7:20What is it and how did it come about?
- 7:24So the variational book, it's about all things generative.
- 7:28AIII discussed literally the last 10 years of generative AI
- 7:35algorithms, not including LLMS. That's the one kind of elephant
- 7:40in the room that I don't touch. But I, I, I basically derive and
- 7:44explained logically all the steps in terms of how the
- 7:48algorithms work, why they work a certain way, provide anecdotal
- 7:53examples, more intuitive examples of, of, of the
- 7:58rationale behind them. And it's a way initially it
- 8:03started as a way for me to personally learn reading a lot
- 8:08of papers, trying to disseminate a lot of the in between kind of
- 8:14knowledge that was transferred in the papers.
- 8:17And yeah, it kind of snowballed from a short kind of blog post
- 8:25that I was going to write in terms of.
- 8:27And then I just kind of kept writing and kept writing and
- 8:30kept writing. So I'm pretty excited about the
- 8:33book because it's very thorough and I think I provide a
- 8:38different context and reference frame for describing these
- 8:44algorithms and then also for the pieces that I include.
- 8:48So if you can think, think of it as like a piece of a puzzle,
- 8:51each publication has a small piece and sometimes it's hard to
- 8:57fit those pieces together, how everything relates to each
- 8:59other. A lot of these algorithms have
- 9:01evolved over time and traditionally now you, you see
- 9:05there's a lot of push on like text to image, text to video,
- 9:10these diffusion models and these diffusion models actually have,
- 9:14you could say have ancestral precedence and other earlier
- 9:18models. So if we talked about, you know,
- 9:21continuous normalising flows, you come on normalising flows,
- 9:25time on score matching, you're talking about variational auto
- 9:28encoders. These are all, I'd say, 10 years
- 9:32old techniques that are still widely used and applicable and
- 9:36very powerful methods, but yet they share similarities to these
- 9:40newer methods. So I, I think the exciting part
- 9:43about my book is I, I create that common thread that lets you
- 9:47kind of in a stepwise fashion, understand things by starting
- 9:52from Bayesian modelling to laden latent models to working your
- 9:57way towards more generative methods and just what it's
- 10:02about. I think it's a great resource
- 10:04for any machine learning engineer, anyone in the field,
- 10:09anyone who's an undergraduate or graduate student, because I
- 10:12literally try to not leave any logical gaps.
- 10:20So I tried to reduce the activation energy or the effort
- 10:24required to learn it. It's still very technical, still
- 10:27requires a lot of effort, but I think it's a very great kind of
- 10:32procession of ideas that I'm able to explain and and provide.
- 10:37Yeah. In terms of how it came about,
- 10:40it's. Yeah.
- 10:41It was started reading papers. It was more of a self
- 10:44interested, I want to do, I want to learn myself.
- 10:47It was a way for me to read papers, to try to understand the
- 10:52papers. And I, I guess the saying goes,
- 10:54you don't really understand it until you either teach it or you
- 10:57write about it. So this was my way of gaining a
- 11:00better understanding. And I think the byproduct has,
- 11:03it's been several years, but the byproduct has been, has been, I
- 11:10think a nice collection of, of, of writings that that fulfilled
- 11:16in at least my initial interest. But also I think I'll provide a
- 11:21lot of value to the wider audience or to to a lot of
- 11:24people I think in universities and and in the field.
- 11:27So it's almost like you have this family tree of the
- 11:30different models. I really like how you put that
- 11:32together. The thing that is a very strong
- 11:38design decision on your part is not including LLMS in this book.
- 11:42Why did you not do that? I didn't include LMS because
- 11:48they're inherently a different, you could think about a
- 11:51architecture from the machine learning side, although maybe
- 11:55that's disputable at some level. But yeah, I, I focused on
- 12:00Bayesian laden models and variational inference and that
- 12:06kind of spilled over to a lot of these kind of newer techniques.
- 12:10As I mentioned, diffusion models, score matching,
- 12:16normalising flows, variational methods, a lot of more, how do
- 12:21you compare 2 distributions or how do you train a model to fit
- 12:27a distribution of data. So it's definitely it's, it's
- 12:33definitely focused on more Bayesian kind of methodology.
- 12:38Suffice to say, there's also a lot of other books that have
- 12:42come out in the LLM space, both on the more theoretical side and
- 12:48more the practical implementation of how you do
- 12:50Laura and Rag and RLHF and so on and so forth.
- 12:54So the spaces is is is is a little crowded.
- 12:59So I thought there'd be a little bit more emphasis on more
- 13:02traditional approaches that are still foundational.
- 13:05And I think the theory, although it might be, albeit a little bit
- 13:09different, still spills over to some of the modern techniques.
- 13:15So there is something that in my eyes actually, no, you know what
- 13:24I was going to mention. Did you see, Speaking of
- 13:28diffusion models right now, I think last week or just a few
- 13:32days ago there was a new open source, well, semi open source.
- 13:36Because these days when it comes to models being open source, you
- 13:40can't really believe any of that.
- 13:43The semi open source model that came out, Flux, which is a
- 13:49diffusion model. And it's super cool to see
- 13:52because it has very high quality.
- 13:54And it seems like just for me playing around with it for 15
- 13:58minutes that it's easy to prompt and you can get some very high
- 14:02quality images. So there's a lot of people that
- 14:06are pushing the boundaries in that direction.
- 14:11When you were reading about all these different models and
- 14:15almost like the evolution of the models per SE, was there one
- 14:20thing or a few different things that surprised you or stood out
- 14:24to you? Specifically you mean in terms
- 14:26of like their designs? You can take it, Yeah, take it.
- 14:29Anyway, If there was anything or it was like, oh, this model
- 14:33never actually got traction and whatever the in the story of the
- 14:37models or the architectures or yeah, whatever the Speaking of
- 14:42the designs, it could be that or on the math level or on The Who
- 14:48created it, whatever jumped out at you and you were like, damn,
- 14:53I didn't realise that. Yeah, I think, you know, I, I
- 14:57think there's a common thread and if we, if we start where
- 15:01let's say the, the initial conception of like variational
- 15:05auto encoders, you encode some data into a latent space.
- 15:10You and then you have this one step procedure where you sample
- 15:13this latent space and you generate whatever you're trying
- 15:18to generate your your synthetic data example.
- 15:21I, I think what was interesting as you get into the weeds of the
- 15:25evolution of the techniques is Gans again have a discriminator
- 15:32and a generator or generator and discriminator again, the
- 15:36generator again sampled in a one step process and you generate
- 15:41your synthetic data sample. I'll bet the training algorithms
- 15:45are a little bit different for, for those techniques and use
- 15:47different types of objectives and approximations.
- 15:51You could say what was interesting what so that was
- 15:54when I started the deep dive into diffusion based models is,
- 16:00is you have essentially you can think of it of a similar
- 16:04analogous process, but it's just repeated many, many times for
- 16:08the training and inference steps.
- 16:10So for example, you start with a data sample and you just corrupt
- 16:16it 1000 times and add noise at each iteration until you just
- 16:20end up with some Gaussian noise. And the inference part is you
- 16:26start without Gaussian noise and then you try to decorrupt it and
- 16:31relearn what that synthetic or generate a synthetic example
- 16:35that comes from the same data distribution as the original
- 16:38training data. So you're relearning to generate
- 16:40those images. The caveat there is these,
- 16:42these, these models are extremely powerful and, and in
- 16:46the in the fidelity and the quality of the samples.
- 16:50But the bottlenecks are the inference where you have to do
- 16:531000 steps to generate how one example, and if you compare it
- 16:59to let's say Gans, you could sample thousands of Gans in mere
- 17:04minutes. And to do the same with the
- 17:06fusion models. If we reference back to 2020,
- 17:10the DDPM paper was a Seminole paper that was that, that that
- 17:17would that would have taken hours because of the just
- 17:20computational effort to do the inference.
- 17:22So, and since that was really surprising because they, they
- 17:26are very similar, but it's just the number of steps.
- 17:30So the interesting part is the evolution of diffusion models.
- 17:33The last few years have focused on the inference side, where
- 17:38instead of 1000 steps, you could reduce it to 100 to 10.
- 17:42Now they're trying to do one or two.
- 17:44So I, I, I think that was very surprising and in, in the sense
- 17:49that the techniques are very related, like you're sampling
- 17:52the latent space in the very at high level abstracted sense.
- 17:57But also in terms of just just in terms of like, I, I would say
- 18:06maybe like in terms of, I was surprised in terms of how
- 18:09they're very related in that sense.
- 18:11And then they're just coming to more practical kind of
- 18:15differences in terms of the inference side of things.
- 18:19Yeah. So the nice piece about that is,
- 18:23and I like that you brought up how we're starting to see an
- 18:27evolution within diffusion models of cutting down those
- 18:31steps because that is where the time consuming part comes in.
- 18:36And I imagine a lot of us out there have played around with,
- 18:40especially if you were playing around with Stable Diffusion in
- 18:432022 or whenever it came out, you would see the image kind of
- 18:47form and then it would kind of get darker and darker and then
- 18:51boom, it would be there. And it was like watching a
- 18:54Polaroid. And those were those steps,
- 18:56right? I think it was like every 15
- 18:58steps or 20 steps. And you can put longer amounts
- 19:04of, you could on the UI that you had, you could say how many
- 19:10steps you wanted. And if you put too many steps it
- 19:12would over bake sometimes. So it's funny how that is.
- 19:18The thing in real life I've tried baking and I'm like.
- 19:23Too many steps too goes back to that.
- 19:25But the, the piece there is now how can we, it's almost like the
- 19:31architects are trying to figure out a how to optimise it so it's
- 19:36faster and B, how to make it so we can't really over bake it so
- 19:40we can idiot proof it a little bit for people like myself to
- 19:43not be able to come up with something and when we don't want
- 19:47it. And one thing that I, I was
- 19:51thinking about as you were talking about this, it just
- 19:53reminded me of a huge takeaway that I got from reading Joe
- 19:59Reese's book, The fundamentals of Data Engineering is how
- 20:04useful it is for engineers to understand the tools and the
- 20:11space that they play in and really understand what are the
- 20:14pros and cons of each. And so as you were saying, well,
- 20:18you know, you have gens that can be really fast, but they only
- 20:21have one step and they don't have all of these cool like
- 20:24generative properties as much as a diffusion model.
- 20:27But a diffusion model is probably going to be a little
- 20:30bit slower. So when you're architecting what
- 20:33you need to architect, you can make your decisions based on
- 20:38that because you can say, do we really need it to go through all
- 20:43these steps or do we have the ability to wait one second or a
- 20:48half a second? If not, and we just need to
- 20:50classify a picture, then maybe it's better to use a different
- 20:54type of architecture. We don't need this diffusion
- 20:56architecture. And Joe was talking about it a
- 21:00bunch in the book on understanding your compression
- 21:05algorithms or understanding what databases are powerful in what
- 21:10ways. And so it just reminded me
- 21:13exactly of that. Yeah, I, I think, I think those
- 21:17are good points. I would also add, I think it's
- 21:21very exciting nowadays, at least from my perspective and vantage
- 21:25point is a lot of this compression on the inference
- 21:29side, I think has direct implications on the video
- 21:34generation side and, and a lot of well, so, so I think the
- 21:41current range is maybe around 5 minutes.
- 21:45I, I, I don't know what each company's secret sauces, but
- 21:48the, the, the, the time frame that you could generate a video
- 21:53is still limited to certain degree.
- 21:55But I think the exciting part is, is that those two things go
- 21:59hand in hand. You reduce the inference time
- 22:01and let's say for video generation, you can create more
- 22:04longer videos. And from what I'm seeing, I
- 22:08think there is a huge like there's hundreds of companies
- 22:12I've talked to people before that are spawning trying to do
- 22:15this video generation stuff. So it's, I think it's very still
- 22:20early stages, but it's it's pretty significant in terms of
- 22:25its applicability and in potential impacts on a lot of
- 22:29industries. And maybe I'm in LA.
- 22:31So I think a lot of entertainment industry is
- 22:34cautiously scared, but very interesting.
- 22:39If I'm understanding you correctly, it's because of the
- 22:43ability for us to go down to one or two step generations with
- 22:48these diffusion models. It's much easier to create
- 22:53videos from these one or two step generations and then put
- 22:58basically you start to create 24 frames and then you have the 24
- 23:03frame per second video and you can add those up.
- 23:09Is it different when it comes to 'cause I had always thought the
- 23:15models that were being used to output the videos were
- 23:20different, like a whole different architecture than the
- 23:25models that were being used to output the photos?
- 23:31I'd have to review it just so I don't, but for video generation,
- 23:35it's usually units that are used and they they have some way of
- 23:41incorporating the time domain elements of the.
- 23:44The issue with video generation is, is you how you stitch
- 23:48certain frames together or different scenes.
- 23:51Yeah, for diffusion models it could vary.
- 23:57It could be units as well, but I have to like take a look at.
- 24:01I think it depends on the exact implementation.
- 24:05So it goes back to what you were saying on how there is this
- 24:11lineage or there's almost like a common thread that is going
- 24:16through all of these models and you're really standing on the
- 24:19shoulder of giants when you're doing anything with diffusion
- 24:23models or units are coming from the the optimization and the
- 24:29efficiency gains that you get with diffusion models also help
- 24:32later on for the units and vice versa, I would imagine.
- 24:38Yeah, I mean, I, I think, I think the from my kind of from,
- 24:43from, from my just literature review and, and just the process
- 24:49of writing the variation of book.
- 24:51You definitely see a lot of I I would say I don't know what the
- 24:56right quantity is or how to quantify, but you definitely see
- 24:59a lot of spillover or, or translation and and and maybe
- 25:06I'm not quite sure what the right verbage is, but you
- 25:08definitely do see a lot of, I don't know, borrowing or
- 25:12learnings throughout the literature.
- 25:14Yeah. And like, maybe the best way to
- 25:17phrase is like learnings from how earlier publications work
- 25:21and, and stuff like that. I, in terms of some of the, in
- 25:29terms of my writing for the book, I tried to stay away from
- 25:31like specific architectural changes that might have been
- 25:35published because those are very specific.
- 25:39And I tried to focus on the core algorithms at hand.
- 25:42So maybe I'm not the best person like like for example, in in
- 25:50Gant training, there's or Gant training or any neural
- 25:55architecture or any model training you could do specific,
- 25:58let's say architectural changes, let's say you know, for for
- 26:03Gans, they would do how do you incorporate style into the Gant
- 26:08generation? So how do you precondition the
- 26:11Gantt to generate certain types of styles or they would modify
- 26:15the architectures that might increase, let's say fidelity
- 26:21somehow. I tried to stay away from
- 26:25architecture specific considerations because I think
- 26:28those are less, those are more, those are more abundant.
- 26:33And what I tried to focus on more is that is the core
- 26:37algorithm in the logic used. And of course, if there's like
- 26:40Seminole papers, for example, again, if we stick with Gans,
- 26:45there's a truncation trick or style based generators or
- 26:48Washestein Gans that improved either the objectives or or did
- 26:54something in terms of the sampling.
- 26:56For example, the truncation trick, not sampling from the the
- 27:00ends of this distribution to prevent searching maybe rare
- 27:07events or rare generation. So yeah, I, I, I, I, I tried to
- 27:14stay away from architectural changes in in the Fort.
- 27:16So I'm not maybe the best person to like comment on on like what
- 27:23how things are have evolved or or how things have maybe yeah,
- 27:32I'm not sure like like. No, I understand that talking
- 27:36about all the different pieces of the ways that one is using
- 27:40the other, Yeah, I think was the original.
- 27:42Thing it's just, it's just like you could for example, if we
- 27:47talked about LLMS, the original transformer paper had one layer
- 27:52normalisation after I, I think the, the transformer block or
- 27:58something like that. And then in hindsight they added
- 28:01one before as well. So like those architectural
- 28:03changes can have significant impact on the actual performance
- 28:08of the method and algorithm, but I've stayed away from those a
- 28:14little bit and try to make it more focused on the algorithms
- 28:19themselves. And then and then of course once
- 28:24one gets one, once someone gets assimilated or comfortable with
- 28:29the algorithm approaches, then you can pull up archive or go do
- 28:33a Google Scholar search to see maybe what the latest and
- 28:36greatest approaches are. Yeah, so it's almost like
- 28:41there's remixes of each algorithm to try and figure out
- 28:45the best ways of optimising it. And.
- 28:48Seeing how can it go from this diffusion model that was
- 28:55originally taking thousands of steps to get to the image
- 28:58generation to now it just takes one step and that's because of
- 29:02some architectural changes that have happened.
- 29:06Sure. Yeah, I mean some of the I can't
- 29:09remember off the top of my head, but for example, there's
- 29:12certain, there are certain public, there are certain
- 29:15publications like the initial diffusion model started with
- 29:18DDPM. That was a a big one that kind
- 29:21of was like the breakthrough moment for those types of
- 29:23modelings. Even though Diffusion itself was
- 29:27published the idea like circa 2015, I think, but I'm going to,
- 29:34I'm not going to say his name right, but.
- 29:38That's always fun, man, pronouncing these names.
- 29:40So the papers are a great time. Yeah, you want to.
- 29:43Get home. I should, I, I should, I should
- 29:48be able to figure out, Yeah, but like, yeah, but I guess there, I
- 29:58guess it's interesting. The literature is filled with a
- 30:00lot of these methods. To your point, there's
- 30:02architectural changes as more algorithmic changes.
- 30:05So from the diffusion side, architecture changes were in
- 30:09terms of could include some type of distillation, whereas like
- 30:14more algorithmic changes. There was a paper called DDIM
- 30:19which is diffusion denoising implicit models where they
- 30:24focused on changing the Markovian nature or today they
- 30:30basically made the the inference process non Markovian and and
- 30:35and in a high level way that allows you to reduce the number
- 30:40of inference steps that are are required.
- 30:43Whereas in the original diffusion papers, here it's very
- 30:46conditional on the previous time step that which would we'd make
- 30:50a very sequential process. Yeah, first of all, you said a
- 30:56word that went right over my head.
- 30:57What is Markovian? Markovian.
- 30:59So and from a probabilistic sense like you, you can have a
- 31:04first order Markov model where the probability of X of T is
- 31:10given based on is conditioned on probability of XT -1, so the
- 31:14time step before. So in this sense it's a first
- 31:18order Markovian model because you're only conditioning on one
- 31:23prior time step and the only thing that really, really
- 31:26matters to predict the the future is the previous time
- 31:31step. And you see Markovian types of
- 31:35modelling is is very predominant in a lot of RL literature and
- 31:39assumptions and a lot of machine learning basically simplifies
- 31:45these types of sequential, sequential decision processes
- 31:50using maybe a some mark type of mark of assumption, although
- 31:53that's that's changed quite a bit I think.
- 31:57How so? I mean you could think about if
- 32:01we do, if we focus on diffusion models.
- 32:04Let's say you have the diffuse, you have diffusion denoising
- 32:09implicit models. So now the you're assuming a non
- 32:13Markovian inference structure. So and without getting into the
- 32:21math of it, you're you're basically not assuming that your
- 32:26inference is dependent on just the previous time step, but it's
- 32:28also dependent on the original for for these implicit models,
- 32:32it's dependent on the original data sample as well.
- 32:35You bake that into the probability distribution that
- 32:38you're trying to model. So with all these diffusion
- 32:40models is you're you're trying to learn at each sequential step
- 32:45what the distribution looks like.
- 32:48And if you take 1000 forward steps and you know what the
- 32:51distribution looks like at each time step, then you could easily
- 32:56take the reverse process back because you're just sampling
- 32:58from a distribution. But in non Markovian diffusion
- 33:06modelling, implicit models, for example, you're not, you're not
- 33:09assuming a just one conditional what you're not, you're not
- 33:16assuming Markovian past or Markovian model.
- 33:22I'd have to maybe go through some of the math to kind of
- 33:24maybe explain a little bit better.
- 33:26But for example, also I, I, I think maybe I could be wrong,
- 33:32maybe there's. But if you look at like language
- 33:34modelling in terms of like attention mechanisms, right?
- 33:37What attention does is initially you would have 6 sequential
- 33:41generation, right? It's you're sampling from some
- 33:44multinomial distribution and you're getting your next
- 33:47character, your next token or whatever it is, but they're
- 33:50biassing it with attention these days.
- 33:52Now you have multiple, let's say hidden states, and then
- 33:55attention is all you need. When the Transformers came out,
- 33:57that changed what attention, how attention was defined.
- 34:02So therefore, this is an interesting question.
- 34:08And I don't know, I don't know how I, I don't really know the
- 34:13theory behind it in terms of, let's say, how attention,
- 34:16whether it's relatable to a first order Markov process or a
- 34:20second or whatever it might be. There might, there's, there's
- 34:22definitely some probably deep connections there.
- 34:25And I would, I, I would be cautious and speaking on it on a
- 34:30personal level. But yeah, there's, there's,
- 34:32there's definitely some, some connections and that's kind of
- 34:37focused on the interpretability of these models and how they
- 34:40actually work, right. So I think probably in the next
- 34:44few years we'll, we'll, we'll have more I think litter or
- 34:48literature or publications on that.
- 34:51So. Yeah, or one of the listeners
- 34:53can just tell us in the comments.
- 34:56Let us know. You said everything.
- 35:00Well, hopefully they say you said pretty much everything
- 35:02correctly, but. Of course, no, the if I'm
- 35:08understanding it correctly and what I really like about that
- 35:12and I appreciate you breaking down what Markovian is for me,
- 35:15Markovian basically means just use the last step as your
- 35:19reference to create the next step.
- 35:21And the non Markovian is try and use the whole picture and what
- 35:27we trained it, whether if it's the diffusion model, it's saying
- 35:32there was 1000 steps from when we had a nice picture to when we
- 35:36had perfect noise. Basically use that whole 1000
- 35:41step journey as your reference. Not, not necessarily, not quite,
- 35:48but just just to say that in a Markovian first order Markov
- 35:55model, you're as you, as you mentioned, you're just assuming
- 36:00that your future depends only on the previous state.
- 36:04And that could be for diffusion models, reinforcement learning
- 36:07or whatever might be basically in a denoising diffusion
- 36:13probabilistic model, what you basically have is you have a
- 36:17conditional dot distribution in the forward training pass.
- 36:21You have your your surrogate QX of T conditioned on X of t -, 1.
- 36:28So imagine you start from t = 0. You take a step, you're only
- 36:34you're, you only care about your previous distribution.
- 36:38What the non Markovian denoising diffusion implicit models do is
- 36:43now they're learning a different distribution during inference,
- 36:48and what they're learning is QX of T condition on XT -1 the
- 36:54previous time step, just as before.
- 36:56But they're also conditioning it in on the original image X of 0.
- 37:01So now this. Is a different.
- 37:04Yeah. So now you're conditioning on on
- 37:06two different, you could say variables instead of one and the
- 37:11distribution you learn is non is non Markovian in that sense.
- 37:16Oh, I. See what, what the diffusion and
- 37:20denoising implicit models show is that even non Markovian
- 37:23distribute distributions can have the same marginals as the
- 37:30original denoising diffusion probabilistic model did.
- 37:35So the beauty of it is what they showed.
- 37:37And, and I, I, I think a lot of this gets lost in translation
- 37:41just by speaking about the mathematics.
- 37:43But from a, a layman's term, I think what's pretty amazing
- 37:47about these techniques is training nothing, nothing
- 37:51changes. And in a lot of these models,
- 37:54you don't really care about, you don't care about the training
- 37:57portion of it because training if it takes 1000 runs or 1000
- 38:02steps to do the to do the training, to do, to do the
- 38:06noising steps, that's OK. But you care about the
- 38:09inference, the reverse because you care about the generation
- 38:12and you want that to be quick. So if you have again to our
- 38:17discussion, 1000 steps, it's going to be very slow.
- 38:19But these implicit models, because they form non Markovian
- 38:23distributions, what they show is you could train the model the
- 38:28same way. But when you do the inference
- 38:30side, because those non Markovian in essence have this
- 38:35is all just kind of like verbiage.
- 38:37I have to kind of I would have to maybe this is like a selling
- 38:41point like, you know, buy my book or subscribe because I go
- 38:45over all the details of the math.
- 38:47But in essence what that means is you're reducing your
- 38:49inference time using these implicit non Markovian
- 38:54distributions. And that goes into the fact that
- 38:58you can have, you can generate the same marginals that your
- 39:01distributions that you're interested for performing that
- 39:04inference. Dude, So I'm going to start
- 39:08using Markovian as a insult to people who are living in the
- 39:14past. You know, like people who can't
- 39:17let the past go. I'm going to say that's so
- 39:19Markovian of you. They're just.
- 39:23Training. They're living their life on in
- 39:25the past and not not able to get over that last step.
- 39:31Yeah. Yeah, you would.
- 39:33You would. That would kind of make sense, I
- 39:38think, from a nerd's perspective.
- 39:41Yeah, I, I might just be the one that looks like an idiot by
- 39:44saying that nobody's going to understand me.
- 39:46I'm just going to be like, what the hell are you talking about,
- 39:49man? And then I have to say, well,
- 39:51you know, Markovian is actually when it's T -, 1, that's what
- 39:57the Alps. And then I look like an idiot
- 40:00because I can't actually explain why the what or what Markovian
- 40:05is, but it. Does I mean you could get more
- 40:09complicated. You could have second order or
- 40:11third order. It's a little tricky because
- 40:12then you can condition on two. So you could still have a
- 40:16Markovian process, but it's not a first order side B.
- 40:19We we could work on the on the. On the on the, on the burn,
- 40:25that's. It you have, you'll have some
- 40:27point and A and a computer science or two computer science
- 40:30people working on on making sure that the delivery is good, but
- 40:34also that that's factually. Yeah, factually correct.
- 40:38And it actually makes sense. The analogy holds up.
- 40:41So you know what else I was thinking?
- 40:43Man, I would love to see what you were talking about, all
- 40:49these different remixes of the models and specifically the
- 40:53model architectures in like a lineage, family tree type of a
- 41:00graph or visualisation to see, all right, here's all the Gans,
- 41:03Here's all the different ways that we've tried to tweak Gans,
- 41:08and then here's all the diffusion models or whatever it
- 41:11may be. And you can climb up the tree
- 41:13and see how diffusion models and Gans came from the same mother
- 41:18or father or whatever it may be. Yeah, I think that would that
- 41:25would be pretty powerful. That would require another some
- 41:29some more effort that. No, I'm not expecting you to
- 41:32put. That to it, but potentially I'll
- 41:34have it to you on Monday. Yeah, totally.
- 41:38I'll be expecting that before this comes out.
- 41:41I imagine somebody that loves data visualisation has thought
- 41:46about that and put it together potentially and showed some way
- 41:52that all of this is linked. Because that's a huge takeaway
- 41:56from what you're saying. And, and really your book is
- 41:58that you can look to the past for inspiration and see how it
- 42:05has given us the future or given us at least the present.
- 42:12Yeah, I mean, I, I think that's definitely the case.
- 42:14I I, I think actually to your point, what I try to embody in
- 42:20this book is it's a little bit biassed because I cherry pick
- 42:24for methods that worked and were well sited and more, you know,
- 42:29rose to the top of the pile. But I actually essentially try
- 42:34to do as you described as go through the evolution from
- 42:39beginnings of Bayesian models and, and just Bayesian model
- 42:43selection or something more old school towards more new
- 42:49flavours, let's say diffusion models or, or text to video and
- 42:54stuff like that. But yeah, I think it's, it's, I
- 43:00think that's, I think it's a very good point.
- 43:02And I, I think some of the things I try to do actually lend
- 43:06itself towards that without actually having to read all the
- 43:10landscape. I think the beauty every writer
- 43:14on a personal level there that you know, they, I'm always
- 43:17curious now, since I've gone into this journey, they always
- 43:20talk about like some of the writers specific considerations,
- 43:24like when do you know, when you finished, how do you stop?
- 43:28And unfortunately, like the computer science literature is
- 43:32so vast and there's so many great papers and there's so many
- 43:35great topics. And when you try to cover a lot,
- 43:38that basically means I just have to keep writing for another.
- 43:42I don't know how long, but yeah. I mean, it's, it's, it's, it's,
- 43:51it's, it's, yeah. It's, it's interesting.
- 43:54It's interesting point, I'd say. And yeah.
- 43:59You have the benefit of time too, now that you've been able
- 44:04to see all of these different models that bubbled up and have
- 44:10withstood the test of time. I think also is a huge factor.
- 44:16It would probably be really hard to do what you're trying to do
- 44:20now for the most cutting edge models because the all of these
- 44:28variants are trying to take hold and we don't know which ones are
- 44:31going to be the ones that will stand the test of time.
- 44:34Yeah, yeah, there's definitely, I, I, there's definitely some
- 44:38selective bias there in terms of how or, or some benefits I have
- 44:44like withstood the test of time. I, I, I'd suppose for, for
- 44:50allowing me to even like write this book because then, yeah,
- 44:54it's hard to predict the future. I think maybe only a few voices
- 44:58out there might have some reasonable yeah, competency to
- 45:03to to try to act Nostradamus. Well, it does make a lot of
- 45:07sense. You named it the variational
- 45:09book and you're really looking at different variants of this
- 45:14original model. Is that how where the
- 45:18inspiration came from? Pretty much, yeah.
- 45:21I initially focused on 1st. I'd say I'm I was, I was very
- 45:25excited that the URL wasn't taken when I when I purchased
- 45:30and and for anyone who wants to remove the the and just do
- 45:34variational book and do a mimic copy, I I got that one too, so
- 45:38they. Can't do it.
- 45:41They can't do it. You got to, you got to be a
- 45:43little bit more creative, but but yeah, yeah, it, it started
- 45:48with variational inference and again, kind of variational
- 45:51techniques, how you have some posterior distribution, some
- 45:56data distribution that is theoretically unknown and how
- 46:01you could model that distribution through a sample of
- 46:03data and build some surrogate approximation to it.
- 46:07So those techniques that I think I've been foundational for just
- 46:12computer science in general, but yeah, they've, it's been pretty
- 46:16cool because it starts with from the Bayesian side, just like I,
- 46:21I start talking about if I go through my chapters like a base
- 46:26theorem, which is a Seminole theory.
- 46:29That is, I think it's easy to memorise, but it's very hard to
- 46:33conceptualise what it actually is doing and what it actually
- 46:37means. But once you conceptualise it, I
- 46:39think it's extremely powerful because again, I think no matter
- 46:43what the model is, I bet there's some interpretation that
- 46:47incorporates some type of Bayes theorem.
- 46:48But I go. Back conceptualise it.
- 46:54So I mean, it's like you could memorise from a latent space
- 46:58model, you could conceptualise it and, and this is some of the
- 47:01things I talk about to help bring some intuition about it.
- 47:06But from a, a latent space model, you always have variables
- 47:10that you observe, which are your XS and then you have your
- 47:14latents, which are things that you don't observe.
- 47:17And you could think of both your latents and your and your
- 47:21observed XS as forming some very complicated dependency graph
- 47:25with connections of some which you might observe and some of
- 47:28which you might not observe. And it's very, the goal is to
- 47:34learn that joint structure of your probability of your X&Z,
- 47:41your joint distribution. And, and, and when anyone said
- 47:44it's a very interesting, actually it's a very interesting
- 47:46question because a lot of people ask you to explain what
- 47:49generative means. And I always go to like Bayes,
- 47:54like, you know, joint distribution.
- 47:56But if you don't know what that is, then it's hard to kind of
- 47:59conceptualise what is generative.
- 48:01Like you could generate stuff. I I think it's in the name but.
- 48:05So that makes me think because you have these strong
- 48:09dependencies with the the things you can see and the things you
- 48:13can't see. It's almost like if you want to
- 48:17find a certain part of latent space, sometimes you have
- 48:23different things, like I'm thinking specifically with LLMS,
- 48:28and sometimes you want to make the LLM perform better or do
- 48:33something be more rigorous. And so you can say things like
- 48:37think very hard or think through this clearly or things like
- 48:42that. And it makes me wonder if that's
- 48:46because there's these dependencies, so you almost zoom
- 48:50to that part of latent space by using these trigger words.
- 48:57Yeah, Yeah. I mean, I think that's
- 48:59essentially that. I think that a lot of
- 49:01interesting research, a lot of the big companies are looking
- 49:03into that like their interpretability and that's the
- 49:06whole thing. It's like prompt engineering,
- 49:09like, yeah, you could do it, but explaining why it might give you
- 49:13a better answer. I think that's the interesting
- 49:16part. And to your point, it's you're,
- 49:19you're you're potentially sampling from a different part
- 49:22of that joint distribution or somehow depending on how you
- 49:25would conceptualise it. But yeah, so it's a very
- 49:29interesting topic. And a lot of the methods again,
- 49:31stem from just these basic core ideas and from the variational
- 49:37side, I think to your original question.
- 49:38So I talked about model selection, I talked about
- 49:42exponential families. They're very important in just
- 49:45modelling in general and, and machine learning.
- 49:48And then you could talk about, well, if you build some
- 49:50approximate distribution with certain assumptions will be
- 49:53called a surrogate. How do you, how do you measure
- 49:57the difference between your surrogate and and your, and your
- 50:02true data distribution? And, and essentially what that
- 50:04is, is everyone post about, you know, the KL divergent is one
- 50:08metric how you could do that and you could define your objective
- 50:10that way. And then basically, you know, we
- 50:14snowball into more complicated topics of how you model the
- 50:17surrogate distribution, what assumptions you can make in the,
- 50:20and a lot of these generative models, the, the, the underlying
- 50:25theme there is, is that they make, they're able to model a
- 50:28more complicated surrogate distribution.
- 50:32And because it's more complicated, you can incorporate
- 50:34a lot more of these dependencies that you might miss with like a
- 50:38simple distribution. It analogously, it's like, and
- 50:44not not to hate on linear regression, but linear
- 50:46regression is a great, very powerful model, but has many
- 50:50assumptions in terms of linearity baked into it.
- 50:54If you want something more complicated, then you could do a
- 50:57function approximation using the neural network and it can and,
- 51:01and there's pros and cons to that.
- 51:03So kind of similar in trajectory there where you can build a
- 51:07simple surrogate and distribution, but then you can
- 51:09work your way towards more complicated stuff.
- 51:12And this is essentially what a lot of these generative methods
- 51:16have done over the last how many number of years.
- 51:20Yeah, not only that, it just goes back to the idea of
- 51:23understanding what you're working with so you can know
- 51:25what the benefits are or the the strengths and weaknesses are of
- 51:29each model and how you can as AI can't tell you how many times
- 51:35I've heard the question, how much machine learning do I need
- 51:38to know to be an ML engineer? Or I'm coming from the data
- 51:42engineering space and I want to get into ML.
- 51:45What should I do? How should I go and learn the
- 51:48depths of this? Or do I just need to understand
- 51:52what people are saying or what they mean when they talk about
- 51:56the different model architectures?
- 51:58And it kind of reminds me of again, of that idea of the more
- 52:02that you can understand on these model architectures, the better
- 52:05you're going to be because you can suggest different
- 52:11architectures and different models for the different use
- 52:14cases and your needs. Yeah, 100% a shameless plug.
- 52:19I wasn't saying go read the variational book to learn more
- 52:22and more. I think theory that transcends a
- 52:24lot of ML. But yeah, I think I think you're
- 52:28that's like the like the hammer right on the nail.
- 52:34In order to be able to make changes or proposed changes, you
- 52:37have to understand, you know, it's very easy to come up with
- 52:40an objective and say, you know, code it or seed and code and
- 52:44say, well, OK, this is what we use.
- 52:46But the question is, is why you're using it?
- 52:48What are the implications? And a lot of I, I think that's
- 52:51where some of the kind of like boundaries between maybe ML
- 52:56engineering and, and, and theory and ML science kind of comes,
- 53:00comes into play. And I think both are very
- 53:02crucially important. So it's I, I think, yeah, I
- 53:07think it's good to have both. Yeah, it's fascinating to me.
- 53:11The more that you think about it, the more that you have to be
- 53:15really working through so many different levels when it comes
- 53:20to AI in industry. Because you not only want to
- 53:26think about the infrastructure side of things and how to
- 53:29optimise on that level, but also optimising the model and making
- 53:33sure that you're choosing the right model for the job.
- 53:35Are you choosing the right databases for the job?
- 53:37Are you choosing the right data for the job?
- 53:39All of that, but then even going up a level and recognising what
- 53:44are we really even trying to accomplish here.
- 53:47When I get tasked with making our user retention better and I
- 53:55decide that I want to use machine learning for that, maybe
- 53:59it's I, I say, all right, well, if we have a better recommender
- 54:03system, then we can have better user retention.
- 54:06You have to be able to think through the business side of
- 54:09things all the way down to the technical side and the, the data
- 54:13side and the, the machine learning side.
- 54:16So you have you're playing at so many different layers.
- 54:21I think, I think with some humility, it's always, you know,
- 54:23we're always, we could always do personally better with all
- 54:26those. And yeah, I think that's the
- 54:31exciting part because some of that kind of manifests
- 54:35differently as time evolves. But also that's something to
- 54:39keep striving for and learning. And I think we could like on a
- 54:43personal level, there's always way more to learn and way more
- 54:46to understand. And, and yeah, every time I see,
- 54:53see really cool new papers that I'm like, well, oh, I should
- 54:57maybe incorporate that. And I'm like a one, on the one
- 54:59hand, it's a dopamine rush 'cause you're like, oh, it's a
- 55:01great new idea that I could learn, right?
- 55:04And understand. And you kind of get into the
- 55:06heads of how people are thinking about these things too, right.
- 55:09On the, on the on the other side, it's like, oh, it's a lot
- 55:13more work. Yeah, you have to balance it and
- 55:17decide. Well, this has been awesome,
- 55:19man. I appreciate you, Yuri.
- 55:21Yeah, this is great.