Latest / CyberSecurity Summary / Data Analysis with LLMs: Text, tables, images and sound
Transcript
- 0:00Speaker 1: Welcome to the Deep Dive, the show that navigates the
- 0:02Speaker 1: labyrinth of information, distilling the essence of what truly matters.
- 0:07Speaker 1: I vividly remember the first time I interacted with GPT three.
- 0:11Speaker 1: Oh yeah, it felt like an almost magical experience. For
- 0:14Speaker 1: the first time, it genuinely seemed like the computer understood
- 0:18Speaker 1: my complex inputs and could react appropriately, you know, solving
- 0:22Speaker 1: diverse tasks from text analysis to coding, just based on
- 0:26Speaker 1: my instructions. It was a complete game changer, especially compared
- 0:29Speaker 1: to the well the prior neural networks that always needed specialized,
- 0:34Speaker 1: hand labeled training data.
- 0:35Speaker 2: It truly redefined what we thought was possible with AI.
- 0:38Speaker 1: The leap was just undeniable, absolutely, and today our Deep
- 0:43Speaker 1: Dive is all about harnessing that power. We're going to
- 0:45Speaker 1: explore how these incredible language models can be used specifically
- 0:48Speaker 1: for data analysis, helping you make the most of your
- 0:51Speaker 1: data sets. Right, They've evolved so rapidly, moving from just
- 0:54Speaker 1: processing text to understanding multimodal inputs that's images, audio, video,
- 0:59Speaker 1: and of course tech.
- 1:00Speaker 2: Yeah, the multi modality is huge.
- 1:02Speaker 1: This expansion makes them an invaluable tool across pretty much
- 1:05Speaker 1: every facet of data science.
- 1:07Speaker 2: Our mission in this deep dive really is to show
- 1:09Speaker 2: you how llms can act as expert guides to your data,
- 1:13Speaker 2: offering a genuine shortcut to being well informed. A shortcut
- 1:17Speaker 2: I like that will delve into how they extract the
- 1:19Speaker 2: most important nuggets of knowledge and insight from various sources
- 1:24Speaker 2: and empower you to build complex analysis pipelines with just
- 1:28Speaker 2: a few lines of Python code, all driven by natural
- 1:31Speaker 2: language instructions.
- 1:32Speaker 1: Okay, let's unpack the core of this magic. Then it
- 1:34Speaker 1: all begins with what GPT actually stands for, generative pre
- 1:39Speaker 1: trained transformer. Generative is key here, meaning these models don't
- 1:44Speaker 1: just classify or recognize things. They create new content, whether
- 1:47Speaker 1: it's text, code or even images.
- 1:49Speaker 2: And the pre trained aspect means they've learned from truly
- 1:52Speaker 2: immense amounts of data, vast swaths of the Internet, books,
- 1:56Speaker 2: and more, enabling them to understand languid broadly, not just
- 1:59Speaker 2: you know, specific narrow task. This generic understanding allows them
- 2:03Speaker 2: to then adapt to specialized tasks much more efficiently. And
- 2:06Speaker 2: the transformer part, ah, that's the underlying neural network architecture,
- 2:11Speaker 2: the brilliant design that makes all this possible.
- 2:14Speaker 1: So how does this fundamental design let them tackle such
- 2:17Speaker 1: a wide array of problems.
- 2:19Speaker 2: What's truly fascinating is how this design allows lms to
- 2:22Speaker 2: be universal task solvers. Unlike earlier models built for one
- 2:26Speaker 2: specific purpose, llms are designed intended to serve as universal
- 2:31Speaker 2: task solvers that can, in principle, solve any task the
- 2:35Speaker 2: user desires.
- 2:36Speaker 1: Any task wow.
- 2:38Speaker 2: Well within reason. The way you communicate with them is
- 2:41Speaker 2: through prompting. Think of a prompt as your direct instruction
- 2:44Speaker 2: to the model. So the input you give it, and
- 2:46Speaker 2: it can be multimodal, combining text with images or other
- 2:49Speaker 2: data types. A really effective plompt needs a clear task description,
- 2:53Speaker 2: all the relevant context like are we talking about reviewing
- 2:56Speaker 2: laptops or lawnmowers for example? Right?
- 2:58Speaker 1: Context matter Context is.
- 2:59Speaker 2: Critical, and crucially, it can optionally include a few examples
- 3:02Speaker 2: to guide the model.
- 3:03Speaker 1: So if the prompt is the key, how much handholding
- 3:06Speaker 1: do we actually need to give the model? Does it
- 3:09Speaker 1: learn from a few examples or can it just get
- 3:11Speaker 1: it from the description alone?
- 3:12Speaker 2: Yeah, that brings us to fu shot learning versus zero
- 3:16Speaker 2: shot learning. FU shot learning is when you provide those
- 3:18Speaker 2: few examples directly in your prompt to show the model
- 3:21Speaker 2: exactly what you expect showing your work exactly. It's like
- 3:25Speaker 2: showing someone a couple of solved puzzles so they understand
- 3:28Speaker 2: the pattern. Zero shot learning, on the other hand, means
- 3:32Speaker 2: you're relying solely on your task description with no examples provided,
- 3:36Speaker 2: and that works. It's impressive how often llms can still
- 3:39Speaker 2: perform effectively even with zero shot prompting. It really depends
- 3:43Speaker 2: on the task complexity and the model itself.
- 3:46Speaker 1: And it's important to distinguish between the types of data
- 3:49Speaker 1: lllms work with, right structured versus unstructured.
- 3:51Speaker 2: Absolutely, we have structured data that's your tables grabs, anything
- 3:55Speaker 2: with a fixed format that specialized tools can process very efficiently.
- 3:59Speaker 2: For this primarily act as an intelligent.
- 4:01Speaker 1: Interface, got it, like a translator kind of.
- 4:04Speaker 2: Then there's unstructured data text, images, audio video, where llms
- 4:08Speaker 2: operate directly on the raw content. A critical point for
- 4:12Speaker 2: anyone using these models, and something that often surprises people,
- 4:15Speaker 2: is that interacting with language models incurs monetary fees. AH
- 4:19Speaker 2: the cost yes proportional to the amount of data process
- 4:22Speaker 2: and using larger language models, well that's often more expensive significantly,
- 4:27Speaker 2: So sometimes how.
- 4:28Speaker 1: Do they measure that cost?
- 4:29Speaker 2: These costs are calculated in tokens. Think of tokens as
- 4:32Speaker 2: the smallest, meaningful lego bricks of language. So if I
- 4:36Speaker 2: say Hello World, that might be just a few tokens.
- 4:39Speaker 2: It's roughly four characters a text, give or take.
- 4:41Speaker 1: That's a good way to put it. So for many
- 4:43Speaker 1: of us are first let's say, dance with an LLM
- 4:46Speaker 1: was likely through the chat GPT web interface. Ugly, most
- 4:50Speaker 1: of you have probably already dabbled there, accessing it at
- 4:52Speaker 1: chat dot OpenEye dot com. It's a great sandbox for
- 4:55Speaker 1: quick text processing or even exploring its data analysis capabilities.
- 5:00Speaker 2: And in that web interface you can perform some genuinely
- 5:03Speaker 2: practical tasks. For text processing, classification is straightforward determining the
- 5:09Speaker 2: sentiment of a movie review or sorting a product review,
- 5:12Speaker 2: like for a I don't know a banana book a
- 5:13Speaker 2: banana book into its correct category. You can even hint
- 5:17Speaker 2: it your desired output format simply by saying answer concisely.
- 5:20Speaker 1: Nice.
- 5:21Speaker 2: For information extraction, it's brilliant at pulling structured data from
- 5:25Speaker 2: freeform text, like gathering a name, GPA, and degree from
- 5:29Speaker 2: a stack of applicant emails.
- 5:31Speaker 1: And what's truly impressive is how it handles tables right
- 5:34Speaker 1: right there in the chat.
- 5:35Speaker 2: It really is. You can upload a dot csv file,
- 5:37Speaker 2: for instance, review stable dot csv. Chat SHPT doesn't just
- 5:42Speaker 2: display it. If you've enabled to write features, it generates
- 5:45Speaker 2: an executes Python code behind the scenes to analyze that
- 5:48Speaker 2: data hikon code.
- 5:49Speaker 1: Really Yeah.
- 5:50Speaker 2: You can even peak at the code by clicking the
- 5:52Speaker 2: show analysis button. This demonstrates lms acting as intelligent orchestrators
- 5:57Speaker 2: for external tools.
- 5:58Speaker 1: Wow.
- 5:58Speaker 2: They also excel as translation, converting natural language questions into
- 6:02Speaker 2: formal query languages like sql.
- 6:04Speaker 1: Ah SQL generation.
- 6:05Speaker 2: That's useful, very You can then execute that SEQL on
- 6:09Speaker 2: your own platform, say and squally database in a Google
- 6:13Speaker 2: collab notebook. It's fantastic for writing complex multiline queries, and
- 6:18Speaker 2: that handy copy code button makes it so easy to
- 6:21Speaker 2: grab the generated sequel.
- 6:22Speaker 1: That sounds incredibly powerful, but it also raises an important question.
- 6:26Speaker 1: Can we truly trust everything? A LLLM tells us.
- 6:29Speaker 2: That's a crucial point, and it's one of the biggest challenges.
- 6:32Speaker 2: The term hallucinations refers to situations where lms will invent
- 6:37Speaker 2: new content in the absence of information, invent things. Yes,
- 6:41Speaker 2: and the truly profound insight here isn't just that they
- 6:43Speaker 2: invent things, but that they do so with such convincing
- 6:46Speaker 2: confidence it sounds completely plausible.
- 6:49Speaker 1: Oh that's dangerous, it can be.
- 6:51Speaker 2: This fundamentally shifts our perspective, and LLLLM doesn't know in
- 6:54Speaker 2: the human sense, it generates plausibly, Yeah, forcing us to
- 6:57Speaker 2: rethink how we trust automated information. So it's essential to
- 7:00Speaker 2: always verify the output, Always double check before relying on it.
- 7:04Speaker 2: Use alternative sources for corroboration.
- 7:06Speaker 1: Okay, always verify.
- 7:07Speaker 2: Got it.
- 7:07Speaker 1: So, while the web interface is great for chatting and
- 7:10Speaker 1: quick tasks, it's not really designed for building robust, complex
- 7:14Speaker 1: data processing pipelines.
- 7:16Speaker 2: Not really.
- 7:16Speaker 1: No, for that, we need to go deeper into the code.
- 7:18Speaker 1: This is where the open ai Python library comes into play.
- 7:21Speaker 2: Exactly. The Python library allows you to directly invoke llms
- 7:25Speaker 2: as a subfunction within your own code, giving you much
- 7:28Speaker 2: more programmatic control.
- 7:30Speaker 1: How do you get started with that?
- 7:31Speaker 2: To get set up, you'll need Python three point nine
- 7:34Speaker 2: or later, and then simply install the opene library using
- 7:37Speaker 2: pip standard stuff. Okay, critically, you'll need an API key
- 7:41Speaker 2: from open Ai, and it is highly recommended to store
- 7:44Speaker 2: this securely as an environment variable.
- 7:46Speaker 1: Right, don't just paste it in your.
- 7:48Speaker 2: Code, absolutely not. Never ever share your code if it
- 7:51Speaker 2: contains your open AI access key directly, as others could
- 7:54Speaker 2: use it to encour charges on your account. Very important.
- 7:56Speaker 1: Okay, key secured?
- 7:57Speaker 2: Then what when using check completetion in Python, you can
- 8:01Speaker 2: struct a list of messages. Each message has a role
- 8:04Speaker 2: user for your input, assistant for the model's reply or
- 8:08Speaker 2: system for instructions about the model's persona or behavior.
- 8:11Speaker 1: System user assistant okay.
- 8:14Speaker 2: And then the actual content of the message the client
- 8:17Speaker 2: dot chat, dot completions, dot create function handles setting this off.
- 8:22Speaker 2: Remember token usage, specifically, the total tokens attribute in the
- 8:26Speaker 2: response you get back directly impacts cost right back to
- 8:30Speaker 2: the tokens, and tokens generated by the model are often
- 8:32Speaker 2: more expensive than the tokens you send as input. Keep
- 8:35Speaker 2: that in mind.
- 8:36Speaker 1: Ah, good tip. Now that we know how to talk
- 8:38Speaker 1: to these models through code, the next logical step is
- 8:42Speaker 1: how do we steer them, how do we make sure
- 8:44Speaker 1: they behave exactly as we want, and crucially, how do
- 8:46Speaker 1: we manage those costs.
- 8:48Speaker 2: That's where customizing model behavior and optimizing for costing quality
- 8:51Speaker 2: comes in. It's really about controlling the generation process. Oh so,
- 8:55Speaker 2: for example, to control output length and therefore fees, you
- 8:59Speaker 2: can set max token to specify a maximum response length.
- 9:02Speaker 1: Pretty straightforward, can't limit the output makes sense.
- 9:04Speaker 2: You can also use obsequences specific text patterns like maybe
- 9:08Speaker 2: endo response or even something narrative like and they lived
- 9:11Speaker 2: happily ever after to tell the model exactly when to
- 9:15Speaker 2: stop generating. This can be very useful for getting structured.
- 9:18Speaker 1: Outputs ah nat trick, and for controlling the actual words
- 9:22Speaker 1: it chooses. How do we guide that for output generation?
- 9:25Speaker 2: Presence penalty and frequency penalty are your levers for controlling repetitiveness.
- 9:29Speaker 2: Positive values discourage the model from repeating tokens it's already
- 9:33Speaker 2: used or that are present in the prompt helps keep
- 9:36Speaker 2: things fresh.
- 9:36Speaker 1: That's repetition.
- 9:37Speaker 2: Good for truly surgical precision, like forcing a model to
- 9:41Speaker 2: use specific words, say positive or negative in a sentiment task.
- 9:46Speaker 2: There's legit bias.
- 9:48Speaker 1: Legit bias sounds complex.
- 9:49Speaker 2: It's a more advanced lever. It lets you explicitly increase
- 9:52Speaker 2: or decrease the likelihood of specific tokens appearing. You need
- 9:56Speaker 2: to find the token IDs using a token aser tool first.
- 9:59Speaker 2: It's powerful, but typically for very niche use cases. You
- 10:02Speaker 2: wouldn't use it every day.
- 10:03Speaker 1: Okay, And what about controlling how creative or let's say
- 10:07Speaker 1: random the model gets. Sometimes you want predictable, sometimes more exploratory.
- 10:12Speaker 2: That's where randomization parameters are key. Temperature, typically set between
- 10:16Speaker 2: zero and two, directly controls randomness. Higher values like maybe
- 10:20Speaker 2: point eight or one point zero lead to more diverse
- 10:23Speaker 2: and sometimes more created outputs. Lower values closer to zero
- 10:27Speaker 2: make it more deterministic and focused.
- 10:29Speaker 1: So zero for facts, higher for fiction.
- 10:32Speaker 2: Sort of kind of yeah. TOP is an alternative approach
- 10:35Speaker 2: that achieves a similar goal. It reduces randomization by focusing
- 10:38Speaker 2: only on the highest probability tokens that add up to
- 10:41Speaker 2: a certain cumulative probability. It's just a different way to tune.
- 10:45Speaker 1: The randomness, temperature or TOP. Okay.
- 10:47Speaker 2: And if you want multiple options for a single plumpt,
- 10:50Speaker 2: you can use the N parameter to generate several replies
- 10:52Speaker 2: at once. Gives you more choices to pick from.
- 10:55Speaker 1: This raises an important question with all these settings, how
- 10:59Speaker 1: do we get the best perform ormans while managing costs effectively?
- 11:02Speaker 1: It sounds like a balancing act.
- 11:03Speaker 2: It absolutely is, and that's where strategic optimization becomes crucial first,
- 11:08Speaker 2: model selection. Do not always default to the largest, most
- 11:12Speaker 2: expensive available model.
- 11:13Speaker 1: Bigger isn't always better.
- 11:15Speaker 2: Not necessarily and certainly not always cost effective. For many
- 11:18Speaker 2: simpler tasks, a smaller, cheaper model like GPT three point
- 11:22Speaker 2: five turbo might perform perfectly well. GPT four, for instance,
- 11:26Speaker 2: can be over one hundred times more expensive per token in.
- 11:29Speaker 1: Some cases, wow, a hundred times.
- 11:31Speaker 2: Yeah, it's smart to check benchmarks like Stanford's ALM evaluation
- 11:36Speaker 2: and definitely experiment with different models for your specific task
- 11:40Speaker 2: to find that sweet spot between cost and quality.
- 11:43Speaker 1: So model choice is clearly a big one. What else
- 11:46Speaker 1: can we do besides tweaking temperature and penalties?
- 11:48Speaker 2: Prompt engineering is absolutely vital. I can't stress this enough.
- 11:52Speaker 2: The design of your prompt can have a significant effect on.
- 11:55Speaker 1: Performance, really just the way you ask.
- 11:58Speaker 2: Yes, it's a really counterintuitive insights sometimes, but the biggest
- 12:01Speaker 2: leap in performance might not come from a bigger model
- 12:03Speaker 2: or more training data, but simply from better instructions, like
- 12:07Speaker 2: a skilled artisan responding to a perfectly precise brief. You know.
- 12:10Speaker 2: That's the magic of fu shot learning, which we mentioned earlier,
- 12:13Speaker 2: including samples of correctly solved tasks directly in the prompt
- 12:17Speaker 2: can dramatically improve quality. It often allows cheaper models to
- 12:21Speaker 2: perform comparably to much more expensive ones just because the
- 12:25Speaker 2: task is clearer.
- 12:26Speaker 1: So invest time in the prompt itself.
- 12:28Speaker 2: Definitely. You can even find ready made prompt templates on
- 12:31Speaker 2: platforms like prompt Base, though crafting your own specific to
- 12:35Speaker 2: your need is usually best.
- 12:36Speaker 1: And what about fine tuning? That sounds like a big
- 12:38Speaker 1: step like retraining the model?
- 12:40Speaker 2: It is kind of. Fine tuning allows you to specialize
- 12:43Speaker 2: base models to the specific tasks you care most about.
- 12:47Speaker 2: You take an existing model like GBT three point five
- 12:50Speaker 2: Turbo and you continue its training, but with a relatively
- 12:53Speaker 2: small amount of your own task specific data, typically fifty
- 12:56Speaker 2: to maybe a few thousand examples.
- 12:58Speaker 1: Fifty examples. That doesn't sound like much compared to the
- 13:00Speaker 1: pre training data.
- 13:02Speaker 2: It's not, but it's focused. The model already understands language,
- 13:05Speaker 2: you're just nudging it to be really good at your
- 13:07Speaker 2: specific thing.
- 13:08Speaker 1: What are the upsides and downsides of that kind of specialization?
- 13:11Speaker 1: Seems powerful?
- 13:12Speaker 2: The advantages include potentially significantly improved accuracy for your specific
- 13:17Speaker 2: use case, and you might get away with shorter, simpler prompts.
- 13:21Speaker 2: Because the task is sort of baked into the specialized
- 13:23Speaker 2: model now and.
- 13:24Speaker 1: The downsides cost I assume yes.
- 13:27Speaker 2: There are upfront monetary fees for the training process itself,
- 13:31Speaker 2: and importantly it usually increases the cost per token for
- 13:36Speaker 2: the fine tuned model's ongoing usage compared to the base model.
- 13:40Speaker 1: Ah, so it costs more to run afterwards.
- 13:42Speaker 2: Often Yes, the training data also needs to be in
- 13:44Speaker 2: a specific JSM lines format, basically representing successful interactions as
- 13:49Speaker 2: little conversations with user and assistant roles. It's a powerful tool,
- 13:53Speaker 2: but when you typically explore once you've exhausted prompt engineering options.
- 13:57Speaker 1: Okay, that makes sense. Let's unpack this further than beyond
- 14:00Speaker 1: just text, lms are fundamentally transforming how we interact with
- 14:04Speaker 1: all sorts of data, right, not just words on a.
- 14:06Speaker 2: Paid absolutely for text analysis. Classification remains a natural application,
- 14:11Speaker 2: like we said categorizing movie reviews or support tickets. Information extraction,
- 14:16Speaker 2: where you pull structured data like compiling a table of
- 14:19Speaker 2: applicant attributes from free form emails, is another really strong suit.
- 14:23Speaker 1: Yeah, pulling structured data from messy texts is huge and.
- 14:27Speaker 2: For clustering which groups semantically similar text documents, llms leverage
- 14:32Speaker 2: something called embeddings.
- 14:34Speaker 1: Embeddings heard that term, what is it exactly?
- 14:36Speaker 2: Think of embeddings like assigning every piece of text a
- 14:39Speaker 2: unique invisible address in a vast high dimensional space, like
- 14:43Speaker 2: a point on a complex map. Okay, the closer to
- 14:46Speaker 2: addresses or points are on this map, the more similarly
- 14:49Speaker 2: the meaning of the texts. This allows the computer to
- 14:52Speaker 2: understand semantic similarity without actually reading in our human sense.
- 14:55Speaker 2: It's purely mathematical, so.
- 14:57Speaker 1: It turns meaning into.
- 14:58Speaker 2: Coordinates basically, yes, and this makes tasks like clustering emails
- 15:02Speaker 2: incredibly efficient, separating them from, say, poems. It also powers
- 15:06Speaker 2: things like semantic search and retrieval systems find me documents
- 15:09Speaker 2: like this one.
- 15:10Speaker 1: So it's about turning complex information into something that computer
- 15:13Speaker 1: can intelligently compare and measure. That's genuinely mind.
- 15:16Speaker 2: Boggling precisely, and for structured data analysis think relational databases
- 15:22Speaker 2: or graph databases. Lms truly act as a universal interface interface.
- 15:27Speaker 2: How they translate your natural language questions directly into formal
- 15:30Speaker 2: query languages like SQL for tables or cipher for graphs.
- 15:35Speaker 2: This contrast sharply with the traditional need for someone to
- 15:38Speaker 2: manually write those precise, often complex queries.
- 15:42Speaker 1: So I can just ask my database questions in English.
- 15:44Speaker 2: That's the goal. We often use external tools with the
- 15:47Speaker 2: LM for this because of efficiency, cost, and the sheer
- 15:50Speaker 2: volume of large data sets that would exceed in LM's
- 15:53Speaker 2: input limits. The LM acts as the translator.
- 15:56Speaker 1: How does that work? In practice?
- 15:57Speaker 2: You can build a natural language query interface for tabular data,
- 16:00Speaker 2: for example, by first having the LM automatically extract the
- 16:04Speaker 2: database structure, maybe by querrying the quite master table in
- 16:07Speaker 2: squite ah.
- 16:09Speaker 1: It figures out the tables and columns itself exactly.
- 16:12Speaker 2: Then it translates your natural language questions into SEQL queries
- 16:16Speaker 2: based on that structure, and finally, your application executes those
- 16:19Speaker 2: queries against the actual database.
- 16:21Speaker 1: That kind of automation sounds amazing, but with that level
- 16:24Speaker 1: of power accessing databases directly, there must be a significant caution, right.
- 16:30Speaker 2: Yes, a big one, a huge one actually. Do not
- 16:34Speaker 2: blindly trust your language model to generate accurate queries. They
- 16:37Speaker 2: can make mistakes. What kind of mistakes They might misunderstand
- 16:40Speaker 2: the question, misinterpret the schema, or generate SQEL that's inefficient
- 16:45Speaker 2: or just plain wrong, or worse, potentially destructive if you've
- 16:48Speaker 2: given it right access.
- 16:49Speaker 1: Yikes.
- 16:50Speaker 2: So always always keep a backup of important data before
- 16:53Speaker 2: enabling data access via language models, and ideally have checks
- 16:57Speaker 2: in place, maybe even human review for sensitive querities. It's
- 17:01Speaker 2: power that absolutely needs human oversight.
- 17:03Speaker 1: Okay, creceed with caution on database access. Got it. And
- 17:06Speaker 1: it's not just text and tables anymore. Llms are now
- 17:09Speaker 1: analyzing images and videos too. How does that work?
- 17:12Speaker 2: It's truly incredible. Models like GPT four to H are
- 17:15Speaker 2: natively multimodal. This means they were trained from the ground
- 17:19Speaker 2: up on different types of data, not just text, so
- 17:21Speaker 2: they can see in the sense, you could ask free
- 17:24Speaker 2: form natural language questions directly about images. For example, detect
- 17:29Speaker 2: golden persian cats in this picture, and you provide the
- 17:32Speaker 2: image along with the text wow. Your prompts combine text
- 17:36Speaker 2: instructions with image ll components pointing to images online. You
- 17:40Speaker 2: could even include multiple images in one prompt for comparative analysis,
- 17:44Speaker 2: like what's different between these two photos?
- 17:46Speaker 1: And cost? Is analyzing images expensive?
- 17:49Speaker 2: The cost is generally proportional to the resolution of the
- 17:52Speaker 2: images you submit. High resolution, more detail, potentially more tokens used.
- 17:56Speaker 1: Okay, what about say, tagging people in photos.
- 18:00Speaker 2: Do that too. You could provide a reference picture of
- 18:02Speaker 2: a person alongside the pictures you want to tag, using
- 18:04Speaker 2: multimodal prompts with two or more images and text instructions
- 18:08Speaker 2: like is the person in the first image present in
- 18:10Speaker 2: the second image?
- 18:11Speaker 1: What if my images and videos aren't online if they're
- 18:14Speaker 1: stored locally on my computer?
- 18:15Speaker 2: Good question. For local images or video frames, you need
- 18:19Speaker 2: to encode them first. Common formats like PNG jpeg up
- 18:23Speaker 2: to about twenty milibuni in size need to be converted
- 18:26Speaker 2: into a text format called Base sixty four and then
- 18:28Speaker 2: encoded as UTF eight.
- 18:30Speaker 1: Encode them as text yes.
- 18:32Speaker 2: Essentially turning the image data into a long string of
- 18:34Speaker 2: characters that can be sent in the API request along
- 18:38Speaker 2: with your text prompt. Libraries like OpenCV are commonly used
- 18:42Speaker 2: to extract individual frames from videos, maybe just the first
- 18:45Speaker 2: ten frames, to get a sense of the videos content and.
- 18:48Speaker 1: What would you do with those frames?
- 18:49Speaker 2: You could use those sampled frames, along with text instructions
- 18:52Speaker 2: to say, generate a concise video title, like provide the
- 18:56Speaker 2: frames and ask generate a short title for a video
- 18:58Speaker 2: showing these scenes. It might come back with traffic conditions
- 19:01Speaker 2: on I five during rush hour.
- 19:03Speaker 1: That's remarkable versatility taking us from text to tables, to
- 19:06Speaker 1: images and video frames. And finally, what about audio data?
- 19:10Speaker 1: Can they listen?
- 19:11Speaker 2: Be sure, can or at least process the data for
- 19:14Speaker 2: audio data analysis. Open AI's Whisper model is a real
- 19:17Speaker 2: game changer. Yeah, it's a transformer model like GPT, but
- 19:21Speaker 2: train specifically on over six hundred and eighty thousand hours
- 19:25Speaker 2: of multilingual audio data. It's excellent for transcription, converting audio
- 19:30Speaker 2: recordings into written text, typically English text output, though it
- 19:34Speaker 2: understands many languages.
- 19:35Speaker 1: So speech to text. What formats?
- 19:37Speaker 2: It supports common formats like MP three, WAV and others,
- 19:41Speaker 2: usually with a file size limit around twenty five milibit
- 19:44Speaker 2: for the standard API.
- 19:45Speaker 1: What can you build with that?
- 19:46Speaker 2: You could build a full voice query interface. Imagine record
- 19:50Speaker 2: a spoken question using a library like sound device on
- 19:53Speaker 2: your computer, OK, transcribe that audio to text using whisper,
- 19:57Speaker 2: translate that text into a SQL query GBT four H,
- 20:01Speaker 2: execute the query against your database, get the result, and
- 20:04Speaker 2: then present the answer back as speech using text to
- 20:06Speaker 2: speech generation.
- 20:07Speaker 1: Whoa a full voice assistant for your data exactly?
- 20:11Speaker 2: OpenAI also has a tts IE model for that text
- 20:14Speaker 2: to speech part You can select from various voices, give
- 20:17Speaker 2: it the text answer, and it generates the audio. Pricing
- 20:20Speaker 2: for TTS is usually based on the number of characters
- 20:22Speaker 2: you convert.
- 20:22Speaker 1: That's amazing. What about translation?
- 20:24Speaker 2: This whole pipeline also enables simultaneous translation. Effectively, spoken input
- 20:29Speaker 2: in one language gets transcribed by whisper, translated to text
- 20:32Speaker 2: in the second language by GPT, and then spoken aloud
- 20:35Speaker 2: in that target language using the TTS model.
- 20:38Speaker 1: Wow, the pieces are all there. Okay, so we've covered
- 20:40Speaker 1: the basics with open AI. But now for the part
- 20:42Speaker 1: that truly blew my mind when I was researching this.
- 20:46Speaker 1: The world of LMS extends far beyond just open AI.
- 20:49Speaker 2: Oh absolutely, It's a rapidly growing ecosystem that are prominent
- 20:53Speaker 2: GPT alternatives, each with unique philosophies and strengths. Like COO, Well,
- 20:57Speaker 2: there's anthropic. With their claud models. They emphasize a constitutional
- 21:02Speaker 2: AI approach, trying to build models that are inherently helpful
- 21:05Speaker 2: and harmless through their training process.
- 21:07Speaker 1: Constitutional AI. Interesting.
- 21:09Speaker 2: Then you have cohere. Their command R plus model, for instance,
- 21:12Speaker 2: focus is heavily on grounding to avoid hallucinations, yet linking
- 21:16Speaker 2: the model's answers back to real data sources. They alpha
- 21:20Speaker 2: use techniques like RAG which stands for retrieval augmented Generation,
- 21:24Speaker 2: and provide connectors that allow the model to perform web
- 21:27Speaker 2: searches or query databases to find factual information before generating an.
- 21:32Speaker 1: Answer, So fact checking itself before answering.
- 21:35Speaker 2: That's the idea. And of course Google they played a
- 21:37Speaker 2: foundational role by inventing the transformer architecture itself back in
- 21:42Speaker 2: twenty seventeen. Their Gemini models offer very powerful multimodal capabilities
- 21:47Speaker 2: as well.
- 21:48Speaker 1: Right, Google's a huge player, and for those who prefer
- 21:50Speaker 1: more control, maybe running models locally on their own machines.
- 21:53Speaker 2: That's where hugging Face really shines. They are central to
- 21:56Speaker 2: the open source AI community.
- 21:58Speaker 1: Hugging Face like the emoji.
- 22:00Speaker 2: Exactly like the emoji, they provide a vast platform and
- 22:03Speaker 2: ecosystem for open source models. This allows users to download
- 22:07Speaker 2: and run models on their own local infrastructure.
- 22:10Speaker 1: What's the benefit of that It can.
- 22:11Speaker 2: Be significantly cheaper in the long run, especially for high
- 22:14Speaker 2: volume use as you're not paying per token to an API,
- 22:18Speaker 2: And crucially, it's ideal for sensitive data that you absolutely
- 22:22Speaker 2: cannot send to a third party API for privacy or
- 22:25Speaker 2: security reasons makes sense.
- 22:26Speaker 1: How many models are we talking about?
- 22:28Speaker 2: The hugging face hub has? I think over a million models,
- 22:32Speaker 2: data sets and related resources. Now, it's enormous. You can
- 22:35Speaker 2: filter models by task, text classification, image generation, visual question answering,
- 22:40Speaker 2: you name it. It's a real treasure trove for finding
- 22:43Speaker 2: or building custom solutions.
- 22:44Speaker 1: A million models. Wow? Okay. So for those truly complex,
- 22:48Speaker 1: multi step data analysis pipelines we talked about earlier, maybe
- 22:51Speaker 1: combining database queries with web searches and tech summarization. Yeah,
- 22:56Speaker 1: we're talking about next level tools, right frameworks exactly.
- 22:59Speaker 2: For those kinds of sophisticated workflows, you'll often turn to
- 23:01Speaker 2: software frameworks like lang chain and lama index. They help
- 23:04Speaker 2: manage the complexity.
- 23:06Speaker 1: Lang chain, what's the core idea there?
- 23:07Speaker 2: Lang chain helps you compose complex applications through chains. Think
- 23:11Speaker 2: of chains as ways to sequence operations, integrating LMAM calls
- 23:16Speaker 2: with other standard Python functions or external.
- 23:18Speaker 1: APIs like linking steps together precisely.
- 23:22Speaker 2: Key components include things like chat prompt template for creating
- 23:25Speaker 2: reusable prompt structures, chat open ai or similar for making
- 23:29Speaker 2: the actual API calls to the LLM, and strout pot
- 23:33Speaker 2: parser for neatly getting the text result out.
- 23:35Speaker 1: Okay, building blocks.
- 23:36Speaker 2: But the really powerful concept in lang chain is often agents.
- 23:40Speaker 1: Agents like secret agents.
- 23:42Speaker 2: Yeah, sort of think of an agent as putting the
- 23:44Speaker 2: LLM in the driver's seat. You give it a complex
- 23:48Speaker 2: task and a sit of tools that can use.
- 23:50Speaker 1: Tools.
- 23:50Speaker 2: Being tools are basically just regular functions, Python functions, API calls, whatever,
- 23:54Speaker 2: but they have a natural language description telling the agent
- 23:57Speaker 2: what the tool does. The agent can then look at
- 23:59Speaker 2: the tag, break it down and decide Okay, for this part,
- 24:02Speaker 2: I need to use the sql query tool. For that part,
- 24:05Speaker 2: I'll use the web search tool. Then I'll use the
- 24:07Speaker 2: summarizer tool. It figures out the plan and wish tools
- 24:10Speaker 2: to invoke in what order.
- 24:11Speaker 1: So the LLM itself orchestrates the workflow using the tools
- 24:15Speaker 1: you give it exactly.
- 24:16Speaker 2: For instance, you could build a data analysis agent that
- 24:19Speaker 2: combines several relational database tools one to list tables, one
- 24:23Speaker 2: to get the schema, one to check sql syntax, one
- 24:26Speaker 2: to actually run the query, maybe alongside a web search
- 24:28Speaker 2: tool for pulling in external context. You define these custom
- 24:32Speaker 2: tools quite easily, often using a simple a tool decorator.
- 24:35Speaker 1: In Python that sounds incredibly powerful. Giving the LM agency
- 24:39Speaker 1: to solve problems and LAMA index how does that fit in?
- 24:43Speaker 2: Lamma index is another extremely popular framework, and it particularly
- 24:47Speaker 2: excels when you're dealing with large collections of your own data,
- 24:51Speaker 2: especially documents of various types of PDFs, powerpoints, text files, etc.
- 24:55Speaker 1: So more focused on query and your own stuff.
- 24:57Speaker 2: Yes, its main strength is in how it indexes this data.
- 25:00Speaker 2: It pre processes your documents to create efficient search structures,
- 25:03Speaker 2: often using those embedding vectors we talked about earlier. This
- 25:06Speaker 2: allows it to quickly identify the most relevant subsets of
- 25:09Speaker 2: your data for a given query.
- 25:10Speaker 1: Ah, So it finds the right needle in the haystack first, exactly.
- 25:14Speaker 2: It retrieves the most relevant chunks of information and then
- 25:17Speaker 2: passes only that context, along with your question to a
- 25:20Speaker 2: powerful LLM like GPT four to synthesize the final answer.
- 25:24Speaker 2: This is much more efficient and effective than trying to
- 25:27Speaker 2: stuff entire documents into an LM prompt, which often isn't
- 25:31Speaker 2: even possible due to length limits.
- 25:32Speaker 1: So lemmy index is about retrieval, augmented generation, finding the
- 25:36Speaker 1: relevant bits first.
- 25:37Speaker 2: Precisely, you could build a simple question answering system over
- 25:40Speaker 2: a whole directory of diverse company reports, PDFs, powerpoints, maybe
- 25:44Speaker 2: web pages, and Lemmy index handles fetching the right pieces
- 25:47Speaker 2: of info before the ll generates the answer.
- 25:50Speaker 1: So how do they compare lang Chain and lemnx. Are
- 25:52Speaker 1: they competitors or complementary? Do you use one or the other?
- 25:55Speaker 2: That's a great question. Lane Chain is perhaps a more
- 25:58Speaker 2: general framework for build all sorts of LLM powered applications,
- 26:02Speaker 2: with a strong focus on agents and chains orchestrating tools.
- 26:06Speaker 2: Lemmy Index is more specialized, really focus on that interaction
- 26:09Speaker 2: pattern between lms and large external data sets via indexing
- 26:13Speaker 2: and retrieval.
- 26:14Speaker 1: So different focuses, right.
- 26:15Speaker 2: You'll often see them used together. Actually, you might use
- 26:18Speaker 2: law index to build a robust retrieval tool and then
- 26:21Speaker 2: incorporate that tool into a Lange chain agent, or you
- 26:24Speaker 2: might use one over the other, depending on whether your
- 26:26Speaker 2: main challenge is complex orchestration, lang chain or querying large
- 26:31Speaker 2: knowledge bases bamby index. Both frameworks are also relatively young
- 26:35Speaker 2: and evolving incredibly quickly, so the lines can blur. It's
- 26:39Speaker 2: really exciting space to watch.
- 26:40Speaker 1: So what does this all mean for you, the listener?
- 26:43Speaker 1: We've unpacked how llms are not just for generating text
- 26:47Speaker 1: or chatting, but are becoming these incredibly powerful engines for
- 26:51Speaker 1: a data analysis across pretty much every format imaginable.
- 26:54Speaker 2: Yeah, it's gone way beyond chatbots.
- 26:56Speaker 1: We've covered their incredible versatility, some practical techniques for optimizing
- 27:00Speaker 1: cost and performance, and explore these advanced frameworks like lang
- 27:03Speaker 1: chain and lem index that let you build truly sophisticated applications.
- 27:08Speaker 1: We're really just scratching the surface of what these frameworks
- 27:11Speaker 1: can do, but the key takeaway is they unlock true
- 27:14Speaker 1: programmatic power for llms.
- 27:16Speaker 2: And remember, knowledge is really most valuable when it's understood
- 27:20Speaker 2: and applied. We encourage you to think about the practical
- 27:23Speaker 2: applications of this knowledge in your own fields, your own work,
- 27:27Speaker 2: whether that's automating the analysis of customer reviews, building voice
- 27:31Speaker 2: interfaces for your internal tools, or extracting new insights from
- 27:34Speaker 2: complex multimodal data sources. The possibilities are just vast. Now,
- 27:41Speaker 2: this really raises an important question, maybe the most important one.
- 27:44Speaker 2: How will you start experimenting with these capabilities to solve
- 27:48Speaker 2: your unique data challenges? What problem could you tackle now
- 27:52Speaker 2: that you couldn't before.
- 27:53Speaker 1: That's the real question. And while llms definitely offer an
- 27:56Speaker 1: almost magical experience. Sometimes, maybe the true power lies in
- 28:00Speaker 1: our human ability to understand how they work warts and all,
- 28:04Speaker 1: to manage their limitations, like those convincing hallucinations, and to
- 28:08Speaker 1: critically design the prompts, the workflows, the frameworks that turn
- 28:11Speaker 1: all that raw data into meaningful, verified insights.
- 28:14Speaker 2: Verification is key.
- 28:15Speaker 1: The continuous journey of learning and applying these evolving tools,
- 28:19Speaker 1: figuring out how to use them responsibly and effectively. That
- 28:23Speaker 1: really feels like the most exciting frontier in data right now.