Latest / CyberSecurity Summary / Generative AI with Python and PyTorch: Navigating the AI frontier with LLMs, Stable Diffusion, and next-gen AI applications
Transcript
- 0:00Speaker 1: Welcome to the deep dive. This is where we take
- 0:02Speaker 1: a whole stack of articles, research papers, notes and basically
- 0:05Speaker 1: just dive in to pull out the key insights for
- 0:07Speaker 1: you today. Our mission is to really get under the
- 0:10Speaker 1: hood of generative AI. It's a technology that's well, it's
- 0:13Speaker 1: changing things incredibly fast. And just to give you a
- 0:16Speaker 1: sense of how impactful it is, remember back in twenty
- 0:18Speaker 1: twenty two the Colorado State Fair Art Competition. The winning
- 0:21Speaker 1: piece in the digital art category, theatro tops Space Shelle
- 0:25Speaker 1: wasn't you know, painted by a human. It was made
- 0:27Speaker 1: using mid journey an AI, a really stunning sci fi scene.
- 0:31Speaker 1: It just perfectly captures this blend of creativity and well
- 0:34Speaker 1: pure tech. That's where we're starting today. So okay, generative AI.
- 0:38Speaker 1: It's making headlines everywhere, creating art, writing code, sounding almost human.
- 0:42Speaker 1: But what is it fundamentally? What's the big shift here?
- 0:44Speaker 2: Yeah, it's a massive shift, really a paradigm shift. You
- 0:47Speaker 2: could say, think about most AI you probably come across before.
- 0:50Speaker 2: It's usually discriminative. I mean it learns to tell things
- 0:55Speaker 2: apart right, classify, predict based on data. It's scene like
- 1:00Speaker 2: telling a cat photo from a dog photo. Generative models,
- 1:03Speaker 2: though they do something different. They're not just recognizing patterns.
- 1:06Speaker 2: They learn the deep underlying rules of the data itself.
- 1:09Speaker 2: They learned enough about what makes a cat a cat
- 1:12Speaker 2: that they can actually create entirely new cat images, believable
- 1:15Speaker 2: ones from scratch. It's about generation, not just discrimination.
- 1:21Speaker 1: Wow, okay, so it's not just sorting or identifying. It's
- 1:23Speaker 1: like imagining. Yeah, materializing things. That feels like a huge leap.
- 1:27Speaker 2: It is a profound one, But.
- 1:29Speaker 1: I mean creating something totally new like that. This sounds
- 1:31Speaker 1: incredibly complicated. What are some of the biggest challenges these
- 1:35Speaker 1: imagination machines face.
- 1:37Speaker 2: You're right, it's definitely not simple for starters. The day
- 1:40Speaker 2: itself is a huge hurdle. Real world information is messy,
- 1:43Speaker 2: you know, it's full of errors, noise, biases, and the models, well,
- 1:48Speaker 2: they can learn those imperfections just as easily as the
- 1:50Speaker 2: useful patterns.
- 1:51Speaker 1: Ah, So garbage in, garbage out potentially sort of.
- 1:54Speaker 2: Yeah, And then there's the issue of staying current, especially
- 1:57Speaker 2: for large language models lllms. The world changes so fast
- 2:01Speaker 2: and the information they generate can become outdated pretty quickly
- 2:04Speaker 2: if they're not constantly updated.
- 2:06Speaker 1: Right, Like asking about current events from a model trained
- 2:09Speaker 1: last year exactly.
- 2:10Speaker 2: And then there's the sheer computational power required learning these
- 2:15Speaker 2: incredibly complex patterns and then generating new high fidelity data.
- 2:21Speaker 2: It demands massive amounts of compute. And finally, think about evaluation.
- 2:25Speaker 2: With a discriminative model, you ask, is this a cat?
- 2:28Speaker 2: Yes or no? Easy to check. But with the generative model,
- 2:32Speaker 2: how do you evaluate if a generated cat picture is
- 2:34Speaker 2: good or accurate? There is, it's a single right answer.
- 2:37Speaker 2: It's much more subjective, much more complex to measure.
- 2:40Speaker 1: That makes total sense. It's not just about being correct,
- 2:42Speaker 1: it's about being believable, useful.
- 2:45Speaker 2: Plausible, believable, useful, coherent, all those things.
- 2:49Speaker 1: Okay, so despite those big challenges, the promise must be huge, right,
- 2:54Speaker 1: that's why everyone's pouring resources into this. Let's dig into
- 2:57Speaker 1: some of those applications. Images. For instance, we've gone way
- 3:01Speaker 1: beyond simple photo filters. Oh.
- 3:02Speaker 2: Absolutely. Models now can create incredibly diverse photorealistic images just
- 3:08Speaker 2: from say a text description, things you'd never imagine possible
- 3:12Speaker 2: a few years ago.
- 3:13Speaker 1: And it's not just art, right. You mentioned data augmentation.
- 3:16Speaker 2: Yeah, that's a really practical one. Imagine you have only
- 3:18Speaker 2: a small data set maybe for training an AI to
- 3:21Speaker 2: recognize a specific product defect. Generative AI can create thousands
- 3:26Speaker 2: of synthetic examples, different angles, lighting conditions, you name it,
- 3:30Speaker 2: to bolster that data set, make the training more robust,
- 3:33Speaker 2: maybe even reduce bias if the original data was skewed.
- 3:36Speaker 1: That's clever using AI to make other AI.
- 3:39Speaker 2: Better exactly, And in content creation too, generating texts for chatbots,
- 3:43Speaker 2: helping writers brainstorm, even drafting emails. We've come such a
- 3:47Speaker 2: long way from Eliza back in the.
- 3:48Speaker 1: Sixties, right, those old rule based bots. Now we have
- 3:51Speaker 1: these powerful models built on architectures like transformers.
- 3:54Speaker 2: It's a different world. But those challenges we mentioned, the
- 3:57Speaker 2: messi data keeping up with reality that can cute demands,
- 4:00Speaker 2: and that tricky evaluation problem. There's still very real hurdles.
- 4:06Speaker 1: Yeah, defining good enough for generated stuff, that's a tough one. Okay.
- 4:10Speaker 1: So before we get deeper into the applications, how did
- 4:13Speaker 1: we even get here? How did machines learn to imagine
- 4:15Speaker 1: like this? Let's trace back the building blocks deep neural networks.
- 4:20Speaker 2: It goes way back. Actually, early ideas in the nineteen
- 4:23Speaker 2: forties were inspired by biological neurons. Simple things like the
- 4:26Speaker 2: threshold logic unit. But those early models hit limitations famously.
- 4:31Speaker 2: Minsky and Paper showed in their book Perceptrons that single
- 4:34Speaker 2: Lairer networks couldn't even solve basic problems like the xoor
- 4:37Speaker 2: logic function that led to the first AI winter in
- 4:40Speaker 2: the seventies.
- 4:41Speaker 1: Progress stalled right the AI winter. So what thought things out?
- 4:44Speaker 1: What was the big breakthrough that got things moving again?
- 4:47Speaker 2: The absolute game changer was backpropagation. Before that, figuring out
- 4:51Speaker 2: how to adjust all the connections the weights in a
- 4:53Speaker 2: deep network was incredibly inefficient, almost impossible for complex networks.
- 4:57Speaker 1: How does it work sort of in simple terms.
- 5:00Speaker 2: Well, it uses calculus, specifically the chain rule, to efficiently
- 5:03Speaker 2: calculate how much each weight in the network contributed to
- 5:06Speaker 2: the final error. It tells each connection exactly how to
- 5:09Speaker 2: adjust itself, layer by layer, working backward from the output air.
- 5:14Speaker 2: It made training deep networks practical. That's what really ended
- 5:17Speaker 2: the AI winter and opened the door to modern deep learning.
- 5:20Speaker 1: But you said even backpropagation wasn't perfect. It had issues
- 5:24Speaker 1: it did.
- 5:24Speaker 2: A big one was the vanish ingradient problem. In very
- 5:27Speaker 2: deep networks, the error signal gets weaker and weaker as
- 5:30Speaker 2: it propagates backward, so the early layers, the ones furthest
- 5:33Speaker 2: from the output, learn extremely slowly or sometimes not at all,
- 5:37Speaker 2: like a whisper getting lost down a long hallway.
- 5:39Speaker 1: Okay, I can picture that the signal just fades out.
- 5:42Speaker 1: So once we had back propagation, even with its flaws,
- 5:44Speaker 1: what kinds of network structures or architecture started showing up well?
- 5:48Speaker 2: For images? A major leap was convolutional neural networks CNNs.
- 5:52Speaker 2: They were kind of inspired by the human visual cortex.
- 5:56Speaker 2: Instead of looking at an image pixel by pixel, CNN's
- 5:59Speaker 2: use filters that slide across the image looking for specific
- 6:02Speaker 2: local features edges, corners, textures, and crucially, they share weights.
- 6:07Speaker 2: The filter looking for a horizontal edge is the same
- 6:10Speaker 2: filter whether it's looking at the bop left or bottom right.
- 6:12Speaker 2: This makes them way more efficient for.
- 6:14Speaker 1: Images sharing weights. Okay, and there were improvements on those
- 6:17Speaker 1: basic CNNs oh.
- 6:19Speaker 2: Yeah, big ones, things like reilu activation functions. They replaced
- 6:22Speaker 2: older functions that saturated easily and helped fix that vanishing
- 6:25Speaker 2: gradient problem. Kept the signal strong and drop out, which
- 6:29Speaker 2: sounds weird but works amazingly well. During training, you randomly
- 6:33Speaker 2: switch off some neurons. It forces the network not to
- 6:35Speaker 2: rely too much on any single neuron, making it generalize
- 6:38Speaker 2: better to new data. Kind of like cross training for
- 6:41Speaker 2: the network.
- 6:41Speaker 1: Huh. Interesting. Okay, so that's images. What about sequences like
- 6:45Speaker 1: text or speech or time series data.
- 6:47Speaker 2: For sequential data, the go to became recurrent neural networks
- 6:51Speaker 2: or RNNs. They have loops allowing information to persist. They
- 6:55Speaker 2: have a kind of memory.
- 6:57Speaker 1: A memory, right, but didn't they also have issues with
- 6:59Speaker 1: a long sequence they did.
- 7:01Speaker 2: That vanishing gradient problem hit them hard too when trying
- 7:04Speaker 2: to remember things from many steps back, which led to
- 7:07Speaker 2: the development of lstm's long short term memory networks. LSTMs
- 7:11Speaker 2: were a much more sophisticated type of RNN. They have
- 7:14Speaker 2: these internal mechanisms called gates, an input gate, a forget gate,
- 7:19Speaker 2: and output gate. These gates carefully control what information gets
- 7:22Speaker 2: stored the memory cell, what gets forgotten, and what influence
- 7:26Speaker 2: is the output at each step. They were much much
- 7:29Speaker 2: better at capturing long range dependencies, crucial for understanding language.
- 7:32Speaker 1: Okay, so lstm's improved memory. But you mentioned earlier that
- 7:36Speaker 1: even they had limitations, especially for really long text, which
- 7:39Speaker 1: led to transformers.
- 7:40Speaker 2: Exactly this is where transformers completely change the game, particularly
- 7:44Speaker 2: for language. They threw out the sequential, step by step
- 7:47Speaker 2: processing of RNNs and LSTMs. The core idea the revolution
- 7:51Speaker 2: was self attention.
- 7:52Speaker 1: Self attention, we hear that term a lot. What does
- 7:55Speaker 1: it actually let the model do?
- 7:57Speaker 2: Instead of processing word by word, self attention allows every
- 8:01Speaker 2: single word in a sentence to directly look at and
- 8:05Speaker 2: weigh the importance of every other word in that same sentence.
- 8:09Speaker 1: All at once, all at once, so no more sequential bottleneck.
- 8:13Speaker 2: Precisely, it can instantly see how the first word relates
- 8:17Speaker 2: to the last word, or how pronoun relates to the
- 8:19Speaker 2: noun it refers to, even if they're far apart. And crucially,
- 8:23Speaker 2: because it's not sequential, you can process all words in parallel.
- 8:27Speaker 2: This makes training on massive data sets much much faster
- 8:31Speaker 2: and scalable than RNNs ever could be. It just unlocked
- 8:34Speaker 2: a whole new level of performance in scale.
- 8:36Speaker 1: Okay, that makes sense why they were such a big deal.
- 8:38Speaker 1: So if we have these powerful architectures, how do we
- 8:40Speaker 1: get them to actually understand and use words? How does
- 8:44Speaker 1: text get turned into numbers the machine can process?
- 8:47Speaker 2: Right? That's fundamental. The early approaches were pretty simple like
- 8:49Speaker 2: bag of words. You literally just count how many times
- 8:52Speaker 2: each word appears in a document.
- 8:53Speaker 1: Simple, But I guess it loses a lot.
- 8:55Speaker 2: It loses all the context, word order, grammar gone, dog
- 9:00Speaker 2: bites man and man bites dog look exactly the same
- 9:04Speaker 2: to a bag of words model. Not very useful for
- 9:06Speaker 2: understanding meaning.
- 9:08Speaker 1: Yeah, that seems like a pretty big flaw.
- 9:10Speaker 2: So the next big step was word embeddings. These are
- 9:12Speaker 2: dense vector representations, basically lists of numbers for each word.
- 9:16Speaker 2: Models like word to vec learn these embeddings by looking
- 9:20Speaker 2: at the context words appear in. The key idea was
- 9:22Speaker 2: that words used in similar contexts should have similar numerical representations,
- 9:26Speaker 2: similar vectors. It started capturing semantic relationships.
- 9:30Speaker 1: So king and queen would be mathematically closer than king
- 9:33Speaker 1: and cabbage exactly.
- 9:34Speaker 2: But even those embeddings were static. The vector for bank
- 9:37Speaker 2: was the same whether you meant a riverbank or a
- 9:40Speaker 2: financial bank. The real breakthrough for nuance was contextual representations.
- 9:44Speaker 2: Models like Burt and Elmo generate embeddings that change based
- 9:48Speaker 2: on the specific sentence the word is in. They understand
- 9:51Speaker 2: that bank means different things in different contexts. That was
- 9:54Speaker 2: huge for understanding language. Properly.
- 9:55Speaker 1: Okay, so we have ways to represent words with nuance. Now,
- 9:59Speaker 1: how do we make the machine talk generate text.
- 10:02Speaker 2: That's the job of language models. At their heart, they're
- 10:05Speaker 2: trying to predict the next word in a sequence given
- 10:08Speaker 2: the previous words, like a superpowered autocomplete.
- 10:12Speaker 1: Just predicting the next word. How does that lead to
- 10:14Speaker 1: coherent sentences or paragraphs.
- 10:17Speaker 2: Well, once it predicts a word, that word becomes part
- 10:19Speaker 2: of the context for predicting the next word and so on.
- 10:22Speaker 2: But just picking the single most probable word at each step,
- 10:25Speaker 2: that's called greedy decoding often leads to really repetitive or
- 10:29Speaker 2: boring text.
- 10:30Speaker 1: Right, It might just get stuck saying the same phrase
- 10:32Speaker 1: over and over.
- 10:33Speaker 2: Exactly, So we use more sophisticated decoding strategies. Beam search
- 10:37Speaker 2: keeps track of several of the most likely sequences at
- 10:40Speaker 2: each step, kind of looking ahead to find a better
- 10:42Speaker 2: overall sentence. And then there's sampling. Instead of always picking
- 10:46Speaker 2: the most likely word, you introduce some randomness. You might
- 10:49Speaker 2: sample from say the top ten most likely words top
- 10:53Speaker 2: k sampling, or from the smallest set of words whose
- 10:56Speaker 2: probabilities add up to a certain threshold nucleus sample. This
- 11:00Speaker 2: adds variety and makes the text feel more natural, less predictable.
- 11:04Speaker 1: So sampling adds a bit of creativity, stops it being
- 11:08Speaker 1: robotic pretty much.
- 11:09Speaker 2: Yeah, it helps avoid getting stuck in loops and generates
- 11:11Speaker 2: more interesting output.
- 11:13Speaker 1: And it seems like the transformer architecture with that self
- 11:15Speaker 1: attention mechanism was absolutely critical for enabling this kind of
- 11:18Speaker 1: sophisticated text generation at scale. Right. Can you expand on
- 11:23Speaker 1: why it was such a turning point for these large
- 11:24Speaker 1: language models.
- 11:25Speaker 2: Oh, absolutely pivotal. That twenty seventeen paper Attention is all
- 11:29Speaker 2: you need. It really did shift the paradigm before transformers. Remember,
- 11:33Speaker 2: even lstm's our best sequential models had that bottleneck issue.
- 11:37Speaker 2: They had to cram the meaning of the entire input sequence,
- 11:41Speaker 2: no matter how long, into a single fixed sized context
- 11:45Speaker 2: vector to pass along. For very long sentences or documents
- 11:48Speaker 2: that just wasn't enough information got lost.
- 11:51Speaker 1: The memory was an infinite.
- 11:52Speaker 2: Right, Transformers, by ditching recurrens entirely and using self attention,
- 11:57Speaker 2: broke that bottleneck wide open. Every word could directly attend
- 12:01Speaker 2: to every other word, instantly capturing those long range dependencies. Plus,
- 12:06Speaker 2: they introduced multihead self attention think of it as allowing
- 12:10Speaker 2: the model to pay attention to different kinds of relationships
- 12:13Speaker 2: simultaneously in parallel subspaces. Maybe one head focuses on grammatical relationships,
- 12:18Speaker 2: another on semantic similarity.
- 12:20Speaker 1: So it could capture multiple layers of meaning at once.
- 12:23Speaker 2: Exactly. That ability to handle long contexts effectively and efficiently,
- 12:28Speaker 2: combined with the massive parallelism allowing them to train on
- 12:30Speaker 2: unprecedented amounts of data, that's what paved the way for
- 12:34Speaker 2: the truly large language models, the lms that we have today.
- 12:37Speaker 1: And from that core transformer idea different sort of flavors
- 12:40Speaker 1: or families of models emerged.
- 12:42Speaker 2: Yeah. Broadly speaking, you see three main types based on
- 12:46Speaker 2: which parts of the original transformer architecture they use. First,
- 12:49Speaker 2: encoder only models like the famous BURT These are designed
- 12:53Speaker 2: primarily for understanding text. They look at the whole sentence
- 12:56Speaker 2: at once. Great for tasks like classification, sentiment analysis, or
- 13:00Speaker 2: question answering where context is key.
- 13:02Speaker 1: Okay, understanding text, What's the next type?
- 13:05Speaker 2: Then you have decoder only models like the GPT family.
- 13:08Speaker 2: These are built for generating text. They work sequentially predicting
- 13:12Speaker 2: the next word based on the preceding ones. This causal
- 13:16Speaker 2: nature makes them naturals for chatbots, story writing, codegeneration. GPT
- 13:21Speaker 2: really revolutionized generation with its ability for unsupervised multitask learning,
- 13:26Speaker 2: learning many tasks just from raw text.
- 13:28Speaker 1: Right. GPT is the one most people probably think of,
- 13:30Speaker 1: and the third type.
- 13:31Speaker 2: Encoder decoder models like T five or the original transformer.
- 13:35Speaker 2: These have both parts and are often used for sequence
- 13:37Speaker 2: to sequence tasks where you're transforming an input sequence into
- 13:41Speaker 2: an output sequence. Think machine translation or text summarization.
- 13:45Speaker 1: Got it encoder for understanding, decoder for generating, and both
- 13:49Speaker 1: for transforming and focusing on GPT since it's so prominent,
- 13:53Speaker 1: what were the big leaps there?
- 13:54Speaker 2: Well, GPT two in twenty nineteen was a major milestone,
- 13:58Speaker 2: one point five billion parameters trained on a huge chunk
- 14:01Speaker 2: of the Internet. What was really stunning was its few
- 14:04Speaker 2: shot ability key shot meaning meaning you could give it
- 14:08Speaker 2: just a couple of examples of a task and the
- 14:09Speaker 2: prompt and it could often figure out how to do
- 14:12Speaker 2: it without any specific training for that task. Yeah, it
- 14:15Speaker 2: showed an incredible level of general language understanding.
- 14:18Speaker 1: Wow.
- 14:18Speaker 2: And then GPT three came along, and how GVT three
- 14:21Speaker 2: was enormous one hundred and seventy five billion parameters over
- 14:24Speaker 2: one hundred times bigger. It started showing these emergent abilities
- 14:27Speaker 2: things it wasn't explicitly trained for but could just do,
- 14:30Speaker 2: like unscrambling words or even basic arithmetic. It felt like
- 14:33Speaker 2: a qualitative leap.
- 14:35Speaker 1: But raw capability isn't always the same as being useful
- 14:38Speaker 1: or safe.
- 14:38Speaker 2: Right exactly, and that led to instruct GPT in twenty
- 14:41Speaker 2: twenty two. It was actually smaller than GPT three, but
- 14:45Speaker 2: critically it was much better at following instructions and aligning
- 14:48Speaker 2: with user intent.
- 14:49Speaker 1: How did they achieve that alignment through.
- 14:51Speaker 2: Two extra training steps after the initial pre training, First
- 14:55Speaker 2: instruction fine tuning, where they trained it on examples of
- 14:57Speaker 2: prompts and desired outputs, and second, crucially, reinforcement learning with
- 15:02Speaker 2: human feedback or URLHF.
- 15:04Speaker 1: Our LHF that involves humans ranking different.
- 15:07Speaker 2: Outcome Yes, humans would compare different responses from the model
- 15:11Speaker 2: to the same prompt and indicate which one they preferred.
- 15:14Speaker 2: This feedback was used to train a reward model, which
- 15:17Speaker 2: then guided the LM during further fine tuning to produce
- 15:21Speaker 2: outputs that humans are more likely to find helpful, honest,
- 15:24Speaker 2: and harmless. That alignment step was key for making models
- 15:28Speaker 2: like chat GPT practical and safer to.
- 15:30Speaker 1: Deploy alignment right, that seems super important. Then it also
- 15:34Speaker 1: brings up the point about access. Many of these really
- 15:36Speaker 1: powerful models like GPT four are closed source. We don't
- 15:40Speaker 1: know the exact architecture of the training data. How does
- 15:42Speaker 1: that affect things.
- 15:43Speaker 2: It's a huge debate in the field. On one hand,
- 15:45Speaker 2: companies invest billions and want to protect their IP. On
- 15:48Speaker 2: the other hand, it raises serious questions about transparency, reproducibility, bias, auditing,
- 15:54Speaker 2: and just how can the broader community innovate and build
- 15:58Speaker 2: if the cutting edge is locked away?
- 16:00Speaker 1: So is there a counter movement?
- 16:02Speaker 2: Absolutely? The open source LLM movement has exploded in response.
- 16:05Speaker 2: You have major efforts like met Islama models. They release
- 16:09Speaker 2: models with billions of parameters, allowing researchers and developers everywhere
- 16:13Speaker 2: to experiment and build on them. They've shown really strong
- 16:16Speaker 2: performance on benchmarks for coding, reasoning, common sense.
- 16:19Speaker 1: Surviable open alternatives are emerging.
- 16:22Speaker 2: Definitely, and you see interesting architectural innovations too. Look at
- 16:25Speaker 2: mixtral frommystrall dot ai. It uses a mixture of experts moe.
- 16:29Speaker 1: Architecture, mixture of experts.
- 16:31Speaker 2: How does that work instead of the entire huge model
- 16:34Speaker 2: processing every single input token, and MOE model has multiple
- 16:37Speaker 2: smaller expert networks, usually specialized transformer layers. A lightweight router
- 16:43Speaker 2: network directs each part of the input to only a
- 16:45Speaker 2: small subset of these.
- 16:46Speaker 1: Experts, ah so only part of the model is active
- 16:49Speaker 1: at any given time. More efficient.
- 16:51Speaker 2: Exactly, you could have a model with a massive total
- 16:54Speaker 2: number of parameters, giving great capacity, but the actual computation
- 16:58Speaker 2: needed for inference is much lower because you're only using
- 17:01Speaker 2: a fraction of the experts for any given input. It's
- 17:04Speaker 2: a clever way to scale up while managing costs. Plus,
- 17:07Speaker 2: Mixed role has a very permissive Apache two point zero license,
- 17:11Speaker 2: making it widely.
- 17:11Speaker 1: Usable interesting any other key open source players.
- 17:15Speaker 2: Well Dolly from data Bricks took a different approach. They
- 17:18Speaker 2: focused on creating a high quality instruction following data set
- 17:22Speaker 2: about fifteen thousand prompts and responses generated entirely by data
- 17:26Speaker 2: Bricks employees. Their goal was specifically to create an open
- 17:29Speaker 2: instruction tuned model without relying on data generated by proprietary
- 17:33Speaker 2: models like chat GPT, which often comes with restrictive licenses.
- 17:37Speaker 2: You wanted to truly democratize instruction following capabilities.
- 17:40Speaker 1: So focusing on open data as much as open models precisely.
- 17:43Speaker 2: And you also have models like Falcon from TII in
- 17:47Speaker 2: the UAE trained primarily on web data, and grock one
- 17:51Speaker 2: from XAI, which also uses that mixture of experts architecture.
- 17:56Speaker 2: The open source space is incredibly vibrant right now, OK.
- 18:00Speaker 1: It's open or closed. We have these incredibly powerful llms.
- 18:03Speaker 1: If they're like general purpose programmable machines, as some say,
- 18:08Speaker 1: how do we the users actually program them? How do
- 18:11Speaker 1: we tell them what we want?
- 18:12Speaker 2: That's the art and science of prompt engineering. It's all
- 18:15Speaker 2: about designing and refining the input, the prompt that you
- 18:18Speaker 2: give to the model to guide it towards the output
- 18:21Speaker 2: you need.
- 18:21Speaker 1: So the prompt is like the code we write for
- 18:23Speaker 1: the LLM.
- 18:24Speaker 2: In a way. Yeah, you're essentially reprogramming the model's behavior
- 18:27Speaker 2: on the fly, just using natural language instructions. It's becoming
- 18:30Speaker 2: a crucial skill for anyone working with these models.
- 18:33Speaker 1: And it's not just writing one prompt and being done right.
- 18:35Speaker 1: You mentioned, it's iterative, totally iterative.
- 18:37Speaker 2: You design a prompt, you test it, you see what
- 18:39Speaker 2: the model gets back, You evaluate that output, and then
- 18:41Speaker 2: you refine the prompt based on the results. Lather, rinse, repeat.
- 18:45Speaker 1: Okay, so what goes into a well structured prompt? What
- 18:48Speaker 1: are the key pieces?
- 18:50Speaker 2: There are a few core components to think about. First,
- 18:53Speaker 2: you often have system instructions or as system prompt. This
- 18:57Speaker 2: sets the stage, defines the LM's persona or overall behavior
- 19:01Speaker 2: for the conversation, like you are a helpful assistant who
- 19:04Speaker 2: explains complex topics simply. This usually persists across multiple.
- 19:09Speaker 1: Turns, so setting the ground rules exactly.
- 19:12Speaker 2: Then you have the main prompt template, which is the
- 19:14Speaker 2: user facing instruction, often with placeholders where specific input will go.
- 19:18Speaker 2: You also need to consider the LM parameters, things like
- 19:20Speaker 2: temperature temperature.
- 19:22Speaker 1: What does that control?
- 19:23Speaker 2: Temperature controls the randomness of the output. Higher temperature means
- 19:26Speaker 2: more randomness, more creativity, maybe more unexpected results. Lower temperature
- 19:31Speaker 2: makes the output more focused deterministic, sticking closer to the
- 19:35Speaker 2: most probable words.
- 19:36Speaker 1: Okay, creativity versus predictability.
- 19:39Speaker 2: Right, And you might set completion tokens to limit the
- 19:42Speaker 2: output length. And importantly, there are usually safeguards or guardrails
- 19:48Speaker 2: in place, either built into the model or added around
- 19:50Speaker 2: it to prevent it from generating harmful, biased or inappropriate
- 19:54Speaker 2: content makes sense.
- 19:55Speaker 1: So beyond the structure, what makes a prompt effective any
- 19:59Speaker 1: general stratu.
- 20:00Speaker 2: Clarity and specificity are key. Be really clear about what
- 20:04Speaker 2: you want, don't be vague. If it's a complex task,
- 20:08Speaker 2: break it down into smaller, simpler steps within the prompt.
- 20:11Speaker 2: Tell the model how you want it to.
- 20:12Speaker 1: Approach the problem, step by step, instructions exactly.
- 20:15Speaker 2: And another really powerful technique is few shot prompting.
- 20:19Speaker 1: Ah, you mentioned that with GPT too giving examples.
- 20:22Speaker 2: Yes, instead of just telling the model what to do,
- 20:24Speaker 2: you showed a few examples of the input and it
- 20:26Speaker 2: got output you want. This helps it grasp the desired
- 20:28Speaker 2: format style or reasoning pattern much more effectively than just
- 20:32Speaker 2: instructions alone.
- 20:33Speaker 1: Okay, showing is better than telling. What about really complex
- 20:36Speaker 1: tasks that require like multi step reasoning.
- 20:39Speaker 2: This is where the advanced prompting techniques come in, and
- 20:42Speaker 2: they are really quite clever. One major one is chain
- 20:46Speaker 2: of thought. At prompting chain of.
- 20:49Speaker 1: Thought making it think step.
- 20:51Speaker 2: By step Precisely, you explicitly instruct the model to think
- 20:56Speaker 2: step by step or show its reasoning before giving the
- 20:59Speaker 2: final answer. For problems like math word problems or complex
- 21:02Speaker 2: logic puzzles. Forcing it to articulate the intermediate steps dramatically
- 21:07Speaker 2: improves its accuracy. It's less likely to jump to a
- 21:09Speaker 2: wrong conclusion.
- 21:10Speaker 1: So you're making the reasoning process.
- 21:12Speaker 2: Explicit yes, and building on that, you have tree of
- 21:16Speaker 2: thought instead of just one chain. The model explores multiple
- 21:19Speaker 2: different reasoning paths or branches, like exploring different possibilities in parallel.
- 21:23Speaker 2: It then evaluates these different thoughts to pick the most
- 21:26Speaker 2: promising path to the solution. It's like enabling the model
- 21:29Speaker 2: to brainstorm.
- 21:30Speaker 1: Wow, Okay, that sounds powerful.
- 21:32Speaker 2: Any others, there's REACT, which stands for reason and act.
- 21:35Speaker 2: This technique combines the llm's reasoning capabilities with the ability
- 21:39Speaker 2: to use external tools tools like what like a calculator,
- 21:43Speaker 2: a web search API, a code execution environment, a database lookup.
- 21:47Speaker 2: The LLLM can reason about the problem, decide it needs
- 21:50Speaker 2: more information, generate an action like search the web for
- 21:54Speaker 2: recent news on X, get the result back from the tool,
- 21:57Speaker 2: incorporate that information into its reasoning, and continue towards the
- 22:01Speaker 2: final answer. It allows llms to interact with the world
- 22:04Speaker 2: and access up to date information.
- 22:06Speaker 1: So it can go beyond its internal knowledge.
- 22:08Speaker 2: Exactly and one more is self consistency. Here, you run
- 22:12Speaker 2: the same prompt often the chain of thought prompt multiple
- 22:15Speaker 2: times with some randomness enabled, generating several different reasoning paths.
- 22:19Speaker 2: You then look at the final answers produced by each
- 22:21Speaker 2: path and choose the answer that appears most frequently or
- 22:24Speaker 2: consistently across the different reasoning attempts. It's like taking a
- 22:28Speaker 2: majority vote among different ways of thinking, which often boosts robustness,
- 22:32Speaker 2: especially for things like arithmetic.
- 22:34Speaker 1: These techniques sound incredibly powerful for unlocking more complex capabilities.
- 22:38Speaker 1: But prompt engineering can't be perfect, right What are the
- 22:41Speaker 1: downsides or limitations?
- 22:43Speaker 2: Definitely not perfect. One big issue is that prompts can
- 22:46Speaker 2: be very brittle. A prompt cracted perfectly for one model
- 22:49Speaker 2: might completely fail or give weird results on another model,
- 22:52Speaker 2: or even a slightly updated version of the same model.
- 22:56Speaker 2: They'd always transfer well.
- 22:57Speaker 1: So you might need to constantly retune your prompts.
- 23:00Speaker 2: Which leads to the next point. Evaluation is hard. How
- 23:03Speaker 2: do you objectively measure if one prompt is better than another?
- 23:06Speaker 2: Especially for creative or complex tasks, there aren't always simple metrics,
- 23:10Speaker 2: and the iterative process of designing, testing, refining it takes time.
- 23:15Speaker 2: In compute resources, which means latency and costs can add up,
- 23:18Speaker 2: especially during development.
- 23:19Speaker 1: Right, and are there risks like people using prompts maliciously?
- 23:23Speaker 2: Yes, that's a growing concern known as adversarial prompting. Bad
- 23:26Speaker 2: actors try to craft prompts to trick the model into
- 23:29Speaker 2: bypassing its safety guidelines so called jail breaks, or to
- 23:32Speaker 2: reveal sense of information prompt injection. Defending against these is
- 23:37Speaker 2: an ongoing challenge.
- 23:38Speaker 1: Okay, so prompt engineering is key, but it has its challenges.
- 23:42Speaker 1: Given all this, how are developers actually building applications that
- 23:46Speaker 1: use these llms in the real world? Are there specific
- 23:49Speaker 1: tools or frameworks.
- 23:50Speaker 2: Yeah, the ecosystem around llms is evolving rapidly. Frameworks like
- 23:54Speaker 2: lane chain have become really popular. They provide building blocks
- 23:58Speaker 2: and abstractions to make it easier to change llms together,
- 24:01Speaker 2: connect them to other data sources, and manage the overall
- 24:04Speaker 2: application logic slang.
- 24:06Speaker 1: Chain helps orchestrate things exactly.
- 24:08Speaker 2: It simplifies common patterns, and one of the most important
- 24:11Speaker 2: patterns it helps implement is retrieval augmented generation or.
- 24:15Speaker 1: Ride ryan do you mention that helps with hallucinations and
- 24:18Speaker 1: keeping infocurrent precisely?
- 24:20Speaker 2: Llms are trained on a snapshot of data. They don't
- 24:22Speaker 2: inherently know your company's latest internal documents or real time news. Alright,
- 24:26Speaker 2: fixes this. The idea is when a user asks a question,
- 24:30Speaker 2: the system first retrieves relevant snippets of information from an
- 24:33Speaker 2: external knowledge base, maybe your company wiki, product manuals, recent reports, whatever.
- 24:38Speaker 2: This is often done using a vector store, which is
- 24:40Speaker 2: like a searchable database for text meaning.
- 24:42Speaker 1: So it finds relevant facts first.
- 24:44Speaker 2: Yes, Then it takes those retrieved snippets and augments the
- 24:48Speaker 2: original prompt, essentially stuffing that relevant information into the context
- 24:52Speaker 2: window it sends to the LLM. So the LLM gets
- 24:55Speaker 2: the user's question plus the relevant facts needed to answer
- 24:58Speaker 2: it accurately and currently.
- 25:00Speaker 1: Ah. So you're giving the LLM the specific knowledge it needs,
- 25:03Speaker 1: right when it.
- 25:03Speaker 2: Needs it exactly. It massively improves factual accuracy, reduces made
- 25:08Speaker 2: up answers, and lets you ground the LM's responses in
- 25:11Speaker 2: specific trusted data sources without having to constantly retrain the
- 25:14Speaker 2: entire model. Our rage is fundamental for most serious enterprise
- 25:19Speaker 2: M applications today.
- 25:20Speaker 1: Okay, our rage is huge for grounding responses, but what
- 25:23Speaker 1: about more complex interactions like a chatbot that needs to
- 25:26Speaker 1: remember the conversation history or applications with multiple steps in
- 25:29Speaker 1: branching logic.
- 25:31Speaker 2: For that kind of complexity, you need ways to manage
- 25:34Speaker 2: state the memory of the interaction. This is where tools
- 25:38Speaker 2: like lang graph, which builds on lang chain come in.
- 25:41Speaker 2: Lang graph allows you to define your LLM application as
- 25:44Speaker 2: a graph, specifically a state graph. Each node in the
- 25:47Speaker 2: graph represents a function, which could involve calling an LLM,
- 25:51Speaker 2: using a tool, or just processing data, and the edges
- 25:54Speaker 2: represent the flow based on the current state.
- 25:56Speaker 1: So it's like a flow chart for the M application.
- 25:58Speaker 2: Kind of yeah, but it's designed explicitly for building clickle
- 26:02Speaker 2: stateful applications. It lets you create agents that can have
- 26:04Speaker 2: multi turned conversations. Remember context, make decisions loop branch basically
- 26:09Speaker 2: build much more sophisticated and robust applications than simple linear chains.
- 26:14Speaker 1: And you mentioned tools and agents earlier with React. How
- 26:16Speaker 1: does that fit into building applications.
- 26:18Speaker 2: It's central to making llms truly useful beyond just text generation.
- 26:23Speaker 2: By giving an LLLM access to tools like the Tavly
- 26:25Speaker 2: search results tool for web searches or custom tools for
- 26:29Speaker 2: your databases, and defining how it can use them, you
- 26:32Speaker 2: turn it into an agent. This agent can then autonomously
- 26:35Speaker 2: decide which tool to use, what input to give it,
- 26:37Speaker 2: and how to use the tool's output to achieve a
- 26:39Speaker 2: larger goal set by the user. Lang Chain and lane
- 26:42Speaker 2: graph provide frameworks for building these agents, managing their state,
- 26:46Speaker 2: their reasoning loops, and their interactions with tools and humans.
- 26:49Speaker 1: So the LM becomes less of a text generator and
- 26:52Speaker 1: more of a problem solver that can use external resources.
- 26:55Speaker 2: Exactly. It's about moving from passive generation to active task execution.
- 27:00Speaker 1: These models are clearly incredibly powerful, and the tools for
- 27:03Speaker 1: building with them are getting sophisticated, But we keep coming
- 27:06Speaker 1: back to the fact that they are massive, expensive, computationally hungry.
- 27:10Speaker 1: Why is optimizing them such a big focus?
- 27:12Speaker 2: Well several reasons. Scalability is one. We want to be
- 27:15Speaker 2: able to run these models for more users more efficiently.
- 27:18Speaker 2: Cost is obviously huge. Training and running billion parameter models
- 27:22Speaker 2: requires immense hardware investment and energy.
- 27:24Speaker 1: Consumption, and the environmental impact too.
- 27:26Speaker 2: I guess absolutely that's increasingly part of the conversation. There's
- 27:30Speaker 2: also research like the Scaling Laws work from Kaplan and
- 27:33Speaker 2: others suggesting that performance scales predictably with model size data
- 27:38Speaker 2: set size and compute. But crucially, they also found many
- 27:42Speaker 2: large models are technically undertrained, meaning they are so large
- 27:47Speaker 2: that they haven't been trained for long enough on enough
- 27:49Speaker 2: data relative to their size to reach their full potential
- 27:52Speaker 2: within typical compute budgets. This implies there are gains to
- 27:56Speaker 2: be had by being smarter about training, not just bigger.
- 28:00Speaker 1: How do we get smarter how do we optimize these
- 28:02Speaker 1: things starting right from the pre training phase.
- 28:05Speaker 2: One major trend is focusing on data efficiency. Instead of
- 28:08Speaker 2: just throwing quintillions of tokens scraped from the Internet of
- 28:11Speaker 2: the model, there's a growing emphasis on using higher quality,
- 28:15Speaker 2: carefully curated and sometimes even synthetically generated data like.
- 28:18Speaker 1: The Microsoft five models you mentioned exactly.
- 28:21Speaker 2: They use textbook quality data and synthetic stories tiny stories
- 28:25Speaker 2: to train much smaller models that achieve surprisingly strong performance,
- 28:28Speaker 2: suggesting data quality can sometimes trump sheer quantity. Another huge
- 28:33Speaker 2: area is using lower numerical precision. Models are typically trained
- 28:37Speaker 2: using thirty two bit floating point numbers f P thirty two,
- 28:40Speaker 2: but using mixed precision combining sixteen bit floats like b
- 28:43Speaker 2: float sixteen with FB thirty two, or even quantization using
- 28:47Speaker 2: eight bit or even four bit integers drastically reduces the
- 28:51Speaker 2: memory footprint and speeds up computation, often with minimal impact.
- 28:54Speaker 1: On accuracy quantization, So using less precise numbers saves space
- 28:58Speaker 1: and time, a.
- 28:59Speaker 2: Lot of space and time. Yes, yeah, you can do
- 29:01Speaker 2: post training quantization PDQ, where you quantize an already trained model,
- 29:05Speaker 2: or quantization aware training QAT, where you incorporate the quantization
- 29:08Speaker 2: process during training to potentially get better accuracy. This lets
- 29:11Speaker 2: you run much larger models on the same hardware.
- 29:14Speaker 1: Okay, data quality and number formats. What about the model
- 29:17Speaker 1: architecture itself? Can we make attention more efficient?
- 29:20Speaker 2: Yes, that's critical because standard self attention has quadratic complexity.
- 29:25Speaker 2: The compute grows with the square of the sequence length
- 29:28Speaker 2: o in two. For very long sequences, that becomes a bottleneck.
- 29:32Speaker 2: So researchers have developed various efficient attention mechanisms, things like
- 29:37Speaker 2: sparse attention where each token only attends to a subset
- 29:39Speaker 2: of other tokens, or methods that approximate attention using linear complexity.
- 29:44Speaker 2: And then there's flash attention, which doesn't change the math
- 29:47Speaker 2: of attention, but cleverly optimizes its implementation to be much
- 29:51Speaker 2: faster on modern GPUs by minimizing slow memory reads and writes.
- 29:55Speaker 2: It's become almost standard now, so.
- 29:57Speaker 1: Optimizing the core attention calculation. Are there entirely different architectures
- 30:01Speaker 1: emerging too, Yes.
- 30:03Speaker 2: Things like Lindformer perceiver IO, and we're also seeing architectures
- 30:06Speaker 2: designed specifically for multimodal inputs right from the start. Efficiency
- 30:11Speaker 2: is being baked into the design process. Now.
- 30:13Speaker 1: Okay, so we've made pre training more efficient. What about
- 30:16Speaker 1: when we have a massive pre trained model and just
- 30:18Speaker 1: want to adapt it to a new specific task. We
- 30:21Speaker 1: don't want to retrain everything.
- 30:22Speaker 2: That's where parameter efficient fine tuning or PFT techniques are
- 30:26Speaker 2: absolutely essential. The goal is to adapt the model effectively
- 30:30Speaker 2: while only updating a very small percentage of its total parameters.
- 30:34Speaker 1: Why is that so beneficial?
- 30:35Speaker 2: It massively reduces the compute cost and time needed for
- 30:39Speaker 2: fine tuning. It requires much less memory, meaning you can
- 30:42Speaker 2: fine tune larger models on less powerful hardware, And importantly,
- 30:46Speaker 2: you only need to store the small number of change
- 30:48Speaker 2: parameters for each task, not a full copy of the
- 30:51Speaker 2: huge model, which saves enormous amounts of storage.
- 30:54Speaker 1: Okay, so how do these PEFT methods work? What are
- 30:57Speaker 1: some examples?
- 30:58Speaker 2: One early approach was. Instead of tuning the model's weights,
- 31:02Speaker 2: you add a small number of learnable virtual tokens to
- 31:05Speaker 2: the input embedding layer and only train those. But perhaps
- 31:09Speaker 2: the most popular method right now is LAURA, which stands
- 31:11Speaker 2: for a low rank adaptation LAURA.
- 31:13Speaker 1: How does that work?
- 31:14Speaker 2: LAURA works on the insight that the change needed to
- 31:17Speaker 2: adapt a pre trained model often lies in a low
- 31:20Speaker 2: dimensional subspace. So instead of updating the massive weight matrices directly,
- 31:24Speaker 2: LAURA injects pairs of small, trainable low rank matrices alongside
- 31:29Speaker 2: the original frozen weights. During fine tuning, you only train
- 31:33Speaker 2: these small injected matrices. The original weights remain untouched. Because
- 31:37Speaker 2: these matrices are small, the number of trainable parameters is tiny,
- 31:41Speaker 2: often less than point one percent or even point zero
- 31:43Speaker 2: one percent of the total model size. Yet it performs
- 31:47Speaker 2: remarkably well, often matching full fine tuning performance.
- 31:50Speaker 1: Wow, only training a tiny fraction but getting similar results.
- 31:54Speaker 1: That's huge, it really is.
- 31:55Speaker 2: And you can even combine techniques likeq LAURA, which applies
- 31:58Speaker 2: LAURA on top of a quantized G four bit base model,
- 32:01Speaker 2: making fine tuning incredibly efficient in terms of memory usage.
- 32:05Speaker 1: So PFT methods like LAURA make adapting models much more practical. Now,
- 32:08Speaker 1: once the model is trained and fine tuned, how do
- 32:10Speaker 1: we make it actually respond faster during inference when a
- 32:13Speaker 1: user is waiting for an answer?
- 32:14Speaker 2: Right Inference optimization is crucial for user experience. Several techniques
- 32:18Speaker 2: help here, offloading parts of the model to CPU or
- 32:22Speaker 2: DISC if GPU memory is tight, shorting the model across
- 32:25Speaker 2: multiple GPUs. Batch inference is a big one. Instead of
- 32:29Speaker 2: processing one user query at a time, you group multiple
- 32:32Speaker 2: queries together into a batch and process them simultaneously to
- 32:36Speaker 2: better utilize the parallel processing power of the hardware.
- 32:39Speaker 1: Processing requests in parallel.
- 32:41Speaker 2: Yes, and for generating texts sequentially with transformers, kV caching
- 32:45Speaker 2: is absolutely VITALKV cashing. What's up in a transformer decoder?
- 32:49Speaker 2: To generate the next word, the model needs to compute
- 32:51Speaker 2: a pension over all the previous words. This involves calculating
- 32:55Speaker 2: key K and value V tensors for each word. Caching
- 33:00Speaker 2: simply stores these calculated K and V tensors from previous steps,
- 33:04Speaker 2: so when generating the next word, the model doesn't need
- 33:07Speaker 2: to recompute all the keys and values for the words
- 33:09Speaker 2: it's already processed. It just reuses the cash ones. This
- 33:13Speaker 2: dramatically speeds up the generation process, especially for long sequences,
- 33:16Speaker 2: because most of the computation.
- 33:18Speaker 1: Is reused, avoiding redundant calculations.
- 33:21Speaker 2: Clever makes a huge difference to latency.
- 33:23Speaker 1: So looking ahead, then, with all this focus on efficiency
- 33:27Speaker 1: and new techniques, what are some of the emerging trends
- 33:29Speaker 1: we should really be kipping an eye on.
- 33:31Speaker 2: Well, Definitely the exploration of alternate architectures beyond the transformer.
- 33:35Speaker 2: We're seeing intriguing results from models like Mamba based on
- 33:39Speaker 2: states based models, which achieves strong performance potentially without Attention's
- 33:43Speaker 2: quadratic complexity, and things like RWKV, which tries to combine
- 33:48Speaker 2: the best of R and n's efficiency for long sequences,
- 33:51Speaker 2: and transformers parallel training.
- 33:53Speaker 1: So maybe the rain of the transformer isn't absolute, it's.
- 33:57Speaker 2: Being challenged certainly. Another big trend is specialized hardware. We're
- 34:01Speaker 2: seeing more dedicated AI accelerators NPUs neural processing units being
- 34:05Speaker 2: built into chips, alongside efforts to optimize AI software for
- 34:09Speaker 2: existing hardware using frameworks like Apple's Metal Performance Shaders MPs
- 34:14Speaker 2: or web GPUs for running models and browsers. And maybe
- 34:17Speaker 2: the most exciting practically speaking is the rise of really
- 34:20Speaker 2: capable small foundational models or SLMs.
- 34:23Speaker 1: Like the FIE models. Again small but mighty.
- 34:26Speaker 2: Exactly, models like five two or PI three demonstrate that
- 34:30Speaker 2: by using extremely high quality, carefully curated, and often synthetic data,
- 34:35Speaker 2: you can achieve performance comparable to much much larger models,
- 34:39Speaker 2: but with drastically less compute memory and cost. This could
- 34:43Speaker 2: democratize access to powerful AI capability significantly, right.
- 34:47Speaker 1: Making powerful AI runnable on say a laptop or even
- 34:50Speaker 1: a phone.
- 34:51Speaker 2: That's the direction things are heading. Efficiency across the board,
- 34:54Speaker 2: data architecture, hardware, fine tuning is the name of the
- 34:57Speaker 2: game right now.
- 34:58Speaker 1: Okay, this has been fascinating on the tip, but we
- 35:00Speaker 1: started this whole deep dive talking about AI art. Let's
- 35:04Speaker 1: swing back to images. How do machines generate pictures? What
- 35:07Speaker 1: are the key generative models?
- 35:09Speaker 2: There two main families really dominated early on, Variational auto
- 35:13Speaker 2: encoders vaes and generative adversarial networks vas.
- 35:17Speaker 1: You mentioned them briefly. Auto encoders suggest encoding and decoding.
- 35:20Speaker 2: Precisely a vee learns two things, and encoder that compresses
- 35:25Speaker 2: an input image down into a compact latent vector. Think
- 35:29Speaker 2: of it as capturing the essential features, or as sort
- 35:31Speaker 2: of barcode for the image, and the decoder that takes
- 35:34Speaker 2: a vector from that latent space and reconstructs an image.
- 35:37Speaker 2: The variational part is a clever mathematical trick using variational
- 35:41Speaker 2: inference and the reparamemorization trick to make this latent space
- 35:45Speaker 2: smooth and continuous, so you can sample new points from
- 35:48Speaker 2: it and decode them into novel realistic looking images that
- 35:52Speaker 2: resemble the training data.
- 35:53Speaker 1: So it learns a compressed representation and can generate from
- 35:56Speaker 1: that space. What about gans, you said they're like a
- 35:59Speaker 1: game exactly.
- 36:00Speaker 2: Jans involve two neural networks competing against each other. You
- 36:03Speaker 2: have the generator, whose job is to create fake images
- 36:06Speaker 2: that look real, and you have the discriminator, whose job
- 36:09Speaker 2: is to look at an image and decide if it's
- 36:11Speaker 2: real from the training set or fake made by the generator.
- 36:13Speaker 1: A forger and a detective perfect analogy.
- 36:16Speaker 2: They train together. The generator gets better at fooling the discriminator,
- 36:21Speaker 2: and the discriminator gets better at spotting fakes. This adversarial
- 36:24Speaker 2: process pushes the generator to produce increasingly realistic and high
- 36:29Speaker 2: quality images.
- 36:30Speaker 1: But jans had some issues too, right, like being hard
- 36:33Speaker 1: to train.
- 36:33Speaker 2: They can be notoriously tricky to train. Sometimes the training
- 36:36Speaker 2: is unstable, or the generator might suffer from mode collapse,
- 36:39Speaker 2: where it gets stuck producing only a few types of
- 36:41Speaker 2: images and fails to capture the diversity of the real data. However,
- 36:45Speaker 2: lots of variations were developed to address these issues, like
- 36:48Speaker 2: deep convolational gans DC jams for better image quality, conditional
- 36:53Speaker 2: gans SEA jams where you can control the output by
- 36:56Speaker 2: providing extra information like a class label, and progressive game progms,
- 37:01Speaker 2: which achieved amazing high resolution results by training the generator
- 37:04Speaker 2: and discriminator gradually on increasingly larger image sizes.
- 37:08Speaker 1: Okay, so vaes and gans were foundational and gans you
- 37:12Speaker 1: mentioned are particularly good at style.
- 37:15Speaker 2: Yes, jans really excel at style transfer, taking the content
- 37:19Speaker 2: of one image and rendering it in the artistic style
- 37:22Speaker 2: of another, turning your photo into a Monet painting, for instance.
- 37:25Speaker 1: How do they do that, especially if you don't have
- 37:27Speaker 1: paired examples like the exact same scene painted by Monet.
- 37:30Speaker 2: That's where cycle gan was a brilliant innovation. It enables
- 37:34Speaker 2: unpaired image to image translation. You don't need photos of
- 37:38Speaker 2: horses perfectly matched with photos of zebras to learn how
- 37:41Speaker 2: to turn horses into zebras.
- 37:42Speaker 1: So how does it learn without matched pairs?
- 37:45Speaker 2: Uses a clever concept called cycle consistency loss. The idea
- 37:49Speaker 2: is if you translate an image from domain A, say horses,
- 37:53Speaker 2: to domain B zebras, and then translate that result back
- 37:56Speaker 2: from domain B to Domain A, you should get something
- 37:59Speaker 2: very close to your original end image.
- 38:00Speaker 1: Ah, the round trips should bring you.
- 38:02Speaker 2: Back home exactly. This constraint forces the model to learn
- 38:06Speaker 2: meaningful translation mappings without needing perfectly aligned pairs. It also
- 38:10Speaker 2: uses discriminators in both domains and often an identity loss
- 38:14Speaker 2: to encourage the generator to preserve color and composition where appropriate.
- 38:18Speaker 2: Cyclegan opened up huge possibilities for creative image transformations.
- 38:21Speaker 1: That's really clever. But this ability to manipulate images and
- 38:25Speaker 1: videos so convincingly it leads directly to the topic of
- 38:29Speaker 1: deep fix right it does.
- 38:31Speaker 2: Deep fakes are essentially AI generated or manipulated media, typically
- 38:36Speaker 2: video or images, where a person's likeness is replaced or
- 38:39Speaker 2: altered convincingly.
- 38:41Speaker 1: We've seen some pretty amazing and maybe sometimes concerning examples.
- 38:45Speaker 1: There are creative uses like that Dolly Museum exhibit brings
- 38:48Speaker 1: Salvador Dolli back to life or campaigns like David Beckham
- 38:52Speaker 1: appearing to speak multiple languages fluently.
- 38:54Speaker 2: Yeah, and even things like AI generated fashion models. The
- 38:57Speaker 2: technology itself can be used for productive or entertaining purposes.
- 39:01Speaker 1: How do they typically work? What are the main techniques?
- 39:03Speaker 2: Broadly, you can think of three modes. Replacement or swamping,
- 39:06Speaker 2: where one person's face is grafted onto another's body in
- 39:09Speaker 2: a video, reenactment where you take a source video of
- 39:12Speaker 2: someone and use it to control the facial expressions, pose, gaze,
- 39:15Speaker 2: or mouth movements of a target person in another video.
- 39:19Speaker 2: And editing, where attributes like hair, color, age, or expression
- 39:22Speaker 2: are modified on an existing image or video.
- 39:25Speaker 1: And this relies on the AI really understanding faces in detail.
- 39:29Speaker 2: Absolutely. Deep fake generation relies heavily on accurately detecting and
- 39:33Speaker 2: modeling facial features. This often involves using standardized systems like
- 39:37Speaker 2: the Facial Action Coding System FACS to describe muscle movements,
- 39:42Speaker 2: using three D morphable models three dmms to represent face
- 39:45Speaker 2: shape and texture, or extracting precise facial landmarks typically sixty
- 39:49Speaker 2: eight key points on the face identified using libraries like
- 39:52Speaker 2: dlib or MTCNN. The AI learns to manipulate these underlying representations.
- 39:57Speaker 1: But creating perfect deep fakes is still hard, right. What
- 40:00Speaker 1: are the technical challenges?
- 40:02Speaker 2: Definitely, generalization is a big one. Models trained on certain
- 40:05Speaker 2: data sets might fail or produce weird artifacts when faced
- 40:09Speaker 2: with unseen lighting conditions, extreme angles or different identities. Occlusions
- 40:13Speaker 2: when parts of the face are blocked by hands, hair,
- 40:15Speaker 2: or objects are really difficult to handle realistically, and maintaining
- 40:19Speaker 2: temporal consistency across video frames avoiding flickering or unnatural transitions
- 40:24Speaker 2: is a constant challenge. It's getting better, but artifacts are often.
- 40:27Speaker 1: Still detectable, and beyond the technical hurdles, there are obviously
- 40:31Speaker 1: significant ethical concerns too.
- 40:33Speaker 2: Huge concerns misinformation, fraud, non consensual pornography, undermining trust. The
- 40:38Speaker 2: potential for misuse is serious. This has led to widespread
- 40:42Speaker 2: calls for legislation, development of detection tools by companies like
- 40:45Speaker 2: Microsoft and initiatives like deep wear, and ongoing research into
- 40:49Speaker 2: robust watermarking and providence tracking. It's a critical area.
- 40:53Speaker 1: Absolutely so. Pulling back a bit as we look across text, images, video,
- 40:58Speaker 1: what does the future hole? How are we going to
- 41:01Speaker 1: interact with these increasingly powerful and multimodal AI systems well.
- 41:05Speaker 2: One ongoing challenge, especially with LLMS, is managing hallucinations. We
- 41:09Speaker 2: need systems that are not just fluent, but also factual.
- 41:12Speaker 2: As we discussed, RG is a key technique here grounding
- 41:15Speaker 2: LLLM responses in external knowledge. This focus on factuality and
- 41:19Speaker 2: reliability will continue.
- 41:20Speaker 1: To be critical, so making them more trustworthy.
- 41:22Speaker 2: Yes, and the trend towards multimodal models is undeniable. Systems
- 41:26Speaker 2: like GPT four OH that can seamlessly process and generate
- 41:29Speaker 2: combinations of text, audio, images, and video are the future.
- 41:32Speaker 2: Think of open AI's Sora model for text to video generation.
- 41:36Speaker 2: It points towards AI understanding and creating rich, dynamic content
- 41:39Speaker 2: across different senses.
- 41:41Speaker 1: Interacting with AI through more than just texts exactly, and
- 41:44Speaker 1: this leads to the concept of AI agents.
- 41:46Speaker 2: These aren't just models anymore. They're systems designed to achieve
- 41:50Speaker 2: complex goals autonomously. They can break down tasks, use tools
- 41:55Speaker 2: like web search or code execution, access databases, learn from feedback,
- 41:59Speaker 2: maybe even collaborate with other AI agents. We're moving towards
- 42:03Speaker 2: systems that don't just respond, but proactively act in the
- 42:06Speaker 2: digital and potentially physical world to accomplish objectives. Multi agent
- 42:11Speaker 2: systems with feedback loops start to hint at rudimentary forms
- 42:13Speaker 2: of self improvement, which inevitably brings up discussions around the
- 42:16Speaker 2: path towards artificial general intelligence or AGI.
- 42:20Speaker 1: Right agents that can chain actions, learn, maybe even collaborate.
- 42:24Speaker 1: That really opens up possibilities. So we've taken quite the
- 42:26Speaker 1: journey here, a real deep dive into generative AI. We've
- 42:29Speaker 1: gone from the basic building blocks like morons and backpropagation,
- 42:32Speaker 1: through the revolutions of CNNs, LSTMs, and especially transformers. We've
- 42:36Speaker 1: looked at how they handle text, the rise of llms,
- 42:39Speaker 1: the open source movement, the crucial art of prompt engineering,
- 42:43Speaker 1: and the tools like lang, chain and RAG used to
- 42:45Speaker 1: build real applications. We've touched on optimization, image generation with
- 42:50Speaker 1: vavaes and jams, style transfer, deep fix, and now these
- 42:53Speaker 1: emerging multimodal models and agents. You've seen how these models
- 42:57Speaker 1: can create translate optimized reason. But as they get better
- 43:01Speaker 1: and better generating content that's increasingly indistinguishable from human creation,
- 43:05Speaker 1: you have to wonder how might our very definitions of
- 43:07Speaker 1: things like knowledge, creativity, originality, maybe even truth itself start
- 43:11Speaker 1: to shift or evolve.
- 43:13Speaker 2: That's the big question. Isn't it The leap from simple
- 43:16Speaker 2: pattern recognition to these dynamic systems that can learn, generate
- 43:20Speaker 2: novel content, interact with tools, and potentially even improve themselves.
- 43:25Speaker 2: It does raise profound questions about intelligence, creativity, and what
- 43:29Speaker 2: it means to understand or create. It's a field moving
- 43:32Speaker 2: at incredible speed. There's always more to learn, more perspectives
- 43:36Speaker 2: to consider, and the deeper you dig, the more fascinating
- 43:39Speaker 2: and complex it all becomes.
- 43:40Speaker 1: And that's really what we hope you take away from this.
- 43:43Speaker 1: Keep exploring, keep questioning, think about how this technology impacts you,
- 43:47Speaker 1: your work, the world around you, because this generative revolution, well,
- 43:51Speaker 1: it feels like it's really just getting started.