Gen AI Notes Part 1
Gen AI Notes Part 1
5. Comparison of Early Generative Models (e.g., Naive Bayes) with Modern Generative
Models (e.g., GANs, VAEs):
- Methodology:
- Naive Bayes:
- Assumptions: Assumes feature independence given the class label, simplifying the
computation of probabilities.
- Learning: Based on counting frequencies and applying Bayes' theorem for classification
tasks.
- Modern Generative Models (GANs, VAEs):
- GANs: Consist of two neural networks (generator and discriminator) competing in a
minimax game. The generator creates data, while the discriminator evaluates it, improving
the generator's ability to produce realistic data over time.
- VAEs: Use a probabilistic approach to learn latent representations, optimizing a
variational lower bound on the data likelihood. They incorporate an encoder-decoder
architecture with stochastic latent variables.
- Applications:
- Naive Bayes:
- Applications: Primarily used for classification tasks such as spam detection, document
classification, and sentiment analysis.
- Limitations: Simplistic assumptions about feature independence limit its ability to
model complex data distributions.
- Modern Generative Models (GANs, VAEs):
- Applications: Used for high-quality image and video generation, data augmentation,
anomaly detection, and complex generative tasks in natural language processing and
reinforcement learning.
- Advantages: Capable of modeling complex data distributions, generating high-
dimensional and realistic data, and learning rich latent representations.
- Challenges:
- Quality and Realism: Ensuring that synthetic data is of high quality and closely
resembles real data is challenging. Poorly generated data can lead to misleading model
training and degraded performance.
- Generalization: Synthetic data may not capture all the complexities and nuances of real-
world data, potentially limiting the model's ability to generalize to unseen real-world
scenarios.
- Biases in Generated Data: Generative models can inadvertently reproduce or amplify
biases present in the training data, leading to biased synthetic datasets and skewed model
outcomes.
- Transformers:
- Architecture: Based on self-attention mechanisms, allowing parallel processing of input
sequences with positional encoding to maintain order.
- Generative Capabilities: Highly effective for generating sequences with long-range
dependencies (e.g., text generation, machine translation), leveraging self-attention to capture
context across the entire sequence.
20. Analysis of Strengths and Weaknesses of RNNs, Transformers, VAEs, and GANs:
- Recurrent Neural Networks (RNNs):
- Strength:
- Sequence Handling: RNNs are designed to handle sequential data, making them
effective for tasks like text generation, time series prediction, and music composition. For
example, an RNN can generate coherent sentences by predicting one word at a time based on
the previous words.
- Weakness:
- Long-Range Dependencies: As mentioned, RNNs struggle with capturing long-range
dependencies, which limits their ability to generate long, coherent sequences. This issue can
be somewhat mitigated by using variants like LSTM (Long Short-Term Memory) or GRU
(Gated Recurrent Unit).
- Transformers:
- Strength:
- Attention Mechanism: Transformers excel at capturing long-range dependencies and
contextual relationships due to their self-attention mechanism, which allows them to process
entire sequences simultaneously. For instance, models like GPT-3 generate highly coherent
and contextually accurate text.
- Weakness:
- Computationally Intensive: Transformers require significant computational resources,
particularly for long sequences, due to their quadratic complexity with respect to the
sequence length.
23. Analysis of Strengths and Weaknesses of RNNs, Transformers, VAEs, and GANs:
- Transformers:
- Strength:
- Handling Long-Range Dependencies: Transformers excel at capturing long-range
dependencies and contextual relationships through their self-attention mechanism. This
allows them to consider all positions in the input sequence simultaneously, enabling better
handling of context.
- Example: The GPT-3 model, based on the Transformer architecture, can generate
highly coherent and contextually relevant text over long passages.
- Weakness:
- Computational Complexity: Transformers require significant computational resources,
especially for long sequences, due to the quadratic complexity of the self-attention
mechanism with respect to the sequence length. This can make them expensive to train and
deploy.
- Transformers:
- Architecture: Transformers use self-attention mechanisms to process entire sequences
simultaneously, allowing them to capture long-range dependencies and contextual
relationships effectively. They do not rely on sequential processing.
- Generative Text Tasks: Transformers generate text by attending to all positions in the
input sequence, making them highly effective for generating long, coherent passages of text.
- Strength: Excellent at capturing long-range dependencies and maintaining context over
long sequences. They also support parallel processing, making them faster to train on large
datasets.
- Weakness: Computationally intensive due to the quadratic complexity of the self-
attention mechanism with respect to sequence length.
- Example: Models like GPT-3 are used for generating essays, articles, and long-form text
with high coherence and contextual accuracy.
- Architecture:
- RNNs: Sequential processing with hidden states. Variants like LSTM and GRU improve
handling of long-range dependencies.
- Transformers: Self-attention mechanisms allow parallel processing of entire sequences,
capturing long-range dependencies effectively.
- VAEs: Encoder-decoder structure with a probabilistic latent space. The encoder maps
input data to a latent space, and the decoder reconstructs data from samples in this space.
- GANs: Composed of two neural networks (generator and discriminator) in an adversarial
setup. The generator creates data, and the discriminator evaluates its realism.
- Training Methods:
- RNNs: Trained using backpropagation through time (BPTT), which involves unrolling
the network through the sequence and applying gradient descent.
- Transformers: Trained using standard backpropagation, but with the addition of self-
attention mechanisms and positional encodings.
- VAEs: Trained by optimizing the Evidence Lower Bound (ELBO), balancing
reconstruction accuracy and regularization of the latent space.
- GANs: Trained through an adversarial process where the generator and discriminator
compete, with the generator trying to fool the discriminator and the discriminator trying to
correctly identify real versus fake data.