Artificial Intelligence

Working of Generative AI

Class 12 · Artificial Intelligence

7.2 Working of Generative AI

Generative AI works by using machine learning and deep learning techniques to learn patterns, structures and relationships from large datasets. After learning these patterns, the model can generate new content that resembles the data on which it was trained.

Key Concept:

Generative AI does not simply retrieve an existing piece of information. It learns patterns from training data and uses those learned patterns to generate new content such as text, images, audio and video.

How Does Generative AI Work?

The working of Generative AI can be understood as a sequence of learning and generation steps.

Step Process Explanation
1. Collect Data Training Dataset A large collection of existing data such as text, images, audio or video is used for training.
2. Learn Patterns Training The AI model analyses the training data and learns patterns, relationships and characteristics present in the data.
3. Build a Model Deep Learning Deep learning architectures are trained to represent the patterns learned from the training data.
4. Provide Input Prompt / Input The user provides an instruction, prompt or other form of input to the trained model.
5. Generate Content Generation The trained model uses its learned patterns to generate new content relevant to the given input.
6. Produce Output Generated Content The final output may be text, image, audio, video or another type of generated content.

Major Architectures Used in Generative AI

Two important neural network architectures used in Generative AI are Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs).

1. Generative Adversarial Networks (GANs)

A Generative Adversarial Network (GAN) consists of two neural networks that compete with each other during training. These networks are called the Generator and the Discriminator.

Network Role
Generator Creates new or synthetic data samples, such as images or other forms of content.
Discriminator Examines the generated samples and compares them with real data to determine whether they are authentic or generated.

Working of a GAN

  1. The Generator creates a synthetic sample.
  2. The Discriminator receives both real and generated samples.
  3. The Discriminator attempts to distinguish between real and generated data.
  4. The Generator learns from the feedback and improves its generated samples.
  5. This adversarial process continues until the Generator can produce increasingly realistic samples.
Remember:

Generator → Creates

Discriminator → Detects / Distinguishes

The competition between the two networks is called adversarial training.

Example of GAN

Suppose a GAN is trained using thousands of photographs of human faces. The Generator attempts to create new faces, while the Discriminator checks whether each face looks real or artificially generated.

Through repeated training, the Generator gradually learns to produce increasingly realistic-looking faces.

2. Variational Autoencoders (VAEs)

Variational Autoencoders (VAEs) are another architecture used for generative tasks. A VAE learns a compressed representation of the input data and uses this representation to generate new samples.

A VAE consists mainly of an Encoder and a Decoder.

Component Role
Encoder Processes the input data and converts it into a compressed representation.
Latent Space Represents the compressed representation of the actual data and captures important characteristics of the input.
Decoder Uses information from the latent space to reconstruct the original data or generate new samples.

Working of a VAE

  1. The Encoder receives the input data.
  2. The Encoder converts the input into a compressed representation called the latent space.
  3. The latent representation captures important patterns and characteristics of the input.
  4. The Decoder uses this representation to reconstruct the original data or generate a new sample.
Remember:

Encoder → Compresses / Encodes

Latent Space → Compressed Representation

Decoder → Reconstructs / Generates

GANs vs VAEs

Feature GAN VAE
Main Components Generator and Discriminator Encoder and Decoder
Learning Approach Adversarial training between two networks Learns a compressed latent representation
Important Concept Competition between Generator and Discriminator Latent space
Strength Excellent for producing visually realistic and high-quality outputs. Useful for structured data generation and interpretable latent representations.
School-Based Example

Imagine a school using Generative AI to create practice questions for students. The model can learn patterns from existing questions and generate new questions based on a specified topic, difficulty level or learning objective.

For example, a teacher could provide a prompt such as: "Generate five competency-based questions on Artificial Neural Networks for Class XII."

The Generative AI system processes the prompt and uses patterns learned during training to produce a new set of questions.

Key Terms

Term Meaning
Generative AI AI that learns patterns from existing data and generates new content.
GAN Generative Adversarial Network consisting of a Generator and a Discriminator.
Generator Creates synthetic data samples.
Discriminator Distinguishes between real and generated data.
VAE Variational Autoencoder that learns a compressed representation and generates new samples.
Encoder Converts input data into a compressed representation.
Latent Space Compressed representation of the actual data in a VAE.
Decoder Uses the latent representation to reconstruct or generate data.

Board Exam & SQP Questions

1. What are the two neural networks used in a GAN?

The two neural networks used in a Generative Adversarial Network are the Generator and the Discriminator.

2. What is the role of the Generator in a GAN?

The Generator creates new or synthetic data samples and attempts to make them indistinguishable from real data.

3. What is the role of the Discriminator in a GAN?

The Discriminator evaluates data samples and attempts to distinguish between real data and data generated by the Generator.

4. What is latent space in a VAE?

Latent space is the compressed representation of the actual data learned by a Variational Autoencoder.

5. What are the two main components of a VAE?

The two main components are the Encoder and the Decoder.

6. How does Generative AI work?

Generative AI learns patterns and relationships from large datasets using machine learning and deep learning techniques. After training, it uses the learned patterns to generate new content based on a given input or prompt.

Exam Tip:

Do not confuse the components of GANs and VAEs:

GAN → Generator + Discriminator

VAE → Encoder + Latent Space + Decoder

Quick Memory Map

Training Data → Learn Patterns → Trained Model → Prompt/Input → Generate New Content

GAN → Generator ↔ Discriminator

VAE → Encoder → Latent Space → Decoder