UNIT – 3
A GAN consists of two neural networks that compete with each other:
Generation of Images: Introduction to Generative Adversarial Networks
2. Working of GAN
Random Noise → Generator → Fake Image → Discriminator → Real/Fake
The process is:
ADVERSARIAL TRAINING PROCESS IN GENERATIVE AI
Adversarial training is a learning process in which two neural networks compete with each other to improve the quality of generated data. It is most commonly used in Generative Adversarial Networks (GANs).
Main Components
Generator (G)
Discriminator (D)
Training Process
Step 1: Generate Fake Data�Random noise is given to the Generator.
Step 2: Discriminator Evaluation�The Discriminator receives:
Step 3: Calculate Errors�The Discriminator learns to correctly distinguish real samples from generated samples.
Step 4: Update the Generator�The Generator is trained to produce increasingly realistic samples that can fool the Discriminator.
Step 5: Repeat the Competition�Generator and Discriminator are trained repeatedly in an adversarial manner.
Step 6: Convergence�Ideally, the Generator becomes capable of producing highly realistic data, while the Discriminator can no longer reliably distinguish fake data from real data.
NASH EQUILIBRIUM
Key Points:
Nash equilibrium vs Dominant strategy
Example of Nash equilibrium
In the given game, we have two players with strategies S1 and S2.
S1 being the optimal strategy considering both the players know each other’s approach or they are made aware of it and both will be moving their initial strategy. They will opt for it because they know deviating from it will not be in the interest of the match.
Hence in case they opt for S1, both will win. In other cases, deviating to S2 will result in defeat of one of them.
Variational Autoencoders
A Variational Autoencoder (VAE) is a Generative AI model that learns the hidden/latent representation of data and uses it to generate new, realistic samples similar to the training data.
1. Encoder (Understanding the Input)
The encoder takes input data like images or text and learns its key features. Instead of outputting one fixed value, it produces two vectors for each feature:
These two values define a range of possibilities instead of a single number.
2. Latent Space (Adding Some Randomness)
3. Decoder (Reconstructing or Creating New Data)
The decoder takes the random sample from the latent space and tries to reconstruct the original input. Since the encoder gives a range, the decoder can produce new data that is similar but not identical to what it has seen.
Encoder-Decoder Architectures
The encoder-decoder model is a neural network used for tasks where both input and output are sequences, often of different lengths. It is commonly applied in areas like translation, summarization and speech processing.
Encoder
The encoder processes the input sequence and converts it into a fixed representation (context vector) using an RNN or LSTM.
Decoder
The decoder uses the context vector from the encoder to generate the output sequence step by step.
Working of Encoder Decoder Model
The actual working of the encoder decoder model is shown in below diagram. Now we will understand it stepwise
Step 1: Tokenizing the Input Sentence
Step 2: Encoding the Input
Step 3: Passing the Context to the Decoder
Step 4: Decoder Generates Output Step-by-Step
Step 5: Attention Mechanism
Step 6: Producing the Final Output
Stable Diffusion is a latent diffusion-based Generative AI model used to generate images from text prompts. It creates an image by starting with random noise and gradually removing the noise until a meaningful image is produced.
Stable Diffusion Models