Latest / Agentic Conversations (formally mlops.community) / DSPy: Transforming Language Model Calls into Smart Pipelines // Omar Khattab // #194
Transcript
- 0:00I'm Omar. I'm a fifth year pH.
- 0:03D candidate at Stanford. I'm also an ALE AIML scholar.
- 0:09I do retrieval and what we call foundation model programmes.
- 0:14So these are pipelines of language models.
- 0:17And I actually don't drink coffee.
- 0:20This is the question that Dimitri has asked.
- 0:21I love tea, right? Welcome back to their beloved
- 0:27community podcast. I am your host Dimitrios and who
- 0:31got a doozy today. Oh my God I love talking to
- 0:34Omar. He is doing some incredible
- 0:37stuff and I just got the full scoop from him.
- 0:40We we stopped recording and then he told me the whole story about
- 0:44the timeline of his creation DSP and then later on DS π and so
- 0:49I'm going to rehash that for you real fast.
- 0:52I think it is quite interesting because he is a researcher, but
- 0:55he is doing DSI, he is creating DY and really looking at
- 1:00retrieval and that is 100% Milos.
- 1:04That in a way is exactly what we're working on day in, day
- 1:08out. And so it's great to hear his
- 1:11stories and how he looks at things and why he felt like
- 1:15something like DSP was needed. It is an abstraction layer that
- 1:19is a bit different than other ones that I think you see out on
- 1:22the market that are doing similar things.
- 1:26And so let's talk about this timeline because he broke it
- 1:30down for me and he said, listen, we started version zero for DSP,
- 1:34which is the precursor to DSI in February 2022, So not February
- 1:402023 when there was all that GPT ChatGPT buzz going on, it was
- 1:44February 2022. And in February 2022, what he
- 1:47wanted to create was something that was an abstraction layer
- 1:51for pipelines using large language models, namely GPT 3,
- 1:57the precursor, again through ChatGPT and all the crates.
- 2:00O they put it out there and then they realised, hey, wait a
- 2:04minute, nobody is really creating pipelines with these
- 2:09large language models. Or if they are, it isn't really
- 2:12a pipeline, It's just a straight GPT 3 call and they're
- 2:16interacting directly with the model, not looking at it as a
- 2:21pipeline in the way that we look at different pipelines these
- 2:25days. And in traditional mill, you
- 2:27would look at pipelines and using different models in
- 2:30different pieces of your pipeline.
- 2:32And so they continued down the road.
- 2:36Nevertheless, they didn't let that discourage them and they
- 2:39released DSP version one. And then he realised, you know
- 2:45what? I think this is the wrong
- 2:47abstraction layer. And so they released the version
- 2:50one. But they had to take a long,
- 2:53cold, hard look in the mirror and see if this is really what
- 2:56they were trying to create and if this was as much of A value
- 3:00add as they wanted it to be. And ultimately they said no.
- 3:05Since they said no, they went back to the drawing board and
- 3:09the reason that they were having trouble was because the D and
- 3:13DSP this demonstrate it was really complex for people to
- 3:18understand. And later in this conversation
- 3:20you'll hear him talk about how this demonstrate what he now
- 3:25considers to be compilers. Are there ways that you can
- 3:29compile these different modules and really like go and do almost
- 3:35this hyperparameter tuning when you're he?
- 3:37He makes a lot of analogies with neural Nets, and he was talking
- 3:42about how compilers are a way for you to go and you can
- 3:46explore the best way of using these pipelines.
- 3:53But when DSP came out, they were not using the compilers because
- 4:01they were putting it on the user, the end user to create
- 4:04this demonstrate and these compilers and they were saying
- 4:07you need to demonstrate what you're trying to get from us,
- 4:09right. And so people didn't know what
- 4:12the hell was going on. They were confused out of their
- 4:14mind and DSP wasn't the right abstraction layer.
- 4:17So they went back to the drawing board after version one and they
- 4:20said you know what, instead of this demonstrate what we're
- 4:23going to do is we are going to be the ones that create the
- 4:26compilers even though it is open source and if anyone wants to
- 4:29create their own compiler they can.
- 4:31But it he feels that it is his job to create the compilers and
- 4:36then the rest, all these modules for the pipelines and all the
- 4:40abstractions the end user can use and leverage.
- 4:45And so you do not have to think through that complex piece when
- 4:50it comes to the compiler and they put out DS PIE from that
- 4:55and DSP I came out in August 2023.
- 4:58It feels like it's been out for ages and it is absolutely
- 5:02killing it. For anyone that has not used it,
- 5:04we're leaving a link in the description.
- 5:06I have fallen in love with this framework.
- 5:09I absolutely think it is fascinating and especially
- 5:12because some of the key things that he pointed out when I was
- 5:15talking to him and I literally was holding on to my chair, this
- 5:18whole conversation trying to keep up with the guy.
- 5:20Omar is brilliant and he was able to bring me on this journey
- 5:25and I hope he brings you on this journey and doesn't lose you.
- 5:28I had to slow him down at some points just to make sure that I
- 5:31was understanding what he was saying.
- 5:32But really he talked about being how brittle it is.
- 5:38If you're prompt 1st and prompt first is like, hey, there's this
- 5:43dark art of prompting. And really if we're looking at
- 5:46it as like we're going to somehow find a magic prompt when
- 5:51we're interacting with these LM's and when we are creating
- 5:54pipelines to go and make LM calls, that's not the way to be
- 5:58looking at it. And that's what they're actively
- 6:00trying to avoid with DS π. So the final thing I want to say
- 6:05is that at the end he talks about fine running and how
- 6:08modules with fine tuning or a module in DPI can just be a fine
- 6:13tuning of a model. And wow, he brought a whole new
- 6:19way of looking at data pipelines.
- 6:21Or ML pipelines, LM pipelines, whatever you want to call it, to
- 6:26my mind and my view. And I really liked it.
- 6:32Hope you enjoy this. Let's get into the conversation.
- 6:36But first I gotta get paid. So let's hear a word from our
- 6:39sponsors. All right, let's take a minute
- 6:41to talk about our sponsors weights and biases.
- 6:44It seems like everyone's working on large language models right
- 6:47now, but understanding what to build with LMS and how they work
- 6:52under the hood can be tricky. Thankfully, weights and biases
- 6:56can help. You might know about weights and
- 6:58biases Flagship experiment tracking product in the LM
- 7:02space. Teams like Open AI and Cohere
- 7:05rely on weights and biases to train and debug their models.
- 7:09But weights and biases? There's plenty more to offer you
- 7:14if you're thinking about training, fine tuning, or prompt
- 7:17engineering in LLM on your own Weights and Biases Traces lets
- 7:22you uncover granular insights about your LMS, providing a
- 7:26visual representation of their execution flows, colour coded by
- 7:30each component in the chain. This helps you understand each
- 7:34step your LM takes on its way to generating its output, giving
- 7:38you a deep, nuanced view of its behaviours and letting you
- 7:42iterate and debug much more quickly.
- 7:45Weights and Biases, LLM production monitoring enables
- 7:49the creation of custom dashboards to monitor your LLM
- 7:53activities in real time, including throughput, token
- 7:58usage, cost, latency, and errors.
- 8:01That sounds so good, and if you need help getting started with
- 8:05weights and biases, they can help too.
- 8:08On that front, they've released multiple free classes for
- 8:11machine learning communities like ours, the ML OPS community,
- 8:15teaching them how to build LLM as intelligently approaching
- 8:21prompt engineering, and a whole lot more.
- 8:25Whether you're a seasoned pro or just getting started on your LM
- 8:29journey, you can find what you need at weights and biases.
- 8:33You can get started today going to one DB dot ME/ML OPS
- 8:41underscore traces, or free today.
- 8:45Get after it 1B dot ME/ML OPS, underscore traces.
- 8:52Let's get back into the podcast. I was calling it dispy, but you
- 9:04said it's not dispute. What is it?
- 9:06Yeah, it's the ESPY like numpy. DSP.
- 9:10I like numpy. Of course it all makes sense now
- 9:14and that's why, yeah, there's the capital.
- 9:16And have you ever thought about calling it dispy?
- 9:22We did. And the story here is that the
- 9:28first version of the framework was called demonstrate, search,
- 9:30predict. So that's the and we got too
- 9:35many questions and too many people who thought it's just
- 9:38about digital signal processing and there's absolutely no
- 9:42relation there. And so in the second version, we
- 9:46wanted a rebrand that nonetheless keeps the people who
- 9:50are familiar with the original version can relate to this.
- 9:52So DSPI was it. Then you pivoted.
- 9:56Basically, you did the good old pivot and you said, hey, we're
- 10:01gonna go with DS pie. I like it.
- 10:03Well, dude, Omar, I'm stoked to have you on here, man.
- 10:06Give me the quick rundown. I know you're doing stuff at
- 10:09Stanford right now, but you've got all kinds of great things
- 10:13happening in your life. I would love to start at how you
- 10:17got into tech. Well, I started building small
- 10:24software, you know, back home, I guess as a teenager and I did
- 10:29see as an undergrad. Um, and what I wanted to do in C
- 10:35was mostly research oriented stuff.
- 10:37Basically I like building systems that have novel
- 10:40components, and in undergrad I did mostly research on sort of
- 10:46optimising the efficiency of AI applications and from there I
- 10:52worked on information retrieval. So making search faster.
- 10:57But this was before the AI boom, I imagine.
- 11:03This was before, well I I mean I've moved as many many of these
- 11:08cycles I guess, but certainly before the the most recent one.
- 11:11And this was you know 20/16/2017 and I started doing IR in 2018
- 11:16from a system standpoint and then I joined.
- 11:19I joined Stanford from my PhD and birth had just come out in
- 11:24NLP. So language models, large
- 11:26language models by some standards, where kind of
- 11:29starting to look like they will be the future and they are the
- 11:32present now, but they weren't really sort of mainstreaming in
- 11:35search yet. And justice around that time the
- 11:40IR community, the information retrieval community started
- 11:42looking at birth for ranking, but it was this sort of artefact
- 11:48that is 1000 times more expensive but a lot better in
- 11:53quality than whatever sort of we had before in in search.
- 11:57So I started my PhD thinking about can we make you know
- 12:01language models for search stuff or there's of magnitudes faster
- 12:05and cheaper while also pushing their quality up and that was
- 12:09Colbert. And from there we started
- 12:12looking also at you know this is work with my advisors Matesa
- 12:16Hadia and Chris Spots. We started looking at building
- 12:20these retrieval based NLP systems.
- 12:22So people talk about RAG all the time now.
- 12:25So that type of thing, building these retrieval based systems,
- 12:28especially in cases where the language model actually needs to
- 12:31interact in complex ways with a search engine.
- 12:34And from there, this is where ultimately the Spy came out as a
- 12:40programming framework that generalises years of our work
- 12:44into a highly expressive and powerfully optimising
- 12:51programming model. So you could build the type of
- 12:54stuff that would take us months before in minutes or hours and
- 12:59compile them into really high quality null systems.
- 13:04Wait, so I gotta ask. Of course.
- 13:07Cold air. Is that a shout out to the good
- 13:10old Stephen Colbert with somebody, a fan?
- 13:14Yeah, I mean it's that is the the, the, the context of the
- 13:18name. We saw that birth was all around
- 13:20and you know it stands for contextualised late interaction
- 13:24over birth. And The funny thing here is the
- 13:27paradigm that we introduced is called latent interaction.
- 13:30And so it was just right there, you know, late interaction and
- 13:32the Late Show nested jokes. Yeah, yeah, yeah.
- 13:36It just gets, keeps getting better.
- 13:38What did you see as the evolution there?
- 13:42Because, as you mentioned, OK, rags are all the rage now, but
- 13:46when you were doing it with Burt, what was it and how has it
- 13:50changed? Yeah, it hasn't fundamentally
- 13:52changed. I say people are doing the very
- 13:54basic versions of things that that that's what got popular,
- 13:57which, which you know, over time you realise that's really what
- 14:00happens, is that the basic thing gets popular because it's very
- 14:02easy for people to sort of grasp it.
- 14:05Um, so generally back in like 2019-2020 and and around that.
- 14:11You know around that time and and and really all the way until
- 14:14last year. In fact the second-half of last
- 14:16year all of the RAG stuff with very, very few exceptions were
- 14:20about fine tuning Retriever and a language model together.
- 14:26Usually very small models such that the language model could
- 14:30condition its generations or like bases generations on the
- 14:34retrieved passages. What we started seeing last year
- 14:37when we let a lot of this is using few shot prompting as a
- 14:42way to use language models for conditioning on retrieval.
- 14:46And this is what people mean when they say ragnell.
- 14:50Technically rag is the name of a method, a great work from Meta I
- 14:55that is a very specific way of fine tuning A generative model
- 15:00with a retriever together. So it's not really what or at
- 15:03least generally fine tuning A generative Retriever, you know
- 15:07conditioned on a fine tuning A generative model language model
- 15:11conditions under Retriever. And what we did basically April
- 15:162022 was for the Natural Language Understanding course at
- 15:21Stanford. We released this course project
- 15:24as open source and we widely announced that as the first open
- 15:29source sort of artefact where you could prompt GPT models and
- 15:34local I think they were GPJ models so that they answer open
- 15:38domain questions through retrieval.
- 15:40And this is basically you know, the foundation of a lot of the
- 15:44recent and popular stuff around drag.
- 15:47But the whole area of retrieval based NLP more broadly than RAG
- 15:51has a lot richer pipelines. So the questions there are
- 15:55things like how do you supervise the retriever so that it solves
- 15:59complex tasks for your generator Usually.
- 16:04You know, maybe you wanna check complex claims or there are sort
- 16:08of dependencies of knowledge so you can't actually find the page
- 16:11you're looking for until you find some other dependencies
- 16:14first. So that's called multihop
- 16:15retrieval and and adapting retrievers.
- 16:19There is a very significant challenge that is, you know,
- 16:22something we worked on for a while and this is kind of
- 16:25missing in the recent developments in open source in
- 16:29general, besides a few key key artefacts.
- 16:33So this is fascinating because it's basically saying like, hey,
- 16:36the rags that we know and love today that everybody's talking
- 16:39about and writing about are one style and maybe not even the
- 16:44style that Meta I put out back in the day when they wrote about
- 16:48Rags. But we kind of hijacked that
- 16:50name and we call it one thing, which is basically you just like
- 16:54go and look for some information in a vector database before you
- 16:57give a prompt to a large language model.
- 17:02And you're mentioning that's like a very basic method of
- 17:06doing retrieval. What are some other.
- 17:08Yeah. And you also mentioned how there
- 17:09there is much more complicated methods, one of them being you
- 17:14gotta get some dependency, so you have to figure out some
- 17:17piece of information before you can move on to the next piece of
- 17:19information. What are some other ways that
- 17:22you've seen or you've been playing around with like super
- 17:25complex retrieval? Yeah.
- 17:28So there is 2 sides to my work that I think are going to, you
- 17:36know, add a lot to the sort of application layer developers
- 17:41we're looking at rag things. So these are research ideas
- 17:45around what we call late interaction.
- 17:48And that is basically at the level of how do you model, how
- 17:53do you model retrieval. And the sort of popular approach
- 17:58that people are familiar with is you encode documents as a
- 18:03vector, so you're producing A dense representation for each
- 18:06document. And similarly for the query.
- 18:08And late interaction says it's actually really a significant
- 18:12burden and really hard for these encoders to produce one vector
- 18:15for each document which might be relatively long and that is
- 18:18supposed to capture every possible query you can ask about
- 18:22that document and nothing else. So late Interaction says we
- 18:28should actually be representing documents as a matrix of many
- 18:31small vectors, so a very, very tiny sort of representation at
- 18:35the level of the tokens, not at the level of the document.
- 18:37And if we sort of optimise that, well, with the right
- 18:41infrastructure we can get this thing that is as fast and as
- 18:46efficient as encoding each document with a vector.
- 18:50But that has much higher quality, especially in domains
- 18:54without a lot of training data. I saw a recent paper that was
- 18:57basically saying if you fine tune cool there with I think it
- 19:01was like 1000 queries. It does as well or better than a
- 19:06single vector representation fine-tuned with 50,000 queries.
- 19:09So there is a 50X sort of data efficiency gap there according
- 19:14to that recent work. So that's one I think direction
- 19:17that people should increasingly pay attention to.
- 19:20And a different line is sort of putting emphasis less on the
- 19:24specific models, language models and retrieval models in general
- 19:29and more emphasis on your programme.
- 19:32So on your pipeline. He liked to draw an analogy to
- 19:37neural networks. When you're building, you know,
- 19:40we've all sort of now come around to or see Transformers as
- 19:46sort of this architecture that works in general and works
- 19:49really well. But for the longest time people
- 19:51were just exploring all these feedforward neural networks
- 19:55where you're composing a lot of layers together.
- 19:57Maybe you have like convolution layers, you have recurrent
- 20:00layers, you have linear layers and then you have all these
- 20:04transformations like dropouts and.
- 20:07Other activation functions and all that stuff and and clearly
- 20:11the power there in general is not in finding like one really
- 20:15great layer or optimising the parameters of a great layer.
- 20:18It's about the death and composing a network out of these
- 20:21modular pieces. And what we're saying is that
- 20:24increasingly in language model land, it's not about using GPT 4
- 20:28or the right or fine tuning with the right RMHC or whatever it
- 20:33is. It's really about building the
- 20:34right architecture for your target task and application and
- 20:38maybe down the line a general purpose one.
- 20:41And so that is where things like multi hop interactions come in.
- 20:47So the idea is we'd like to basically be able to build these
- 20:53higher level architectures where language models are simply
- 20:57devices that can execute these instructions, where the focus is
- 21:01not on, like prompting the model as carefully as possible with
- 21:07magical once or or or fine tuning it and you know the exact
- 21:11right way. It's really about breaking down
- 21:13problems so that this powerful contextual processor that we
- 21:21have can make sense of complex tasks.
- 21:24And that's where something like ESPY comes in.
- 21:26It gives you a programming model for programming these language
- 21:29models into pipelines. Dude, a lot to take in here.
- 21:34And of course I was stuck when you were talking about I was
- 21:40expecting you to have some word for the rag averse or something
- 21:44that you were gonna say these rags that we come on and the
- 21:48that's kind of the the way that we're looking at rags these days
- 21:51is through this one encoding the the whole document as a vector
- 21:57as opposed to this matrices that you're talking about.
- 21:59And so there, let's just harp on that point real fast.
- 22:04It's not, you're not saying that, OK, vector databases
- 22:07aren't going to be needed. You're saying that the way that
- 22:10we create the vectors and then throw them into the database can
- 22:13be fundamentally looked at in a different style.
- 22:17Right, that's exactly right. So you still, you still you
- 22:20still need some infrastructure to do the search and right now
- 22:24Colbert is an open source project that has that
- 22:28infrastructure. We've written a lot of papers on
- 22:30making it really efficient and both in terms of latency and
- 22:36storage costs and otherwise. But this is you know many, much
- 22:39of that is actually integrated in vector database called Vespa.
- 22:44I believe they are also open source and they have offerings
- 22:47that are commercial and you know maybe you can expect more in the
- 22:51in the future. In general though, this is this
- 22:57is a fundamental redesign of the search stack.
- 22:59But at the same time, from an end user standpoint, it's a
- 23:02black box. So it's the same.
- 23:04It's the same behaviour. You're sending search queries,
- 23:06you're getting back results. But the encoding of these
- 23:12documents is redesigned in such a way that our encoders, our
- 23:15language models, get to focus on representing documents
- 23:19contextually, as opposed to doing this combinatorial process
- 23:23of just trying to find representations in one fixed
- 23:26embedding space for, you know, entire documents.
- 23:29Yeah, which ultimately leaves a better end user experience
- 23:33because they're going to be getting more relevant and
- 23:36retrieved information and faster if I'm understanding correctly.
- 23:40It's not faster, but it's it's about as fast it is.
- 23:43The quality though that is that is that can be a lot better,
- 23:46especially in harder domains and domains with little data.
- 23:50No. OK, OK, cool.
- 23:51And I gotta ask before we move on to the next point around this
- 23:55system, because this ML hub or the like, the hub that you spoke
- 23:59about is incredible too with Burt.
- 24:03What is the reason for using Burt as opposed to now?
- 24:08There's been a tonne of new open source large language models
- 24:11that come out. Have you thought about trying to
- 24:14do stuff with those? Or is it that Burt is the right
- 24:17size and the right the right model because of the way that it
- 24:22performs? It's good, it works.
- 24:24It's smallish. So it depends which points
- 24:29you're asking about. If you're talking about like
- 24:31building pipelines of language models, birth birth can't really
- 24:34take you further. But if you're talking about
- 24:37modelling retrieval, so for example if you're talking about
- 24:40DPI, yeah, you gotta use Lama to or Mistral or GPT models.
- 24:47If you're talking about modelling search and in
- 24:50particular encoding documents for retrieval.
- 24:52Up until now, birth is both birth like models.
- 24:57I don't mean actual original. Birth are still both the right
- 25:01size and the right pre training and the right architecture
- 25:06combination. There has been some cool recent
- 25:09work that looks at like using lama two models for this.
- 25:13I'm not impressed yet. Wait, why not?
- 25:15Well, because I mean people release their artefacts and you
- 25:18can play with them and sort of see what's the trade off.
- 25:21And so you have these models that are.
- 25:23I don't know is that like 700 or whatever 70 times bigger, but
- 25:29they are like 2 points better on some benchmarks and so retrieval
- 25:35is a special problem because the emphasis is really on scale.
- 25:42Like you can throw all the kitchen sink at your problem and
- 25:47maybe get one extra point of quality in some cases.
- 25:50The the real the real deal is in things that could process, you
- 25:54know, millions of query queries over millions of documents in
- 25:58like 10 milliseconds or 20 milliseconds.
- 26:00Because you have a lot of concurrent users, you have a lot
- 26:03of documents and so you know, it's not the sort of thing like
- 26:08for, you know, reading the documents where you can read 10
- 26:13or 20 documents and get really great results.
- 26:15So it's a fundamentally different game.
- 26:17That said, I do expect that we will see you know more GPT style
- 26:23models entering the core. You know encoding and retrieval
- 26:28art of IR with higher quality fairly soon.
- 26:34And with that will that will that will spur is people who
- 26:38will start to think like, hey, how can we actually make that
- 26:40efficient, which is that cycle. You know that we see a lot in
- 26:44mill but especially in IR. That said, I think my bigger
- 26:50message is this specific model you're using for language
- 26:54modelling and to a large extent for retrieval isn't actually the
- 26:57key focus going forward. You still want to use the best
- 27:01components and we build a lot of the retrieval site there.
- 27:04So we'd like people to use it. But fundamentally it's really
- 27:08about how you bring these things together.
- 27:09And so, for example, you might have a limited retriever.
- 27:12But what a lot of the research is showing is that if you
- 27:15generate good queries for a fairly limited retriever, you
- 27:19could get around a lot of these limitations.
- 27:20And while you don't want to use a limited retriever, the bigger
- 27:25picture here is it's not about the representations, it's really
- 27:28about getting the right workflow.
- 27:31So if you're trying to maybe Fact Check a complex claim, you
- 27:36shouldn't expect this. You know, magical vector that
- 27:40can take any string you have and justice find all the right
- 27:42sources for you without any additional intent.
- 27:45You really should expect this pipeline that breaks this thing
- 27:48down, runs multiple queries, aggregates the results, compares
- 27:51the documents, and focusing on optimising the quality of that
- 27:55sort of thing is what I've been doing for the last year and a
- 27:57half or so. Dude, So again, it comes back to
- 28:02looking at it as a system, looking at it as a whole.
- 28:05And this is a perfect segue into that second part of this hub.
- 28:09Break that down more like, what does that look like?
- 28:12You kind of let us in. You did a little foreshadowing
- 28:15right there, right where you said, OK, let's if you're trying
- 28:19to Fact Check something, you might want to look at the
- 28:21pipeline this way. What are some other ways that
- 28:23you've seen pipelines being built so that they are more
- 28:26resilient and more reliable and just more able to do what we
- 28:31want them to do? Awesome.
- 28:34So maybe. This is a good place for a
- 28:36little bigger context O what we've seen over the last, you
- 28:43know, maybe seven or eight years or whatever it is that you want
- 28:47to start with a pre trained language model and then adapt it
- 28:50to whatever task you want to do. And adaptation for the longest
- 28:54time has been through fine tuning, which is this data
- 28:56intensive, complex process that needs a lot of expertise and it
- 28:59is fragile and slow ways. And then prompting came along,
- 29:04right. So that's maybe three years old
- 29:06and you know especially in the general form and and it really
- 29:11only started properly working like two years ago.
- 29:14So what we started seeing in 2022, especially an increasingly
- 29:20now is this notion of prompting techniques.
- 29:23So people have been you know researchers and practitioners
- 29:26and everyone interested in this space.
- 29:28I've been proposing these sorts of like conceptual ways of
- 29:32inducing behaviour from language models by talking to them in the
- 29:36right way. And so chain of thought is 1
- 29:39building agents React and self refine and all these cool
- 29:42things. Retrieval augmented generation
- 29:44through prompting is another here in this space.
- 29:49But increasingly I think people that are coming to the very
- 29:51correct realisation that that can only take you so far because
- 29:56the language models don't actually know everything.
- 29:59It's not about talking to them in the right way.
- 30:01It's a very fragile process. So increasingly what you want is
- 30:04to prompt model in the right way and stack them in the right way.
- 30:08So we're seeing things like if you want to generate SQL queries
- 30:12from your model, you don't just want to ask it with a nice
- 30:15prompt. You probably want to structure
- 30:17this into a process, and we're seeing research in that in that
- 30:19space that will handle different types of queries differently or
- 30:23will actually look at the schema and like the, you know, the
- 30:26parts of the database that you have and the columns that you
- 30:29have more carefully before it generates queries.
- 30:32And maybe it could great stuff and revise them or other things
- 30:37like that. We're seeing tonnes of this when
- 30:38it comes to retrieval. Lots of pipelines that sort of
- 30:42generate queries, edit them, find citations and all that
- 30:46stuff. So with these pipelines in their
- 30:51in the wild, what you actually see is that to implement them,
- 30:55researchers and open source solutions alike, what people do
- 30:58is they write strings, they sit down and they open up Python
- 31:02file or whatever JSON file and they start writing these kind of
- 31:06handcrafted prompts. They don't work.
- 31:08They edit them a little bit until it starts working for
- 31:10their favourite model and then they connect these pieces.
- 31:13They chain them to build these pipelines and that is bad.
- 31:19You know, that's bad for many reasons.
- 31:20First of all, super brittle. The language model changes under
- 31:23the hood. You get harder questions or
- 31:25different questions, the domain changes.
- 31:27Someone was working in a a general domain that wants to do
- 31:30biomedical stuff. Your prompts don't work anymore.
- 31:32So it's super brittle. But more importantly, it's also
- 31:36scalable. So every time you want to change
- 31:39this pipeline, are you going to edit all your prompts?
- 31:44And that's especially important in pipelines because if you are,
- 31:50if you have like 3 or 4 stages of calling the language model,
- 31:53you know this third stage doesn't have any labels
- 31:56inherently. It's just trying to connect the
- 31:57pieces. And so if the other, if the
- 32:00pieces around the change, there's no guarantee that
- 32:03whatever prompt you wrote initially is actually going to
- 32:06be the correct glue in between. So this is super brittle and our
- 32:10solution to that is sort of keeping the focus on building
- 32:14these architectures and building these pipelines but shifting it
- 32:18from kind of a hand tuning game of open-ended three form prompts
- 32:24to a more structured and automatically optimizable view
- 32:28of the world where give you modules And these modules are
- 32:33going to represent you know all of the conceptually clean
- 32:39prompting techniques that are out there.
- 32:40But they're actually well defined functions that have
- 32:44these parameters that can be optimised automatically.
- 32:46And so you can say I want a chain of thought module that has
- 32:50the following signature. Maybe the signature is it should
- 32:52take a question and some paragraphs and give me an answer
- 32:56for example. And that's all you specify.
- 32:58And then you can reuse that in your pipeline as many times as
- 33:01you want, you know in loops or in complex control flow.
- 33:04And once you're done, you can give it your data and say all
- 33:07right, please optimise my pipeline for my data given my
- 33:11language model under the following constraints.
- 33:14And that's something we know how to do automatically as opposed
- 33:19to just leaving that to the developer who now has to write
- 33:22all these strings. So it's just a significant step
- 33:27forward, I think, from writing prompts as the main way in which
- 33:32we build these systems, which I think is just a really bad idea,
- 33:36yeah. It's not prompt first, it's
- 33:37really workflow. And again coming back to the
- 33:40system first and thinking about it holistically, I'm going to
- 33:44just keep repeating myself because I like the way that you
- 33:46think about it. And I I see the pain every day
- 33:50in the MLS community, community when people are talking about
- 33:53how brittle those workflows are. And so that's one of the main
- 33:57reasons why I wanted to talk to you and you did gloss over
- 34:01something though that I want to go over and it's about stacking.
- 34:05Can you explain this this idea of stacking more?
- 34:10Yeah, so the general idea here, people call it stacking,
- 34:14chaining networks, programmes, but it's fundamentally the same
- 34:18thing. It's that you have this language
- 34:20model and for the longest time we thought of language models in
- 34:25NLP including fine-tuned ones as like these task specific
- 34:29Transformers. But now you can think of them as
- 34:32these devices that you can programme.
- 34:34And so instead of thinking, oh, I have a language model that I
- 34:39could use as a chat bot and I can ask the questions you really
- 34:42want to think of it as like, Well, I'd like to write a
- 34:44programme. I'd like to build a system that
- 34:46solves my task or solves my problem.
- 34:50What are these little sort of primitives that I'd like this
- 34:56model to softly implement? And that any unique thing here
- 35:01is that for a lot of things that are fuzzy, for a lot of
- 35:05computations that are fuzzy, you want to work with.
- 35:07You don't want to work with strings and integers.
- 35:09You want to work with questions and answers and messages and
- 35:12queries and SQL queries. And as opposed to, I don't know,
- 35:17JSON output and all these sorts of things where there is some,
- 35:22you know, limited hard constraints on them.
- 35:25Like Jason, valid JSON versus invalid JSON is a is a pretty
- 35:28hard constraint. But fundamentally though it is
- 35:31fairly fuzzy. Like what is the right, Jason to
- 35:34have? That's not the thing you could
- 35:36just easily automate the check of and so stacking language
- 35:40models into fairly complex pipelines, basically arbitrary
- 35:44code, maybe recursion or loops or whatever.
- 35:46But we're language models are responsible for these fuzzy
- 35:49computations that is the world that we're moving towards
- 35:54increasingly. And our sort of big message is,
- 35:59yes, we should move there, but that shouldn't be done through
- 36:02prompting, it should be done through programming model that
- 36:06sort of codifies and standardises the way we interact
- 36:10with these things such that we can automatically compile them
- 36:13or optimise them. Yeah, so if I'm.
- 36:15Understanding this correctly, really it's like trying to
- 36:18change the chip in my mind or anyone's mind who who's
- 36:24listening as to, hey, we're not just going to hit GPT 4 and
- 36:28expect it to do everything because we magically came up
- 36:31with the perfect prompt that solves all our problems.
- 36:35We need to look at how we are going to be trying to.
- 36:40Almost constrain these different large language models to where
- 36:46they are doing the one thing that we're trying to get done
- 36:51and like you said it's it's the building blocks that we can
- 36:53stack stack on top of each other.
- 36:56The in my getting that right First off and next I guess I'll
- 37:01ask you a question just to make sure I'm clarifying that and
- 37:04yeah you are you. You're exactly right.
- 37:06So the focus now is like, what is the workflow, what is the
- 37:09code that can solve this problem, and which are the
- 37:12little hard arts that they actually couldn't just easily
- 37:14write myself in Python? And how do you know what is the
- 37:17right signature there and what is the right module to ask a
- 37:21model to do that? But the focus is on your entire
- 37:24workflow, so this could be just Python or I don't know,
- 37:29TypeScript or whatever it is, and the language model is just
- 37:31handling these relatively well defined or much better defined
- 37:35now pieces in that bigger workflow O.
- 37:39You're not going and saying to the language model, hey do XYZ
- 37:44and expecting the auto GBT to bake you a carrot cake because
- 37:49it says OK well 1st I'm going to buy carrots and then I'm going
- 37:52to get them ordered to your house and then I'm going to have
- 37:54the robot machine cut the carrots and put it into with
- 37:57some flour and stuff. It's realising that large
- 38:02language models have a function that you can give them and they
- 38:05are really good at playing with, as you mentioned, fuzzy things
- 38:11that aren't so clear and aren't as well defined as something
- 38:18that you could just code with Python or any other language.
- 38:22And so the more that you're able to just plug it in to your
- 38:26pipeline and recognise that we're only going to have it do
- 38:30this one thing and that's all we want.
- 38:32And then we move on to the pipeline.
- 38:34And maybe the next step in the pipeline is something that's
- 38:37just hard coded and there's no machine learning or AI or
- 38:39anything involved in it. And then the next step in the
- 38:43pipeline might be a new set of large language model calls that
- 38:47you're doing. And so you get to construct that
- 38:49because you're the architect of that pipeline.
- 38:51And my one thing is that automatically comes up is how it
- 38:59seems like we could get a really expensive bill coming in because
- 39:03we start to really like modular lot module.
- 39:07I don't know how to say that word, but we could make a lot of
- 39:11calls to large language models and then recognise like, oh man,
- 39:15I have to be smart about how I'm using these large language
- 39:19models calls because it's starting to get expensive.
- 39:22Have you seen that? Like have you have you
- 39:24recognised like, ohh, yeah. Well, now that I've got this
- 39:26pipeline, I could do anything. And then next thing you know in
- 39:30one pipeline you're making like 20 calls.
- 39:33Yeah, of course this is something that we this is a
- 39:35central concern that we tackle. So the key observation here to
- 39:40keep in mind is that when you're building these pipelines,
- 39:44there's 2 dimensions to this. The 1st is pipelines inherently
- 39:49require a lot less complexity from the language model.
- 39:51When you're breaking things down the individual steps, they
- 39:54almost never need GT4 for the full pipeline.
- 39:57There's at most in a typical pipeline, there's at most 1 coal
- 40:01that actually needs to go to a really powerful language model.
- 40:03And that's because most of the steps are, hey, let's break this
- 40:06thing down, let's put these things together, and that's not
- 40:10that hard. The second thing which is a lot
- 40:12more important, is that these pipelines are optimizable.
- 40:15So when you say I want the chain of thought module.
- 40:18MSI. What that means under the hood
- 40:20is I want this thing to actually teach my language model how to
- 40:24solve this step of my pipeline by thinking step by step.
- 40:28So this is not like inserting in the prompt.
- 40:31Let's think step by step. It's actually hey, can it
- 40:34internally come up with a few short examples that show
- 40:37whatever model it is, how to think step by step for my task?
- 40:40So that could be by few short prompting or it could be through
- 40:42fine tuning. And that's all done internally
- 40:44in the programming model in the spy.
- 40:47And so actually happens is when you're compiling programmes like
- 40:51this, you can make them really small in terms of the models
- 40:54they use. Like we can go like the FLAN T5
- 40:57lawyers for example, which has 700 million parameters, million
- 41:01not billion, right. So you're going to things that
- 41:03are, you know, maybe a thousandfold smaller than GPT 4
- 41:06or even smaller. And and because they're working
- 41:10at the granularity of like I want to solve this one step, not
- 41:13like this overarching task. And because they're sort of
- 41:17compiled on your data with your model and automatically you can
- 41:22actually get pipelines that are a lot cheaper than calling a
- 41:24model. And this is this is where this
- 41:27really ends U connecting all of these pieces.
- 41:31Dude, well, we've gotta go into what I brought you on here to
- 41:35talk about this beat or DS pie, as you like to call it.
- 41:38I'm gonna call it this beat because that's what I had in my
- 41:41mind before you showed up. But the give us the breakdown.
- 41:45I mean, you've showed a little bit of it, but now like Open the
- 41:51Corona, what exactly is it there?
- 41:53Are these modules and modules I'm kind of thinking of as
- 41:57templates that we can use as a nice starting point and then we
- 42:02can tweak those. Is that how we should look at
- 42:05them or should it be a little bit different?
- 42:08I think it's a little. Different.
- 42:10So let me tell you the way things are done now and what
- 42:12people mean outside of the spy when they talk about modules,
- 42:15just for context. And this is probably familiar to
- 42:17many in the audience. So if you go to a, you know a
- 42:20another library for building with language models, they'll
- 42:24have modules. But these modules are going to
- 42:26be things like the module that generates queries for SQLite,
- 42:31and there's a different one that generates queries for MySQL.
- 42:34For example, there's a module that does self ask.
- 42:39There's a, which is a particular kind of workflow for working
- 42:42with search engines. There's a module that does.
- 42:45Let's see particular type of rag in DSP, that's not the
- 42:51granularity of the modules that we have.
- 42:52And the reason for that is if you go and look at these modules
- 42:55in the libraries that provide this type of thing, that's
- 42:58basically a wrapper around the prompt or two and then some kind
- 43:03of tool use that allows the language model that they built
- 43:06this around to conduct that particular pipeline.
- 43:12And so it's really helpful if you just want something off the
- 43:15shelf that you can stack with other pieces.
- 43:18But if you want to build your own workflow and have a lot of
- 43:22control over it, it's not actually that helpful because
- 43:24you will have to open it up, start changing that prompt the
- 43:28moment things go slightly wrong. In the ESPY our focus is on
- 43:32finding the right modules and the right primitives that are
- 43:36task independent and in fact task adaptive.
- 43:39One way to think of this is how the neural network sort of
- 43:42development process and how frameworks around that have have
- 43:45sort of developed. We think we take them for
- 43:47granted now, but you know this stuff actually took a while to
- 43:51reach a consensus. So the idea here is I don't want
- 43:54my modules to be. Here is a pre trained resnet and
- 43:57here is a pre trained birth. I want my modules to be.
- 44:01Here is layer that I can reuse and train for each task
- 44:06differently. So in our case, for example,
- 44:08prompting techniques, our modules and.
- 44:10So if you want to do a chain of thought, that's a module.
- 44:12If you want to do a programme of thought, that's a module and
- 44:16that is not a task specific thing.
- 44:18A programme of thought module just says I want the model to
- 44:21solve a particular subtask by generating code and executing
- 44:25that code and then interpreting the output of that code.
- 44:28That's a very general process, and the way it works in DSPI is
- 44:31that you are going to declare whatever modules you're going to
- 44:35use. So there's a bunch of built-in
- 44:36ones. You can easily add new ones by
- 44:39using existing modules to build bigger modules.
- 44:41And these modules, what makes them really general is that they
- 44:44take this thing called the signature.
- 44:46So a signature is just a specification of the input
- 44:49output behaviour. You can think of it as a prompt
- 44:51that is not written in around hundreds of words, but is
- 44:54written around, you know, 3 or 4 words.
- 44:58And so that's basically a function signature that says
- 45:00something like alright, for this module what I wanted to do is to
- 45:04take a long document and give me a summary or and that's
- 45:07literally it, like long document summary, or it takes a question
- 45:11and maybe some paragraphs and gives me a response or whatever.
- 45:16You know gives takes an English thing and gives me its German
- 45:19translation. And this is just trying to
- 45:21specify the input output behaviour there, because you
- 45:24want to be able to interact with this thing as a function.
- 45:26So just as with a normal function signature, you might
- 45:29say I should give you a list and you give me a string.
- 45:32That's the type of signature that we have here, except that
- 45:34the types themselves are specified in natural language.
- 45:38Once you've done that and you give that to the module, you
- 45:40have this function that the module gives you that you can
- 45:44call. So if you call the module that's
- 45:46a chain of thought that answers questions, you give it a
- 45:49question. Internally it does a train of
- 45:51thoughts I think, step by step, and it gives you an answer.
- 45:54And by declaring several of these modules, you can start
- 45:58writing your code in any way you like.
- 45:59You could have like recursion and loops and exceptions where
- 46:03you are calling these modules in the right places of your code
- 46:06and they're acting as these sorts of language model
- 46:11computation devices that you can call at the appropriate places
- 46:18and that gives you a programme. Now the third and the last.
- 46:21And the key thing in DSPI that makes all of this work is that
- 46:25once you've written your programme, you can compile it.
- 46:27And by then get means, hey, I have, you know, I'm actually
- 46:31working in some context. So there is some data I work I
- 46:34want to work with or I want to process, you know, my internal
- 46:37database or whatever it is. And what the compiler is going
- 46:40to do is it's going to say, oh, you have 3 modules, like you
- 46:42have this chain of thought module, you have this programme
- 46:45of thought module, whatever. You have this other agent that's
- 46:48right there and you're using them in this pipeline on this
- 46:51data. Each of these modules has some
- 46:53parameters that I can optimise. So in particular, each of these
- 46:56modules is actually sending a prompt to to a language model
- 46:59that Prompter 2 is not something we wrote.
- 47:01Like if you open the SPA, there isn't a single prompt in the in
- 47:03the code base. These prompts are going to be
- 47:05generated. It's through an algorithmic
- 47:07process that is going to call the language model on your
- 47:10pipeline, like execute your pipeline on your data several
- 47:13times, potentially with high temperature, and it will keep
- 47:16track of successful traces through each module.
- 47:20So every time it goes through a module, it sees.
- 47:22Oh, when I called it with these inputs, I got these outputs and
- 47:25ultimately it passed all the constraints.
- 47:29So I I had a metric that I wanted to maximise and that it
- 47:32raised my score. It will cache those and it will
- 47:35basically be able to reuse it later after compilation in such
- 47:38a way that the whole pipeline maximises its metric.
- 47:44O Basically we've taken this prompting technique that is
- 47:47right now an idea that you can sort of sit down and type as a
- 47:51string. And we've said, well, what are
- 47:54the parameters of this idea? Well, there are a few short
- 47:56examples. No one is going to give us
- 47:58those, but we can generate them through the pipeline itself.
- 48:01So we can bootstrap them and maybe some instructions and
- 48:04other pieces and we've converted into like OK, how can we
- 48:07optimise these pieces automatically so that you're
- 48:10just focused on when I use this module with this signature in
- 48:14the in this workflow and you know you just compile it with
- 48:18your favourite data and language model without sort of hand
- 48:21engineering like data labels for all these stages or prompts for
- 48:25all these stages etc. And what that gives you is that
- 48:29compiling takes the same workflow that you wrote and you
- 48:32can actually map it to fundamentally different and
- 48:34powerful things. For example, the same code that
- 48:36you write could be a zero shot prompt to GPT 4 because you want
- 48:40to keep your prompt short or a few short prompt to Loma two
- 48:43that has like several samples and it's very careful about how
- 48:45to optimise that so that Lamma 2 understands your task.
- 48:48Or a fine tune of local language models that are small, like flat
- 48:53five that is under a billion arbiters in size.
- 48:56And it's the same code because fundamentally you're just saying
- 48:59I want the module that asks this language model to solve the task
- 49:04that has the following structure by thinking step by step.
- 49:07So the key thing here is that with an abstraction like this
- 49:10these modules are highly declarative.
- 49:13And so when I say they want a chain of thought module, that is
- 49:18going to take maybe a document and give me a summary through
- 49:22thinking step by step. As far as the compiler is
- 49:25concerned, you are free to specify that you want to do this
- 49:28by compiling into short zero shot or one shot prompt for GPD
- 49:354 because you want to keep the prompt short because it's
- 49:37expensive. Or a long few short prompt for
- 49:41llama to, for example, you know 7 billion because that's you
- 49:45know, cheaper. But also you want to give it a
- 49:48complex enough prompt that shows exactly what you want.
- 49:51Or by fine tuning a small model, like a model with hundreds of
- 49:57millions of parameters, not billions, so that it follows
- 49:59that task. And I think this is something
- 50:01that really surprises people a lot and is a key strength.
- 50:07And ESPY is that there's no difference between prompting and
- 50:10fine tuning when you're not doing either.
- 50:12You're just saying, I want this module that has these pieces and
- 50:16I want to interact with the language model, you know at
- 50:19these intersections of my code to solve the following sub task.
- 50:23Doing that through prompting or fine tuning is almost equivalent
- 50:26at that point when you leave it to a compiler.
- 50:28Because in both cases what the compiler is going to do is it's
- 50:31going to simulate your pipeline on a lot of examples and it's
- 50:34going to keep track of inputs and output behaviour of each
- 50:37module and in particular cases that are actually effective.
- 50:41And with that you could either fine tune the model on those
- 50:44inputs and outputs or prompt it with them, or you could even do
- 50:47like learning based on preferences.
- 50:49You could say like this output is better than that one.
- 50:51We're not doing this at the moment, this last one, but it's
- 50:54a very easy extension. So it is basically an
- 50:57abstraction that takes us to a different way of thinking about
- 51:01interacting with language models.
- 51:04So this compiler idea is fascinating to me because it
- 51:07reminds me of basically how you get to a point in time and then
- 51:11boom, there's infinite options. Almost.
- 51:14I mean not infinite, but you get many different options where it
- 51:17explores what is the best route. Here.
- 51:20Let's just go and really explore our options and change the
- 51:24temperature, change all the turning, all these knobs and
- 51:28then you see which ones are coming out and which ones are to
- 51:33the liking of the end user I guess.
- 51:36Or is it to the liking of the actual model and?
- 51:41So these, these ideas are sort of all subsumed here, but the
- 51:45way in which we make it, I think this is also a key contribution.
- 51:49The way in which we make this whole thing tractable is by
- 51:52analogy to neural networks. So when you have a neural
- 51:55network, it has a gazillion parameters.
- 51:58You don't generally sit down and think.
- 52:00It's not even tractable to sit down and think, what should I
- 52:03set all of the weights to today, right.
- 52:05You say, well, what is my loss function?
- 52:07What am I trying to optimise this network for?
- 52:10You say what is the architecture?
- 52:11Google, I gotta decide the layers and how large they are
- 52:14for example. And you also say what is my
- 52:16optimizer. So different optimizers can have
- 52:18fundamentally different behaviour, like they want to do
- 52:20basic SGD, they want to add some momentum or add them or
- 52:23whatever. So the same thing is the message
- 52:26we're pushing here. You are going to decide your
- 52:29workload, your workflow or your programme.
- 52:32No one is going to, it's all automated.
- 52:33You still need to decide that code, but it's going to be like
- 52:3615 lines of code, 20 lines of code.
- 52:38And then you are going to have to decide what are you
- 52:41optimising, like what are you optimising for.
- 52:43So you need a metric, you know, I mean, are you trying to get
- 52:46the answers to be correct? What does it mean for the answer
- 52:48to be correct? That that itself could be a
- 52:50different programme that you just use off the shelf or that
- 52:53you write yourself that determines that process.
- 52:55And now that you have a programme and a metric, you need
- 52:58to pick the right optimizer from what we are, what we provide.
- 53:01Or you could write a new one if you want.
- 53:03And the combination of these three pieces over your data and
- 53:06your language model is going to hill climb in the right way.
- 53:09So for example, one particular optimizer, we go, we go we call
- 53:14these teleprompters because they do prompting at a distance.
- 53:17O1 particular teleprompter is called bootstrap view shot with
- 53:22opportuna. O what that's going to do is
- 53:24it's going to simulate your pipeline on a bunch of inputs
- 53:29and then it's going to keep track of the full traces through
- 53:32all the modules whenever the metric, your metric likes the
- 53:36output. So likes the output could mean
- 53:38hey the answers are right or it could mean I actually don't have
- 53:41labels at all. But the answer is fulfil the
- 53:43following criteria as tested by other DSM 5 programme, when it
- 53:48when it finds those outputs, it'll basically cache them and
- 53:51then it will go back in the pipeline and say oh what if I
- 53:53used one or more of these as psot examples in each of the
- 53:57modules. Does the average score go up now
- 53:59as far as my metric is concerned and that is an automatic
- 54:03optimization process. In fact it's like a
- 54:04hyperparameter search that an off the shelf thing like
- 54:07opportunity in this case could run a sophisticated sort of
- 54:12discrete search algorithm under the hood, you know, can optimise
- 54:15this process, but there's a lot of other teleprompters that are
- 54:17already there or things that we're adding O you know there
- 54:20are teleprompters that are based on fine tuning.
- 54:23So you're not trying to update the few shot examples, you
- 54:27actually trying to update or basically update the weights of
- 54:30a smaller language model in order to conduct each of these
- 54:35steps that are modules. And the idea is not that your
- 54:40first attempt will be this perfect programme that is
- 54:43infallible. It's really more like we give
- 54:47you the the way to iterate, right?
- 54:49So you build this programme, you test it prompting.
- 54:52It works well, but it's too expensive.
- 54:53Try fine tuning. It works well in most cases, but
- 54:56it's making a consistent Tye of mistake.
- 54:58Well, you have two well defined options, or at least better
- 55:01defined options. Do you want add an exception in
- 55:04your code that deals with that edge case?
- 55:06Or do you want to add you want to change the module that you're
- 55:10using here to a more resilient module?
- 55:12Or do you want to change the metric so it catches those
- 55:15errors and optimises them away? Right now I think what is
- 55:19happening in practise is a lot less structured than this.
- 55:22Is that oh, I'm seeing a mistake.
- 55:24Maybe if I did this prompt in just the right way or wait for
- 55:27the next update to GPD 4 maybe things will be better.
- 55:30Or if I get the bigger pay for the bigger model, maybe I'll
- 55:33just solve my problem and we're saying, you know, you actually
- 55:37have a lot of options and we can structure them.
- 55:39It's so funny because. Earlier this week I was thinking
- 55:42about how fine tuning, I think it's thrown around a lot by
- 55:45people because it's like as a last resort, it's like, damn,
- 55:49my, my rag isn't working. And so it must mean that I have
- 55:53to fine tune this and then maybe what I want to happen will
- 55:57happen, you know, and hopefully a lot of people out there.
- 56:00That's not the case. But I do feel like I've seen
- 56:03that enough to where it's like people are scratching their
- 56:06heads and they're trying to do exactly what you're talking
- 56:09about, where they're using the framework and they're saying,
- 56:12hmm, I guess I gotta like tweak this prompt to our guests like
- 56:16they're trying to debug why it's not actually coming out with
- 56:19what needs to come out or what they're hoping for.
- 56:23And it's really not as granular as you're you're talking about.
- 56:27And it's really kind of just like throwing spaghetti at the
- 56:30wall, right? And and.
- 56:31And I think a lot of that spirit is needed.
- 56:34Like that debugging mindset is good, but you want to have some
- 56:39structure to it. And I think your example on fine
- 56:42tuning is great because maybe fine tuning is the answer for
- 56:45you. But do you really want to work
- 56:47in an abstraction where fine tuning is a complete revamp of
- 56:50everything you've done, where you throw it away and you start
- 56:53from scratch to build this fine-tuned that may or may not
- 56:55even work? Or do you want to work in an
- 56:57abstraction where it's just the same code, just flip out the
- 57:00teleprompter from the one that's doing future learning to the one
- 57:03that's doing tuning and test it out?
- 57:05I mean, maybe it doesn't work right away, but you didn't
- 57:07didn't cost you anything. And in terms of complexity.
- 57:10And maybe you know what you want to do is a different
- 57:12teleprompter that does a different type of fine tuning.
- 57:15And so adding structure into this space and thinking about it
- 57:18as an optimization problem helps a lot with the problems that you
- 57:24just brought up. Dude, it's funny because I was
- 57:27on a podcast a while back to and I was talking about how fine
- 57:31tuning is a lot more of a headache than most people think.
- 57:35And it is something that you probably don't need.
- 57:39Because just with the normal and what I understand now is a
- 57:43simple rag, it's usually good enough and it's like you can go
- 57:51really far with a simple rag, right?
- 57:54You can get it really far. But then people again like to
- 57:58think that Ohh and I gotta fine tune this and I want to figure
- 58:02that out. And so like I'm I just need to
- 58:05throw some data at it. But people don't think about how
- 58:07much work goes into a like gathering the data and cleaning
- 58:12the data and getting all that data, like preparing it for the
- 58:15fine tuning and then the cost of actually like fine tuning it,
- 58:20right. And so in one way, potentially
- 58:22our minds have been tainted because we had stable diffusion
- 58:27before we had fine tuning on LM and we were like ohh, stay fine
- 58:31tuning. Stable diffusion is just like a
- 58:33Google collab, you know, like I can throw a few photos of myself
- 58:37in there and then boom, I prompt it with my name and I've got
- 58:41this incredibly fine-tuned text to image model and it works
- 58:45pretty well. But then when you try and do
- 58:48that same fine tuning on a large language model, it's not exactly
- 58:52one to one comparison at all, right?
- 58:54But what you're talking about here, I think is is fascinating
- 58:58because I love the idea of how you want to make sure that fine
- 59:03tuning in DSP does not allow you to forget about anything that
- 59:11you've already created. In fact it's it's a way to
- 59:13augment what you've already created so that you're able to
- 59:17say, OK, well it's not really working with my rag.
- 59:21I've tried all these different things.
- 59:23I've tweaked it. I feel like I could get there.
- 59:25But as that next step you say, I'm going to try and fine tune
- 59:30it and see if that works and you do understand it's it's much
- 59:34more. Again, it's a much more modular
- 59:36way of looking at a whole system as opposed to going in and
- 59:40trying to figure out if that prompt that's been hard coded
- 59:43needs a little tweaking. And then if it does get tweaked
- 59:46and you figure out, you have to dig through documentation after
- 59:50documentation to find that prompt that is at the bottom of
- 59:53it's the needle in the haystack. And then you say, OK, well you
- 59:56know what, Now I'm I can tweak that prompt and then it doesn't
- 1:00:00actually come out better. Yeah, that's exactly right.
- 1:00:04And I think to your point about the hard coded prompt, people
- 1:00:08are doing a lot of hardcoded fine tunes too.
- 1:00:10And that's also bad when you're fine tuning in D and this is
- 1:00:14just a general message, even if someone doesn't use DY, at the
- 1:00:17end of the day the key artefact you're producing is your system.
- 1:00:20Your system might use one or more fine-tuned models.
- 1:00:23These models are not your system, they're just sort of
- 1:00:26processing parts of the kind of components or the modules in
- 1:00:30your system. So when you're fine tuning in
- 1:00:32the ESPY, actually you're not fine tuning the programme.
- 1:00:35The programme is still there. It's just that every time it's
- 1:00:38going to call the language model, it's going to call an
- 1:00:40appropriately fine-tuned language model.
- 1:00:42O That's the an important kind of shift from the way you know,
- 1:00:46in general, as you've said, people are thinking about these
- 1:00:48fine tunes as these kind of end to end solutions, which they're
- 1:00:52not. Yeah, well, I I love the
- 1:00:55versatility on this too, how you don't get trapped into one
- 1:01:00workflow for one model for one use case.
- 1:01:04It's really generalizable in that way.
- 1:01:06And Speaking of generalizable things, I think I would be
- 1:01:10remiss to not ask your opinion on agents and how your
- 1:01:16experience with them have been and what you've been up to in
- 1:01:19that realm, because it feels like this very much is to help
- 1:01:24move the ball forward in that space.
- 1:01:27I think agents are a good idea and if they were great, I would
- 1:01:32have said great Agents or workflows.
- 1:01:35They are just programmes like any other except that they
- 1:01:38usually have a loop and they sort of their modules are making
- 1:01:44decisions about coding tools. So they're just like any other
- 1:01:47type of programme. And so we've written agents in
- 1:01:49DSPI. You can compile agents in DSP
- 1:01:52because they're just programmes. The thing about agents is that
- 1:01:56it's kind of like we just this is an analogy, so hopefully
- 1:02:00people can sort of follow along. It's kind of like we just
- 1:02:02discovered neural networks and the first thing we wanted to
- 1:02:05build is the right Transformer architecture.
- 1:02:07But we have no clue what convolutions are, are, what
- 1:02:10attention is what anything is. We're just kind of jumping right
- 1:02:13away to build the GPS of neural networks.
- 1:02:17But in the land of language models, meaning agents are this
- 1:02:20general purpose architecture that is supposed to be able to
- 1:02:24solve all kinds of tasks in the general purpose way.
- 1:02:27But as a community, we still actually haven't fully figured
- 1:02:30out how to solve individual, well defined tasks.
- 1:02:32First, jumping into agents at this point is someone needs to
- 1:02:37explore. I'm not against exploration at
- 1:02:39all, but from a deployment standpoint, 90% of things that
- 1:02:43you're that people are doing don't need agents and are going
- 1:02:46to get better performance if they don't use agents.
- 1:02:49That said, I'm all for exploratory science and research
- 1:02:55and just development in general. And agents are just programmes,
- 1:02:59they're just workflows that you can compile.
- 1:03:01So if you're going to build an agent, don't write the prompts,
- 1:03:05select your modules, connect them in the right way and
- 1:03:07compile appropriately. You might get a fine-tuned
- 1:03:09model. You might get a sort of sequence
- 1:03:12prompts that optimises your agents for the actual goals that
- 1:03:16you care about now. One thing that this will make
- 1:03:19clear is for some cases a lot of the exploratory, exploratory
- 1:03:24research or just discussion around this is so open-ended
- 1:03:27that it's not actually trying to optimise for any metric.
- 1:03:30So if you want to build this agent that could do everything,
- 1:03:33I think a programming abstraction like DSCI at least
- 1:03:36makes it very clear what you are optimising for.
- 1:03:39Or if you're not really optimising for anything in
- 1:03:41particular. At least that's a decision that
- 1:03:44you'd have to be making, which I think is is still valuable as an
- 1:03:48exploratory thing, but maybe not really for deployment.
- 1:03:52I love this. Conversation that we've been
- 1:03:54having. I love that you came on here and
- 1:03:56you talked to me about all of this and you explained DS π in a
- 1:04:00way that was very understandable for my thick skull.
- 1:04:05Right. And I appreciate you doing that.
- 1:04:07Yeah. Thanks for thanks for.
- 1:04:08Inviting me it was. It was great chatting, chatting
- 1:04:11about this with last question I got.
- 1:04:13For you is if you weren't doing the work that you're doing now,
- 1:04:16where would you be focusing your time and energy?
- 1:04:19And I'm mainly thinking about in the AI sphere, like if you
- 1:04:23weren't working on DSI, what other or retrieval, right?
- 1:04:26Where would you be looking? Yeah, so my time.
- 1:04:28Is spent 5050 between these two? If I wasn't doing the spy, I'd
- 1:04:32definitely go all in on on building better retrieval
- 1:04:35models. If I'm not doing either, I know
- 1:04:39what I will not be doing. What I will not be doing is
- 1:04:41trying to build better language models because I think I think
- 1:04:44it's all in the system architecture.
- 1:04:46But yeah, if I'm not doing this I I'd be releasing colder V3
- 1:04:50sooner rather than later. Incredible.
- 1:04:54And there's no plan right now. I mean to go and make a run at
- 1:04:59it with DS Pie and create some company around it, No?
- 1:05:04There, there are no such plans. This is open source research we
- 1:05:07want. We definitely want to keep it
- 1:05:09around. This is, we're looking at this
- 1:05:10as like the pie torch of this new language model space.
- 1:05:13And so we want to support all kinds of innovative abstractions
- 1:05:17and research and development, and we certainly want to keep
- 1:05:21this around for years. But no commercialization plan.
- 1:05:27Incredible. Well, Omar, man, thank you for
- 1:05:29coming on here. We'll end it there, dude.
- 1:05:31Yeah. Thanks A.
- 1:05:32Lot.