Hugo speaks with Hamel Husain, a machine learning engineer who loves building machine learning infrastructure and tools π·. Hamel leads and contributes to many popular open-source machine learning projects. He also has extensive experience (20+ years) as a machine learning engineer across various industries, including large tech companies like Airbnb and GitHub. At GitHub, he led CodeSearchNet (https://github.com/github/CodeSearchNet), a large language model for semantic search that was a precursor to CoPilot. Hamel is the founder of Parlance-Labs (https://parlance-labs.com/), a research and consultancy focused on LLMs.
They talk about generative AI, large language models, the business value they can generate, and how to get started.
They delve into
Where Hamel is seeing the most business interest in LLMs (spoiler: the answer isnβt only tech);
Common misconceptions about LLMs;
The skills you need to work with LLMs and GenAI models;
Tools and techniques, such as fine-tuning, RAGs, LoRA, hardware, and more!
Vendor APIs vs OSS models.
LINKS
Our upcoming livestream LLMs, OpenAI Dev Day, and the Existential Crisis for Machine Learning Engineering with Jeremy Howard (Fast.ai), Shreya Shankar (UC Berkeley), and Hamel Husain (Parlance Labs): Sign up for free! (https://lu.ma/m81oepqe/utm_source=vghh)
Our recent livestream Data and DevOps Tools for Evaluating and Productionizing LLMs (https://youtube.com/live/B_DMMlDuJB0) with Hamel and Emil Sedgh, Lead AI engineer at Rechat -- in it, we showcase an actual industrial use case that Hamel and Emil are working on with Rechat, a real estate CRM, taking you through LLM workflows and tools.
Get full access to Vanishing Gradients at hugobowne.substack.com/subscribe
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Hey there, it's Hugo Bowne-Anderson here, your friendly neighborhood podcast host.
SPEAKER_00So today I'm excited to be speaking with Hamil Hussain, a machine learning engineer who loves building machine learning infrastructure and tools. Hamil leads and contributes to many popular open source machine learning projects. He also has extensive experience, that's 20 plus years, as a machine learning engineer across various industries, including large tech companies like Airbnb and GitHub. At GitHub, Hamill led CodeSearchNet, a large language model for semantic search that was a precursor to Copilot. Hamill is also the founder of Parlance Labs,
a research and consultancy focused on LLMs.
SPEAKER_00Today, Hamill and I will be talking about generative AI, large language models, the business value they can generate, and how to get started. We'll delve into where Hamill is seeing the most business interest in LLMs. Spoiler, The answer isn't only tech. Common misconceptions about LLMs. We'll also talk about the skills you need to work with LLMs and generative AI models. Tools and techniques such as fine-tuning, rags, LoRa, hardware, and more. We'll also discuss how to make decisions between using vendor APIs,
SPEAKER_00such as OpenAI and ChatGPT, for example, versus open-source models such as Llama 2, among many others. Now, a bit of bookkeeping before we jump in. I'd honestly love to hear from you about what resonates with you, what doesn't, and anybody you'd like to hear me speak with, along with topics you'd like to hear more about. The best way to let me know currently is on Twitter. At Vanishing Data is the podcast handle, and I'm at Hugo Bound. It would also be great if you could subscribe to the show on your app of choice. And if you like it, do write us a review on iTunes and or anywhere else. So also this episode was recorded as a YouTube live stream.
So when we occasionally refer to people commenting in the chat, that's what we're on about. We plan to have more such live streams and you can subscribe to our channel to keep up to date.
SPEAKER_00The links in the show notes. So a week after recording this episode, Hamill and I did another live stream showcasing an actual industrial use case that Hamill is working on with ReChat, a real estate CRM, taking you through the LLM workflows and tools. We were fortunate enough to be joined by Emil Sedge, a lead AI engineer at ReChat.com. It was intentionally an incredibly visual live stream with going through lots of code. So we won't release it as a podcast episode, but do check it out. The link's in the show notes. And if you're interested in it,
SPEAKER_00we cover prompt engineering, data quality checks, large language model evaluation for both human and synthetically generated prompts. Creating a human-centric UX for interacting with LLMs and their outputs. Unit tests for LLM output and integrating this into a continuous integration pipeline. Fine-tuning, chat GBT with your results and training classifiers and using RLHF, which stands for reinforcement learning from human feedback, among many other things. So finally, we're going to jump into the interview in a second, but finally, I'm also excited to be doing another live stream on November 16
with Jeremy Howard
SPEAKER_00of Fast.ai, Shreya Shankar from UC Berkeley, and Hamill about generative AI, OpenAI's recent Dev Day, and the existential crisis for machine learning engineering. I've included a link in the show notes that you can use to sign up to the live stream for free. That's enough out of me. I'm your host, Hugo Baron-Anderson, and welcome to Vanishing Gradients.
Ooh. There's so much excitement and signal and noise around LLMs and Gen AI at the moment.
SPEAKER_00And I want to first focus in, Pamela, and hear from you why you are so excited about LLMs and generative AI at the moment. I'm excited because everyone else is excited and they're actually investing serious resources. Compared to classic machine learning, generative AI, things are quite different.
SPEAKER_02People are investing a lot of resources in this. It's not just talking points or writing blog posts. I mean, there's still some of that, but it's at a completely different level. People are seriously taking it seriously they have a sense of urgency and it's actually it's pretty cool and it's fun to work with and it's fun to kind of see what you can do and yeah that's why i'm excited about doing it i'm also excited about doing it because it's new and also i'm trying to figure it out so one thing i want to say is i'm not the expert by any means still very early and maybe i've
figured out a couple of things but i certainly have not figured out everything and there's so
SPEAKER_02much to learn about how to do things correctly
SPEAKER_00And nobody's the expert yet, right? Which makes it incredibly exciting. And I mean, I said this to you the other day that this is the first Vanishing Gradients episode that I'm doing around generative AI. And there was a reason that I haven't done anything around generative AI in the past year. Because I didn't think there was a sense, any sense of stability around it. And I think there's options to, we're still doing a lot of exploring, but I do think we've reached a point now, you know, we do have chapter two of generative AI or large language models.
SPEAKER_00We are entering this new phase, I think. We do have a sense of what the LN space looks like now. some of the tools and techniques, some of the concepts that will help people need to know, some of the skill sets, which we'll get to. So everyone, a little teaser for later in this conversation, we're going to talk about the types of skills that people who do want to build and deploy large language models need to have and what type of skills best position you to do that. So we have more of a sense of that now. I am interested, because you could be doing a lot of things, man. You could be working classical ML, you could be working in
SPEAKER_00building tools still for literate programming, these types of things. What is it about large language models that keeps you up at night or that really gets you going?
SPEAKER_02So, like, one thing I want to share about large language models, like, okay, my first experience with large language models. So, like, you mentioned, like, okay, I was working at GitHub and this project called CodeSearchNet. That's, like... That was like really long time ago. It was before like GPT 3.5, like really early, you know, like BERT, basically in the BERT era, I was building large language models for, you know, me and the team at GitHub were building large language models for semantic search. At some point, like along that journey, you know,
SPEAKER_02like after we were done with that, GitHub got bought by Microsoft. And then soon thereafter, kind of OpenAI called us up and said like, hey, do you want to partner with us? Like we'd really like to explore, you know, code in GitHub. And I remember, you know, we had also acquired a company and there was a guy who was leading these kind of like rock, like moonshot projects. His name is Uga, really, really talented guy. And he asked me, hey, like, okay, like we have open AI. What do you think, what kind of project like should we pursue here?
SPEAKER_02Like, should we like double down into semantic search or like, should we just use AI to write code? And I was like, I was like, no way, like AI writing code, that doesn't seem like it's gonna work. It seems like, that seems like super challenging. And at that point in time, like at the BERT era, And then plus, like, whatever was happening at OpenAI, I couldn't see, it just didn't feel realistic at all that language model could write code. I was like, the syntax is going to be really brittle. Like, how are you going to, you know, just imagine, I was imagining myself as a developer,
SPEAKER_02like, wanting to use that. And I was like, this sounds... like a really risky project like maybe start with something else and then work your way up to this thing so i was like super scout to cause it's not gonna work that's what i you know told myself but then they're like you know what hamel we can't this is not a time to be shy that's not thinking big enough like we just need to we may you know maybe these things can just write code i was like you guys are crazy and what year was this this was 20 maybe seven Hold on. 2018, 2019, 2018, maybe.
SPEAKER_02I don't know. The time is hard to remember exactly like that, but somewhere in that range. I was briefly involved because like, okay, I pivoted to what I was doing and kind of, started helping the team. And then I left GitHub shortly thereafter. But what we were focused on early on on the GitHub side was evaluation, rigorous evaluation of these models. And I just watched as the models got better and better and better like incrementally over lots of tinkering, lots of experimentation,
SPEAKER_02lots of engineering and thinking around like, how do we use this? How do we test it? How do we give feedback to OpenAI? So on and so forth. And eventually it got so good that it just blew my mind. And it taught me, I was this very skeptical person. And, you know, I was skeptical for a lot of reasons. Like one, I was skeptical because I was like, had a mental model of language models that was quite different. But then I was also skeptical because of all this prior history and career in machine learning where lots of things didn't work and projects
always get shut down
SPEAKER_02or they would be more expensive than people thought they would. And I was a bit more skeptical because of all those experiences. And like this kind of like taught me like, okay, I'm completely wrong. Like this language model, like I was wrong. And language models, like they're very, very powerful, way more powerful than I even thought at that time. I think a lot of people were surprised, frankly. And people that didn't know as much about language models per se, they had a lot more optimism in that, in kind of an ironic way, like that optimism like paid off,
SPEAKER_02if you know what I mean. And so it really reset the level of excitement that I have and made me feel like, okay, I think this is actually something worth investing in and I'm going to keep investing in it. And then also saw that it's actually quite complicated to get it right in terms of implementing this in a product. And so all that stuff is really interesting. And yeah, it just made me really bullish on it. So that was like kind of just some background.
SPEAKER_00I really appreciate that. And I think I appreciate how you share, you know, a failure mode of yourself or being wrong. I think you were wrong for the right reasons, right? And what I mean, like in decision theory or decision science, right? You can make a right decision that doesn't have the result that you want, because based on the information you have at the time, you made the most optimal decision. And I think in a lot of ways, that's what happened in this scenario. When you were talking about that, it wasn't ready for prime time. I think it probably wasn't. And then there were advances and maybe the bullish people pushed it, pushed it forward so much that it did become far more useful.
I am interested before we dive into what you're doing at the parlance labs, how you think about using large language models to write code in your own practice
SPEAKER_00these days.
SPEAKER_02I believe in trying to use large language models. Like, okay, if you're gonna be using large language models at a company, like if you're trying to build a product around LLMs, it's actually really helpful. I think it's really important to use it everywhere you can. you know as like a constant practice like outside like wherever it makes sense for your work so for example so i use it for like code but also like go on walks and just talk to bing bing chat now i talk to chat gpt because it has the voice dictations you can talk to it and i'll talk back to you and
i'll just go on a walk and like ask like lots of questions about things so like yeah maybe like i mean not
SPEAKER_02like every i don't do this i haven't done it in a while but Yeah, I went on a long walk a couple of weeks ago and asked a lot of questions about FSDP and all this other stuff. And I use it for writing, use it for code. And yeah, I use it to make websites. to write code, to even logos and things like that, like basically everything I can think of, try to integrate it into my workflow. And that actually helps give lots of intuition about like the failure modes of large language models with limitations are like different ideas,
SPEAKER_02prompt engineering, things like that. It's really helpful to like integrate to use it because it kind of like it sort of takes practice to, you know, use them effectively, I think. And what are current failure modes of using large language models to write code?
SPEAKER_00Because previously, they would write a lot of unnecessary boilerplate and a lot of spaghetti code that you didn't necessarily need, right?
SPEAKER_02It's not so much like the failure mode of the language model. I'm going to sound like an accelerationist or something when I say this. Kind of, there's a failure mode in the way that you use it. So I think it's a good learning tool. What I mean by this is you say, if you have a coding issue that's non-trivial, like something you kind of care about, the right way to use these things is to say, you know, once you get the code back, to say like, is there another way of doing this? Why did you, like, ask like many follow-up questions, like, why do you decide to make this trade-off?
SPEAKER_02You know, are there other trade-offs? can you think of anything that you would do differently and like just like have like really try to like hammer the language model to get as much information as you like be extremely curious you know and that is really like that's like a really good way to use language models to actually learn a lot and then like you can't just trust whatever is saying blindly of course but you can kind of with enough practice you can kind of calibrate sort of the right way to use it, so to speak. You'll learn,
SPEAKER_02okay, you can still figure out what it's telling you, like, okay, should I go read about that thing or search this thing or that thing and ask follow-up questions and then go verify it, things like that. So I think using it like that is really helpful.
SPEAKER_00Just on that note, I do think quote unquote prompt engineering and using large language models and that type of stuff is very different to ML in a lot of ways, but there is an analog in that. The first model you build will not be the model you want to use, right? Well, I'd be very surprised if it ever hits. And similarly, the first time you ask a question or the first prompt you give around a particular thing, you'll then want to kind of redesign that and iterate on that, right? So there is an iterative process of, I suppose it is that iterative loop, right, of building a first model or a first prompt, then looking at the results,
SPEAKER_00then doing some error analysis, then like iterating on that.
SPEAKER_02Yeah. I mean, and sometimes I don't care. There is a fair amount of boilerplate involved with programming. Like, okay, I need some CSS to like move this box to this thing, or I need to, you know, whatever, do something else. And so I'm more than happy to just to use it without asking too many questions. And like low stakes matters. There's a lot of low stakes things that are there. So... Yeah, I think it's surprising, like people, I find, I don't know what your friends are like, but I feel like there's a bimodal distribution in my friends of
people that use
SPEAKER_02LLMs for everything. Like when I say use it for everything, like they try really hard to integrate into everything in their workflow. And other friends are like, I don't really use it at all. It's really, it's really fascinating to me. Yeah, most people I know have used it as hobbyists, like to get a sense of it.
SPEAKER_00But yeah, then they don't use it to help them with tasks, right? In work or hobby or that type of stuff. And then there are a bunch of people who use it for a lot of things. So we've actually got an interesting question about someone's interested in hearing examples of industry cases that require fine tuning of LLMs. So I want to jump into thinking about what you're seeing in the space. But before that, I'd just like you to set the scene by telling us a bit about Parlex Labs and what you're doing there. And then we can talk about the people and industry cases that
you're working with there.
SPEAKER_00What's Parlous Labs, Emil?
SPEAKER_02Yeah. So Parlous Labs is a kind of research lab and consultancy that help people operationalize LLMs. And really, that's what it is. Right. And so, yeah, I help people. And we have some other people that there's about four of us. And we partner together to help companies build AI products. And the motivation for doing it was it's hard, like, okay, so I can, you know, it is tempting to like, there is a lot of interesting things to do with regards to, you know, like fine tuning open source models on open data sets,
SPEAKER_02running them against benchmarks and things like that. There's a fair amount of like open research. But the thing that is really interesting to me is like, how do you make this work in the messy kind of nature of businesses? And I wanted to get more intuition around the kinds of problems people are facing and where the roadblocks are and just kind of be in the field a lot because that's where I find that's interesting. So I decided that, okay, I'm going to create this consultancy. I'm going to focus solely on LLMs.
I get pinged all day long about all kinds of things and I say no to those things
SPEAKER_02and also don't say yes to every company. And the idea is like, okay, can I learn really fast about what in industry, what are the patterns that I see and where the opportunities are?
SPEAKER_00Incredible. So where are you seeing the most interest currently?
SPEAKER_02The most interest that I do see is definitely in tech companies. But that's not to say that that is where the most interest is because I'm also like, my network is tech heavy. I used to work at all these tech companies. You work at a tech company. You know, everyone I know, like most of my friends work at tech companies. So of course, I'm going to hear from lots of tech companies. But also, yeah, I mean, I definitely, most of the people that reach out are working at some kind of tech company. It is interesting, like, you know, there's a fair amount of people investing a lot of money outside,
SPEAKER_02like in LMs, outside Silicon Valley, investing serious resources, like startups that they wouldn't have ever touched ML before. But just because of the nature of LLMs and the fact that they can prototype this stuff and get an intuition that, hey, there is something there that is interesting, that has created a lot of demand for these types of things. So in a way, ChatGPT has been a boon to anybody working in LLMs because it's
created this
SPEAKER_02massive interest. There's product managers everywhere. Even technical people everywhere, non-ML people fiddling with this stuff, and they have realized there's actually promising capabilities here. How do I integrate this into my product versus classic ML? That was a little bit more abstract, I think, and not accessible, not as accessible.
SPEAKER_00Yeah, our co-friend and colleague, Vilay Toulos, who's the CEO at Out of Bounds and built and works on Metaflow. And this is something that I think maybe is in the zeitgeist as well. But last time I was hanging out with him here, he drew a figure of time on the x-axis and excitement on the y-axis of traditional software or ML software. And at the start, excitement's pretty low. You're writing code and then you're doing unit tests and... doing all of this stuff and then slowly you get like a product
that's looking kind of cool and people like oh okay that's delivering value that type of stuff whereas chat gpt is that but inverted right so at the start you've got you can write
SPEAKER_00something and get a get a response and it's like wow this is amazing so excitement's off off the charts and then it's like oh wait now we're getting hallucinations okay so that's a bit and wait now we've got a relevance issue And wait, now we've actually got latency issues that my product manager won't even allow us to use because we need. And then how do I actually embed it in my enterprise software already? So it's kind of this inversion of this excitement curve or something like that, which I think it did capture the zeitgeist immediately,
SPEAKER_00if that makes sense.
SPEAKER_02I think that's right. I think it's like a U-shaped curve. It's like extreme excitement followed by lots and lots of suffering followed by extreme excitement at the very end. Again, when you make it work for real.
SPEAKER_00Where are you in that curve? Or are you like, because you work in lots of different parts of it, you are the curve.
SPEAKER_02I think the U, the part of the U, the U is like pretty, the flat part of the U is pretty large, I would say. It's like a very steep U, you know? It's more like a square, like in a way. It's like, or more like a, you know, like square with three sides. So it's like, If there's anything you learned from this podcast, if you said, can you summarize this podcast and the most important thing to take away? I would say you have to spend a lot of time looking at data. Look at lots of data until your eyes are bleeding.
Just look and look at data and really sweat about evaluations and things like that.
SPEAKER_02And looking at data and evaluations is, you know, like people, that's kind of unglamorous, not glamorous stuff. I like, I think it's fun in a way, because like once you set up the evaluations, you can start to see that you're making progress. But, you know, it looks like you're not like shipping something directly, but it is exciting to me. But a lot of people don't find it exciting. And, you know, that's where like that flat part is.
SPEAKER_00Well, exactly. And I think you're helping to set expectations around what the work looks like. I always said to people, if you want to work in data science, don't think you'll be building models all day. There's the whole 80% of whatever is whatever, right? If you really don't enjoy cleaning data and writing SQL, probably more than every now and then, and if you can't handle dealing with a lot of delimiter issues and that type of stuff, I always used to say to people, maybe this line of work isn't quite for you. Right?
SPEAKER_02Yeah. I mean, like you just have to constantly, you have to constantly look at data and why do you have to look at data? So you have to look at data for debugging reasons. You have to get, you have to like constantly have intuition and find like what your failure modes are. You certainly want to do some level of evaluation and all of that informs how you engineer the system. Looking at this data, like your, you know, LLM traces or other data that you're using, that are kind of like the exhaust of your early LLM attempts
it's kind of like this continuous cycle and yeah I mean it's just it's like it ends up you end up like looking at lots of data cleaning it and yeah I think a lot is I know this sounds like common sense like oh we're all like two data scientists saying that you should be looking at data and cleaning it like we've been people have been preaching that
SPEAKER_02forever like That's not uncommon advice. But even though it's not uncommon advice, just like before, people are not doing it.
SPEAKER_00But also, it's more hardcore now, man. At least we used to have, at least some of the time, work with tabular data. I mean, the conversation we're having now is about unstructured data. And it's about models that generate, at least colloquially, exponentially more unstructured data as well. Yes. And then part of thinking, and we'll get to this, part of thinking about evaluation, right? So much evaluation these days is around vibe checks and that type of stuff, or getting GPT-4 to evaluate.
SPEAKER_00So thinking about how then we work with that data is mind-boggling. yeah so what i ended up doing and you're absolutely right there's like lots of unstructured data so what do you mean look at this data do i just look at a wall of text all day kind of so what that means is so what i've i've found at least right
SPEAKER_02now maybe this will change as things mature like i have to build my own applications to look at data because it's like it's like this data is like messy you know like you have these like lm traces so you might have like RAG, function calls, all kinds of stuff going on, multi-turn conversations, and you have a lot of text. And we'll explain what these things are for those who don't know in a bit when we
SPEAKER_00get to a lot of the concepts.
SPEAKER_02Basically, you have chats. In the most common scenario, you have chat-like things happening. You want to be able to inspect that. I found that every client that I work with is a little bit different. They have different metadata associated with these chats that are relevant. They have other external applications and all kinds of things going on. The most important part of making progress in LLMs is to reduce
your iteration speed.
SPEAKER_02Make your developer velocity as fast as possible. It's not really anything new. I mean, it's kind of the same principle in software engineering. The way you do that in software engineering is, you know, like having good CICD, having good tests, things like that. Now, I'm not saying like you map those things directly as they are into LLM. No, like that. You can't just say CICD for LLMs and just does not really a thing. I mean, it's like more, there's a lot more going. I'm just trying to say like the velocity.
SPEAKER_00Even if you say CICD for ML, it isn't always clear that that's the best.
SPEAKER_02Yeah, that doesn't necessarily make sense. I mean, it's not. Yeah, it's kind of doesn't always matter. Kind of does. Yeah, kind of not really. I mean, you can learn something, but it's not like a direct translation. So it's like, what I'm trying to say is really like make the developer velocity as high. Sorry, it said low, I meant high, like make it as fast as possible. What that means is you guys should be able to look at data as fast as possible and debug your issues as fast as possible and try things as fast as possible and get feedback as fast as possible.
And if you are having to look at like five different applications or something to look at your LLM data to understand like what is happening and debug it and do all
SPEAKER_02this stuff. And, you know, your tests take like two hours or, you know, things like that is going to really slow you down. And a lot of people don't even have tests, but we can get to like what is test. But in general, at a high level, it's like increasing your velocity so you can try things faster and get feedback faster.
SPEAKER_00I want to jump into what we've mentioned, kind of data skills in some ways, but explicitly, I want to hear from you, what skills do you need to work with? Sorry, what skills do you need or will best equip you to work with LLMs and generative AI models in general?
SPEAKER_02This is a good question. I think a lot of people, a lot of data scientists and ML people even, for some reason, When LLMs kind of came bursting onto the scenes, they're like, oh, okay, like existential crisis in a way. Like, what do we do now? Like a lot of people don't feel like they know anything about LLMs, but like nobody knows. I mean, there's some people that know, of course, like OpenAI and these companies, but a lot of people don't, nobody is like an expert. Nearly nobody is an expert in LLMs. And it turns out that cleaning data,
SPEAKER_02looking at data, designing good metrics, thinking rigorously about how you're evaluating things, those things are core skills for data scientists. And whether you realize it or not, if you have been practicing data scientists for a while, those things kind of come naturally to you in a way that you might not appreciate. There's actually lots of skills in that. to look at data skeptically, think about metrics, think about evaluation properly. These things map very well to a lot of the core tasks for LLMs.
Because again, the core task of LLM is I spent almost no time thinking about training.
SPEAKER_02And then 99% of my time is looking at data, thinking about better ways to measure the system, and evaluate the system. How do I generate more high-quality data? And how do I speed up the iteration cycle? And I don't think too much about training. Maybe I will think more about training at some point, but I spend all my time on this. And I think that is something that data scientists can do, in my opinion, anyway. Very cool. It's really interesting. There's some notion like,
SPEAKER_02okay, you have to be an expert in transformers and know everything about transformers very deeply to be effective at deploying LLMs. No. What you need to be an expert in is getting, have some practice with training models, but really like spend a lot of time with like curating datasets and getting intuition about like what kinds of datasets work really well, you know, in terms of the diversity of those datasets and the quality of them and like intuition, like, you know, for various problems, like,
SPEAKER_02okay, like how to acquire those datasets, how to transform them properly, even using large language models to transform them and, you know, have that kind of nailed down that's where the biggest gains are but it's also a lot of work it's not like if it was just like training models like oh you just like train a model but it was never the case that it was about training the models i don't think like in machine learning it was always like this data cleaning high quality data stuff in a lot of ways so yeah so what i'm saying probably is not that profound at all i'm just saying the same thing we've been here for years
SPEAKER_00I think it resets expectations and manages. I mean, when we have new technologies emerge, we do think maybe a whole new set of skills, like we've got job titles like prompt engineer and that type of stuff. But what I'm hearing is that I agree completely, is that the skill set doesn't change that much. Maybe, you know, the ability to deal and figure out ways to deal with unstructured data. And I should want to talk about tooling and infrastructure around that as well, because it isn't clear. It isn't like, you know, you get a CSV and put it in a pandas data frame, right? You know? So, which we used to do with competitions,
for example, or whatever we did there.
SPEAKER_00But what I am hearing is that the ability, the skill set remains very similar in how to think about data, how to work with data. I do how to think about modeling, how to think about metrics and evaluation, what you're missing with metrics, these types of things. I do like your point that you don't necessarily need to know the ins and outs of Transformers. And this is something that comes up time and time again, particularly when I teach, is I always tell people, you know, to drive a car, you don't need to know how the combustion engine works, right?
You do need to know that if you drive a car into a wall at 60 miles an hour,
SPEAKER_00what impact that is, that that's going to have, right? So there are certain failure modes you need to know more than the internals of everything. Similarly, I mean, pre, in 2010, if you were trying to build neural networks, you probably needed to know a bunch of linear algebra and multivariate calculus, right? Then you had some APIs. I think Keras was the first one, which was really help people build models build neural networks without necessarily knowing all of the calculus and all the linear algebra and that type of stuff and now of course transformers
several years ago to use them you kind of needed to know some of the internals but now it's all about abstraction lanes and what we build to quote unquote democratize
SPEAKER_00what we want people to do So does that end?
SPEAKER_02The more you know, the more helpful it is. I'm not going to say it's not. It's like pointless. But I will say there are a lot of people fine-tuning models that just started coding last year. They're fine-tuning really good models. Yeah. If you look on Twitter and the community. Absolutely. I mean, there's people that were just like Uber drivers last year. And why are their models good? Well, first of all, they have tremendous grit and willing to just... But they're also looking at lots of data and curating data and
trying things. constantly trying things that's really cool and interesting absolutely the other skill set though or part of a skill set that i think and once again this is part of the data scientist skill set is being a hacker man there are all kinds of different frameworks and like land chain and land free and you know all these things that we need to figure out how to use and apis to use and that type of stuff having a curiosity around that also and this is i hope we we get to this at some point thinking about hardware man like if you want to fine tune a model or train a model
SPEAKER_00Getting access to GPUs, get A100, whatever it is, like finding these things and working, like using the command line to do this type of stuff. That isn't only data skills. That's kind of hacker grid, right? And that's frustrating AF, right? Like that is, like you do that. You've got to have, there's a certain zen one needs to have. I mean, you can hear I'm getting slightly agitated thinking about it.
SPEAKER_02Especially right now, a lot of the stuff, some of the stuff doesn't work to be, I mean, just being honest with you, like some of it kind of is okay. And it's kind of all over the place. Like the more I learn, the more that I find like, okay, like this official tutorial here has like weird stuff in it. It doesn't make sense. That thing is broken over there. It's just that I think it's, it's very early. And so, yeah, you have to have tremendous patience.
SPEAKER_00Yeah, I'd say that stuff has never quite worked as well. AWS has an amazing suite of tools, but like stitching them together and that type of stuff has always been like a mind bending. In my 20s, I lived in like a building with a lot of warehouses in it. I lived in a variety of warehouses. I remember there was a dude who'd like build rooms and sometimes he'd use like cable ties and blue tack and like tie things up. And like that's what we do in machine learning. Essentially, a lot of the time, we're just like, let's connect these things and wrapping duct tape around and be like,
SPEAKER_00I think that will work. And then we move on to the next thing because of other constraints. But enough about where I used to live. I am interested. We did have a question around examples of industry that require fine tuning. And I am interested in hearing just a bit about the non-tech industry. examples you've worked in. Because we've talked about this, that you've seen a bunch of interest from non-tech companies who really want to demonstrate value ASAP. So if that involves fine tuning or otherwise, it'd be great to jump into a couple of those use cases. There's only one client I have that I could say they're
non-tech, which is a non-profit
SPEAKER_02that they support animal rights. And so they're creating these applications to help people eat vegan by giving them recipes. Now, there's tons of demos out there about image to recipe. I mean, even that was one of the first OpenAI demos. If you recall, take a picture of your fridge, you get recipes. They want to cater it to like their specific audience and sort of like their specific interfaces and all kinds of stuff.
So there's some nuance there and they don't necessarily want to use OpenAI for that
SPEAKER_02because, you know, one, their nonprofit too is like, they just don't, they want to see if like they can make this stuff run on device, for example, things like that. So this kind of thing is something that we're exploring like fine tuning on, for example, you know, to go It's a multimodal kind of approach, but yeah, that's one example.
SPEAKER_01There was also another, didn't you tell me about a real estate example?
SPEAKER_02Yeah. So there's a real estate CRM company. So that's why, I don't know if this counts as tech. I mean, I think it is tech because it's a CRM software. So basically, and this is probably my most interesting client. And this client, so this company is actually really interesting. It's called ReChat. I can name the company. And it's a real estate CRM company. Basically, what that means is if you're a real estate agent, if you need to do anything, like create an appointment, research listings, manage contracts or even do a showing or do anything.
It's a CRM application and basically they have an AI interface that allows you to
SPEAKER_02do all those things by chatting with the application and say, hey, can you please do a comparative market analysis for this property? And then the AI will then pull the listings that are in that comparative market and make a brochure of the competitive market and summarize that, for example. Or it'll help you review a contract and do all these things. So actually, it's very interesting because the surface area is kind of large-ish. I mean, it's scoped to real estate and it's scoped to those features. But it's a really cool product.
And the reason it's really interesting is because I can see the progress being made.
SPEAKER_02And it kind of reminds me of GitHub Copilot. It's a bit ambitious, but then it gets better every day. And it actually works. And it's really cool.
SPEAKER_00That is tech. I think the application in real estate is it's using tech for a decidedly non-tech purpose.
SPEAKER_02Yeah. Yeah. All the users are non-tech for sure.
SPEAKER_00Which I think is important in recognizing that. I think the reason I wanted to kind of quote unquote double click on sound like all the VCs I speak with, no, I'm only half joking, but. The reason I wanted to zoom in on that is just to notice that people in a lot of spaces are thinking about how to deliver value. Just as previously, I mean, as part of your history, 20 years ago or whatever, you were going to Vegas to casinos to help people figure out what data science and ML, how that could deliver value there. Is that right? Or did I make some of that up?
SPEAKER_02It was basically marketing optimization. So there's... the casinos give away free thing, free, like basically incentives to people to like come gamble. So I was, yeah, I was helping them optimize those.
SPEAKER_01And to your point, the skillset that was important there. I remember you telling me this. was going in and being able to look through their data and listen to their business concepts and try to tie these together in some ways and designing the job and
SPEAKER_00designing the workflows. And a lot of it comes down to looking at data, looking at business concerns, and then there's a design process which then creates the work.
SPEAKER_02Yeah, it's very similar. Just like anything else, LLMs don't live in a vacuum. With ReChat, I have to consider their entire technology stack, what their product looks like, and how many people they have, and everything else when I try to think about what is best for them. and like what can make them succeed you know like that the hacker in me is like oh yeah like i just want to go straight to fine-tuning open source model like we should just do that but that's not what i say because that doesn't make sense a lot
SPEAKER_02of these business a lot of businesses out there are, you know, using things like OpenAI. And what I'm seeing is kind of creating a glide path for them to slowly maybe get off of OpenAI if they want to. But first, like create something that works, generate lots of data, have a good evaluation system, have something that like a pipeline that you can use and then think about open source models. For sure. If you don't need them. Sometimes you do need the open source models out of the gate because of some reason or the other.
But a lot of people where the demand, at least a lot of demand is coming from this kind of area.
SPEAKER_00That makes sense. So I do want to talk about how to choose between vendor APIs and OSS models in a minute. But before that, we've got a lot of listeners and a lot of viewers who are interested in learning more about how to get started and how to become good with LLM. So what are the top... three tools and or techniques that you think people need to learn so we've talked about skills in terms of like data skills evaluation metrics hacker skills but what type of tools and techniques do people really need to get their heads around and become you know develop muscle memory around finding a problem
that you want to solve with large llms is always the best is the best way to get started with anything in life i think i mean it was the best way to get started with deep
SPEAKER_02learning I think it was the best way to get started with like even programming in general is like find the problem that motivates you that you want to solve and try to take and take baby steps towards like solving that problem. And the barrier to entry is so low with LLMs. So like the first thing you can try is try to like mock it out and chat GPT or something like don't even write any code. just get intuition like maybe you know whatever if it's possible it might not be possible to do that but just you know if you can and then you
know start tinkering with off-the-shelf models seeing how you can compose those together get a feel for what their capabilities might be out of the box for example yeah like okay like if you're doing something around code you could try code llama try like these mistral
SPEAKER_027b llama You can kind of look at the leaderboard, not that the leaderboard, leaderboard is maybe a proxy, kind of a loose proxy. It's not the strongest signal in my experience. Like, you know, when you use these models in real life, the kind of the leaderboard is kind of irrelevant in a way. These like different leaderboards, different evaluations. I think there's a lot of noise in these evaluations in a lot of sense. And so like, because you're not going to care like about the leaderboard that much. I mean, it's not, there's like a very, I don't even know if like,
SPEAKER_02in my personal experience, it doesn't seem a tremendous amount of correlation between the leaderboard and like if it's working for my problem or not. So you just have to do a lot of tinkering. And yeah, just get out there, take people's blog posts and like try to run them, change those blog posts a little bit, tinker with it, see what happens. That's what I would recommend. I know that's like, I'm not pointing you to like one specific thing, but you know, Frank, that's what I do. That's what I do myself. That's what I do. Honestly, like, cause I don't, okay. Like when it comes to, you know, training models,
SPEAKER_02You know, I just take what other people, like I just take like scripts from other people, scripts that Jeremy, you know, like Jeremy, my friend Jeremy Howard, like script that he has, or this other guy that we'll kind of talk about today, Philip, he creates like really good blog posts on like, you know, fine tuning. I'll like look through his stuff and I'll tweak it. I'll tweak it and like try to change things and like get intuition on what's going on. You know, I'll ask my friends. I know there's cheating because like if you're starting out, maybe you don't have friends that are doing language models, but like I just do whatever, you know,
SPEAKER_00That's actually, and I rarely recommend people check out Twitter for these types of things these days. But Twitter is actually following Hamill and Jeremy, Philip, a bunch of other people, and seeing their conversations around this type of stuff can be incredibly instructive as well. We actually have two questions in the chat, which are super relevant. One is from Renee from NVIDIA. And Renee asks, there are several benchmarks in LLM for different tasks. How much can we trust offline evaluation metrics? Any best practices on this topic from your own experience?
SPEAKER_00Another question, and I think we can deal with both of these together in some ways from Shreya, how do you scale up eyeballing and vibe checks as evaluation techniques? And I also want to thank Rene and Shreya for these questions. Also, these two people are wonderful. And I've actually done live streams with both of them previously before. So it's really cool that they're here asking questions as well. I'm really excited that they're listening and they're still listening, which is great. Yeah, exactly.
SPEAKER_02So, okay. The first one from Rene. How can we trust offline evaluation metrics and any best practices on this topic
SPEAKER_00from your experience?
SPEAKER_02It's hard to be nice about this, but I don't trust offline evaluation metrics on generic evaluation tests for applied problems. And the reason I say that is because it has tended not to map very well for me, personally. This is like tremendous noise. I don't know what exactly the source of that noise is. I mean, people think that there's a lot of leakage going on. Maybe these models are being trained on the benchmarks inadvertently, either implicitly or explicitly even. we don't really know and you know the benchmarks themselves may
have problems there's a benchmark called fast eval which my friends like which kind of so okay like one useful kind of common sense thing which is only like common sense after it
SPEAKER_02was explained to me and i'm like oh of course that makes sense is like try to find benchmarks that correlate with what you experience in reality. So if you, so like, for example, fast eval, you know, that specific benchmark still has like GPT-4, like blowing everything else out of the water. And that maps that, you know, for a lot of people, that maps it with reality. They're like, okay, yeah, that model is like way better than for my tasks and my things. So if you can find a benchmark, once you tinker enough with models and you find like,
SPEAKER_02oh, you know what, like this benchmark actually is correlating with my reality, then maybe you can trust it more. But generally speaking, I found like tremendous noise in that. And I find I can't really, really rely on these those things. And I have to have my own like I have to create my own evaluation set that is beyond the vibe check. So we can get into the question, which is like probably the most important question of like LMS is like, how do you go beyond vibe checks?
SPEAKER_00So maybe you can tell us what a vibe check is first.
SPEAKER_02Well, a vibe check is like, yeah, you're just using a model. You're like, oh, this is pretty cool. I like it. It's good. You know, like you do maybe, you know, you try it for a couple of things. You're like, you feel impressed. You're like, it's good. You're like, it's good. You know, you're like, I got a sense. It's very tempting to do the vibe check because it, the reason I don't, I think it's tempting to rely on vibe checks because if you, you know, if you, if you're, it's easy to anthropomorphize a model and you kind of like do vibe checks on people. Like vibe checks kind of work on people.
SPEAKER_00And we're constantly doing vibe checks subconsciously as well, right? Like a lot of the world is just vibe checks. Like we're doing vibe checks of people walking down the street. But I think one of the reasons vibe checks are so important is because of Shreya's question as well, that we actually have no idea really how to scale these things up at the moment, how to do this robustly and quantitatively and that type of stuff. So to that point, how do you think about scaling these things up as valuation, valuation techniques?
SPEAKER_02There's kind of like level one and level two. I'm just making this up. So I hope this doesn't become a thing. So please don't make it a thing. But so like level one is kind of like, and this is the case across many of my clients. It also was the case to a large degree, like the way the co-pilot was like when it was getting built. It's like, okay, so level one is have like lots of assertions on the failure cases you're seeing. Because in the beginning, you're going to see lots of stupid failure cases.
SPEAKER_02The model is like repeating itself. It's leaking part of the prompt. It's giving you JSON that's not valid. It's giving you, it's like emitting you like IDs, like, you know, user IDs into the output. It's like, you know, has some template that is like been admitted to the output. You know, I can go on and on. There's like 30 of them. There's like 30 of them on my mind right now because I look at them all day. But like for every particular in like, okay, so in the Copilot sense, that was a little bit of a special case where what the way
Copilot was built was they're able to basically run unit tests in mass and basically do like mask code,
SPEAKER_02have Copilot. It was like basically like complete the code and then run the unit tests and see if they pass. And do that in mass. And that's a kind of insane thing to do. Especially this thing about Python. You're just going to do that based on requirements, TXT. Like it's going to be, it's like, imagine doing that in mass at scale. But anyways, like that's another story. I think it's kind of funny, but like, that's like the assertion level of like, can you, is there a way that you can, there's always like in the beginning, I find that there's ways that you can measure models for dumb mistakes.
SPEAKER_02Yeah. these different failure modes and if if you look at your data enough like you'll encounter lots of failure modes or you should be in kind of lots of failure modes if you're not then okay maybe you can go to like level two once it gets good enough like at some point if you're iterating on your lms in the right way you will find that these level one assertions start to become useless If you're doing a good job to become useless, you're not failing any of these assertions. And then you can't find really dumb things necessarily and
become a lot more
SPEAKER_02nuanced to the point where you can't write assertions. There's something like, oh, this is not that great. You can't be like, I don't even know how to write an assertion about that. It's kind of like, hmm, requires a little bit of human judgment for this, that, and the other. So in that regime... Once you graduate to that regime, which is a really good problem to have, then it's really helpful to do some human evaluation. And then what you want to do is you want to do human evaluation, but you also want to also construct synthetic evaluation,
SPEAKER_02let's say with GPT-4 or some Oracle model. But the most important thing is, is you want to track the correlation between them. So this is where you move a little bit beyond vibe checks. is by studying so first of all a lot of times when i do this study where i measure the the human evaluation and the ai evaluation there's a fair amount of times like they're in like agreement and it's not like you can ever stop doing the human evaluation but you can kind of you have a signal that you can rely on this
SPEAKER_02automated evaluation you have some confidence in that way it's not just vibe check it's like it's a principled study of like how much you can trust the ai evaluator if that makes sense so that's one that you know that is another tactic and then you know like the level three is like always like if you have implicit feedback from actual users implicit or explicit feedback in some way actual users you should always do that but you know it's all it's hard to like develop that way i mean i just try something and a b test it necessarily like you want
SPEAKER_02see if you can get feedback earlier before you do that. Because like, otherwise, how are you going to develop? So like, okay, but the problem with that level two example is like, what if they don't agree?
SPEAKER_00So just one thing Shreya has actually asked an interesting question. Can you give examples of evaluation, evaluation tasks, inputs and outputs in level two?
SPEAKER_02For ReChat, basically what we have is Okay. So we have a lot of scenarios. Okay. So we break down the evaluation by feature, for example. There's a listing finder. There's a competitive market analysis feature. There's a contract review. There's email stuff. And basically for every feature, there's different scenarios, different scenarios that you should be able to go through with the LLM. I'm just giving you like, I'm being very specific. This is not, may not generalize, but I want to give you a specific thing.
SPEAKER_02So like for each scenario, we have like features. And then within those features are different scenarios. And those scenarios, what we do is we go through and we synthetically generate, we have like a, We synthetically generate inputs, and then we have humans evaluate like, okay, is the output of the model good or not? Like, okay, find me a property in this zip code that has less than two bedrooms that does this and that, this thing. Based on the scenario we generate, we perturb the inputs as much as we can.
SPEAKER_02And then we have humans. This is like... This is for level one. It's a kind of mix between level one and level two. We have a bunch of assertions against that to know if they're doing something really stupid. They also have human evaluators that say, hey, is this output helpful? like is what happened because it's quite complicated right it's like you ask for something there's some rag there's some retrieval augmented generation maybe there's some function calls something else happens and the application renders something and so you know we have a human evaluator that
evaluates the entire interaction to say like is this good or not and that helps us know okay like is the
SPEAKER_02product working or not like you know is the language model It's a little bit messy because there's like some engineering components in there. It's not purely about language models, but it is mostly it is like we are evaluating the language model. And so we have these tools. We've created these tools that people can use to quickly do this evaluation. Now, I'll be honest with you, I am doing a lot of the evaluation also. And I think that's important. That's the unglamorous thing. I find that it's hard to outsource that for whatever reason.
SPEAKER_02Maybe I can.
SPEAKER_00Once again, this comes back to the skill set, at least when initially building these things, right? You've got evaluation on one end and you have all the data stuff on the other. And people think a lot of it's the stuff in the middle, but a lot of it is actually the things at the start and the end, which is the data and the evaluation and the loop between them. Shrey has also just commented, this is super interesting. So, and she states, you're deconstructing a vibe check into a set of predicates, i.e. Boolean functions, essentially.
SPEAKER_02I'm not sure, you know, maybe, I don't know what the Boolean thing may be about, but could be missing something. But there's definitely like... Well, I think it's binary.
SPEAKER_00It's like, yes or no, right?
SPEAKER_02Oh, yes, yes, yes, yes. So it's like, is it good or is it bad? So we, okay, like that, that is a really good comment. Like, okay, I understand what you're saying now. So let's try to simplify the problem a little bit as much as we can. So like, because you can make this evaluation like really insane. You can be like, oh, rated from like one to five and Like what went wrong? You can try to evaluate different runs. Like you can say, cause like you have a whole trace or a whole, let's call it a chain. I don't know what else to call it at this point.
SPEAKER_02So like you have a whole chain of things in a chat. You know, you have like a multi-turn conversation. Like you're asking a question and you get an answer. You ask another question. Might be function calls, might be rag. So you could try to like debug like one part of it or another part of it. Basically what to simplify it so that we can have some sanity is that basically we take the trace that is the last call in the whole chain and we only evaluate the final, like the whole thing. Like is it good or bad? If anything in that chain is like bad, we just throw the whole thing out. And we think that's okay.
SPEAKER_02I mean, that's okay. Cause like, cause we understand a little bit of the way that fine tuning works. We're like, we'll get enough good examples or hopefully we'll get enough good examples. Like we can just throw away, like it's not anything that is going wrong and we don't have to like, we can just make a determination, like is this good and is bad. And so there's some leniency here. Like we have the ability to edit the final output, but that, that is the nuance of this particular client. Cause like it's the final output that, it tends to go wrong in this particular situation.
SPEAKER_02So that is editable. I can edit that response and save it and say, yes, except that gets saved into a fine tuning dataset. You may want to edit other things, but I actually don't allow you to edit other things. I'm like, no, because you edit other things, you're going to make a mistake. You are going to mess up some JSON. I'm like, I don't trust myself and I don't trust other people. They'll say, okay, maybe the final output, maybe you can edit that. You can edit that.
SPEAKER_00I want to have a whole other conversation about that, about the type of guardrails you can put up in order to help people with these systems. But what I want to do, we've got around 20 minutes left, and I want to move on to showing an example of how people can get started with these tools. Because one question people come to me and ask, and they're like, you know, you've told us to go and do a project, but do I need to know about fine-tuning and rags and vector databases and LoRa and hardware and quantization? And should I have like a vendor API or an OSS model? What's 7B?
SPEAKER_00What's XB? What's XP? What's an A100? And I'm like, you know, and I do actually think the real advice, as you said before, is like find a problem that you're interested in and try to solve it. And then you'll start discovering all of these things and learn and hack it out. I do want us to be more helpful than that as well by showing people an example where maybe we're not going to dive deep into lore now, but maybe we'll see where fine-tuning is important or rags are important, all that type of stuff. And hardware. And you're going to show us your rig as well at some point, I think.
SPEAKER_00So I don't know how you want to go about this. It's easy to like... sweep all that complexity under the rug because i had to like go through all that nonsense that you described yeah like i spent a good like probably two months like i don't know if you have to master all those things but just my own curiosity like i went through like what is all that stuff that you that you uh name and like why do i need it why i don't need it i mean yeah it's definitely there's a lot of stuff
SPEAKER_02to sort through and it's definitely
SPEAKER_00And it's about a language as well. Like if you look up a blog post that's like Mr. 7B, for example, right? Then it's like, what does that even mean? What is the 7B? So it's kind of becoming able to converse in a particular language. So why don't we get started? Do you want to share your screen?
SPEAKER_02I just want to ask you a question first. Like I got that question from Shreya about this evaluation. So I can actually show you a little bit what that evaluation looks like. That would be amazing. What the application of that looks like? What does that mean? Let me show you that. I know it's taking us off the plan, but I don't know. I just wanted to ask you. It would be great if we could just show some fine-tuning stuff first because I
SPEAKER_00think that sets the stage for evaluation as well. But then if we jump into evaluation, that would be great. Okay. And for those listening to the podcast, I'm going to try and talk through what's happening, but I'll put a link to the video in the show notes so you can check out this live stream as well.
SPEAKER_02What do you see now?
SPEAKER_00We see the entire desktop and then extended guide. This is a blog post by Philip Schmidt at Hugging Face.
SPEAKER_02I'm going to be honest with you. When it comes to training, I don't really feel like I know what I'm doing necessarily. And it changes so much. The tools change so much. And especially like I am GPU poor. Like I have three GPUs under my desk, A6000s. or RTX 6000. Maybe that sounds like I'm not poor, but whatever. It's poor in some scale. And, you know, I have to like use things like LoRa and quantization and like find ways to shard models. Like I'm really interested, like, okay, how do I fit models?
SPEAKER_02Like, how do I train models that don't fit on one GPU and all this stuff? And the combination of all those things are quite complicated. There's so many tools, like there's gradient checkpointing that reduces memory. There's LoRa. You know, that freezes the parameters and makes it to where, you know, you can use less memory. There's quantization, there's flash attention, which makes it, you know, that is like more memory efficient. And then, you know, you can also like distribute the model.
Like you can take the different components of the model and shard it over the GPUs. there's all kinds of trade-offs and all these things and it can be kind of like hard to navigate like what to do and all that stuff and so there's many different things you can go with like you can look at hugging face stuff like blogs you know
SPEAKER_02they have like how to get started like you know actually like there's this thing so efficient training on multiple gpus this is a really good series at least to get started it'll tell you the concepts like what's data parallel tensor parallel pipeline parallel tell you about you know zero tell you about sharded ddp you can kind of go into all these things and like read about them this is great we'll link to this and similar resources in the show
SPEAKER_00notes but i'm already overwhelmed man yeah it can be overwhelming what i like to do is be like i'm the kind of person i don't know i mean different people are different styles but i like to find code that does a thing and then just tinker with that code that's like my own thing and that's what we're going to do now right we're going to show people some code yeah and so there's some people on twitter like you mentioned that kind of have good stuff that do things so one such person there's like some back you mentioned like
SPEAKER_02There's a guy, Anton, he shares code. He does a lot of fine tuning all day, basically, and talks about it all day long and has code that he shared. And I use his scripts all the time. But there's also Phil. Phil works at Hugging Face. And he also has an interest in Laura and QLaura and DeepSpeed and whatever, all this stuff. But I really like his... I don't know. I just really like his blog post. and so i think a really good way to get started with fine tuning is to actually think about instruction tuning so what is instruction tuning
instruction tuning is taking a language model that by default just is like generating the completing text and you're teaching it how to next word prediction essentially right yeah next word prediction and you're still going to train a model to next word prediction but you're going to train the model to do the next word prediction in the style of a
SPEAKER_02chat And the reason that's important, that's important for usability.
SPEAKER_00So you feed it essentially question and answer pairs, right?
SPEAKER_02Yeah, you feed it in question and answer pairs. Now, the reason why I like this blog post, it's a little bit of a different twist.
SPEAKER_00And for those listening, we're looking at a blog post that I'll include in the show notes by Phil Schmidt called Extended Guide Instruction Tune Llama 2.
SPEAKER_02Yeah. So the reason that this blog post is really cool, and I like it, I like it as a starting point, even, you know, into LLMs in general is, so what is instruction tuning? So like, so okay, like, so this is an example, like, you have the end product, you know you might have something where so this is like the alpaca format where you have an instruction you have like some input and then you get a response and the idea is like you want so like basically how so okay what is
instruction so let me like let's in a normal like language model situation you would ask a question like when is the indian national flag when was the indian national flag adopted and then you would get an answer i don't even know if his answer is correct it sounds like
SPEAKER_02it maybe is correct but i don't know And, you know, you would have a question and you would have an answer. Now, I know this doesn't say question and this doesn't say answer, but just bear with me for a second. So like you might want to take a language model off the shelf in instruction and you want to make it such that you you ask a question and you get an answer or you say something and it tells you something helpful. Right. But like, how do you take your data? Okay. Like the Outer Bounds docs. Like you work at Outer Bounds, this company that does Metal Flow and you have all this documentation.
Is there a way that you could transform that into a dataset that can be used for
SPEAKER_02instruction tuning?
SPEAKER_00I love that example because any business can think about, you know, trading instruction tuning, an open source model on... let's say, internal docs or external docs in order to create business value or help people query their own documents, essentially.
SPEAKER_02And so the idea is you should be able to fit in. What you want to do is, so you want to train a model. Eventually, you want to train a model to see this as a question and give a response. Now, I mean, this is not like the best example because you would, I mean, you don't want just to memorize these facts, but just like, this is like just for like, you know, for teaching purposes, pedantic purposes, like, so basically you want to feed in some context and like, so you reverse engineer that and you say like, okay, you have these docs of some kind and you want to,
SPEAKER_02what you want to do is have question answer pairs. You want to have a question about those docs and maybe some context about the doc and then you want an answer. You want to train a model to like be helpful, basically. But how do you do that? One way is to like invert the problem and show it like lots of sort of context and have it predict what a question would be. So like you might say, you might like show it some fact like this and then have it generate a valid question. The reason for doing that is then you can take this, invert it, and then it becomes a question answer data set.
SPEAKER_02So you can like, if you teach, imagine instead of 2nd July 1947, instead of that, it was like, I don't know, something from, you know, the how-to guides, let's say, of like learning data science and, you know, something from here, how to chunk a data frame. And then like, you know, you want it to generate a question, like some question about this. Like you want to show it some text. You want to have a question. you know, and then you want an answer. So basically like, that's what this does is it's like, it helps you transform unstructured data into this like
instruction tuning data
SPEAKER_02set. It's like a precursor to instruction tuning. The reason it's good is like, it gives you an idea of like how you can use language models, how you can like go from like nothing where all you have is unstructured data and people have unstructured data to a situation where, okay, like you might be able to create something from like kind of from scratch. You can create a model from scratch. So, okay. So there's some setup. The first thing you want to do is load the model. And I have a notebook here, but I think something went wrong with my environment because
it's not working. like the last part something happened oh good and very common i mean yeah it's like very uh real not surprised that we've got an environment concern but basically like okay you load your model he's showing some things like flash attention and device map equals auto i actually turned that on like i didn't want to do that that's like a naive model parallelization you don't you know i didn't need that so that's
SPEAKER_02something you should read about you know whenever you get a chance And basically all these little, all these little like sort of parameters, you should go read about them. I read about what this was before this podcast and I actually already forgot. It's like, I don't even know, to be honest. But like, you know, there's so many. It's one of those things where like you look it up three times and you're like,
SPEAKER_00okay, maybe I should remember this. But let's, let's keep going. We're going to need to wrap up, wrap up soon.
SPEAKER_02Okay, so you load the model. So, you know, and this one does the LoRa stuff. So LoRa is where you freeze most of the parameters and you add the low rank adapter. This one is doing Q LoRa. So, you know, like the Q part is for quantization and that's because we load in 4-bit. Then, you know, this is using Hugging Face Trainers. Then you have all these training arguments. So like... You can just copy all these things and tinker with it so you don't have to get stuck on that. So this is the configuration. This is the actual trainer where you put the data set and you feed in the different
SPEAKER_02configuration values. And you train the model. And then basically, you can then take that data and then you can generate instructions. So this is some context. and like this is what the model this is like a question that the model would ask about this and then you know this is the ground truth and so this is what i was going to show i think if you're going to do this what you should do is like for intuition take the model before it was fine-tuned and see what happens versus the
SPEAKER_02model after it's fine-tuned to give you to give you like a intuition on like the metamorphosis of what this instruction tuning did to the model you're gonna be like wow okay with just that much but not that much fine-tuning just a little bit you really change the behavior of the model completely because like before fine-tuning is going to try to complete you know it's just gonna try to complete stuff and it's not gonna make it's not gonna it's gonna be weird but then after this fine-tuning it's gonna like have this very specific behavior
SPEAKER_00I appreciate you walking us through that. And I do think if people are interested in trying that themselves, I think that's wonderful advice. I think we probably don't have time for hardware concerns. So we'll have to have you back sometime to show us your rig and talk about hardware because actually accessing hardware to do this type of stuff is non-trivial these days. But I would like to thank everyone for joining. I'd like to thank you for your time and expertise, Hamill. I also just... A lot of different things. of how people can get started. But I'm wondering for people interested in LLMs and working
with LLMs and deploying
SPEAKER_00them, if you have some sort of call to action, something you'd be really excited about getting people to do.
SPEAKER_02Yeah, just tinker. Just start slow, spend an hour every day, half an hour every day. tinkering on something, you know, take a blog post, edit it, use your own data with it, see what you can do. Take this blog post that you have showing you today. You can start small and you don't need to fine tune on like massive data sets to see something, to see something cool. You can So yeah, just do it. It's very accessible. It's never been more accessible.
SPEAKER_00Absolutely. And in fact, we've showed Phil Schmidt's blog post. Hamill has a lot of great blog posts as well. So check out his blog. If you Google Hamill Hussain blog, you'll find it. Follow him on Twitter as well, at Hamill Hussain, for more of this type of exciting stuff as well. So thanks once again, Hamill. It was such a pleasure as always having you on the show.
SPEAKER_02Yeah, thank you. Thank you for having me.
SPEAKER_00Thanks for tuning in, everybody. And thanks for sticking around to the end of the episode. I would honestly love to hear from you about what resonates with you in the show, what doesn't, and anybody you'd like to hear me speak with, along with topics you'd like to hear more about. The best way to let me know currently is on Twitter, at Vanishing Data is the podcast handle, and I'm at Hugo Bowne. See you in the next episode.
Hilary Mason, CEO of Hidden Door, works with agents across software development and creative projects. Drawing on Richard Hammingβs distinction between science and engineering, she describes agents as βbringing the...
Agents can write the code, run the analysis, and produce a convincing explanation. How do you check that theyβve answered the right question, used the data appropriately, and reached a conclusion you can act on? I...
βItβs an LLM, a loop, and enough tokens.β - Nicolay Gerold, Amp Code So why does a coding agent forget your instructions, keep reading tiny pieces of a file, or struggle with an edit another model handles easily?...
βIf you feel that a product is hard to eval, or you feel like, βI donβt even know how to eval this,β itβs a strong smell that your product isnβt good.β - Hamel Husain, on AI product design An AI data agent tells you...
βIt would be sad if local models were not an option and there were only proprietary models. Itβs good to have alternatives. Competition is good for business.β - Sebastian Raschka, on open-weight AI Kimi K3βs weights...