Generative AI Foundations in Python
A comprehensive guide to understanding and implementing Generative AI and Large Language Models (LLMs). This course covers the transition from theoretical foundations to practical Python-based development, including GANs, diffusion models, transformers, fine-tuning, and production deployment.
Pelajaran
Gambaran Umum Kursus
📚 Content Summary
A comprehensive guide to understanding and implementing Generative AI and Large Language Models (LLMs). This course covers the transition from theoretical foundations to practical Python-based development, including GANs, diffusion models, transformers, fine-tuning, and production deployment.
Master the core principles and practical applications of modern LLMs and generative techniques with Python.
Author: Carlos Rodriguez
Acknowledgments: Special thanks to the author's wife, Jill, his parents, and the technical reviewers Morgan Boyce, Eric Rui, and Samira Shaikh (Foreword author).
🎯 Learning Objectives
- Distinguish between classical (discriminative) machine learning paradigms and generative AI models.
- Identify the foundational architectures of Generative AI, including GANs, Diffusion models, and Transformers.
- Explain the role and evolution of Large Language Models (LLMs) within the broader artificial intelligence landscape.
- Distinguish the unique features and architectural paradigms of GANs, diffusers, and transformers.
- Analyze the advancements and limitations of each model type, including specific issues like mode collapse or sampling speed.
- Implement a Stable Diffusion pipeline and evaluate generated outputs using CLIP-based logits and probabilities.
- Trace the evolution of NLP from early count-based methods and RNNs to modern Distributed Representations and Transfer Learning.
- Explain the technical mechanics of Multi-head Attention (MHA), Self-attention, Masking, and the Feed-Forward Network (FFN).
- Implement a complete Transformer model architecture, including data tokenization, positional encoding, and training/inference functions.
- Map prototyping features (e.g., Google Colab) to production-ready environments using Docker and VS Code.
🔹 Lesson 1: Foundations and Paradigms of Generative AI
Overview: This lesson establishes the fundamental shift from classical machine learning paradigms to the era of Generative AI. It explores the architectural evolution—from GANs to Transformers—and introduces Large Language Models (LLMs) as the cornerstone of synthetic understanding and content generation.
Learning Outcomes:
- Distinguish between classical (discriminative) machine learning paradigms and generative AI models.
- Identify the foundational architectures of Generative AI, including GANs, Diffusion models, and Transformers.
- Explain the role and evolution of Large Language Models (LLMs) within the broader artificial intelligence landscape.
🔹 Lesson 2: Architectural Survey: GANs, Diffusers, and Transformers
Overview: This lesson provides a comprehensive survey of the three primary architectural pillars of Generative AI: Generative Adversarial Networks (GANs), Diffusion Models, and Transformers. Students will explore the technical deconstruction of these methods, their evolutionary advancements, inherent limitations, and practical applications in image generation and evaluation using CLIP metrics within Jupyter/Colab environments.
Learning Outcomes:
- Distinguish the unique features and architectural paradigms of GANs, diffusers, and transformers.
- Analyze the advancements and limitations of each model type, including specific issues like mode collapse or sampling speed.
- Implement a Stable Diffusion pipeline and evaluate generated outputs using CLIP-based logits and probabilities.
🔹 Lesson 3: The Evolution of NLP and the Transformer Architecture
Overview: This lesson traces the historical trajectory of Natural Language Processing, from early statistical methods to the revolutionary Transformer architecture. It covers the transition from sequential RNN-based models to parallelizable self-attention mechanisms, detailing the specific components of the original Transformer (Encoder/Decoder) and the practical implementation of a translation pipeline using PyTorch.
Learning Outcomes:
- Trace the evolution of NLP from early count-based methods and RNNs to modern Distributed Representations and Transfer Learning.
- Explain the technical mechanics of Multi-head Attention (MHA), Self-attention, Masking, and the Feed-Forward Network (FFN).
- Implement a complete Transformer model architecture, including data tokenization, positional encoding, and training/inference functions.
🔹 Lesson 4: Production Engineering and Responsible AI Deployment
Overview: This lesson covers the critical transition from machine learning prototyping (experimental phases) to stable, production-ready deployments. It integrates production engineering principles—such as containerization with Docker and environment mapping—with the ethical imperatives of Responsible AI, focusing on bias mitigation, transparency, and rigorous model benchmarking using metrics like CLIP scores and lexical similarity.
Learning Outcomes:
- Map prototyping features (e.g., Google Colab) to production-ready environments using Docker and VS Code.
- Calculate model computational complexity and memory requirements to determine specialized hardware needs.
- Evaluate generative models using quantitative metrics (BLEU, ROUGE, METEOR) and alignment with CLIP.
🔹 Lesson 5: Fine-Tuning Techniques and Parameter-Efficient Learning
Overview: This lesson covers the transition from prompt-based model adaptation to task-specific fine-tuning. It explores In-Context Learning (Zero-shot and Few-shot), Retrieval Augmented Generation (RAG), and the practical implementation of Parameter-Efficient Fine-Tuning (PEFT) using Python. Students will learn to build a question-answering pipeline, utilize the Hugging Face Trainer class, and evaluate results using training loss and semantic similarity.
Learning Outcomes:
- Distinguish between In-context learning (Zero/Few-shot), RAG, and Fine-tuning.
- Implement a PEFT-based fine-tuning workflow using AdaLoRA and the Hugging Face
Trainerclass. - Calculate and interpret model performance metrics, including training loss and semantic similarity scores.
🔹 Lesson 6: Domain Adaptation for Specialized Large Language Models
Overview: This lesson explores the transition of Large Language Models (LLMs) from general-purpose tools to specialized experts within the finance domain. Students will learn the historical context of domain adaptation, master core training methodologies like Causal Language Modeling (CLM) and Next-Sentence Prediction (NSP), and execute a hands-on transfer learning project using Parameter-Efficient Fine-Tuning (PEFT). The module concludes with rigorous evaluation techniques using ROUGE metrics and traditional classification scores (Precision, Recall, F1).
Learning Outcomes:
- Articulate the history and critical importance of adapting general LLMs to specialized domains.
- Execute a full pipeline for finance-domain transfer learning, including preprocessing and tokenization.
- Differentiate between CLM and NSP training methodologies.
🔹 Lesson 7: Advanced Prompt Engineering and Retrieval Implementation
Overview: This lesson explores the evolution of Large Language Model (LLM) interaction, moving from traditional fine-tuning to prompt-based approaches. It details the strategic use of personas, situational role-play, and the implementation of Retrieval-Augmented Generation (RAG) using LlamaIndex to create context-aware, safe, and brand-aligned AI responses.
Learning Outcomes:
- Articulate the transition from parameter-heavy fine-tuning to efficient prompt-based inference.
- Design and implement personas and situational role-play to guide model behavior and output distribution.
- Construct a functional RAG pipeline using Python and the LlamaIndex framework.