AI Agents and Data Integration with GPT and LLaMa with Jerry Liu - #628

8 May 2023 · 41 min

Ask about this episode

Ask anything about it. ChatGPT or Claude reads this page and answers with the times it was said.

Connect VO and ask about every podcast you hear, including the moments you saved. Add to ChatGPT · Add to Claude

In short

Podcast Summary: The TWIML AI Podcast Episode #628

Episode Title: AI Agents and Data Integration with GPT and LLaMa Host: Sam Charrington Guest: Jerry Liu, Co-founder and CEO of Llama Index Release Date: [Insert Date]

Overview In this episode of The TWIML AI Podcast, Sam Charrington interviews Jerry Liu about Llama Index, a platform designed to connect external data sources with large language models (LLMs). The discussion covers challenges in integrating private data, the role of agents in automation, and advanced techniques like summarization and semantic search.

Key Topics Discussed

  • Introduction to Llama Index
  • Central mission: Connect data to language models, enhancing decision-making capabilities.
  • Origin story: Inspired by personal need to automate tasks using GPT-3 and internal company data.
  • Challenges of Data Integration
  • Difficulty of feeding private data into LLMs due to token limits and data structure.
  • Different modes of inserting knowledge into models (e.g., embeddings, vector databases).
  • Agent Abstraction in Automation
  • Evolution of the agent abstraction space and its role in optimizing queries over complex data.
  • Definition of agents as automated decision-makers that interact with data tools.
  • Advanced Query Processing
  • Combining summarization with semantic search.
  • Need for a decision-making layer to route queries to appropriate data sources.
  • Potential for multi-step reasoning and synthesizing information from various sources.
  • Future of Data Systems with LLMs
  • Predicted simplification of data stacks as LLMs improve.
  • Importance of hierarchical agents working together to process queries and optimize data usage.
  • Ongoing research on combining structured and unstructured data for better insights.

Key Takeaways

  • Llama Index as a Tool:
  • Acts as a middleware to integrate various data sources with LLMs efficiently.
  • Focused on providing users with customizable building blocks for data structuring.
  • Impact on Data Engineering:
  • Anticipated shift from traditional ETL processes to automated, agent-driven systems.
  • Potential for LLMs to facilitate better insights from unstructured data.
  • Emerging Use Cases:
  • Early adopters are already using Llama Index to interact with diverse data types, including video and web scraped data.
  • Users are moving beyond basic semantic search to more interactive reasoning over data.

Conclusion Jerry Liu envisions a future where Llama Index can help simplify the complexity of integrating LLMs with enterprise data, emphasizing the importance of automating decision-making processes. The conversation highlights the immense potential of LLMs in transforming how organizations manage and utilize their data.

For more information about the episode and related topics, visit [twimlai.com/go/628](http://twimlai.com/go/628).

---

This markdown file captures the essence of the podcast episode, outlining the major themes and discussions while highlighting important points for easy reference.

Written by AI. May contain mistakes. Listen to the episode to check what was said.

Hear the part that matters, and keep it.Open this episode in VO. Double tap your headphones to save a moment as you listen.
Get VO free

Transcript

Automatic transcript. May contain errors.

0:07All right, everyone, welcome to another episode of the TwiML AI podcast. I'm your host, Sam Charrington. And today I'm joined by Jerry Liu. Jerry is co-founder and CEO of Llama Index. Before we get into today's conversation, be sure to take a moment to head over to Spotify or your listening platform of choice. And if you enjoy the show, please leave us a five-star rating and review. Jerry, welcome to the podcast. Thanks, it's super great to be here. And thanks for having me, Sam. Yeah, I'm really looking forward to digging into this conversation. Of course, LLMs are on everyone's mind right now.

0:41And as someone who's keenly interested in platforms and enabling technologies, like the questions around all the infrastructure that we're going to need to build to adequately support LLMs, particularly in enterprise-type scenarios, is really interesting. And you founded one of the early open source projects in the space. So I'm looking forward to exploring that with you, as well as kind of your general take on the space and what you're seeing. But before we dive into that, I'd love to have you share a little bit about your background and how you got here. For sure. Yeah, happy to chat about this.

1:16So I started Llama Index back in November. Before that, I spent two years at Robust Intelligence, leading the monitoring team in ML, back when we were thinking a lot about the ops stack for the traditional machine learning pipelines and workflows. And then before that, I spent two and a half years as a research scientist at Uber. And then before that, I was a machine learning engineer at Quora, working on recommendation systems. So I've had a bit of experience in both industry research, as well as at startup. And fundamentally, that's kind of the intersection of my interests as well. And so it's cool to see all these things come together, especially with both excitement and LLMs, as well as the huge wave of new startups are popping up at every layer of the stack, from the tooling layer to the application layer to the foundation model layer to the data layer.

2:01And so I'm super excited to share some of my thoughts in this space. But I would say I've been interested in generative models for a while. I first discovered GANs back in the day, back in 2016, 2017, the things that generated like small pictures of bedrooms and animals and faces. That was actually probably one of the first things that got me interested in AI in the first place. I thought it was magic. I looked at the 64 by 64 pixels of a bedroom and I thought, wow, this is really cool. And I want to dive in a bit more into this. And that motivated some of my interest into getting a bit more deep into the research side of things as well.

2:36And so kind of been tracking language model progress for a few years now, but haven't really kind of thought about fully how to really interleave language models with the rest of the application ecosystem until relatively recently. And this was one of the main impetuses for Lama Index. Well, I'd love to have you start out by describing Llama Index and what you're hoping to achieve with it. I think I initially came across it, I guess, a little bit in the context that I mentioned. But specifically, I want to say early on, but this is really only a few weeks ago. Like, you know, there was ChatGPT and then everyone was like, OK, how do I create ChatGPT for my stuff?

3:14And one of the tools out there that seemed to be kind of positioning around that niche was Llama Index. in particular as a way to kind of tie language model to existing data stores. Tell me about how you kind of arrived at that as a direction and describe it all in your words. Exactly. Yeah. The central mission of Lama Index is to connect your data to language models and to really tap into all the capabilities of language models and utilize them on top of your own private sources of data. I can trace the origins of Lama Index. And we started with a bit more of a smaller scope, and very much more as kind of like a fun tool to play around with and to solve a more specific problem.

3:59So the background is that back in November, I was trying to build a sales bot, basically. And I started playing around with GPT-3, I thought it was really cool. And then I wanted to use it on my internal company data. And one of the first use cases I thought about was, we have a lot of these like customer conversations, I was part of some of our customer calls, how can I use this technology to basically synthesize a to-do list for me for the next meeting? Because otherwise, before every customer meeting, I have to spend 20, 30 minutes reviewing some of the notes from the previous call transcripts to basically see what's actually happening and what I should do next.

4:30And so I was trying to use GPT-3 to help with this. And then, of course, once I started doing that, that's when you start running into all the issues of actually trying to feed your own private data to a language model. And so the technique that people were kind of playing around with at the time, and I can describe this a bit more in detail was this idea of just like, you know, stuffing stuff into the prompt. I think we call it a few different terms. Now there's like prompting and context learning, all these different things, but fundamentally it's just conditioning. You're providing the right conditioning variable for your input and using that to send some sort of input prompt to the language model and get back a response.

5:03And so as I was playing around with how do I stuff this big call transcript into the prompt window at GPT-3, the prompt size is around 4 ,000 tokens, but the call transcript can be a lot bigger than that. And especially if you have multiple call transcripts across multiple customers. So then I thought, what's the best way to like structure this data in some way such that we can still utilize the prompt window of GPT-3, but almost use it as like a cache space and still maintain some sort of external RAM or hard drive or whatever analogy that makes sense in order to feed into this cache space so that you can still achieve the task, but make use of the kind of like limited prompt size that you have.

5:41So that motivated some of the initial design of probably some of the origins of GPT index, as it was called at the time, and now it's called Lama Index. It was this idea of just building some sort of general data structure in order to organize your data in some way that the language model could access and traverse later on in order to give you back the results that you want. And so it started off as this design project. We came up with this very initial prototype of like a tree-like data structure and then posted it and released it on Twitter. it got some initial traction and discussion, even if it didn't work super well at the time.

6:15And I think that's at a certain point, it got me, you know, like pretty interested. That's a good sign, I guess. Like if it doesn't work and people are excited about it. But like, it was clear that people were thinking about this. Like it's one of those things where the tree index, like there were certain limitations of GPT-3 being able to kind of like sequentially reason over data. And we can kind of talk about that as well. But it was clear that people were thinking about this idea of augmenting GPT-3 with a memory or some sort of like external storage system, right? So that it could still have access to this data, but this data would be structured in a way that GPT-3 could access.

6:50And so as I was working on this, there started becoming more user interest in the space. Then I really made a decision to basically try to convert this project, which was more of a design project at a time, into a set of useful tools and distractions that people could actually use to build applications on top of. And so that's where what GPT index and that Lama index has evolved into now, where it's basically a central toolkit for, again, connecting your language models to your data. Any individual and enterprise is going to have some private sources of data that they're going to want to tap into when they think about, you know, utilizing the capabilities of language models.

7:25There's going to be PDFs, PowerPoints, spreadsheets, all those types of files on your drive. There's also going to be, for instance, like workplace apps and a lot of data contained in Notion, Slack, Salesforce, et cetera. There's going to be data in your data lake, for instance, vector databases, structure databases, et cetera. How do you think about both what this data stack is going to look like, as well as tapping into all this private knowledge so that you could combine it and use it with power foundation models like GPT or LAMA or other types of models? So I think it leads to some pretty interesting technical challenges, which I'm happy to share as well.

7:59But I think fundamentally, there's really like two modes of inserting knowledge these days when you think about how do you augment a language model with your own private data? I was going to jump in and say, it strikes me that one of the fundamental challenges is that the language model is going to be the most useful if it's fully aware of everything that you have, everything that it has access to, all that data, but you can't give it all that data at once. You have to come up with creative ways to either pre-process and identify the data that it's going to need to solve a certain address, a prompt and be selective or what?

8:37I know the first has led a lot of people to, you know, tools like embeddings and vector databases and things like that. I'm curious kind of how you kind of contextualize that and over, you know, address that problem. 100%. So I'll talk about that in just a bit and taking a slight quick step back to like contextualize the overall space of like, how do you feed external data into a language model? Probably one of the first things that has evolved is just like, how do you perform gradient descent right on top of some data so that in some sense like gpt3 can't memorize data from your knowledge corpus and so if you just ask like chat gpt anything about anything that's public on wikipedia it'll generally know the answer and you don't really have to do any of this like retrieval augmented generation i think there's some issues and right now at least in kind of making some of this fine-tuning distillation accessible to the end user it tends to cost a decent amount you have to prepare your data in a certain way and you have to have some sense of how to experiment and evaluate with these training techniques in order to make it work well for the end user.

9:33And so I think as a result, there's this other paradigm we'll talk about now, which is basically just take a pre-trained model and then figure out how do you have the best retrieval model to augment the existing language model with. And so that's kind of the space that Lama Index operates in right now. And that's where people are starting to think about this intersection between vector databases, language models, and then how do you actually surface the best context for the given task that you want to solve. And so let me give like an initial example, right? So like for an existing question that you want to ask, let's say it's a very simple question.

10:07It's just like, what did the author of this book do during his time in college, right? And let's say you have access to the entire biography of the author. The way that you would typically make this interaction work with vector databases is that you would take this knowledge, store the document as chunks in a vector database and add an embedding for each chunk. and then you would pair that with a language model. So then during query time, when you actually ask this question to this overall system, we'll do top K retrieval by embedding similarity. We'll embed the query and then use it to look up, you know, the relevant chunks from the vector database and then take those chunks and then inject it into the prompt.

10:45And then the prompt will look something like, here's the context, put the context in, here's a question, now give me the answer. And so I think I would say a lot of people are discovering that basic paradigm these days where you're basically just doing kind of like general semantic search over your knowledge corpus in order to find the relevant context. And I think for relatively simple questions that require kind of like fact-based retrieval, that tends to work well, just because you're kind of embedding the semantic context of the query and just matching it to some basic semantic context in your knowledge corpus, and then feeding it roughly the relevant information that you need to generate a response.

11:17I think Lama Index sees ourselves as both doing that as well, right? Because like that is a pretty common paradigm. And in fact, that's probably one of the easiest ways to get started with Lama Index. But we also offer some of the more advanced primitives as well on top of this in order for users to really kind of not only be able to get back a response from relatively simple questions, but for more complicated questions as well. And so what's an example of a more complicated question that necessitates these advanced primitives and kind of talk us through some of those primitives those examples.

11:52100%. So one basic example, and this is not getting into more complex territory yet, is let's say you just want to ask a question that requires a summary over the document, as opposed to top K retrieval. For instance, your task that you want to send in is literally, give me a summary of this document, or how can you describe the overall tone of this essay? Now, the type of data structure that you might use in order to look up information for this request, probably should not use top K retrieval, because if you embed the semantic context of that question, you're going to get some random chunks from the document.

12:24Whereas really what you want is have a system of going through all the chunks in that document. And so one thing, just very basic example, is that if you're trying to build some sort of, you know, general query interface that can handle both fact based retrieval questions, as well as summarization questions, how can you first have almost some sort of decision maker at the top that can take in this question that you have, decide whether it requires summarization of your documents or fact-based retrieval, route it to the right sub data structure, and then rely on the kind of query interface by that data structure to give you back the answer that you want.

13:00So that's probably one of the most basic examples of just how do you actually have combined both summarization and semantic search in one query interface. As another example, let's say you have information in both your Notion database, as well as your Slack conversations. And you want to synthesize an answer explicitly from both of them. And so for instance, you want to propagate the request from a query down into maybe a vector database or some sort of index structure from your Notion documents. And you also want to propagate this query down to your Slack conversations. How can you route this query down to both data systems and then combine the information at the top level to synthesize the response to your question?

13:40That's another example. And if you generalize this a little bit, let's say you ask the agent to, hey, not only synthesize information, but actually give me like the trade-offs, give me the pros and cons between this approach, which is documented in this section versus this other approach, which is documented in this other section. And if each of those are stored in separate data systems, you're going to need almost some sort of higher level primitives that can decide, given this query, how can I route it to these different data systems, transform the question in order to fetch the information that I want from these data sources, and then give me this full comparison between these responses at the top level.

14:16And so I think the interaction between retrieval and language model synthesis, in my mind, at least, there is inherently some sort of coupling between the two. And there's going to be some repeated interactions as both between the language model and retrieval model, as well as with the data structures that you have and the nature of the data systems. And so we want to build a tooling to help users be able to create all these different customizable indexes and views of their data to allow them to actually execute these different types of queries. And going through those examples, you've got this information retrieval style use case or effect-based query.

14:53You've got the summarization example. It sounds like we're starting to identify a higher level of abstraction that different use cases will fall under. You've identified two. Is it more the case that there's some manageable number of these primitives, like 10, 20, whatever? Or is it that every use case is going to be a little bit different? And there are hundreds of or 1000s of kind of fundamental ways that people want to work with their documents. And so you need to just give them a very open capability. That's a really good question. I think there's two ways I think about this. One is that right now we see probably like a few of these different use cases, like five to 10 that people tend to want to get answers from over their data.

15:39And it's possible there's like a giant long tail of different tasks. And I think it really scales with the complexity of the task. Like if you kind of give a very vague description to this system, and you expect it to just logically break it down into different subcomponents and execute all these different subcomponents for you, then the complexity just scales kind of like exponentially with the number of steps that it requires to execute this task. We want to provide the basic customizable building blocks in order to allow users to set up the structure so that for any subset of tasks or queries that they want to run, they're able to get back the result that they want.

16:14And so both from the simple stuff like question answering to more multi-step stuff, like if you ask a multi-part question or you ask this kind of general question that really requires breaking this down into individual questions over your knowledge sources, we want to give users the tools that do that. I think now taking a step forward, the next natural evolution of this is the fact that you don't actually want the users having to specify like a slightly different parameter for every use case that they want to solve, like semantic search or fact based retrieval, you're going to have to specify some top K parameter.

16:46And then for summarization, you're going to have to specify like the set of documents you want to summary over. And then for kind of like more complex interactions, you're going to have to explicitly say, hey, I want to break this question down into sub questions, and then route these sub questions through the underlying data sources. I think the next natural step here is how can we actually automate this and unify everything under a single query interface, right? Because you don't want the user to actually spend the time to actually define all the parameters, define all the tools just to handle the subset of queries, when they're going to have to know a priori, they're going to have to know like a priori what these tools are going to have to be.

17:23And so I I think building this next level of automation that can just take in a query and then in some sort of agent style interaction, decide what's the most relevant tool for the job and how can I use this tool and almost like build this tool as well. That's something that we're super interested in, especially as it relates to data systems, something that has a deep view of your existing data system and can make the right decisions in order to give you back the retrieval results that you want. Whether it's picking these different types of index structures that we offer that can solve these different use cases, or from another data systems lens, being able to look at stuff like how do you optimize like token usage?

17:57How do you make this faster, right? Like given previous queries, how can I actually make this faster? How can I reduce costs for the user, all these decisions. And so we're super excited to kind of take some of these paradigms are emerging nowadays of task automation and apply that to this data system world as well. When you think about the interface between LLM-based data processing system and data sources of record, what does that interface evolve to look like? You know, for example, does it evolve to look like the chat GPT plugin model where, you know, we're going to teach our Oracle databases how to spit out natural language prompt responses, that kind of thing?

18:42Or do you think that there's some more efficient way of doing that? Or is that more efficient? What's your view of the way these things evolve? I think the way it's going to work is that there's actually a few different lenses of looking at this. And I think all of these are pretty interesting to think about. One way of looking at this is that the data stack is actually just going to get radically simplified over time, especially as language models take off. The amount of hand engineering you're going to have to take to go from raw data source to massaging that data into some format, to some structured format, and then doing ETL and loading into a database such that you can run some structured query like SQL over it.

19:17I think a lot of that stack is going to become simplified. And especially because we can trust language models as these automated decision makers. And so if you look at some of the most basic things that people are doing nowadays, LMs have a capability of just understanding raw text, even if there's just a bunch of stuff in there. So if you load in a PDF file, you just dump the entire raw text into the chat GPT prompt window and you get back a response. You don't need to write a bunch of parsers to like extract some stuff. Obviously some cleaning up of this data would be nice, but QBT can generally just understand what's going on in the context, even if it has a bunch of like HTML tags or other kind of like markdown tags in there as well.

19:55So there's a huge possibility for the overall data landscape to just become simplified as we can figure out how to leverage the capabilities of LLMs and these various components of the data landscape to just like simplify the number of steps it takes from raw data to insight for the user. That's one way of looking at it. Going back into the plugin discussion though, and this relates to some of the stuff I was talking about with this idea of kind of like automated reasoning over your data. I see Llama Index as a core module that you could plug into any agent. And I think fundamentally what's going to happen is that as you see this rise of language model agents, each agent is going to have some sort of things that it could probably specialize in.

20:37And so you're going to have, for instance, this like outer agent abstraction for your application that's deciding what is exactly the best tool for my job. And one of those tools could be Llama Index over some view of your data. And then within Llama Index itself, we're probably going to have hierarchical agents within Llama Index, each that's really good at trying to automate and decide what's the best decision and best index and what optimizer to use over your data. And so we could totally see that being a system where there's basically this like outer agent abstraction that's using us as a core plugin.

21:09They send in this input request to us as a service, and then we take in this request, and then we can have some sort of agent-based system over your data as well that can decide what's the best tool to use and give you back the response that you would want. So I think it's just very interesting to see this, like, you know, you're going to have these different networks of agents all kind of interacting with each other in order to give you back the task. Curious to have you elaborate on you mean slash think of when you say agent. I can kind of parse that in two ways. One is we're going to have kind of these layers of LLM type systems that are making decisions and acting on both the user request and the data to compose the ultimate system.

21:56And while yes, these things will get cheaper computationally and cost-wise over time. That sounds very complex and expensive in a sense and slow by today's standards. But then there's another view in which agent is just the cool word that we're using to say software or rules or decision framework or something like that. And you're just talking about software. What is it that makes something an agent in your mind like? It's a good question. I think the definition of agent is going to evolve over time for what it's worth. And I have an initial view of that. And I think this view will absolutely evolve over time.

22:32I see agents as a layer of automation for decision making over any sort of function that you want to run. So for instance, you could, for instance, in your code, write a bunch of if statements that could decide, hey, you know, if this condition is true, do this function. If this other condition is true, do this function. I see an agent as basically taking in some input and doing that reasoning under the hood to decide, make a decision over some input, as well as some access to some context, for instance, over your data or over the set of tools that it's able to have access to. And it's able to decide what's kind of like the best next step to take given the previous step, the context, as well as the set of tools.

23:12And so I think fundamentally, to me, at least right now, even that on its own, which will probably evolve over time, is a pretty powerful paradigm because it just means that it's adding more layers of automation to the end user because now the end user does not have to set up all these structures on their own. They can set up stuff as like functions. And then in terms of routing between functions, they can trust this agent-like abstraction to make that decision for them. And so there's a lot of stuff around some of the core toolkits of LLAMA index that I think could be super valuable when coupled with this agent abstraction.

23:46Now, having a chat about that in just a bit, I think another thing you mentioned, though, was this idea of like cost and latency, which to be fair, I think are really good points. I mean, I think one of the fundamental downsides of costs or of agencies is that the moment you chain a lot of these calls together, especially when you add a ton of context to the prompts, the cost tends to balloon upwards. There tends to just be a lot of latency. Every call to GPT starts or to OpenAI starts incurring two to three seconds of latency. And then the end user might have to wait a bunch of time before seeing any results.

24:18And so I think part of this is banking on the fact that cost and latency do go down, that you might start seeing kind of more fine-tuned distilled models that are a bit smaller that can make decisions a bit quicker. I think that's another thing that's super interesting. And then the other part is performance. I think the other aspect is that the more decisions you chain together, the more errors propagate over time, right? If you have like, you know, 95 % accuracy over a single step reasoning, then, you know, like the error rate, if you chain like three or four calls is going to be like, you're kind of like multiplying a bunch of these together and the error rate will increase the more calls you change.

Read the full transcript

24:54I think one thing that's very interesting though is that as these models get better, the ability to rely on them as reasoning agents does get a lot better too. For instance, like GPT-3, just empirically, I've noticed tends to get stuck at more complex instructions. And so if you have a long chain of instructions and it breaks in the middle, then the rest of the chain just breaks as well. GPT-4 tends to be able to follow both very complex instructions as well as propagate that chain later on. And I think that's actually why you're starting to see agents become more popular as these language models get better, because now they're able to handle kind of more automated, inherent reasoning under the hood.

25:29And so to me, it kind of calls to mind, and maybe we can kind of turn back to how you define Lama Index and like where you see it going. But if you buy into this idea of agents, you can imagine it being a new paradigm for writing software. Like you've got these hierarchical distributed agents that are collaborating with one another, and that's going to give rise to the need for a whole new approach to infrastructure for these digital agents. Like how do you observe ability and providence across a chain of relatively independent decisions that individual agents are making? And what are those interfaces look like?

26:09And they're all kind of primitives that these things might need, like queues and like all the traditional software stuff, but an agent world. What does all that look like? These are the problems that you think that we're going to need to solve to fully take advantage of what LLMs have to offer us? I think so. And to be fair, I think there's a tremendous amount of interest in the space. And this overall agent abstraction is super broad. It's going to evolve over time. And a lot of people are thinking about it, both in the tooling layer, the foundation model layer, as well as pretty much every application builder out there.

26:39I think for us, because we are really focused on building this core module as an interface with your data systems, like your data lake, your unstructured data, or your semi-structured data, your structured data. We think there's a ton of complexity in how to combine this agent abstraction and how to effectively apply it as, for instance, like a knowledge worker or decision engine on top of your data system, right? Because like building, for instance, just a traditional database is very hard. You have to think about just basic system concerns of how to store the data. But there's a lot of research, for instance, going on and how do you optimize a given query in order to, for instance, kind of increase the performance of how do you actually retrieve the results, right?

27:20If you look at a SQL database, there's like a ton of research on query optimization. And if you think about for us, like if you're dealing with just gigabytes, terabytes of semi-structured, unstructured, structured data, how do you best make the decision of if you have a query, what's the best query to execute that can fulfill the task at hand and do it in a way that's cheap, fast, and effective. So just as a kind of concrete example, going back, very back to the indexes that we have right now, which are toolkits that allow users to define different views of their data, how can we have an agent that can basically choose the best index for the task along with the top, the best hyperparameters for the task, given some input query at hand?

28:01And then going down into some of the other modules that we have, for instance, we're starting to invest a bit more in these optimizers that can optimize token usage. How can we have some sort of like agent system choose the best optimization module that you can use that will still maintain performance and accuracy, but reduce the number of tokens that you're using for a language model? Some of the other modules that we have exploit like relationships between nodes, for instance, like given a unit or module of data, you can, for instance, have relationships to stuff behind you, you could have relationships to stuff ahead of you, for instance, and temporally, or if you're semi structured data like JSON, you can have relationships from a unit of data to the parent and child, because something like JSON is inherently like a graph structured data.

28:45How can you basically define these relationships within your data, and then also offer this as a view to, for instance, some language model agent that can effectively parse the structure and be able to crawl the structure in order to give you back the results that you want. And so for us, we are super interested in doing this very well, because I think nowadays what you see a lot of is just you have a lot of text, raw text. And I know I just said language models are very good at parsing raw text, but you have some naive chunking strategy where you just split it with every 4 ,000 characters or something, and then you dump it.

29:18But I think there's just a lot more interesting things if you just even define some light metadata layers on top of your data that you can have the language models exploit and reason about almost in an automatic fashion in order to give you back the best results for a query. Is Lama Index, do you see it as an alternative to something like a LangChain or are these complementary tools that you might use as part of building a broader solution? I see them as complementary. I think LangChain has done a great job at being a general application development framework, consisting of a lot of these core modules that anyone can just go in and use.

29:55We see ourselves more as a subcomponent of this overall LLM space, specifically being this module around language models and your data systems. And so one thing that we're very interested in is just how do you build this well-functioning system for a lot of these end users and kind of abstract away some of the complexity such that it does this job really, really well. Again, given some sort of query over your data, you're able to get back the right response. And so we see ourselves building this data system that you could actually plug in into an outer abstraction. For instance, if you're building like a chatbot with LangChain, you can add us as a tool or retriever module in order to retrieve the relevant context information as well as synthesized responses that you can use.

30:35We're building out other integrations. For instance, we're also a plugin in ChatGPT as well. And basically with this outer abstraction, you can call us as a service. And then under the hood, we can figure out the best answer to give to you given your data and give you back the response. So if I have a host of traditional enterprise data stores, file servers with lots of documents, maybe some MongoDB document databases, some traditional SQL databases, Postgres, whatever. And I want to build the mother of all chatbots that answers everything about my enterprise. Like what is the process? How would you set my expectations first in terms of like, how far am I going to be able to get today given the tools we have available today?

31:20And what are the steps to getting there? Yeah, so a lot of that falls under the steps that I described earlier on. then we can synthesize it in a more concrete fashion for, for instance, this hypothetical, like enterprise user persona. So we would connect your existing data systems. Right now, we're just a metadata layer on top of your existing, for instance, vector database or structured database or unstructured files. And so we would connect your existing data systems, we would define some metadata on top of each unit of data that you have stored within these data systems that allow us to do stuff like indexing, look at relationships between your data.

31:58And then we would provide that light storage layer on top. When you say units, like rows in a database or tables or... Exactly. So for instance, if you have unstructured data, a unit could be like a chunk of data, right? It could be, we call it like a node. Then a database, it could be an individual entry. Within a semi-structured data, one JSON file could have a variety of nodes, both with hierarchical relationships as well as previous next relationships, we would define that view over your data as metadata. And then we would provide the building blocks to allow you to create these different types of indexes over your data if you want to do it yourself.

32:37And so if you want to tinker around with the different types of views that could make sense to solve all these different queries from easy to advanced, we would do that within the open source project as well. But if, for instance, since you're also the type of user that doesn't want to deal with a lot of this complexity, we could also just abstract this away within this outer agent layer that can actually automatically reason which structure to use given this outer query request. And so we could actually be this drop-in module that you can easily use on top of your data without you having to worry about the complexity.

33:09But if you want to go in there and play around with the open source components and modules, you could do that as well. And you said something in there, and I want to dig into it. When you're using the outer layer to do some of the mediation for you, is it structuring these indices on a per request basis? Like what's the most efficient index to use to address a particular query? Or are those static? Because I thought you said the former and it just sounded complicated and fragile maybe. Got it. Yeah, it's interesting. It could actually be a bit of both, right? It's also actually a data systems problem too, because a lot of indexes you could actually define beforehand because sometimes they might take a bit of time to actually build that view over your data.

33:52And so a priori, you might have some existing set of tools that you might have access to, which are these indexes, such that you can build this decision engine to route between these different indexes. There are also certain decisions that you can make during query time as well that are actually probably conditioned on the nature of the query. So given some query that requires some sort of, for instance, temporal reasoning over your data, you could actually reason that, hey, maybe I should add this extra module that can actually allow us to exploit the temporal relationships between nodes. And so given the query, I might also need to choose to break that query down into smaller subtasks to ask over your knowledge source.

34:30So I would say it's a combination of both defining some initial set of lightweight structures in the beginning, especially stuff that's going to kind of incur a bit of cost, and also making some decisions during query time as well to figure out how to best utilize some of the structures that you've created. Hmm, interesting. Are there kind of standout use cases that you've come across that are kind of the most exciting or interesting or worth kind of digging into? Yeah, so it's actually kind of interesting how this simple paradigm has led to people just building a variety of these types of applications, where you just send in some requests, and you got some output over different types of data.

35:05And it's cool how like people are plugging this into different types of systems. So for instance, one of the earliest contributors to Llama Index built a variety of tools that actually allows you to ingest a bunch of video unstructured data. And then you can parse that into an audio transcript through Whisper, run it through an image captioning model. and then you can start asking questions over your videos. There's other tools that allow you to ingest web scrapers. So basically do a bunch of scraping over your sites and over any sort of request. It's basically an augmented Google search. You can send in a network request to a web scraper, scrape a bunch of sites on your own, and then all of a sudden you now have this augmented chatbot experience on top of your initial search where you can ask questions over the initial search result.

35:46So I think there's a lot of complexity in the data that's being fed in. And for instance, you see everything from like PDFs to text data to video data as well. And a lot of this goes into this overall paradigm, which I've kind of described. That's kind of interesting where basically with a few lines of code, you can basically just feed in like any type of data that you want and start asking questions over it. I think nowadays we're starting to see more and more users be a bit more thoughtful about moving a little bit beyond pure semantic search as well. So once you have this data, the default mode is to just dump it to a vector database and then you do some basic top case semantic search in order to get back the results.

36:21And we're starting to see users define almost some of these abstractions so that you can start doing these interactive reasoning over your data in order to fulfill more complex tasks. And we're starting to see users exploit these modules. You talked a little bit about seeing this paradigm as displacing, I guess, maybe more static paradigms like ETL. You made that comment broadly, and I'm wondering how broad really is it? Is it for a certain class of applications? Do you see this agent type environments becoming kind of fundamental infrastructure that totally re-imagines the entire existing enterprise data stack?

37:01Like how deep and far do you see this going? Yeah, that's a good question. So I know I mentioned that comment broadly, so I'm happy to talk a bit about some of those components as well. So you're already kind of seeing that actually with just like raw unstructured data. I mean, I think one of the most basic paradigms that we actually help users build is, again, just dump in a bunch of raw text into Llama Index and by extension GPT, it can just answer questions over that data. This is something that you actually really could not do beforehand. Even if you had some sort of embedding-based lookup, it would just give you back some text trunks.

37:32You really couldn't actually synthesize an answer over that. And so without some of the kind of reasoning and synthesis capabilities that LLMs have provided recently. Honestly, on its own, it's already super exciting. And so I think just the volume of unstructured data. And I think actually, as a result, there's become a lot more focus on these databases or stores that can index these complex types of data from unstructured text to semi structured data to images and audio as well. Now, I think if we also talk about some of the agent aspects that we were talking about earlier, I think there is also some capability for this ETL stack, and just like the data stack in general, to be transformed as we bet on this feature that that cost latency will go down and that these reasoning capabilities get better.

38:17And I think it's one of those things where I think we could basically make the job of the data engineer and also the data scientist much more efficient by basically having these automated reasoning agents over making decisions at every stage of the data infrastructure stack. All the way from ingestion, where you have raw data, you're trying to parse it into something that's structured. And there's actually some interesting work for the right schemas and for the right structured data from unstructured data. Now you're within the data system, how to best transform this data from one place to another.

38:47And then from like the end user perspective, like the data scientist, how do you automatically build this right query interface, like a natural language query interface that has a view of this data within your data system that you can then get results over? So I think all of these are super interesting. And I think it is kind of a bet because for this pure agent system to take off, where everything is going to be more automated and that humans are not in the loop yet. I think people are probably a bit more skeptical of that future, but some future where there are existing agents within your data system and they actually aid humans and they make humans a lot more efficient.

39:23I think that's something that is interesting and will probably happen as these models scale and get better. Yeah, super interesting. Well, Jerry, thanks so much for taking the time to share a bit about what you've been working on with us. Very cool stuff. and looking forward to hearing about what's to come. And in fact, maybe I should pause and ask, what's to come? Yeah, super exciting stuff. I mean, I think a lot of the stuff that we talked about, especially around this idea of kind of automated reasoning over different components of your data system is something that if not there yet, will be there soon and is actually something we're probably actively investing in every day.

40:01And so just going along with this vision of there's so many dimensions to push on and making this module of LLMs plus your data easy to use, fast, cheap, and efficient. And just how can we really push along all of these and make this the best possible tool that can do this task over different types of data that you have? Yeah, awesome. Well, once again, thank you. It was great chatting and looking forward to keeping up with you. Awesome. Thanks so much, Tim. Thank you.

40:30All right, everyone, that's our show for today. To learn more about today's guest or the topics mentioned in this interview, visit twimla.ai.com. Of course, if you like what you hear on the podcast, please subscribe, rate, and review the show on your favorite podcatcher. Thanks so much for listening and catch you next time.

From the publisher

Today we’re joined by Jerry Liu, co-founder and CEO of Llama Index. In our conversation with Jerry, we explore the creation of Llama Index, a centralized interface to connect your external data with the latest large language models. We discuss the challenges of adding private data to language models and how Llama Index connects the two for better decision-making. We discuss the role of agents in automation, the evolution of the agent abstraction space, and the difficulties of optimizing queries over large amounts of complex data. We also discuss a range of topics from combining summarization and semantic search, to automating reasoning, to improving language model results by exploiting relationships between nodes in data. 
The complete show notes for this episode can be found at twimlai.com/go/628.

More from The TWIML AI Podcast (formerly This Week in Machine Learning & Artificial Intelligence)

All 156 episodes
AI Agents and Data Integration with GPT and LLaMa with Jerry Liu - #628The TWIML AI Podcast (formerly This Week in Machine Learning & Artificial Intelligence) · 41 min
Listen in VO