GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
GENERATIVE AI
Zero to Job-Ready
A Complete Beginner-to-Professional Course covering Neural Networks, LLMs, Transformers,
GANs, Diffusion Models, Prompt Engineering, Fine-Tuning, Deployment & Real-World
Projects
Module 1: AI & ML Fundamentals Module 2: Deep Learning & Neural Nets
Module 3: Transformers & LLMs Module 4: Generative Models
Module 5: Prompt Engineering Module 6: Fine-Tuning & Embeddings
Module 7: Tools & Frameworks Module 8: Applications & Use Cases
Module 9: Deployment & MLOps Module 10: Capstone Project
10 Modules • 50+ Exercises • 1 Capstone Project • Free Resources Included
2025 Edition | Beginner → Advanced
© 2025 GenAI Course Page 1
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
TABLE OF CONTENTS
Module 01 — AI & Machine Learning Fundamentals
• What is AI?
• Types of ML
• Key Terminology
• The ML Pipeline
• Exercises
Module 02 — Deep Learning & Neural Networks
• Biological Neurons
• Perceptrons & MLPs
• Activation Functions
• Backpropagation
• CNNs & RNNs
• Exercises
Module 03 — Transformers & Large Language Models
• Attention Mechanism
• Transformer Architecture
• BERT, GPT, T5
• How LLMs are Trained
• Exercises
Module 04 — Generative Models
• GANs
• Variational Autoencoders
• Diffusion Models
• Stable Diffusion Deep-Dive
• Exercises
Module 05 — Prompt Engineering
• Zero-Shot & Few-Shot
• Chain-of-Thought
• Role Prompting
• Advanced Techniques
• Exercises
Module 06 — Fine-Tuning & Embeddings
• Transfer Learning
• LoRA & QLoRA
• Embedding Spaces
• Vector Databases
• Exercises
Module 07 — Tools & Frameworks
• Python Essentials
• PyTorch Basics
• HuggingFace
• LangChain
• OpenAI API
• Exercises
Module 08 — Real-World Applications
© 2025 GenAI Course Page 2
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
• Chatbots & Assistants
• Image Generation
• Code Generation
• RAG Systems
• Exercises
Module 09 — Deployment & MLOps
• Model Serving
• Docker & FastAPI
• Cloud Platforms
• Monitoring
• Exercises
Module 10 — Capstone Project
• Project Overview
• Architecture
• Implementation Steps
• Deployment
• Portfolio Tips
© 2025 GenAI Course Page 3
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 01
AI & Machine Learning Fundamentals
Building your mental model from the ground up
1.1 What is Artificial Intelligence?
Artificial Intelligence (AI) refers to the simulation of human-like intelligence in machines. Rather than following
rigid rules, AI systems learn patterns from data and make decisions or predictions. The field has existed since
the 1950s but has exploded in capability since 2012 with the rise of deep learning and large datasets.
■ The AI Landscape
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■ ARTIFICIAL INTELLIGENCE ■
■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■
■ ■ MACHINE LEARNING ■ ■
■ ■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■ ■
■ ■ ■ DEEP LEARNING ■ ■ ■
■ ■ ■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■ ■ ■
■ ■ ■ ■ GENERATIVE AI (LLMs, GANs) ■ ■ ■ ■
■ ■ ■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■ ■ ■
■ ■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■ ■
■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
Figure 1.1 — Nested hierarchy of AI disciplines
1.2 Types of Machine Learning
Machine Learning (ML) is a subset of AI where systems improve automatically through experience. There are
four primary learning paradigms:
■ Supervised Learning
The model learns from labeled examples (input → known output). Examples: spam detection, image
classification.
■ Unsupervised Learning
The model finds patterns in unlabeled data on its own. Examples: customer clustering, anomaly detection.
© 2025 GenAI Course Page 4
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Semi-Supervised Learning
Uses a small amount of labeled data combined with a large amount of unlabeled data. Useful when labeling
is expensive.
■ Reinforcement Learning
An agent learns by trial and error, receiving rewards for correct actions. Examples: game-playing AI,
robotics.
1.3 Key Terminology
Term Plain-English Definition
Dataset A collection of data used to train or evaluate a model
Feature An input variable (e.g., pixel values, word counts)
Label / Target The correct answer the model should predict
Training Teaching the model by showing it many examples
Validation Testing during training to tune settings (hyperparameters)
Test Set Held-out data used only to measure final performance
Model A mathematical function that maps inputs to outputs
Inference Running a trained model on new, unseen data
Overfitting Model memorizes training data but fails on new data
Underfitting Model is too simple to capture the underlying patterns
Loss Function Measures how wrong the model's predictions are
Optimizer Algorithm that adjusts model weights to minimize loss
Epoch One complete pass through the entire training dataset
Batch Size Number of training examples processed at once
Learning Rate Controls how large each weight update step is
1.4 The Machine Learning Pipeline
Every ML project follows a structured pipeline. Understanding this flow is critical before writing a single line of
code.
© 2025 GenAI Course Page 5
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ ML Pipeline
[Raw Data] → [Data Cleaning] → [Feature Engineering]
↓ ↓
[EDA & Viz] [Model Selection & Training]
[Validation & Hyperparameter Tuning]
[Evaluation on Test Set]
[Deployment & Monitoring]
• 1. Data Collection: Gather relevant data from APIs, web scraping, databases, or public datasets. Quality
trumps quantity.
• 2. Data Cleaning: Handle missing values, remove duplicates, fix formatting errors, and remove noise.
• 3. Exploratory Data Analysis (EDA): Visualize distributions, find correlations, understand the data's
structure.
• 4. Feature Engineering: Transform raw data into meaningful inputs — normalize, encode categoricals,
create new features.
• 5. Model Selection: Choose algorithms appropriate for your problem type and data size.
• 6. Training: Feed data into the model; the optimizer adjusts weights to minimize the loss function.
• 7. Evaluation: Use metrics like accuracy, F1-score, RMSE, or AUC to measure performance.
• 8. Deployment: Serve the model via an API, embed it in an application, or schedule batch predictions.
1.5 Evaluation Metrics Cheat Sheet
Metric Use For Formula / Notes
Accuracy Classification Correct / Total — misleading on imbalanced data
Precision Classification True Positives / (TP + FP)
Recall (Sensitivity) Classification True Positives / (TP + FN)
F1-Score Classification Harmonic mean of Precision and Recall
AUC-ROC Classification Area under ROC curve; 1.0 = perfect
MSE / RMSE Regression Mean Squared / Root Mean Squared Error
MAE Regression Mean Absolute Error — interpretable units
BLEU / ROUGE Text Generation N-gram overlap between generated & reference text
Perplexity Language Models How well a model predicts a sample; lower = better
■ HANDS-ON EXERCISES — MODULE 1
© 2025 GenAI Course Page 6
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Exercise 1: Explore a Dataset [ Beginner ]
1. Download the Iris or Titanic dataset from Kaggle.
2. Load it with pandas and print shape, dtypes, describe().
3. Plot histograms and a correlation heatmap using seaborn.
4. Identify which features correlate most with the target.
Tools: Python, pandas, seaborn, matplotlib
■ Exercise 2: Train Your First Classifier [ Beginner ]
1. Use sklearn's train_test_split to split the dataset 80/20.
2. Train a LogisticRegression and a RandomForestClassifier.
3. Compute accuracy, precision, recall, and F1 for both.
4. Plot a confusion matrix and interpret results.
Tools: Python, scikit-learn
■ FREE RESOURCES
[Link] — Practical Deep Learning: [Link]/course (free, beginner-friendly)
Google ML Crash Course: [Link]/machine-learning/crash-course
Kaggle Learn: [Link]/learn (interactive notebooks for every concept)
3Blue1Brown Neural Networks: [Link]/c/3blue1brown (visual intuition)
Scikit-learn Docs: [Link]/stable/user_guide.html
© 2025 GenAI Course Page 7
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 02
Deep Learning & Neural Networks
How machines learn to see, hear, and understand
2.1 From Biological to Artificial Neurons
The brain contains roughly 86 billion neurons connected by synapses. An artificial neural network borrows
this metaphor: each node (neuron) receives inputs, applies a weighted sum, passes through an activation
function, and fires an output.
■ Single Neuron (Perceptron)
x1 ■■ w1 ■■
x2 ■■ w2 ■■■■■ [Σ(xi·wi) + bias] ■■■ activation(z) ■■■ output
x3 ■■ w3 ■■
Equation: y = activation( w1·x1 + w2·x2 + w3·x3 + b )
2.2 Activation Functions
Activation functions introduce non-linearity, allowing networks to learn complex patterns.
Function Formula When to Use
Sigmoid 1 / (1 + e^(-x)) Binary output layer; vanishing gradient issue
Tanh (e^x - e^(-x)) / (e^x + e^(-x)) Hidden layers; zero-centered, still has vanishing gradient
ReLU max(0, x) Default choice for hidden layers — fast, simple
Leaky ReLU max(0.01x, x) Fixes 'dead ReLU' problem
Softmax e^xi / Σ e^xj Multi-class output layer — outputs a probability distribution
GELU x · Φ(x) Used in transformers (GPT, BERT) — smooth & effective
2.3 Multi-Layer Perceptron (MLP)
Stacking multiple layers of neurons creates a Multi-Layer Perceptron. The layers are:
• Input Layer: Receives raw feature values. One neuron per feature.
• Hidden Layers: Learn intermediate representations. Deeper = more abstract features.
• Output Layer: Produces the final prediction (class probabilities or continuous values).
© 2025 GenAI Course Page 8
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ MLP Architecture
Input Layer Hidden Layer 1 Hidden Layer 2 Output Layer
x1 ■■■■■■■■■■■ [h11] [h21] ■■■■■■■■■■■ y1
x2 ■■■■■■■■■■■ [h12] ■■■■■■■■■■■ [h22] ■■■■■■■■■■■ y2
x3 ■■■■■■■■■■■ [h13] [h23]
x4 ■■■■■■■■■■■ [h14]
Each arrow = a learned weight (parameter)
2.4 Backpropagation — How Networks Learn
Backpropagation is the algorithm that trains neural networks. It uses the chain rule of calculus to compute
how much each weight contributed to the error, then adjusts weights in the direction that reduces the loss.
• Forward Pass: Input flows through the network; predictions are generated.
• Compute Loss: The loss function (e.g., Cross-Entropy, MSE) measures the prediction error.
• Backward Pass: Gradients of the loss with respect to each weight are computed via the chain rule.
• Weight Update: Optimizer (SGD, Adam) adjusts weights: w ← w − η · ∂L/∂w
• Repeat: Process repeats for each mini-batch until convergence.
■ Gradient Descent Intuition
Imagine you are blindfolded on a hilly landscape and want to reach the lowest valley (minimum loss). At
each step, you feel the slope beneath your feet (gradient) and take a step downhill. The learning rate
determines how large each step is. Too large = overshoot; too small = slow convergence.
2.5 Convolutional Neural Networks (CNNs)
CNNs are specialized for grid-like data such as images. Instead of fully connected layers, they use
convolutional filters that slide over the input to detect local patterns (edges, textures, shapes).
© 2025 GenAI Course Page 9
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ CNN Architecture for Image Classification
[Input Image]
[Conv + ReLU] → detect low-level features (edges, lines)
[Max Pooling] → downsample, reduce spatial dimensions
[Conv + ReLU] → detect mid-level features (shapes, textures)
[Flatten] → [Fully Connected] → [Softmax Output]
2.6 Recurrent Neural Networks (RNNs) & LSTMs
RNNs process sequential data by maintaining a hidden state that carries information from previous time
steps. However, vanilla RNNs struggle with long-range dependencies due to the vanishing gradient problem.
LSTMs (Long Short-Term Memory) networks solve this with gating mechanisms.
■ LSTM Cell (simplified)
Input (xt) ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
Hidden (ht-1) ■■■ [Forget Gate] ■■■ forget ■
■■■ [Input Gate] ■■■ add ■■■■ Cell State (ct)
■■■ [Output Gate] ■■■ expose ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■■■ ht (new hidden state)
■ The Sequence Bottleneck
RNNs and LSTMs process tokens one at a time, making them slow to train on long sequences. This
limitation motivated the invention of the Transformer architecture (Module 3), which processes all tokens in
parallel using the attention mechanism.
2.7 Regularization Techniques
• Dropout: Randomly zeroes a fraction of neurons during training, preventing co-adaptation and overfitting.
• Batch Normalization: Normalizes layer outputs across a mini-batch, stabilizing and accelerating training.
© 2025 GenAI Course Page 10
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
• L1 / L2 Regularization: Adds a penalty on large weights to the loss function (L2 = weight decay).
• Early Stopping: Monitors validation loss; stops training when it starts increasing.
• Data Augmentation: Artificially expands the training set via transformations (flipping, cropping, color
jitter).
■ HANDS-ON EXERCISES — MODULE 2
■ Exercise 3: Build an MLP from Scratch [ Beginner ]
1. Implement a 2-layer neural network in pure NumPy.
2. Manually code forward pass, loss (MSE), and backward pass.
3. Train on a simple XOR or sine wave regression problem.
4. Plot training loss vs epoch.
Tools: Python, NumPy
■ Exercise 4: Image Classifier with PyTorch [ Intermediate ]
1. Load CIFAR-10 dataset using torchvision.
2. Build a CNN with 2 conv layers + 2 FC layers.
3. Train for 10 epochs with Adam optimizer + CrossEntropyLoss.
4. Evaluate on test set; visualize misclassified images.
Tools: Python, PyTorch, torchvision
■ FREE RESOURCES
Neural Networks & Deep Learning (free book): [Link]
Deep Learning Specialization — Coursera (Andrew Ng): [Link] (audit free)
PyTorch Tutorials: [Link]/tutorials
CS231n CNN for Visual Recognition (Stanford): [Link] (free lecture notes)
[Link] — Dive into Deep Learning: [Link] (interactive textbook with code)
© 2025 GenAI Course Page 11
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 03
Transformers & Large Language Models
The architecture powering GPT, BERT, Gemini, and Claude
3.1 The Attention Mechanism
The core innovation of the Transformer is the self-attention mechanism. Instead of processing tokens
sequentially, attention allows every token to directly look at every other token and weigh its relevance. This
captures long-range dependencies in a single step.
■ Self-Attention (Scaled Dot-Product)
Input tokens: [The] [cat] [sat] [on] [the] [mat]
↓ (Learned projections)
Queries (Q), Keys (K), Values (V) — all from same input
Attention Score = softmax( Q · K^T / sqrt(d_k) ) · V
Each token's output = weighted sum of ALL Value vectors,
where weights = how much attention it pays to each token.
Figure 3.1 — Self-Attention allows 'cat' to attend strongly to 'mat' even across distance
3.2 Multi-Head Attention
Running attention multiple times in parallel with different learned projections is called Multi-Head Attention.
Each 'head' can focus on different types of relationships (e.g., one head might capture subject-verb
relationships, another might capture coreference).
■ Intuition
Think of multi-head attention as having multiple 'perspectives' on the same sentence. Head 1 might ask 'who
is doing the action?', Head 2 asks 'what is being modified?', and Head 3 asks 'what time or place is
involved?'. Their outputs are concatenated and projected.
3.3 The Full Transformer Architecture
© 2025 GenAI Course Page 12
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Transformer Encoder-Decoder
ENCODER (stack of N layers) DECODER (stack of N layers)
■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■■■
■ Input Embeddings ■ ■ Output Embeddings ■
■ + Positional Encoding ■ ■ + Positional Encoding ■
■ → Multi-Head Attn ■ ■ → Masked MH Attn ■
■ → Add & Norm ■■■■■■■■■■■ → Cross-Attn (Enc) ■
■ → Feed-Forward ■ ■ → Add & Norm ■
■ → Add & Norm ■ ■ → Feed-Forward ■
■■■■■■■■■■■■■■■■■■■■■■■■■■ ■ → Linear + Softmax ■
■■■■■■■■■■■■■■■■■■■■■■■■■■
• Positional Encoding: Since attention has no sense of order, sinusoidal positional encodings are added
to embeddings to inject sequence position information.
• Layer Normalization: Applied after each sub-layer to stabilize activations and accelerate training.
• Feed-Forward Network: A two-layer MLP applied independently to each position — allows the model to
'think' about each token's updated representation.
• Residual Connections: Each sub-layer's input is added to its output (x + sublayer(x)), allowing gradients
to flow easily through deep networks.
3.4 Major Language Models Compared
Model Type Key Strength Released by
BERT Encoder-only Text understanding, classification, NER Google (2018)
GPT-2/3/4 Decoder-only Text generation, completion, dialogue OpenAI (2019–2023)
T5 Encoder-Decoder Translation, summarization, Q&A Google (2020)
LLaMA 2/3 Decoder-only Open-source, efficient generation Meta (2023–2024)
Mistral 7B Decoder-only High quality at small model size Mistral AI (2023)
Claude 3 Decoder-only Long context, safety, reasoning Anthropic (2024)
Gemini 1.5 Multimodal 1M token context, vision + text Google (2024)
3.5 How LLMs Are Trained
Modern LLMs are trained in three stages that progressively align the model's behavior:
■ Stage 1: Pre-Training
The model is trained on a massive corpus of text (terabytes from the internet, books, code) using a
self-supervised objective. For GPT-style models, this is next-token prediction: predict the next word given
all previous words. This builds deep world knowledge.
© 2025 GenAI Course Page 13
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Stage 2: Supervised Fine-Tuning (SFT)
The pre-trained model is fine-tuned on high-quality human-written instruction-response pairs. This teaches
the model to follow instructions and behave helpfully.
■ Stage 3: RLHF — Reinforcement Learning from Human Feedback
Human raters compare model outputs. A reward model is trained to score responses. The LLM is then
optimized using PPO (Proximal Policy Optimization) to maximize the reward — making it safer, more helpful,
and less likely to hallucinate.
3.6 Tokenization
LLMs don't operate on characters or words — they operate on tokens. Tokenization is the process of splitting
text into sub-word units.
■ Byte-Pair Encoding (BPE) Example
Input: 'unhappiness'
Tokens: ['un', 'happ', 'iness'] → token IDs: [1423, 7892, 3301]
'ChatGPT is amazing!'
Tokens: ['Chat', 'G', 'PT', ' is', ' amazing', '!']
Rule of thumb: 1 token ≈ 4 characters ≈ 0.75 words (English)
Context window = maximum tokens model can process at once
■ HANDS-ON EXERCISES — MODULE 3
■ Exercise 5: Attention Visualization [ Intermediate ]
1. Load 'bert-base-uncased' from HuggingFace transformers.
2. Feed a sentence and extract attention weights.
3. Use bertviz or matplotlib to plot the attention heatmap.
4. Interpret which words attend to which others.
Tools: Python, transformers, bertviz
© 2025 GenAI Course Page 14
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Exercise 6: Build a Mini GPT [ Intermediate ]
1. Follow Andrej Karpathy's 'nanoGPT' tutorial (GitHub).
2. Train a tiny character-level GPT on Shakespeare text.
3. Generate new text and observe quality vs training loss.
4. Experiment with n_heads, n_layers, and learning rate.
Tools: Python, PyTorch, nanoGPT
■ FREE RESOURCES
Attention Is All You Need (original paper): [Link]/abs/1706.03762
The Illustrated Transformer — Jay Alammar: [Link]/illustrated-transformer
Andrej Karpathy — Let's build GPT from scratch (YouTube): [Link]/@karpathy
HuggingFace Course: [Link]/learn/nlp-course (free, hands-on NLP)
Stanford CS224N NLP with DL: [Link]/class/cs224n (free lecture slides)
© 2025 GenAI Course Page 15
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 04
Generative Models
GANs, VAEs, and Diffusion — the engines of AI creativity
4.1 Introduction to Generative Modeling
Generative models learn the underlying distribution of training data and can then sample new data points
from that distribution. Unlike discriminative models (which draw boundaries between classes), generative
models ask: what does a realistic example look like?
4.2 Generative Adversarial Networks (GANs)
Introduced by Ian Goodfellow in 2014, GANs consist of two networks in competition: a Generator (G) and a
Discriminator (D). This adversarial dynamic drives both networks to improve.
■ GAN Training Loop
GENERATOR (G) DISCRIMINATOR (D)
[Random Noise z] ■■■ G ■■■ Fake Image ■■■ D ■■■ 'Fake' (0)
[Real Dataset] ■■■■■■■■■■■■■■■■■■■■■ Real Image ■■■ D ■■■ 'Real' (1)
G learns: fool D into saying 'Real'
D learns: correctly classify Real vs Fake
Nash Equilibrium: G generates images indistinguishable from real
4.3 GAN Variants
• DCGAN (Deep Convolutional GAN): Uses convolutional layers in G and D — dramatically improves
image quality over original GAN.
• StyleGAN / StyleGAN2: Produces photorealistic high-resolution faces; separates style and content at
different scales.
• Conditional GAN (cGAN): Conditions generation on a label (e.g., generate 'a cat'). Enables controlled
outputs.
• CycleGAN: Translates images between domains (horse ↔ zebra, photo ↔ painting) without paired
examples.
• Pix2Pix: Paired image-to-image translation — sketch to photo, satellite to map, etc.
© 2025 GenAI Course Page 16
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ GAN Training Instabilities
GANs are notoriously hard to train. Common failure modes include mode collapse (G produces limited
variety), oscillation (D and G fail to converge), and vanishing gradients. Techniques like Wasserstein loss,
spectral normalization, and gradient penalty help stabilize training.
4.4 Variational Autoencoders (VAEs)
VAEs are probabilistic models that encode input data into a latent space distribution (mean and variance),
then decode samples from that distribution back into data. Unlike GANs, VAEs offer a mathematically
principled training objective (ELBO).
■ VAE Architecture
[Input x]
[Encoder] ■■■ µ (mean), σ (std) ← Latent Distribution
Sample z = µ + ε·σ (reparameterization trick)
[Decoder] ■■■ [Reconstructed x']
Loss = Reconstruction Loss + KL Divergence
KL term: forces latent space to be smooth and continuous
■ Why VAE Latent Space is Useful
Because the latent space is continuous and regularized, you can interpolate between two images by walking
between their latent codes — producing smooth transitions. You can also perform arithmetic: latent('King') -
latent('Man') + latent('Woman') ≈ latent('Queen').
4.5 Diffusion Models — The State of the Art
Diffusion models (like Stable Diffusion, DALL-E 3, Midjourney) have surpassed GANs as the dominant
approach for high-quality image generation. They work by learning to reverse a gradual noising process.
© 2025 GenAI Course Page 17
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Diffusion Process
FORWARD PROCESS (fixed, not learned):
[Clean Image x0] ■■noise■■■ [x1] ■■noise■■■ ... ■■■ [xT ≈ pure noise]
REVERSE PROCESS (learned by neural network U-Net):
[Pure Noise xT] ■■denoise■■■ ... ■■denoise■■■ [Clean Image x0]
At each step t, the network predicts the noise that was added,
then subtracts it — gradually refining the image.
Conditioning: text embeddings guide the denoising toward the prompt.
Figure 4.1 — Diffusion models learn the reverse of Gaussian noise addition
4.6 Stable Diffusion Deep-Dive
Stable Diffusion (Rombach et al., 2022) runs diffusion in a compressed latent space rather than pixel space,
dramatically reducing computational cost while maintaining quality.
• VAE Encoder/Decoder: Compresses 512×512 images into 64×64 latent representations (8×
compression).
• U-Net: The denoising backbone; uses cross-attention layers to incorporate text conditioning.
• CLIP Text Encoder: Converts text prompts into embeddings that guide the denoising process.
• Scheduler (DDPM/DDIM): Controls the noise schedule and number of denoising steps (20–50 typical).
• ControlNet: Add-on that conditions generation on extra signals: edges, depth maps, poses, etc.
• LoRA: Low-rank adapters that fine-tune the model for specific styles or subjects efficiently.
4.7 Comparison of Generative Model Types
Model Training Quality Diversity Controllability
GAN Adversarial (unstable) Very High Low-Med Medium
VAE ELBO (stable) Medium High High
Diffusion Denoising (stable) State-of-Art Very High Very High
Flow Models Exact likelihood (slow) High High High
Autoregressive Next-token prediction High (text) High Medium
■ HANDS-ON EXERCISES — MODULE 4
© 2025 GenAI Course Page 18
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Exercise 7: Train a DCGAN on MNIST [ Intermediate ]
1. Build Generator and Discriminator with PyTorch Conv layers.
2. Implement the GAN training loop with separate G and D optimizers.
3. Generate digit images every 5 epochs and visualize the grid.
4. Plot D_loss and G_loss; identify mode collapse if it occurs.
Tools: Python, PyTorch
■ Exercise 8: Image Generation with Stable Diffusion [ Beginner ]
1. Install diffusers library: pip install diffusers transformers.
2. Load 'runwayml/stable-diffusion-v1-5' pipeline.
3. Generate images from 5 creative prompts.
4. Explore CFG scale (1–15) and number of inference steps.
5. Try negative prompts to remove unwanted elements.
Tools: Python, diffusers, HuggingFace
■ FREE RESOURCES
GAN Lab (interactive visualization): [Link]/ganlab
Lilian Weng's blog — GANs overview: [Link]
Denoising Diffusion Probabilistic Models (DDPM paper): [Link]/abs/2006.11239
Stable Diffusion Web UI (AUTOMATIC1111): [Link]/AUTOMATIC1111/stable-diffusion-webui
HuggingFace Diffusers Docs: [Link]/docs/diffusers
© 2025 GenAI Course Page 19
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 05
Prompt Engineering
The art and science of communicating with AI models
5.1 What is Prompt Engineering?
Prompt engineering is the practice of crafting inputs to language models to elicit optimal outputs. Since LLMs
are sensitive to how instructions are phrased, a well-designed prompt can dramatically improve output
quality, accuracy, and safety — without any model training.
■ Why It Matters
The difference between a mediocre and outstanding AI output often comes down to how well the prompt
communicates the task. Prompt engineers can achieve fine-tuning-level performance improvements purely
through better prompting — making it a highly valuable skill.
5.2 Core Prompting Strategies
Zero-Shot Prompting
Ask the model to perform a task with no examples. Works well for simple, well-defined tasks.
Prompt: Classify the sentiment of this review as Positive, Negative, or Neutral:
Review: 'The food was incredible but the service was slow.'
Response: Mixed (Positive food, Negative service)
Few-Shot Prompting
Provide 2–5 input-output examples before your actual query. This 'in-context learning' teaches the model the
desired format and style.
Prompt:
Tweet: 'I love this product!' → Sentiment: Positive
Tweet: 'This is the worst thing ever.' → Sentiment: Negative
Tweet: 'It arrived on time.' → Sentiment: Neutral
Tweet: 'The battery life exceeded my expectations!' → Sentiment:
Chain-of-Thought (CoT) Prompting
Instruct the model to reason step-by-step before giving the final answer. This significantly improves
performance on math, logic, and multi-step reasoning tasks.
© 2025 GenAI Course Page 20
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
Prompt: A store sells apples for $0.50 each and oranges for $0.75.
If I buy 4 apples and 3 oranges, how much do I spend?
Let's think step by step.
Response:
Step 1: Cost of apples = 4 × $0.50 = $2.00
Step 2: Cost of oranges = 3 × $0.75 = $2.25
Step 3: Total = $2.00 + $2.25 = $4.25
5.3 Advanced Techniques
Role / System Prompting
Assign the model a persona or role to constrain its behavior, tone, and knowledge domain.
System: You are an expert data scientist with 10 years of experience.
You explain concepts clearly to non-technical audiences using analogies.
You always provide code examples in Python.
User: Explain gradient descent.
Tree-of-Thought (ToT)
Instead of a single reasoning chain, the model explores multiple reasoning paths (a tree) and selects the
most promising branch. Better for complex planning and problem-solving.
ReAct (Reasoning + Acting)
The model alternates between reasoning ('Think') and taking actions ('Act') — like calling a web search API or
executing code — to solve tasks that require external information.
Retrieval-Augmented Generation (RAG)
Augment prompts with relevant documents retrieved from a knowledge base. This grounds the model's
response in up-to-date, factual context and reduces hallucination. (Covered in depth in Module 8.)
5.4 Prompt Structure Best Practices
Element Purpose Example
Role / Context Set the model's persona and expertise You are a senior Python developer...
Task / Instruction Be explicit about what you want Refactor the following code to...
Input / Data Provide the content to work on ```python\n def foo(): ...\n```
Output Format Specify structure of the response Respond as a JSON with keys: ...
Constraints Define boundaries / limitations Use only standard library. Max 20 lines.
Examples Show desired input-output pairs Example: Input: X → Output: Y
© 2025 GenAI Course Page 21
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
CoT Trigger Activate step-by-step reasoning Think step by step before answering.
5.5 Prompt Injection & Safety
Prompt injection attacks occur when malicious content in user input attempts to override system instructions.
This is a critical security concern for production AI applications.
■ Security Warning
Never concatenate untrusted user input directly into system prompts. Always sanitize inputs, use separate
message roles (system/user/assistant), implement output filtering, and consider using a dedicated prompt
injection detection layer.
■ HANDS-ON EXERCISES — MODULE 5
■ Exercise 9: Prompt Comparison Lab [ Beginner ]
1. Choose a complex task (e.g., solving a riddle, writing code, data analysis).
2. Write 5 versions: zero-shot, few-shot, CoT, role-prompted, and combined.
3. Submit each to an LLM API and score the outputs on accuracy and quality.
4. Document which techniques worked best and why.
Tools: Python, OpenAI API or HuggingFace Inference API
■ Exercise 10: Build a Prompt Template Library [ Intermediate ]
1. Identify 10 common tasks (summarization, classification, code review, etc.).
2. Design and test a reusable prompt template for each task.
3. Package templates in a Python class with .format() method.
4. Evaluate each template across 3 different LLMs.
Tools: Python, Jinja2 or f-strings, API access
■ FREE RESOURCES
Prompt Engineering Guide: [Link] (comprehensive, free)
OpenAI Prompt Engineering Guide: [Link]/docs/guides/prompt-engineering
Learn Prompting: [Link] (free interactive course)
[Link] Prompt Engineering Course (GitHub): [Link]/dair-ai/Prompt-Engineering-Guide
Anthropic Prompt Engineering Documentation: [Link]
© 2025 GenAI Course Page 22
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 06
Fine-Tuning & Embeddings
Customizing LLMs for your domain and unlocking semantic search
6.1 Transfer Learning
Transfer learning is the foundational idea behind modern AI: instead of training from scratch, start from a
powerful pre-trained model and adapt it to your specific task with much less data and compute. This is why
even small companies can deploy state-of-the-art AI.
■ Transfer Learning Workflow
STAGE 1: Pre-Training (done by labs — very expensive)
Massive corpus (1T+ tokens) ■■■ Train LLM from scratch ■■■ Foundation Model
STAGE 2: Fine-Tuning (done by you — affordable)
Foundation Model + Your Domain Data ■■■ Fine-Tuned Model
Examples of fine-tuning targets:
• Legal document summarizer • Customer support chatbot
• Medical diagnosis assistant • Code generation for your codebase
6.2 Full Fine-Tuning vs. Parameter-Efficient Methods
Full fine-tuning updates all model parameters — prohibitively expensive for 7B+ models. Parameter-Efficient
Fine-Tuning (PEFT) methods update only a small fraction of parameters, achieving similar results at a
fraction of the cost.
Method Parameters Updated Compute Quality
Full Fine-Tuning All (100%) Very High Best
LoRA ~0.1–1% Low Near-Best
QLoRA ~0.1–1% (4-bit) Very Low Near-Best
Adapter Layers ~2–5% Low-Med High
Prompt Tuning <0.01% Very Low Task-Dependent
IA3 <0.01% Very Low Competitive
6.3 LoRA: Low-Rank Adaptation
LoRA (Hu et al., 2021) freezes the original model weights and injects small trainable rank-decomposition
matrices into each transformer layer. During inference, these can be merged back in, adding zero latency.
© 2025 GenAI Course Page 23
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ LoRA Mechanism
Original Weight Matrix W (frozen, e.g., 4096 × 4096)
∆W = B × A where B is 4096×r, A is r×4096, r << 4096
(r = rank, typically 4–64)
Output = W·x + (B·A)·x = (W + ∆W)·x
Only A and B are trained — ~0.1% of total parameters
Savings: 65B model full fine-tune ~780GB vs LoRA ~200MB
6.4 QLoRA — Quantized LoRA
QLoRA (Dettmers et al., 2023) combines 4-bit quantization of the base model with LoRA adapters. This
allows fine-tuning a 65B parameter model on a single 48GB GPU — making SOTA fine-tuning accessible on
consumer hardware.
# QLoRA fine-tuning setup (simplified)
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
from peft import LoraConfig, get_peft_model
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type='nf4',
bnb_4bit_compute_dtype=torch.float16
model = AutoModelForCausalLM.from_pretrained(
'meta-llama/Llama-2-7b-hf',
quantization_config=bnb_config
lora_config = LoraConfig(r=16, lora_alpha=32, target_modules=['q_proj','v_proj'])
model = get_peft_model(model, lora_config)
6.5 Word Embeddings & Semantic Search
Embeddings are dense vector representations of text that capture semantic meaning. Similar meanings →
similar vectors. This enables powerful semantic search, recommendation, and clustering applications.
© 2025 GenAI Course Page 24
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Embedding Space (simplified 2D projection)
HIGH-DIMENSIONAL VECTOR SPACE (e.g., 1536 dimensions)
'dog' → [0.32, -0.14, 0.87, ...] ■■■
'puppy' → [0.31, -0.12, 0.85, ...] ■■■■■ close together (similar)
'car' → [-0.55, 0.43, -0.21, ...] ■■■ far from 'dog'
Cosine similarity: how 'close' two vectors are (1=identical, 0=unrelated)
Word2Vec analogy: King - Man + Woman ≈ Queen
6.6 Vector Databases
A vector database stores embeddings and enables ultra-fast approximate nearest-neighbor (ANN) search at
scale — essential for production RAG systems.
Database Type Best For
Pinecone Managed cloud Production RAG, quick setup, fully managed
Weaviate Open-source Hybrid search (semantic + keyword), self-hosted
Chroma Open-source Local prototyping, lightweight, great with LangChain
Qdrant Open-source High performance, filtering, Rust-based
FAISS Library Offline similarity search, research, Meta
pgvector PostgreSQL ext Existing Postgres infra, SQL + vectors together
■ HANDS-ON EXERCISES — MODULE 6
■ Exercise 11: Semantic Search Engine [ Intermediate ]
1. Embed 500 Wikipedia article summaries using sentence-transformers.
2. Store embeddings in ChromaDB (local vector database).
3. Build a search function: user query → embed → find top-5 similar docs.
4. Compare semantic search results vs. keyword (BM25) search.
Tools: Python, sentence-transformers, chromadb
© 2025 GenAI Course Page 25
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Exercise 12: Fine-Tune LLaMA-2 with QLoRA [ Advanced ]
1. Choose a domain dataset (e.g., medical Q&A, legal text, customer support).
2. Format data in Alpaca instruction format: instruction/input/output.
3. Fine-tune LLaMA-2-7B with QLoRA using HuggingFace + PEFT.
4. Compare base model vs fine-tuned model on 20 domain-specific prompts.
Tools: Python, transformers, peft, bitsandbytes, datasets
■ FREE RESOURCES
HuggingFace PEFT Library: [Link]/docs/peft (LoRA, QLoRA, adapters)
QLoRA Paper: [Link]/abs/2305.14314
Sentence Transformers: [Link] (embedding models, free)
LangChain Vector Stores Guide: [Link]/docs/modules/data_connection
Weights & Biases Course on LLM Fine-Tuning: [Link]/site/courses
© 2025 GenAI Course Page 26
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 07
Tools & Frameworks
The professional GenAI developer's tech stack
7.1 Python for AI — Essential Libraries
Python is the undisputed language of AI. Its rich ecosystem of libraries covers every stage of the ML lifecycle.
Here is the core stack you need to master:
Library Purpose Key Functions
NumPy Numerical computing Arrays, linear algebra, broadcasting
Pandas Data manipulation DataFrames, groupby, merge, read_csv
Matplotlib/Seaborn Visualization Plots, heatmaps, histograms
Scikit-learn Classical ML Pipeline, GridSearchCV, metrics
PyTorch Deep learning Tensors, autograd, [Link]
TensorFlow/Keras Deep learning (alt) Model, fit, compile, Sequential
HuggingFace Transformers LLMs & NLP AutoModel, pipeline, Trainer
Diffusers Image generation StableDiffusionPipeline
LangChain LLM orchestration Chains, agents, memory, RAG
LlamaIndex Data-LLM integration Index, query engine, retrieval
OpenAI SDK OpenAI API client ChatCompletion, embeddings, DALL-E
FastAPI API serving Endpoints, async, Pydantic models
Weights & Biases Experiment tracking [Link], [Link], sweeps
7.2 PyTorch Fundamentals
PyTorch is the framework of choice for research and production GenAI. Its dynamic computation graph
makes debugging intuitive.
© 2025 GenAI Course Page 27
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
import torch
import [Link] as nn
# Tensors — PyTorch's core data structure
x = [Link]([[1.0, 2.0], [3.0, 4.0]])
x = [Link]('cuda') # Move to GPU
# Define a simple model
class SimpleNet([Link]):
def __init__(self):
super().__init__()
self.fc1 = [Link](784, 256)
self.fc2 = [Link](256, 10)
[Link] = [Link]()
def forward(self, x):
x = [Link](self.fc1(x))
return self.fc2(x) # logits
model = SimpleNet()
optimizer = [Link]([Link](), lr=1e-3)
criterion = [Link]()
# Training loop
for epoch in range(10):
optimizer.zero_grad() # Clear gradients
output = model(x_train) # Forward pass
loss = criterion(output, y) # Compute loss
[Link]() # Backpropagation
[Link]() # Update weights
7.3 HuggingFace Ecosystem
HuggingFace is the GitHub of AI models. The Transformers library provides instant access to thousands of
pre-trained models with a consistent API.
© 2025 GenAI Course Page 28
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
from transformers import pipeline
# Text generation
generator = pipeline('text-generation', model='gpt2')
result = generator('Once upon a time', max_length=100)
# Sentiment analysis
classifier = pipeline('sentiment-analysis')
out = classifier('I absolutely loved this movie!')
# → [{'label': 'POSITIVE', 'score': 0.9998}]
# Summarization
summarizer = pipeline('summarization', model='facebook/bart-large-cnn')
summary = summarizer(long_text, max_length=130, min_length=30)
# Image generation (Stable Diffusion)
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained('runwayml/stable-diffusion-v1-5')
image = pipe('a photo of an astronaut riding a horse on mars').images[0]
7.4 LangChain — LLM Orchestration
LangChain is a framework for building applications powered by LLMs. It provides abstractions for chains,
agents, memory, and retrieval — enabling complex multi-step AI workflows.
■ LangChain Core Concepts
LLMs / Chat Models — wrappers for OpenAI, Anthropic, HuggingFace
Prompt Templates — parameterized prompts with variables
Chains — sequences of LLM calls + transformations
Memory — conversation history management
Retrievers — fetch relevant docs from vector stores
Agents — LLMs that decide which tools to call
Tools — functions the agent can invoke (search, code, APIs)
© 2025 GenAI Course Page 29
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
from langchain_openai import ChatOpenAI
from [Link] import ChatPromptTemplate
from [Link].output_parser import StrOutputParser
# Simple chain: prompt | LLM | parse
model = ChatOpenAI(model='gpt-4o-mini')
prompt = ChatPromptTemplate.from_template(
'Summarize the following text in 3 bullet points:\n{text}'
chain = prompt | model | StrOutputParser()
result = [Link]({'text': my_article})
7.5 OpenAI API Quick Reference
from openai import OpenAI
client = OpenAI() # Uses OPENAI_API_KEY env var
# Chat completion
response = [Link](
model='gpt-4o',
messages=[
{'role': 'system', 'content': 'You are a helpful assistant.'},
{'role': 'user', 'content': 'Explain quantum entanglement simply.'}
],
temperature=0.7, # 0=deterministic, 2=creative
max_tokens=500
print([Link][0].[Link])
# Embeddings
emb = [Link](input='Hello world', model='text-embedding-3-small')
vector = [Link][0].embedding # 1536-dim float list
# Image generation (DALL-E 3)
img = [Link](
model='dall-e-3',
prompt='A futuristic city at sunset, digital art',
size='1024x1024'
■ HANDS-ON EXERCISES — MODULE 7
© 2025 GenAI Course Page 30
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Exercise 13: Multi-Model Comparison CLI [ Intermediate ]
1. Build a Python CLI that sends the same prompt to 3 different models.
(e.g., GPT-4o-mini, Mistral-7B via HuggingFace, LLaMA via Groq API)
2. Display responses side-by-side with latency and token counts.
3. Add a flag to save results to a JSON file for later analysis.
Tools: Python, openai, transformers, rich (CLI formatting)
■ Exercise 14: LangChain Document Q&A Bot [ Intermediate ]
1. Load a PDF or set of web pages with LangChain document loaders.
2. Chunk text, embed with OpenAI or sentence-transformers.
3. Store in ChromaDB; implement retrieval chain with memory.
4. Build a CLI chatbot that answers questions about the documents.
Tools: Python, langchain, chromadb, openai
■ FREE RESOURCES
PyTorch Official Tutorials: [Link]/tutorials
HuggingFace Documentation: [Link]/docs/transformers
LangChain Documentation: [Link]
OpenAI API Reference: [Link]/docs/api-reference
Full Stack Deep Learning 2022: [Link]/course/2022 (free)
© 2025 GenAI Course Page 31
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 08
Real-World Applications & Use Cases
Putting GenAI to work across industries
8.1 The GenAI Application Landscape
Generative AI is transforming every industry. Here is a taxonomy of the most impactful application categories:
• ■ Conversational AI: Chatbots, virtual assistants, customer support automation, internal knowledge
bases.
• ✍■ Content Generation: Marketing copy, blog posts, product descriptions, email drafting, social media.
• ■■ Image & Video: Product photography, UI mockups, video ads, avatar generation, design iteration.
• ■ Code Intelligence: Code completion (GitHub Copilot), code review, test generation, documentation.
• ■ Information Retrieval: Semantic search, RAG-powered Q&A;, document summarization, contract
analysis.
• ■ Audio & Music: Text-to-speech, voice cloning, music composition, audio restoration.
• ■ Science & Research: Drug discovery (AlphaFold), protein design, literature review, hypothesis
generation.
• ■ Healthcare: Medical imaging analysis, clinical note generation, patient Q&A;, drug repurposing.
• ■ Data & Analytics: Natural language to SQL, automated reporting, anomaly explanation, forecasting.
• ■ Education: Personalized tutoring, content generation, automated grading, accessibility tools.
8.2 RAG (Retrieval-Augmented Generation)
RAG is the dominant architecture for building production LLM applications that need to work with private or
frequently updated data. Rather than fine-tuning, you retrieve relevant documents at query time and include
them in the prompt as context.
© 2025 GenAI Course Page 32
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ RAG Architecture
INDEXING PHASE (done once):
[Documents] → [Chunking] → [Embedding] → [Vector DB]
QUERY PHASE (per user query):
[User Query]
[Embed Query] → [Vector DB Search] → [Top-K Chunks]
■ ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
[Augmented Prompt: System + Context Chunks + User Query]
[LLM] → [Grounded Answer]
Figure 8.1 — RAG enables LLMs to answer questions from private knowledge bases without retraining
Advanced RAG Techniques
• HyDE (Hypothetical Document Embeddings): Generate a hypothetical answer first, embed it, then
search — improves retrieval for complex questions.
• Re-ranking: Use a cross-encoder to re-score retrieved chunks for precise relevance before sending to
LLM.
• Contextual Compression: Extract only the relevant parts of retrieved chunks to fit more context in the
prompt.
• Multi-Query Retrieval: Generate multiple query variants to increase recall from the vector store.
• Hybrid Search: Combine dense (embedding) search with sparse (BM25/keyword) search for better
coverage.
8.3 AI Agents & Tool Use
AI agents extend LLMs with the ability to take actions — calling APIs, executing code, browsing the web, or
interacting with databases. The agent uses the LLM as its reasoning engine and decides which tools to call
based on the task.
© 2025 GenAI Course Page 33
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ ReAct Agent Loop
User Query
[LLM Reasoning: What do I need to do next?]
■■■■ Call Tool (web_search, run_code, query_db, ...)
■ ■
■ [Tool Returns Result]
■ ■
■■■■■■■■■■■■■■■■ [LLM: Incorporate result, continue reasoning]
[Final Answer to User]
8.4 Multimodal AI Applications
Modern GenAI isn't limited to text. Multimodal models can understand and generate across text, images,
audio, and video simultaneously — unlocking entirely new application categories.
• Visual Q&A;: Upload an image and ask questions about it — useful for document processing,
accessibility, e-commerce.
• Image-to-Code: Convert UI screenshots or mockups directly to HTML/CSS/React code (e.g., GPT-4V,
Claude 3).
• Video Understanding: Analyze video content for summarization, moderation, sports analytics, or
security.
• Audio Transcription + LLM: Whisper transcribes speech → LLM summarizes, extracts actions, or
translates.
• Document Intelligence: Extract structured data from PDFs, invoices, forms using vision + LLM.
■ HANDS-ON EXERCISES — MODULE 8
■ Exercise 15: Build a RAG-Powered Chatbot [ Advanced ]
1. Ingest a set of 10+ PDF documents (e.g., research papers, manuals).
2. Chunk, embed, and store in a vector database.
3. Build a conversational chain with memory using LangChain.
4. Add source citation — show which document each answer came from.
5. Evaluate answer quality using RAGAS framework.
Tools: Python, LangChain, ChromaDB, OpenAI, RAGAS
© 2025 GenAI Course Page 34
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Exercise 16: AI Agent with Tools [ Advanced ]
1. Define 3 tools: web_search, calculator, weather_api.
2. Use LangChain's create_openai_tools_agent or ReAct agent.
3. Test with queries requiring tool chaining (e.g., 'What is the population
of the capital of France divided by the current EUR/USD rate?')
4. Log the agent's reasoning trace and tool call sequence.
Tools: Python, LangChain, OpenAI function calling, Tavily search API
■ FREE RESOURCES
Building LLM Applications (LlamaIndex): [Link] (comprehensive RAG guide)
RAGAS — Evaluation Framework for RAG: [Link]/explodinggradients/ragas
OpenAI Function Calling Guide: [Link]/docs/guides/function-calling
AI Engineer Foundation Course (free): [Link]
Towards Data Science — GenAI articles: [Link]
© 2025 GenAI Course Page 35
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 09
Deployment & MLOps
Taking AI models from notebook to production
9.1 The Deployment Challenge
Getting a model to work in a Jupyter notebook is only 10% of the job. Deploying it reliably, scalably, and
safely in production is the hard part. MLOps (Machine Learning Operations) is the discipline that bridges
model development and production systems.
■ MLOps Lifecycle
Data Collection → Data Validation → Feature Engineering
↓ ↓
Model Training ←■■■ Experiment Tracking ■■→ Model Registry
Model Evaluation → A/B Testing → Canary Deployment
Production Serving → Monitoring → Alerting → Retraining
9.2 Serving Models with FastAPI
FastAPI is the most popular Python framework for serving ML models. It's fast, async-capable,
auto-generates API docs, and integrates perfectly with Pydantic.
© 2025 GenAI Course Page 36
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
from fastapi import FastAPI
from pydantic import BaseModel
from transformers import pipeline
app = FastAPI(title='GenAI API')
# Load model at startup (not per request!)
@app.on_event('startup')
async def load_model():
[Link] = pipeline('text-generation', model='gpt2')
class GenerateRequest(BaseModel):
prompt: str
max_length: int = 200
class GenerateResponse(BaseModel):
generated_text: str
model: str = 'gpt2'
@[Link]('/generate', response_model=GenerateResponse)
async def generate(request: GenerateRequest):
result = [Link]([Link], max_length=request.max_length)
return GenerateResponse(generated_text=result[0]['generated_text'])
# Run: uvicorn main:app --reload
# Docs: [Link]
9.3 Containerization with Docker
Docker packages your application and all its dependencies into a portable container that runs identically on
any machine — eliminating 'it works on my machine' problems.
© 2025 GenAI Course Page 37
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
# Dockerfile for a GenAI API
FROM python:3.11-slim
WORKDIR /app
# Install dependencies
COPY [Link] .
RUN pip install --no-cache-dir -r [Link]
# Copy application code
COPY . .
# Expose port
EXPOSE 8000
# Run the API
CMD ['uvicorn', 'main:app', '--host', '[Link]', '--port', '8000']
# Build & run:
# docker build -t genai-api .
# docker run -p 8000:8000 genai-api
9.4 Cloud Deployment Options
Platform Best For Key Services
AWS Enterprise, full control SageMaker, Lambda, ECR, Bedrock
Google Cloud ML research, BigQuery users Vertex AI, Cloud Run, GKE
Azure Microsoft/enterprise shops Azure ML, OpenAI Service, AKS
HuggingFace Spaces Quick demos, free tier Gradio/Streamlit apps, free GPU
Modal Serverless GPU inference [Link] — pay-per-use, simple
Replicate Model API marketplace [Link] — run any model via API
Railway/Render Simple web app hosting Deploy FastAPI in minutes, free tier
9.5 Model Monitoring & Observability
Production GenAI applications require continuous monitoring to detect issues before users do.
• Latency (P50/P95/P99): Track response time percentiles; set alerts for SLA breaches.
• Token Usage & Cost: Monitor tokens consumed per request to control API costs.
• Hallucination Rate: Evaluate factual accuracy periodically using a judge LLM.
• User Feedback: Collect explicit thumbs up/down signals; analyze negative feedback patterns.
• Toxicity & Safety: Run outputs through safety classifiers to detect harmful content.
• Data Drift: Monitor distribution shifts in user inputs that may degrade performance.
• Retrieval Quality (for RAG): Track retrieval precision and answer faithfulness scores.
© 2025 GenAI Course Page 38
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Recommended Monitoring Stack
LangSmith (LangChain tracing) + Weights & Biases (experiment tracking) + Prometheus/Grafana
(infrastructure metrics) + Sentry (error tracking) covers most production needs.
9.6 Optimization for Production
• Quantization: Reduce model precision (FP16, INT8, INT4) — up to 4× smaller and faster with minimal
quality loss.
• Model Distillation: Train a small 'student' model to mimic a large 'teacher' model — deploy at lower cost.
• Caching: Cache embeddings and LLM responses for identical or similar queries (semantic caching with
GPTCache).
• Batching: Process multiple requests together to maximize GPU throughput.
• Streaming: Stream tokens as they generate instead of waiting for full response — dramatically improves
perceived latency.
• vLLM / TGI: Optimized inference engines (vLLM, Text Generation Inference) for 10–50× throughput vs
naive serving.
■ HANDS-ON EXERCISES — MODULE 9
■ Exercise 17: Deploy a GenAI API [ Advanced ]
1. Package your Module 8 RAG chatbot as a FastAPI application.
2. Write a Dockerfile and build the container locally.
3. Deploy to HuggingFace Spaces or Railway (free tier).
4. Test the live API with curl and a simple Gradio frontend.
5. Add basic logging to track query latency and token usage.
Tools: Python, FastAPI, Docker, HuggingFace Spaces / Railway
■ FREE RESOURCES
Full Stack LLM Bootcamp (free): [Link]/llm-bootcamp
MLOps Zoomcamp ([Link]): [Link]/DataTalksClub/mlops-zoomcamp (free)
LangSmith Tracing & Observability: [Link] (free tier available)
vLLM — Fast LLM Inference: [Link]/vllm-project/vllm
HuggingFace Spaces Docs: [Link]/docs/hub/spaces
© 2025 GenAI Course Page 39
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
MODULE 10
Capstone Project
Build a full-stack AI-powered knowledge assistant
10.1 Project Overview
Congratulations on reaching the capstone! In this project, you will build a production-ready AI Knowledge
Assistant that integrates everything you have learned. The system will answer questions from a custom
document collection, maintain conversation history, cite its sources, and be deployed as a live web
application.
■ Capstone: AI Knowledge Assistant [ Advanced ]
Domain: Choose your own (company docs, research papers, legal text, etc.)
Features: Multi-turn chat, source citation, streaming, web UI
Stack: FastAPI + LangChain + ChromaDB + Streamlit + Docker
Deployment: HuggingFace Spaces or any cloud platform
Tools: Python, FastAPI, LangChain, ChromaDB, Streamlit, Docker
10.2 System Architecture
© 2025 GenAI Course Page 40
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Capstone Architecture Diagram
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■ FRONTEND (Streamlit) ■
■ Chat UI ■ File Upload ■ Source Display ■ Chat History ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■ HTTP (REST)
■■■■■■■■■■■■■■■■■■■■■■■■■▼■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■ BACKEND (FastAPI) ■
■ /ingest ■ /chat ■ /history ■ /clear ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■■■■■■■▼■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■
■ RAG CHAIN (LangChain) ■
■ Retriever → ContextualCompression → ConversationalRAG ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■ ■
■■■■■■■▼■■■■■■■■■■■ ■■■■■■■■■■■▼■■■■■■■■■■■■■■■
■ Vector DB ■ ■ LLM (OpenAI / Local) ■
■ (ChromaDB) ■ ■ GPT-4o-mini / Mistral ■
■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■
Figure 10.1 — Full-stack production architecture of the capstone project
10.3 Implementation Steps
■ PHASE 1: DATA PIPELINE
■ Step 1 — Document Collection
Gather 20–50 documents in your chosen domain. PDFs, web pages, or markdown files all work. Use
LangChain's UnstructuredPDFLoader, WebBaseLoader, or TextLoader.
■ Step 2 — Chunking Strategy
Use RecursiveCharacterTextSplitter with chunk_size=800, chunk_overlap=150. Add metadata: source file,
page number, section heading.
© 2025 GenAI Course Page 41
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ Step 3 — Embedding & Indexing
Embed chunks with 'text-embedding-3-small' (OpenAI) or 'all-MiniLM-L6-v2' (free, local). Persist to
ChromaDB with persist_directory='./db'.
■ PHASE 2: RAG BACKEND
■ Step 4 — Retrieval Chain
Build a ConversationalRetrievalChain with a ContextualCompressionRetriever. Enable
return_source_documents=True so you can display citations.
■ Step 5 — FastAPI Server
Expose /ingest (upload + index documents), /chat (query with history), /history (get conversation), /clear
(reset session). Use background tasks for indexing.
■ Step 6 — Conversation Memory
Use LangChain's ConversationBufferWindowMemory with k=5 to maintain recent context while staying
within the context window limit.
■ PHASE 3: FRONTEND & DEPLOYMENT
■ Step 7 — Streamlit UI
Build a chat interface with st.chat_message, file uploader for documents, expandable source citations, and a
session history sidebar.
■ Step 8 — Streaming Responses
Implement token streaming with LangChain callbacks + Streamlit's st.write_stream to display responses as
they generate — dramatically improves UX.
■ Step 9 — Dockerize
Write a [Link] with backend and frontend services. Use .env for API keys and volume mounts
for the ChromaDB persistence directory.
■ Step 10 — Deploy & Monitor
Deploy to HuggingFace Spaces (free) or Railway. Add LangSmith tracing for observability. Implement basic
analytics: query count, average latency, user ratings.
© 2025 GenAI Course Page 42
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
10.4 Evaluation Criteria
Criterion Weight How to Measure
Answer Accuracy 30% RAGAS faithfulness + answer relevancy scores
Retrieval Quality 20% RAGAS context precision + recall on 20 test queries
Code Quality 15% Modular structure, type hints, docstrings, tests
UI/UX 15% Ease of use, citation display, streaming, file upload
Deployment 10% Live URL, Docker working, README with setup steps
Documentation 10% Architecture diagram, API docs, design decisions
10.5 Portfolio & Career Tips
A strong portfolio is your most powerful tool for landing a GenAI role. Here is how to maximize the impact of
your capstone and coursework projects:
• GitHub: Create a clean, well-documented repository. Write a compelling README with an architecture
diagram, demo GIF, and setup instructions.
• Live Demo: Deploy on a free tier and include the URL everywhere — recruiters want to click, not read.
• Write About It: Publish a Medium or Substack post explaining what you built, the challenges, and the
design decisions.
• LinkedIn: Post a demo video (60 seconds) with key takeaways. GenAI content gets enormous
engagement.
• Quantify Impact: 'Reduced document search time from 15 minutes to 10 seconds' beats 'built a RAG
chatbot'.
• Stack Variance: Showcase different tools across projects (LangChain, LlamaIndex, raw PyTorch) to
demonstrate breadth.
• Contribute to Open Source: Even small PRs to HuggingFace, LangChain, or popular AI repos build
credibility.
10.6 GenAI Career Paths
Role Focus Key Skills
ML Engineer Build & deploy models PyTorch, MLOps, cloud, system design
AI/LLM Engineer LLM apps & integrations LangChain, RAG, APIs, prompt engineering
Prompt Engineer Optimize AI outputs Prompting, evaluation, domain expertise
ML Researcher Advance the field Math, paper reading/writing, PhD often needed
AI Product Manager Shape AI products Technical understanding + product skills
Data Scientist (AI) Analytics + ML Statistics, Python, ML, communication
MLOps Engineer Production ML systems DevOps, Kubernetes, monitoring, CI/CD
© 2025 GenAI Course Page 43
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ FREE RESOURCES
GitHub — Awesome Generative AI (curated list): [Link]/steven-tey/novel
AI Jobs — Job board for AI roles: [Link] | [Link]/jobs
Papers With Code — Latest SOTA: [Link]
RAGAS Evaluation Framework: [Link]/explodinggradients/ragas
Gradio / Streamlit — Quick UI demos: [Link] | [Link]
© 2025 GenAI Course Page 44
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
APPENDIX
A. Complete Learning Roadmap
■ Suggested Study Schedule (6 months to job-ready)
MONTHS 1-2: FOUNDATIONS
Week 1-2: Module 1 (AI/ML fundamentals) + Python refresher
Week 3-4: Module 2 (Deep Learning) + NumPy/PyTorch basics
Week 5-6: Module 3 (Transformers) + HuggingFace tutorials
Week 7-8: Module 4 (GANs/VAEs/Diffusion) + image experiments
MONTHS 3-4: APPLICATION SKILLS
Week 9-10: Module 5 (Prompt Engineering) + API integration
Week 11-12: Module 6 (Fine-tuning) + QLoRA experiment
Week 13-14: Module 7 (Tools) + build 3 small projects
Week 15-16: Module 8 (Applications) + RAG chatbot
MONTHS 5-6: PROFESSIONAL LEVEL
Week 17-18: Module 9 (Deployment) + Docker + cloud deploy
Week 19-22: Module 10 (Capstone) — full project build
Week 23-24: Polish portfolio, apply for jobs, network
B. Essential Math for GenAI
• Linear Algebra: Vectors, matrices, dot products, eigenvalues — the language of neural networks.
• Calculus: Derivatives, chain rule, gradients — needed to understand backpropagation.
• Probability & Statistics: Distributions, Bayes' theorem, expectation — essential for generative models.
• Information Theory: Entropy, cross-entropy, KL divergence — the foundations of loss functions.
■ Best Math Resources
3Blue1Brown Essence of Linear Algebra (YouTube) • Khan Academy Calculus • Mathematics for Machine
Learning (free PDF at [Link])
C. Must-Read Papers
• Attention Is All You Need (2017): The original Transformer paper — foundational reading.
• BERT (2018): Bidirectional encoder; introduced masked language modeling.
• GPT-3 (2020): Showed that scale alone unlocks emergent few-shot capabilities.
• DALL-E / CLIP (2021): Aligned text and images in a shared embedding space.
• InstructGPT (2022): Introduced RLHF for aligning LLMs with human preferences.
© 2025 GenAI Course Page 45
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
• LLaMA (2023): Open-source competitive LLM; democratized LLM research.
• QLoRA (2023): Enabled fine-tuning of 65B models on a single consumer GPU.
• Mamba (2024): State-space model alternative to Transformers — potentially more efficient.
D. Glossary of Key Terms
Term Definition
Autoregressive Model generates output one token at a time, each conditioned on previous tokens.
Context Window Maximum number of tokens an LLM can process in one forward pass.
Embedding Dense vector representation capturing semantic meaning of text/image/audio.
Fine-tuning Further training a pre-trained model on a domain-specific dataset.
Foundation Model Large pre-trained model that can be adapted to many downstream tasks.
Hallucination When an LLM confidently generates factually incorrect information.
Inference Running a trained model on new inputs to generate predictions.
Latent Space Compressed internal representation learned by a neural network.
LoRA Low-Rank Adaptation — efficient fine-tuning by injecting small trainable matrices.
Multimodal Model that processes/generates multiple data types (text, image, audio).
Parameter A single learnable weight in a neural network.
Perplexity Measure of how well a language model predicts a text; lower = better.
Reinforcement Learning from Human Feedback — aligns LLMs with human
RLHF
preferences.
Temperature Controls randomness in LLM outputs; 0=deterministic, >1=creative.
Token Smallest unit of text processed by an LLM (roughly 4 characters).
Transformer Attention-based neural network architecture underlying most modern LLMs.
Vector Database Specialized database for storing and querying embedding vectors at scale.
Zero-Shot Model performs a task with no task-specific examples in the prompt.
E. Master Resource List
© 2025 GenAI Course Page 46
GENERATIVE AI: ZERO TO JOB-READY Complete Course Guide
■ FREE RESOURCES
■■ COURSES ■■
[Link] Practical Deep Learning: [Link]/course
[Link] Specializations (Coursera): [Link] (audit free)
HuggingFace NLP Course: [Link]/learn/nlp-course
Full Stack LLM Bootcamp: [Link]
Andrej Karpathy Neural Networks from Zero to Hero: [Link]/@karpathy
■■ BOOKS (FREE) ■■
Dive into Deep Learning: [Link]
Neural Networks & Deep Learning: [Link]
Mathematics for Machine Learning: [Link]
Probabilistic Machine Learning (Murphy): [Link]
■■ TOOLS & PLATFORMS ■■
HuggingFace Hub (models, datasets): [Link]
Kaggle (competitions, datasets, free GPU): [Link]
Google Colab (free GPU notebooks): [Link]
Weights & Biases (experiment tracking): [Link]
Replicate (deploy/run models): [Link]
■■ COMMUNITIES ■■
r/MachineLearning | r/LocalLLaMA | Hugging Face Discord
Papers With Code: [Link]
The Batch (newsletter): [Link]/the-batch
© 2025 GenAI Course Page 47