Latest / CyberSecurity Summary / Designing Large Language Model Applications: A Holistic Approach to LLMs
Transcript
- 0:00Speaker 1: Welcome to the deep dive. If you've been watching the
- 0:03Speaker 1: tech world, you know we're living through an incredible moment.
- 0:06Speaker 1: This AI revolution powered by large language models or.
- 0:11Speaker 2: LMS, it really is something else.
- 0:12Speaker 1: Yeah, it's not just a minor tech update. It feels
- 0:14Speaker 1: like one of those huge shifts, you know, like the computer,
- 0:17Speaker 1: the internet, or the smartphone.
- 0:18Speaker 3: Definitely pivotal.
- 0:19Speaker 1: We're seeing these prototypes that seem almost magical. You can
- 0:23Speaker 1: write stories, generate code, it's amazing.
- 0:26Speaker 3: The demos are stunning.
- 0:28Speaker 1: But here's the thing, right, taking that cool demo and
- 0:30Speaker 1: making it a reliable, production grade application, that's well, that's
- 0:35Speaker 1: a whole different.
- 0:36Speaker 3: Credit, much harder game.
- 0:37Speaker 1: Yeah. So our mission today is really to cut through
- 0:39Speaker 1: some of that hype and navigate this pretty complex landscape
- 0:43Speaker 1: of LM development. We want to equip you, our listener,
- 0:47Speaker 1: with the core intuition, some surprising facts maybe, and the
- 0:51Speaker 1: practical tools you'll need to build genuinely sophisticated applications, the
- 0:55Speaker 1: ones that actually work.
- 0:56Speaker 2: And to guide us on this deep dive. We're leaning
- 0:58Speaker 2: pretty heavily on a fent plastic resource designing Large language
- 1:02Speaker 2: Model applications by suhas PE. What's great about it? I
- 1:05Speaker 2: think is that it's not just some dry technical manual.
- 1:09Speaker 3: It gives this.
- 1:10Speaker 2: Really holistic overview for you know, software engineers and mel folks,
- 1:15Speaker 2: product managers, anyone involved.
- 1:16Speaker 1: That's useful.
- 1:17Speaker 2: Yeah, and it provides surprising depth that helps you understand
- 1:21Speaker 2: not just what the models do, but fundamentally why they
- 1:25Speaker 2: behave the way they do, and that why is crucial,
- 1:27Speaker 2: absolutely crucial, especially for getting past fragile prototypes to something robust.
- 1:32Speaker 1: Okay, let's unpack this then when we talk about lms,
- 1:35Speaker 1: what are they actually made of? Like what are the
- 1:37Speaker 1: basic ingredients before they even start learning?
- 1:40Speaker 3: Right?
- 1:40Speaker 2: So, at their very core, lms are built on pre
- 1:43Speaker 2: training data.
- 1:44Speaker 1: That's the raw fuel data. Got it?
- 1:46Speaker 2: And you know that old saying garbage in, garbage out,
- 1:48Speaker 2: It applies massively here. The scale and maybe even more importantly,
- 1:53Speaker 2: the quality of this data is paramount.
- 1:56Speaker 1: So where does it all come from?
- 1:57Speaker 2: We're talking colossal amounts of text. A huge chunk often
- 2:01Speaker 2: comes from web text, like from common Girl. Massive, but
- 2:04Speaker 2: it needs so much cleaning because well, the Internet's.
- 2:07Speaker 1: Messy understatement of the year, huh.
- 2:09Speaker 3: Right.
- 2:09Speaker 2: Then you have things like web text or open web text.
- 2:12Speaker 2: They often use signals from places like Reddit outbound links
- 2:16Speaker 2: specifically trying to filter for you know, higher quality stuff.
- 2:19Speaker 3: Wisdom of the crowd kind of interesting.
- 2:21Speaker 1: What else?
- 2:22Speaker 2: There's factual knowledge from Wikipedia, super valuable for accuracy, but
- 2:26Speaker 2: the style.
- 2:27Speaker 1: Is very formal, yeah, very encyclopedic.
- 2:29Speaker 2: And historically BooksCorpus was big, lots of narrative but surprisingly
- 2:33Speaker 2: like twenty six percent romance novels from unpublished authors, so
- 2:37Speaker 2: quite specific.
- 2:38Speaker 1: Wow.
- 2:38Speaker 2: Okay, and now you see newer efforts like hugging faces,
- 2:41Speaker 2: Fine Web aiming for even cleaner web data and I'm
- 2:45Speaker 2: fine Web ed you focusing on educational content.
- 2:48Speaker 3: Fifteen trillion tokens. It's huge.
- 2:50Speaker 1: So it's clearly not just about quantity, it's about cleaning
- 2:54Speaker 1: and curating this raw material. What does that involve exactly?
- 2:57Speaker 2: Data preprocessing is key, It's not glamorous, but maybe the
- 3:00Speaker 2: most vital step, like what specifically you got to strip
- 3:03Speaker 2: out all the web boilerplate, menus, navelinks, lar nipsen, placeholders,
- 3:07Speaker 2: all that junk.
- 3:08Speaker 3: And language identification.
- 3:10Speaker 2: Is surprisingly tricky, even in supposedly English only data sets.
- 3:15Speaker 3: Other languages creep in.
- 3:17Speaker 2: If you don't catch that, your model might suddenly start
- 3:19Speaker 2: speaking Spanish, which.
- 3:21Speaker 1: Could be a bug or maybe a.
- 3:23Speaker 2: Feature could be either, and quality filtering is vital too
- 3:27Speaker 2: often using things like perplexity scores.
- 3:29Speaker 1: Okay, perplexity scores, how does that work? Break that down?
- 3:31Speaker 3: Sure? Think of it like this.
- 3:33Speaker 2: If you're trying to predict the next word in a
- 3:36Speaker 2: really well written, clear sentence, it's pretty easy.
- 3:39Speaker 3: Low uncertainty. That's low perplexity, makes sense. But if you're
- 3:43Speaker 3: trying to.
- 3:43Speaker 2: Guess the next word in some garbled text full of errors,
- 3:46Speaker 2: it's super hard. High uncertainty, that's high perplexity.
- 3:50Speaker 1: Ah, okay, So high perplexity means noisy, bad data.
- 3:54Speaker 2: Basically, yeah, you probably don't want to feed that to
- 3:56Speaker 2: your expensive model.
- 3:57Speaker 1: Got it? And after cleaning you mentioned duplication in privacy?
- 4:01Speaker 1: Why is that so important?
- 4:02Speaker 3: Oh? It's massive.
- 4:03Speaker 2: Web tex is full of duplicates. Removing them isn't just
- 4:06Speaker 2: about efficiency. It's critical to stop llms from accidentally memorizing
- 4:11Speaker 2: and leaking PII personally identifiable information.
- 4:14Speaker 1: Right, even if it's technically published exactly.
- 4:17Speaker 2: That's the whole contextual integrity issue. Should an AI just
- 4:20Speaker 2: blurt out someone's address because it found it online somewhere?
- 4:23Speaker 2: It's tricky, especially with public figures.
- 4:26Speaker 1: Complex ethical grounds totally.
- 4:28Speaker 2: And what's wild is that even a tiny bit of
- 4:31Speaker 2: manipulated data, like less than point one percent, can potentially
- 4:35Speaker 2: make it easier for other sensitive data to leak.
- 4:38Speaker 1: Wow. Okay, that's a lot about the raw material. But
- 4:41Speaker 1: this next part for me is where it gets really fascinating.
- 4:45Speaker 1: How do these models actually read. It's not like they
- 4:48Speaker 1: see words like we do, is it?
- 4:50Speaker 3: You're spot on?
- 4:51Speaker 2: They don't process discrete words like humans. They use something
- 4:53Speaker 2: called tokens, and often these tokens are.
- 4:56Speaker 1: Subwords, subwords like parts of words kind of yeah.
- 4:59Speaker 2: So example in gpt ex, office might be one token,
- 5:03Speaker 2: but office with that little meaning a space before it
- 5:05Speaker 2: is a different token.
- 5:06Speaker 3: Case matters to office versus office.
- 5:09Speaker 1: Okay, so it's more granial exactly.
- 5:11Speaker 2: And the subword approach is clever because it mostly avoids.
- 5:14Speaker 3: The out of vocabulary problem.
- 5:16Speaker 2: If it sees a totally new word, it can usually
- 5:18Speaker 2: break it down into known subword pieces instead of just crashing.
- 5:22Speaker 1: So it's almost like they're reading in syllables or morphemes,
- 5:25Speaker 1: not whole words.
- 5:25Speaker 2: Oh a bit like that, Yeah, smaller meaningful units. And
- 5:28Speaker 2: sometimes this process creates weird artifacts glitch tokens tokens, yeah,
- 5:34Speaker 2: or undertrain ones. There's this great story about solid Magic
- 5:38Speaker 2: gold Carp. It was a Reddit username that actually became
- 5:41Speaker 2: a token in GPT two.
- 5:42Speaker 1: Seriously a username yep.
- 5:44Speaker 2: But then later models like GPT three were trained on
- 5:47Speaker 2: different data where that token barely appeared. It had no
- 5:50Speaker 2: training signal. So if you fed GPT three Solid Magic
- 5:53Speaker 2: old Carp, it would just act weirdly like it had
- 5:55Speaker 2: no clue what to do as it are it is.
- 5:58Speaker 2: But it raises this cool question, what can these weird
- 6:01Speaker 2: tokens tell us about the training data. It's like a
- 6:04Speaker 2: little window into the model's digestive system.
- 6:07Speaker 1: Huh, a digital digestive system. I like that. Okay, so
- 6:10Speaker 1: we have the data, we have the tokens. How does
- 6:12Speaker 1: this all come together? We hear neural networks transformers. What's
- 6:16Speaker 1: the engine?
- 6:17Speaker 3: Right?
- 6:17Speaker 2: The engine at the heart of almost all modern llms
- 6:20Speaker 2: is the transformer architecture. It was a huge breakthrough back
- 6:23Speaker 2: in twenty seventeen. Why was it such a big deal
- 6:25Speaker 2: because older recurrent neural networks RNNs really struggled with long sentences,
- 6:32Speaker 2: long range dependencies. They were trying to sort of cram
- 6:35Speaker 2: the meaning of a whole sentence into one single vector.
- 6:38Speaker 2: It just didn't scale well. The transformer changed that with
- 6:40Speaker 2: its key innovation self attention.
- 6:43Speaker 1: Self attention. That sounds mindful. How does it work for AI?
- 6:47Speaker 2: Heah, Yeah, it's actually pretty intuitive. Think about how we read.
- 6:50Speaker 2: We don't give every word equal weight, right, definitely not.
- 6:54Speaker 2: We focus on certain words to understand context, like bank
- 6:57Speaker 2: means something different in riverbank versus saving bank. Self attention
- 7:01Speaker 2: lets the model do exactly that way, the importance of
- 7:04Speaker 2: different words in the sequence as it processes them, so it.
- 7:07Speaker 1: Learns context from surrounding words precisely.
- 7:09Speaker 2: It's like that old linguistics idea you shall know a
- 7:12Speaker 2: word by the company it keeps. It uses these things
- 7:14Speaker 2: called query key and value matrices to let words mathematically
- 7:18Speaker 2: attend to each other.
- 7:20Speaker 1: Okay, mathematically attend, got it? And they're different types of
- 7:23Speaker 1: these transformers.
- 7:24Speaker 3: Yeah, broadly. Three main transformer backbones.
- 7:28Speaker 2: First, encoder only models like Burt great for understanding text things,
- 7:32Speaker 2: search or classification.
- 7:33Speaker 1: Right.
- 7:33Speaker 2: Then the original encoder decoder design still fantastic for things
- 7:37Speaker 2: like machine translation, where you need to process an input
- 7:40Speaker 2: and generate a distinct output.
- 7:42Speaker 1: Okay.
- 7:43Speaker 2: And finally, the one we usually associate with generative AI
- 7:46Speaker 2: like GPT four the decoder only architecture. These models are
- 7:50Speaker 2: specialized in predicting the very next token in a sequence.
- 7:53Speaker 2: That's how they generate text.
- 7:55Speaker 1: And what about these mixture of experts models? Loe? Are
- 7:59Speaker 1: they different? Again?
- 8:00Speaker 2: There are really interesting evolution sort of built on the backbone.
- 8:04Speaker 2: Mixture of experts aims to massively increase a model's capacity
- 8:08Speaker 2: how much it knows without proportionally increasing the compute cost
- 8:12Speaker 2: for every single input.
- 8:13Speaker 1: How does that work?
- 8:14Speaker 2: The clever bit is that for any given input, only
- 8:16Speaker 2: a subset of specialized experts inside the model gets activated.
- 8:19Speaker 2: So ask about physics, the physics expert activates. Ask about poetry,
- 8:23Speaker 2: The poetry expert lights up. The others stay quiet.
- 8:26Speaker 1: Huh So it's like calling on specialists exactly.
- 8:29Speaker 2: You get the power of a huge model, but you
- 8:31Speaker 2: only run the relevant parts for each query. Mistral's mixtral
- 8:35Speaker 2: is a key example, and many suspect GEPC four uses
- 8:39Speaker 2: something similar, though it's unconfirmed.
- 8:41Speaker 1: This is really critical then for you, the listener, understanding
- 8:45Speaker 1: these foundations, the data, the tokens, the transformer architecture MOE.
- 8:52Speaker 1: It's crucial, absolutely, even if you never train one from scratch.
- 8:56Speaker 1: That intuition helps you debug, figure out why it's behaving oddly,
- 9:00Speaker 1: and build better apps. You start to see why it
- 9:03Speaker 1: might struggle or succeed.
- 9:04Speaker 3: Get a feel for the machine.
- 9:06Speaker 1: So we've established these models are powerful, but yeah, definitely
- 9:09Speaker 1: not perfect. What are some of the biggest practical limitations
- 9:12Speaker 1: and how are we starting to tackle them.
- 9:14Speaker 2: One of the biggest and probably most talked about, is hallucinations.
- 9:17Speaker 1: Right when they just make stuff up.
- 9:19Speaker 2: Exactly more formally, it's generated text that isn't grounded in
- 9:22Speaker 2: the training data or the input context.
- 9:25Speaker 3: It sounds plausible, but it's just fabrications.
- 9:27Speaker 1: Do you give an example.
- 9:28Speaker 2: Sure, there was a well known case with the NAS
- 9:31Speaker 2: Research Hermes model. It hallucinated details about Ugandan medal winners
- 9:36Speaker 2: from the twenty twenty Olympics. Oh wow, Yeah, it got
- 9:39Speaker 2: birth dates wrong, mixed up which medals they won. The
- 9:42Speaker 2: athletes were real, the core facts were real, but the
- 9:45Speaker 2: details were just invented, confidently stated but wrong.
- 9:48Speaker 1: Yikes, how do you even begin to fix that?
- 9:52Speaker 2: It's tough. Mitigation involves several things. Good product design helps
- 9:56Speaker 2: try not to ask questions the LLM likely can't answer,
- 10:00Speaker 2: soh knowing what it doesn't know is hard true. We
- 10:02Speaker 2: also look at model self knowledge and calibration, basically, how
- 10:06Speaker 2: confident is the model in its own output. Sometimes low
- 10:09Speaker 2: confidence correlates with higher hallucination risk.
- 10:11Speaker 1: Okay, using its own uncertainty signals.
- 10:13Speaker 3: Yeah.
- 10:14Speaker 2: And then there are technical effixes during generation, like factual
- 10:17Speaker 2: nuclear sampling, which tries to reduce randomness for more factual outputs,
- 10:21Speaker 2: or doulity coding, which cleverly uses differences between signals and
- 10:25Speaker 2: the transformulators to spot potential hallucinations.
- 10:28Speaker 1: Fascinating, And sometimes they hallucinate just because the prompt itself
- 10:31Speaker 1: is confusing, right, like yeah, with irrelevant info?
- 10:33Speaker 2: Yeah, absolutely. If you put distracting sentences in the prompt
- 10:37Speaker 2: like mentioning max selling apples in Sarah's unrelated math problem,
- 10:42Speaker 2: the LM can get confused and incorporate the wrong info,
- 10:45Speaker 2: so prompting it to first identify and remove irrelevant context
- 10:49Speaker 2: can help.
- 10:50Speaker 1: Okay. So beyond just factual accuracy, what about actual reasoning?
- 10:55Speaker 1: Can they really connect dots logically?
- 10:58Speaker 2: That's a huge area of research and development. Natural language
- 11:01Speaker 2: reasoning means integrating knowledge to draw conclusions, and there are
- 11:04Speaker 2: different kinds. Deductive is pure logic premise a premise B,
- 11:09Speaker 2: therefore conclusion C. Like mister Shockley is allergic to mushrooms.
- 11:12Speaker 2: This dish has mushrooms, so mister Shockley.
- 11:14Speaker 3: Should avoid it.
- 11:15Speaker 2: Simple logic, then inductive generalizing from examples, so hundreds of
- 11:19Speaker 2: round manhole covers conclude manhole covers are generally round. Abductive
- 11:23Speaker 2: reasoning is finding the most likely explanation streets, wet puddles, umbrellas, hmm,
- 11:27Speaker 2: probably rain inferance of the best explanation exactly. And then
- 11:31Speaker 2: there's common sense implicit stuff like you can't fit a
- 11:34Speaker 2: horse in a Mini Cooper.
- 11:35Speaker 1: Huh yeah, hopefully obvious. How do you get an LLM
- 11:38Speaker 1: to do that better?
- 11:39Speaker 2: A major technique is chain of thought prompting or cooey.
- 11:43Speaker 2: You literally tell the LLM to think, step by.
- 11:46Speaker 1: Step, show your work basically pretty.
- 11:48Speaker 2: Much for a math problem like thirty four plus forty
- 11:51Speaker 2: four plus three twenty three three to two. Instead of
- 11:54Speaker 2: just asking for the answer, you ask it to break
- 11:56Speaker 2: it down first, calculate three, two, three, and so on.
- 11:59Speaker 2: Performance jump dramatically.
- 12:01Speaker 1: Because it forces a sequential process right.
- 12:03Speaker 2: It gives it intermediate steps to work with. It costs
- 12:05Speaker 2: more tokens, more time, but it's often worth it for
- 12:08Speaker 2: complex tasks. You can also use verifiers, maybe another LM
- 12:12Speaker 2: to check the steps, or even fine tune models specifically
- 12:15Speaker 2: on reasoning data sets.
- 12:16Speaker 1: Okay, so we can make them smarter, more reliable, but
- 12:19Speaker 1: these things are huge. How do we actually run them
- 12:22Speaker 1: efficiently in the real world. That sounds like a massive hurdle.
- 12:25Speaker 2: It is a huge hurdle, and that brings us to
- 12:26Speaker 2: choosing and optimizing llms for production. First, you have to
- 12:30Speaker 2: pick one. You've got proprietary providers open AI, Google, Mthropic
- 12:34Speaker 2: via APIs easy to use, manage the big players, and
- 12:37Speaker 2: then open source models Metaslama, luther AI, Mistral, Microsoft's FI models.
- 12:44Speaker 2: You get the model weights, more transparency, more flexibility, but
- 12:46Speaker 2: you often have to manage the deployment yourself or use
- 12:49Speaker 2: specialized platforms.
- 12:50Speaker 1: Trade offs there big time.
- 12:51Speaker 2: Transparency versus convenience, cost versus latency, And.
- 12:55Speaker 1: Once you pick one, how do you know if it's
- 12:57Speaker 1: any good for your job? Benchmarks are everywhere, but are
- 13:00Speaker 1: they the whole story?
- 13:02Speaker 2: Definitely not the whole story. Evaluating llm's is super tricka.
- 13:06Speaker 2: Benchmarks can suffer from test set contamination. The model might
- 13:09Speaker 2: have seen the answers in its training data cheating basically
- 13:13Speaker 2: kind of or models get over optimized just to score
- 13:16Speaker 2: well on a benchmark, but aren't great in practice, and
- 13:19Speaker 2: they're very sensitive to how you prompt them. Frameworks like
- 13:22Speaker 2: Stanford's HLM try to be more comprehensive, looking at accuracy, robustness, fairness, calibration.
- 13:28Speaker 3: Lots of things.
- 13:29Speaker 2: So you need holistic evaluation and ideally your own internal
- 13:33Speaker 2: benchmarks tailored to your actual use case. That's key now
- 13:37Speaker 2: actually running them, you generally need GPUs for decent speed.
- 13:40Speaker 2: They're just computationally intensive, right, expensive hardware, which is where
- 13:44Speaker 2: quantization comes in.
- 13:45Speaker 3: It's a lifesaver.
- 13:46Speaker 1: Quantization Explain that sounds.
- 13:48Speaker 3: Complex, it's actually a pretty neat idea.
- 13:50Speaker 2: It's about reducing the memory footprint. You take the numbers
- 13:53Speaker 2: inside the model, usually high precision floating point numbers like
- 13:57Speaker 2: FP thirty two, and represent them with fewer bits like
- 14:01Speaker 2: FP sixteen, b F sixteen or even eight bit integers.
- 14:04Speaker 2: It's an INN eight so like compressing the numbers.
- 14:07Speaker 1: Exactly like compressing them, you lose a tiny bit of precision,
- 14:11Speaker 1: usually negligible, but the model becomes much smaller, uses less memory,
- 14:15Speaker 1: and runs faster. Tools like a LAMA. Make it easier
- 14:18Speaker 1: to run these quantized models, even locally on a powerful laptop.
- 14:21Speaker 2: Sometimes that's cool. Make the more accessible. Okay, so it's loaded,
- 14:25Speaker 2: maybe quantized. How do you speed up the inference, the
- 14:28Speaker 2: actual running part, and make it cheaper.
- 14:29Speaker 1: Several key tricks for LLM inference optimization. A huge one
- 14:33Speaker 1: is the cav cash cav cash Yeah, key value cash.
- 14:36Speaker 1: Think of it as the model's short term memory for
- 14:38Speaker 1: the current conversation or task. When you send a prompt,
- 14:41Speaker 1: especially one with instructions, those instructions often stay the same
- 14:45Speaker 1: for follow up questions.
- 14:46Speaker 2: The cav cash stores the internal calculations the key and
- 14:49Speaker 2: value matrices from self attention related to that initial prompt,
- 14:53Speaker 2: so the model doesn't have to recalculate them every single
- 14:56Speaker 2: time you ask a follow up question. It dramatically speeds
- 14:59Speaker 2: things up after.
- 15:00Speaker 3: The first turn.
- 15:01Speaker 1: Ah avoids redundant work clever what.
- 15:05Speaker 2: Else, there's speculative decoding. This is pretty cool. You use
- 15:09Speaker 2: a small, fast draft model to generate a chunk of
- 15:12Speaker 2: tokens quickly, Then the larger, more accurate model verifies those
- 15:16Speaker 2: tokens in a batch, like.
- 15:18Speaker 1: A quick first draft, and then a careful.
- 15:19Speaker 2: Edit exactly the big model checks the interns work quickly
- 15:23Speaker 2: instead of doing it all slowly. Itself speeds things up
- 15:26Speaker 2: a lot for generation nice. We also use knowledge distillation.
- 15:30Speaker 2: Train a smaller student model to mimic a big teacher model.
- 15:33Speaker 2: You get a faster, cheaper model that retains a lot
- 15:36Speaker 2: of the capability.
- 15:37Speaker 1: Think the stillburd right, smaller but still capable.
- 15:39Speaker 2: And things like parallel de coding for generating multiple parts simultaneously,
- 15:44Speaker 2: or early exit where simpler queries might get an answer
- 15:46Speaker 2: from an earlier layer of the model without going all
- 15:49Speaker 2: the way through lots of techniques to.
- 15:51Speaker 1: Make them practical. Okay, this brings us squarely to the
- 15:53Speaker 1: application layer. How do we take these optimized lmms and
- 15:57Speaker 1: actually plug them into complex software? They can't just operate
- 16:00Speaker 1: in a vacuum, can they?
- 16:01Speaker 2: No, definitely not. They have real limitations. Knowledge cutoff is
- 16:05Speaker 2: a big one. They don't know about yesterday's news unless retrained.
- 16:08Speaker 2: They struggle with precise math, no factual guarantees, can't easily
- 16:13Speaker 2: cite sources and context. Windows while growing are still finite.
- 16:18Speaker 1: So they need help from the outside world.
- 16:20Speaker 3: Precisely.
- 16:21Speaker 2: You need to interface them with external tools and data.
- 16:24Speaker 2: We generally talk about three core LLM interaction paradigms. Okay, First,
- 16:29Speaker 2: the passive approach. This is basically retrieval augmented generation or RG.
- 16:35Speaker 2: The LLM just receives information and its prompt. It doesn't
- 16:38Speaker 2: know where it came from. You feed it the relevant context.
- 16:40Speaker 1: Giving it the answer key snippet.
- 16:42Speaker 2: Kind of yeah, perfect for Q and A over your
- 16:44Speaker 2: own private documents. You retrieve the relevant text, put it
- 16:47Speaker 2: in the prompt, and the LLM answer.
- 16:49Speaker 3: Is based on that.
- 16:50Speaker 1: Okay, passive, what's next?
- 16:52Speaker 3: Explicit tool use here? The LLM is more active.
- 16:55Speaker 2: You give it instructions and a set of tools it
- 16:57Speaker 2: can use, like a web search tool, a calculator, a
- 17:00Speaker 2: database connector, and.
- 17:01Speaker 1: It chooses which tool to use exactly.
- 17:04Speaker 2: Frameworks like lang chain help manage this. The LLM decides, okay,
- 17:07Speaker 2: to answer this, I need to search the web, and
- 17:09Speaker 2: it triggers the search tool. It becomes an orchestrator, more interactive.
- 17:13Speaker 1: And the third, the.
- 17:14Speaker 2: Most advanced, is the aegentic paradigm. Think autonomous agents. These
- 17:19Speaker 2: lllms can interact with their environment, break down complex goals
- 17:22Speaker 2: into subtasks, and take a sequence of actions using tools
- 17:25Speaker 2: to achieve the goal.
- 17:27Speaker 1: Like that Apple CFO example you.
- 17:28Speaker 2: Mentioned earlier, Exactly like that, who was Apple CFO at
- 17:32Speaker 2: its lowest stock price in ten years? The agent figures
- 17:35Speaker 2: out one, get stock data, two, find lowest point three
- 17:39Speaker 2: find CFO for that date. It plans and executes.
- 17:43Speaker 1: Wow, that's powerful. Still limitations though, you said.
- 17:46Speaker 2: Oh yeah, current agents can still get stuck in loops,
- 17:48Speaker 2: choose the wrong tool, or just fail. It's definitely the
- 17:51Speaker 2: frontier very active research.
- 17:53Speaker 1: Okay, but let's go back to Eric retrieval augmented generation.
- 17:57Speaker 1: You said it's passive, but it feels like the cornerstone
- 18:00Speaker 1: of so many practical LLM apps today. Let's really dive
- 18:03Speaker 1: deep into OURG. Why is it so vital and how
- 18:07Speaker 1: does it actually work?
- 18:08Speaker 3: Under the hood, OURAG is absolutely fundamental.
- 18:10Speaker 2: Its main job is letting LMS access your specific private
- 18:14Speaker 2: data stuff it never saw.
- 18:15Speaker 1: During training, right bitging the knowledge gap.
- 18:18Speaker 2: Exactly, and by doing that it drastically reduces hallucinations because
- 18:22Speaker 2: responses are grounded in actual provided text. It allows for citations,
- 18:26Speaker 2: It lets the LM talk about recent events, and it
- 18:29Speaker 2: handles the long tail entities.
- 18:31Speaker 1: Long tail entities what are those again? Think?
- 18:33Speaker 3: Really niche facts stuff? So rare.
- 18:36Speaker 2: It might only appear once or twice in trillions of
- 18:38Speaker 2: tokens of training data. LM struggle to memorize that OURG
- 18:42Speaker 2: retrieves that specific fact just when needed. Without our AG,
- 18:45Speaker 2: you'd need impossibly huge models to maybe memorize everything.
- 18:49Speaker 1: So OURG is essential for accessing specific, less common knowledge totally.
- 18:53Speaker 2: The RAG pipeline itself is actually quite sophisticated.
- 18:55Speaker 1: Now.
- 18:56Speaker 3: It's not just a simple.
- 18:57Speaker 1: Look up, okay, walk us through the steps.
- 18:59Speaker 2: It often starts with rewrite. The user's query might get
- 19:02Speaker 2: rephrase to better match the documents. Sometimes an LM even
- 19:06Speaker 2: generates a hypothetical document high D that would answer the query,
- 19:09Speaker 2: and then you search using.
- 19:10Speaker 1: That clever search for the ideal answer.
- 19:13Speaker 2: Shape kind of then retrieve, fetching potentially relevant documents, often
- 19:18Speaker 2: using embeddings for semantic similarity. But other methods exist too,
- 19:21Speaker 2: like generative retrieval, where the LLM predicts document IDs.
- 19:25Speaker 1: Okay, got a pile of potential documents, then.
- 19:28Speaker 2: Rerank That initial retrieval might grab some irrelevant stuff. Reranking
- 19:32Speaker 2: uses another model, often a smaller specialized one, to score
- 19:36Speaker 2: and reorder the retrieved docs by true relevance quality.
- 19:40Speaker 1: Control, refining the results. What's next?
- 19:43Speaker 2: Refine Now, you might shorten or summarize the relevant snippets
- 19:46Speaker 2: to fit the context window better and make them more useful.
- 19:49Speaker 2: Techniques like chain of note use an LLM to generate
- 19:52Speaker 2: summaries or bullet points, highlighting key info from the retrieved.
- 19:56Speaker 1: Chunks, making it digestible for the main LLM precisely.
- 20:00Speaker 2: Then insert This is just about how you put that
- 20:02Speaker 2: refined context into the final prompt. Turns out lllms often
- 20:06Speaker 2: pay more attention to stuff at the very beginning or
- 20:09Speaker 2: very end of the prompt attention biases.
- 20:11Speaker 1: Huh interesting quirk.
- 20:13Speaker 3: Yeah.
- 20:13Speaker 2: Finally, generate the main LLM produces the answer, grounded by
- 20:18Speaker 2: the context you just carefully prepared and inserted. That's the
- 20:21Speaker 2: basic flow well, and it can get even more complex
- 20:24Speaker 2: techniques like flare, interleave generation and retrieval. The LM starts writing,
- 20:28Speaker 2: identifies a bit it's unsure about low confidence tokens, pauses,
- 20:33Speaker 2: retrieves more specific info just for that gap, than continues generating.
- 20:37Speaker 1: Wow, dynamically retrieving info mid sentence. That's intricate. Now, with
- 20:42Speaker 1: context windows getting huge like Gemini one point five pros
- 20:45Speaker 1: million tokens, does rags start to become less important. Can't
- 20:48Speaker 1: we just stuff everything in the context.
- 20:50Speaker 2: That's a really common question, and maybe counterintuitively, no, our
- 20:53Speaker 2: rag is still crucial, maybe even more crucial. It is
- 20:56Speaker 2: that because even a million tokens of real world data
- 20:59Speaker 2: can be incredibly noisy, finding that one specific fact the
- 21:03Speaker 2: needle in the haystack, is still hard for the LLM.
- 21:06Speaker 2: RI provides that targeted grounding. It ensures factuality and allows
- 21:10Speaker 2: citations in a way that just having a massive context
- 21:13Speaker 2: window doesn't guarantee.
- 21:14Speaker 1: So long context helps fit more potential info, but ARI
- 21:17Speaker 1: helps find the right info within it exactly.
- 21:20Speaker 2: It reduces the noise problem. Long context isn't a magic
- 21:23Speaker 2: bullet for messy data or the need for verifiable grounding,
- 21:27Speaker 2: and often are and fine tuning work together. You might
- 21:30Speaker 2: fine tune the retriever, the reranker, the generator, each part benefits.
- 21:34Speaker 1: Okay, that makes sense. So given all this complexity, RI pipelines, optimization,
- 21:39Speaker 1: choosing models, how do developers actually build and manage these systems?
- 21:42Speaker 1: It sounds way beyond just fiddling with prompts.
- 21:44Speaker 2: Oh, it absolutely is. It requires real system design. One
- 21:47Speaker 2: common pattern is MULTILLLM.
- 21:49Speaker 1: Architectures using more than one LM.
- 21:51Speaker 2: Yeah, maybe a small, fast, cheap model for simple tasks
- 21:55Speaker 2: or routing the query, then escalating to a big, powerful
- 21:58Speaker 2: model for the complex reasoning A cascade or a router
- 22:01Speaker 2: setup balances cost and capability. And the programming paradigms are
- 22:06Speaker 2: evolving too. We're moving away from just endless manual prompt engineering.
- 22:11Speaker 1: Thank goodness.
- 22:11Speaker 2: Right. Frameworks like DSPI are pushing this idea of programming
- 22:15Speaker 2: not prompting.
- 22:16Speaker 1: DSPI tell me more.
- 22:18Speaker 2: It abstracts the prompting process. You define the flow using
- 22:22Speaker 2: modules that represent techniques like chain of Thought or React.
- 22:26Speaker 2: Then DSPI figures out the best prompt and even model
- 22:29Speaker 2: parameters to make that flow work for your data, often
- 22:32Speaker 2: through optimization. It separates the program logic from the prompt tinkering.
- 22:37Speaker 1: So the framework optimizes the prompts for you largely.
- 22:40Speaker 2: Yes, it angks for more robust, generalizable applications.
- 22:43Speaker 1: That's a big shift. What about controlling the output format
- 22:45Speaker 1: more strictly?
- 22:46Speaker 2: For that, look at things like LMQL. It stands for
- 22:49Speaker 2: Language Model Query Language. It's like SQL but for.
- 22:52Speaker 3: Llms embedded in Python.
- 22:54Speaker 1: Okay.
- 22:54Speaker 2: It lets you write prompts but add declarative constraints like
- 22:57Speaker 2: you could define a template for generating a jet pre clue,
- 23:00Speaker 2: then add a wear clause in LMQL saying the output
- 23:04Speaker 2: must be phrased as a question and be exactly three
- 23:06Speaker 2: words long.
- 23:07Speaker 1: Ah, so you enforce structure directly.
- 23:09Speaker 2: Exactly, much more control over the output format than just
- 23:12Speaker 2: asking nicely in the prompt. Really useful for structured data
- 23:16Speaker 2: extraction or making the LM fit into existing systems.
- 23:20Speaker 1: What an incredible journey we've been on really, from the
- 23:23Speaker 1: fundamental building blocks that messy data, the weirdness have tokens
- 23:28Speaker 1: the transformer all the way to these advanced techniques are
- 23:31Speaker 1: gree optimization, ds PI, LMQL, making them robust, efficient, integrated.
- 23:38Speaker 3: Yeah, it's a lot to cover.
- 23:39Speaker 1: It really shows these lemms aren't just inscrutable black boxes,
- 23:42Speaker 1: are they They're complex, yes, but they can be steered, optimized,
- 23:46Speaker 1: connected to the world.
- 23:47Speaker 2: Absolutely, they are tools we can shape and direct. And
- 23:50Speaker 2: maybe that's the provocative thought to leave you with. This
- 23:53Speaker 2: field is moving so incredibly fast. What we discussed today
- 23:55Speaker 2: as best practice, it might honestly be different in six
- 23:59Speaker 2: months or a year.
- 24:00Speaker 1: Constant change, constant change.
- 24:01Speaker 2: So the real lasting value for you as someone Learning
- 24:04Speaker 2: or building in this space isn't just memorizing today's specific techniques.
- 24:08Speaker 2: It's getting that deeper, intuitive grasp of the underlying.
- 24:11Speaker 1: Principles, Understanding the why.
- 24:13Speaker 2: Understanding the why, how they work, why they fail, how.
- 24:16Speaker 3: To nudge them.
- 24:17Speaker 2: That intuition will be your best asset as the technology
- 24:21Speaker 2: keeps evolving at this frankly breathtaking pace.
- 24:24Speaker 1: To keep exploring, keep asking questions, and keep building.
- 24:27Speaker 3: That's where the real learning happens.