Python中的生成式AI基础
本课程全面讲解生成式人工智能和大语言模型(LLMs)的理解与实现。课程涵盖从理论基础到基于Python的实际开发的过渡,包括GAN、扩散模型、Transformer、微调以及生产环境部署。
课程概述
📚 内容概要
一本全面指南,帮助理解并实现生成式人工智能与大型语言模型(LLMs)。本课程涵盖从理论基础到基于 Python 的实际开发的转变,包括生成对抗网络(GANs)、扩散模型、Transformer 架构、微调以及生产环境部署。
掌握现代 LLM 与生成技术的核心原理和实际应用,使用 Python 进行实践。
作者: 卡洛斯·罗德里格斯
致谢: 特别感谢作者的妻子吉尔、他的父母,以及技术审稿人摩根·博伊斯、埃里克·鲁伊和萨米拉·沙伊赫(前言作者)。
🎯 学习目标
- 区分传统(判别式)机器学习范式与生成式 AI 模型。
- 识别生成式 AI 的基础架构,包括 GANs、扩散模型和 Transformer。
- 解释大型语言模型(LLMs)在更广泛人工智能领域中的角色与演变。
- 区分 GANs、扩散模型和 Transformer 的独特特征及架构范式。
- 分析每种模型类型的进展与局限性,包括模式崩溃或采样速度等具体问题。
- 实现一个 Stable Diffusion 流水线,并使用基于 CLIP 的逻辑值和概率评估生成输出。
- 追溯自然语言处理(NLP)从早期计数方法和循环神经网络(RNNs)到现代分布式表示与迁移学习的发展历程。
- 解释多头注意力(MHA)、自注意力、掩码机制以及前馈网络(FFN)的技术原理。
- 实现完整的 Transformer 模型架构,包括数据分词、位置编码,以及训练/推理函数。
- 将原型功能(如 Google Colab)映射到生产就绪环境,使用 Docker 与 VS Code。
课程 共 7 课时 · 预计 21.0h
课程
Lesson
This lesson explores the concept of the technological Singularity and the exponential growth of AI, while establishing the fundamental distinction between discriminative models that classify data and generative models that synthesize it. Students will learn to analyze the synergy between compute, data, and algorithmic efficiency, as well as the mathematical foundations of probabilistic modeling in high-dimensional spaces.
This lesson explores the three core pillars of generative AI—GANs, diffusion models, and transformers—by analyzing their unique mathematical strategies and architectural trade-offs. Students will learn to differentiate these models based on their training stability, computational efficiency, and specific applications in multimodal synthesis.
This lesson explores the evolution of Natural Language Processing from sparse, count-based methods like TF-IDF to dense, distributed vector representations and recurrent neural architectures. It examines the limitations of RNNs and LSTMs, such as the vanishing gradient problem and the Seq2Seq bottleneck, while establishing the mathematical foundations of the Transformer architecture and self-attention mechanisms.
AI030: Production Engineering and Responsible AI Deployment (Lesson 4) explores the transition from experimental prototyping in notebooks to robust, scalable production systems. Students will learn to implement CI/CD pipelines, ensure model reliability through automated testing, and integrate fairness monitoring to meet ethical and regulatory standards.
This lesson explores the spectrum of model adaptation, comparing the computational efficiency of In-Context Learning with the specialized performance and stability of Parameter-Efficient Fine-Tuning (PEFT) and full fine-tuning. Students will learn to navigate the trade-offs between hardware constraints and model alignment, with a focus on implementing techniques like LoRA to optimize performance in resource-limited environments.
This lesson explores the necessity of domain adaptation for general-purpose LLMs, focusing on techniques like continued pre-training and fine-tuning to align model knowledge with specialized fields. Students will learn to implement parameter-efficient methods like LoRA and develop evaluation frameworks to ensure linguistic accuracy in high-stakes professional environments.
This lesson explores the paradigm shift from resource-heavy model fine-tuning to efficient prompt-based inference and in-context learning. Students will learn to master advanced prompting techniques, such as persona-based conditioning and Chain-of-Thought, to optimize model performance and maintain factual consistency.