Unit 1: Foundations of Generative AI - Subjective Questions
CSG202 — Generative Ai Fundamentals • Practice Questions with Detailed Answers
20 questions
Define Generative AI. How does it fundamentally differ from traditional (discriminative) AI systems?
Generative AI refers to a class of artificial intelligence systems capable of creating new, original content such as text, images, audio, video, and code, rather than merely analyzing or classifying existing data.
Key Definition:
- Generative AI learns the underlying patterns and distribution of training data and then uses this understanding to produce novel outputs that resemble the training data but are not exact copies.
Difference from Traditional (Discriminative) AI:
| Aspect | Generative AI | Discriminative AI |
|---|---|---|
| Goal | Generates new data | Classifies or predicts labels |
| Learns | Joint probability | Conditional probability |
| Output | New content (text, image, etc.) | Categories, labels, scores |
| Example | ChatGPT, DALL-E | Spam filter, image classifier |
Summary: While discriminative models answer "What is this?", generative models answer "Can I create something like this?"
Explain how Generative AI works, describing the key stages from training to content generation.
Generative AI works through a series of stages that enable it to learn from data and produce new content:
1. Data Collection & Preprocessing
- Massive datasets (text, images, etc.) are gathered and cleaned.
- Data is converted into numerical representations (tokens or embeddings).
2. Model Training
- The model learns the statistical patterns and distribution of the data.
- It minimizes a loss function to improve predictions, e.g., predicting the next token: .
3. Learning Representations
- The model captures relationships and features in a high-dimensional latent space.
4. Content Generation (Inference)
- Given a prompt or seed input, the model samples from the learned distribution to generate new output.
- Techniques like sampling, temperature control, and beam search influence output diversity.
5. Fine-tuning & Alignment
- Models are refined using techniques like RLHF (Reinforcement Learning from Human Feedback) to align outputs with human preferences.
Summary: The core idea is to learn a probability distribution over data and then sample from it to create realistic, novel content.
Describe the major types of Generative AI models with examples of each.
There are several major categories of generative AI models:
1. Generative Adversarial Networks (GANs)
- Consist of a Generator and a Discriminator competing against each other.
- Example: StyleGAN for realistic face generation.
2. Variational Autoencoders (VAEs)
- Encode data into a latent space and decode to reconstruct/generate data.
- Example: Image generation and denoising.
3. Transformer-based Models
- Use self-attention mechanisms to process sequences.
- Example: GPT (text), BERT (understanding).
4. Diffusion Models
- Gradually add noise to data, then learn to reverse the process to generate content.
- Example: Stable Diffusion, DALL-E 2.
5. Autoregressive Models
- Generate output one element at a time, conditioning on previous elements.
- Example: PixelRNN, GPT series.
Summary: Each model type has strengths — GANs excel at sharp images, diffusion models offer high quality and diversity, and transformers dominate text generation.
Describe at least five real-world applications of Generative AI across different domains.
Generative AI has transformed numerous industries. Key applications include:
1. Content Creation
- Writing articles, marketing copy, and creative fiction (e.g., ChatGPT, Jasper).
2. Image & Art Generation
- Creating artwork, designs, and photorealistic images (e.g., DALL-E, Midjourney).
3. Healthcare
- Drug discovery by generating novel molecular structures.
- Generating synthetic medical images for training.
4. Software Development
- Code generation and auto-completion (e.g., GitHub Copilot).
5. Entertainment & Media
- Music composition, video generation, and game asset creation.
6. Customer Service
- Intelligent chatbots and virtual assistants.
7. Education
- Personalized tutoring and automated content generation.
Summary: Generative AI enhances productivity, creativity, and automation across virtually every sector.
Distinguish between Generative and Discriminative models with respect to their objectives and mathematical formulation.
Generative and Discriminative models differ fundamentally in what they learn and how they operate:
Generative Models:
- Learn the joint probability distribution .
- Can generate new data samples.
- Model how the data is generated.
- Examples: Naive Bayes, GANs, VAEs.
Discriminative Models:
- Learn the conditional probability directly.
- Focus on the decision boundary between classes.
- Cannot generate new data.
- Examples: Logistic Regression, SVM, Neural Network classifiers.
Mathematical Relationship:
Using Bayes' theorem, generative models can derive the conditional:
Key Distinction:
- Generative: "What does data of class Y look like?"
- Discriminative: "Given this data, which class does it belong to?"
Summary: Generative models are more versatile (can create data), while discriminative models are often more accurate at classification tasks.
Explain the architecture and working of Generative Adversarial Networks (GANs) in detail.
Generative Adversarial Networks (GANs), introduced by Ian Goodfellow in 2014, consist of two neural networks in competition:
Components:
1. Generator (G)
- Takes random noise as input and generates fake data .
- Goal: Fool the discriminator into thinking fake data is real.
2. Discriminator (D)
- Takes data as input and classifies it as real or fake.
- Goal: Correctly distinguish real from generated data.
Adversarial Training (Minimax Game):
The two networks play a min-max game with the value function:
Training Process:
- The Discriminator improves at detecting fakes.
- The Generator improves at producing realistic fakes.
- At equilibrium, the Generator produces data indistinguishable from real data.
Challenges:
- Mode collapse (limited output variety).
- Training instability.
Applications: Image synthesis, style transfer, super-resolution.
Summary: GANs use adversarial competition to progressively generate increasingly realistic content.
What are Large Language Models (LLMs)? Explain their role in Generative AI.
Large Language Models (LLMs) are deep learning models trained on vast amounts of text data to understand and generate human-like language.
Key Characteristics:
- Built primarily on the Transformer architecture.
- Contain billions of parameters (e.g., GPT-3 has 175 billion).
- Trained on diverse internet-scale text corpora.
How They Work:
- LLMs predict the next token in a sequence based on context:
- They use self-attention to weigh the importance of different words.
Role in Generative AI:
- Text Generation: Essays, stories, code.
- Conversation: Powering chatbots like ChatGPT.
- Translation & Summarization.
- Reasoning & Question Answering.
Capabilities:
- Few-shot / Zero-shot learning — performing tasks with little or no examples.
- In-context learning from prompts.
Examples: GPT-4, LLaMA, PaLM, Claude.
Summary: LLMs are the backbone of modern text-based generative AI, enabling versatile natural language capabilities.
Explain the working of Diffusion Models and why they have become popular for image generation.
Diffusion Models are generative models that create data by learning to reverse a gradual noising process.
Two-Phase Process:
1. Forward Diffusion (Noising)
- Gaussian noise is progressively added to training data over steps until it becomes pure noise.
- At step :
2. Reverse Diffusion (Denoising)
- The model learns to remove noise step-by-step, reconstructing data from noise.
- A neural network predicts and subtracts the noise at each step.
Why They Are Popular:
- High-Quality Output: Produce sharp, detailed, photorealistic images.
- Diversity: Avoid mode collapse issues seen in GANs.
- Stable Training: More stable than adversarial training.
- Controllability: Support text-to-image conditioning.
Examples: Stable Diffusion, DALL-E 2, Imagen, Midjourney.
Summary: Diffusion models generate content by learning to reverse noise, offering superior quality and diversity, making them the leading choice for image generation today.
Compare GANs, VAEs, and Diffusion Models in terms of their approach, strengths, and weaknesses.
A comparison of three prominent generative model families:
| Feature | GANs | VAEs | Diffusion Models |
|---|---|---|---|
| Approach | Adversarial (Generator vs Discriminator) | Encoder-Decoder with latent space | Iterative denoising |
| Output Quality | Sharp, realistic | Slightly blurry | Very high, detailed |
| Training Stability | Unstable (mode collapse) | Stable | Stable |
| Generation Speed | Fast | Fast | Slow (many steps) |
| Diversity | Limited | Good | Excellent |
GANs:
- Strengths: Sharp, realistic images; fast generation.
- Weaknesses: Training instability, mode collapse.
VAEs:
- Strengths: Stable, smooth latent space, good for interpolation.
- Weaknesses: Blurrier outputs.
Diffusion Models:
- Strengths: Best quality and diversity.
- Weaknesses: Slow sampling (computationally expensive).
Summary: Each model has trade-offs — GANs for speed, VAEs for smooth latent spaces, and diffusion models for the highest quality.
What is a Transformer architecture? Explain the role of the self-attention mechanism.
The Transformer is a neural network architecture introduced in the paper "Attention Is All You Need" (2017). It revolutionized generative AI, especially for sequence data.
Key Features:
- Relies entirely on attention mechanisms, eliminating recurrence (RNNs).
- Processes sequences in parallel, making training faster.
- Composed of Encoder and Decoder stacks.
Self-Attention Mechanism:
Self-attention allows the model to weigh the importance of different words in a sequence relative to each other.
Computation:
Using Query (), Key (), and Value () matrices:
Why It Matters:
- Captures long-range dependencies between words.
- Understands context (e.g., resolving pronouns).
- Enables parallel processing for efficiency.
Multi-Head Attention:
- Multiple attention heads capture different types of relationships simultaneously.
Summary: The Transformer's self-attention mechanism enables it to understand context and relationships across sequences, forming the foundation of modern LLMs.
Explain the concept of prompts and prompt engineering in Generative AI.
Prompts are the input instructions or queries given to a generative AI model to guide its output.
What is a Prompt?
- A prompt can be a question, instruction, or context that tells the model what to generate.
- Example: "Write a poem about the ocean."
Prompt Engineering:
The practice of designing and refining prompts to obtain the best possible outputs from a model.
Key Techniques:
1. Zero-shot prompting
- Asking the model to perform a task with no examples.
2. Few-shot prompting
- Providing a few examples to guide the model.
3. Chain-of-Thought (CoT) prompting
- Encouraging step-by-step reasoning for complex problems.
4. Role prompting
- Assigning a persona (e.g., "Act as a teacher").
Best Practices:
- Be clear and specific.
- Provide context and constraints.
- Use examples where helpful.
Summary: Effective prompt engineering is crucial for maximizing the quality, relevance, and accuracy of generative AI outputs.
Discuss the ethical concerns and challenges associated with Generative AI.
While powerful, Generative AI raises several ethical concerns:
1. Misinformation & Deepfakes
- Ability to create fake images, videos, and news that appear real.
2. Bias & Fairness
- Models can inherit and amplify biases present in training data.
3. Copyright & Intellectual Property
- Questions about ownership of AI-generated content and use of copyrighted training data.
4. Job Displacement
- Automation of creative and knowledge-based work.
5. Privacy
- Risk of models memorizing and leaking sensitive personal data.
6. Hallucinations
- Models generate plausible but false information.
7. Malicious Use
- Generating spam, phishing content, or harmful material.
Mitigation Strategies:
- Content watermarking and detection tools.
- Bias auditing and diverse training data.
- Human oversight and responsible AI guidelines.
- Regulation and transparency.
Summary: Responsible development, transparency, and regulation are essential to address the ethical challenges of Generative AI.
Explain what a Variational Autoencoder (VAE) is and how it generates new data.
A Variational Autoencoder (VAE) is a generative model that learns a probabilistic mapping of data into a latent space and can generate new samples from it.
Architecture:
1. Encoder
- Maps input data into a latent distribution defined by mean and variance .
2. Latent Space
- A compressed, continuous representation. Samples are drawn using the reparameterization trick:
3. Decoder
- Reconstructs data from the latent vector .
Loss Function:
VAEs optimize the Evidence Lower Bound (ELBO):
How It Generates Data:
- Sample a random point from the latent space.
- Pass it through the decoder to produce new data.
Advantages:
- Smooth, continuous latent space enabling interpolation.
- Stable training.
Summary: VAEs generate new data by learning a probabilistic latent representation and sampling from it, balancing reconstruction accuracy and latent regularization.
Describe the concept of tokens and embeddings in the context of text-based Generative AI.
Tokens and embeddings are fundamental to how text-based generative AI processes language.
Tokens:
- A token is the basic unit of text a model processes.
- Tokens can be words, subwords, or characters.
- Example: The word "unbelievable" might be split into "un", "believ", "able".
- Tokenization is the process of splitting text into tokens.
Embeddings:
- An embedding is a numerical vector representation of a token in a high-dimensional space.
- Similar words have vectors that are close together in this space.
- Example: The vectors for "king" and "queen" are related.
Vector Relationship Example:
Why They Matter:
- Computers cannot process raw text; embeddings convert words into numbers.
- Embeddings capture semantic meaning and relationships.
Summary: Tokens break text into manageable units, while embeddings convert them into meaningful numerical vectors that models can process and understand.
Explain the concept of Foundation Models and their significance in Generative AI.
Foundation Models are large-scale AI models trained on broad, diverse data that can be adapted to a wide range of downstream tasks.
Key Characteristics:
- Trained on massive, diverse datasets (text, images, etc.).
- Contain billions of parameters.
- Use self-supervised learning on unlabeled data.
- Serve as a base that can be fine-tuned for specific applications.
Examples:
- GPT-4 (text)
- CLIP (image-text)
- Stable Diffusion (image generation)
Significance:
1. Versatility
- A single model can handle multiple tasks (translation, summarization, Q&A).
2. Transfer Learning
- Knowledge learned during pre-training transfers to new tasks with minimal fine-tuning.
3. Cost Efficiency
- Reduces the need to train models from scratch for each task.
4. Emergent Abilities
- Large scale enables unexpected capabilities like reasoning.
Challenges:
- High computational cost, potential biases, and lack of transparency.
Summary: Foundation models provide a reusable, adaptable base for building diverse generative AI applications, driving efficiency and versatility.
What is fine-tuning in Generative AI? Explain its importance and different approaches.
Fine-tuning is the process of taking a pre-trained model and further training it on a specific, smaller dataset to specialize it for a particular task or domain.
Why It Is Important:
- Adapts general models to specialized needs (e.g., medical, legal).
- Improves accuracy and relevance for specific tasks.
- More efficient than training from scratch.
Approaches to Fine-tuning:
1. Full Fine-tuning
- Updates all model parameters. Expensive but thorough.
2. Parameter-Efficient Fine-tuning (PEFT)
- Updates only a small subset of parameters.
- Examples: LoRA (Low-Rank Adaptation), Adapters.
3. Instruction Tuning
- Training on instruction-response pairs to follow commands better.
4. RLHF (Reinforcement Learning from Human Feedback)
- Aligns model outputs with human preferences.
Alternatives to Fine-tuning:
- Prompt engineering and Retrieval-Augmented Generation (RAG).
Summary: Fine-tuning specializes general-purpose models for specific tasks, with modern efficient methods like LoRA reducing computational cost significantly.
Describe multimodal Generative AI and provide examples of its applications.
Multimodal Generative AI refers to models that can process and/or generate content across multiple types of data (modalities) such as text, images, audio, and video.
What Makes It Multimodal:
- Unlike single-modality models (text-only), these integrate different data types.
- They learn relationships between modalities (e.g., matching text descriptions to images).
Types of Multimodal Tasks:
1. Text-to-Image
- Generating images from text descriptions (e.g., DALL-E, Midjourney).
2. Image-to-Text
- Generating captions or descriptions from images.
3. Text-to-Video
- Creating videos from text prompts (e.g., Sora).
4. Text-to-Audio
- Generating speech or music from text.
Example Models:
- GPT-4V (vision + text)
- CLIP (connects images and text)
- Gemini (natively multimodal)
Applications:
- Visual question answering, content creation, accessibility tools, medical imaging analysis.
Summary: Multimodal AI bridges different data types, enabling richer, more versatile applications that mirror human-like understanding across senses.
Explain the concept of hallucination in Generative AI. Why does it occur and how can it be mitigated?
Hallucination in Generative AI refers to instances where a model generates information that is factually incorrect, fabricated, or nonsensical, yet presented confidently as true.
Examples:
- Inventing fake citations or references.
- Stating incorrect historical facts.
- Making up non-existent people or events.
Why It Occurs:
1. Probabilistic Nature
- Models predict the most likely next token, not verified facts.
2. Training Data Gaps
- Missing, outdated, or incorrect information in training data.
3. Lack of Grounding
- Models have no inherent connection to real-world truth.
4. Overgeneralization
- Models fill knowledge gaps with plausible-sounding content.
Mitigation Strategies:
- Retrieval-Augmented Generation (RAG): Ground responses in external, verified data.
- Fine-tuning on high-quality, factual data.
- Human verification and fact-checking.
- Prompt engineering to encourage caution.
- Confidence calibration and citing sources.
Summary: Hallucinations arise from the probabilistic and ungrounded nature of models; grounding techniques like RAG and human oversight are key to mitigation.
Discuss the impact of Generative AI on different industries with specific use cases.
Generative AI is transforming industries by automating creative and analytical tasks:
1. Healthcare
- Drug discovery: Generating novel molecular structures.
- Medical imaging: Creating synthetic data for training.
- Clinical documentation assistance.
2. Finance
- Fraud detection through synthetic data generation.
- Automated report generation and financial analysis.
3. Media & Entertainment
- Scriptwriting, music composition, and visual effects.
- Personalized content recommendations.
4. Education
- Personalized tutoring and adaptive learning content.
- Automated grading and content creation.
5. Software Development
- Code generation and debugging (GitHub Copilot).
- Documentation automation.
6. Marketing & Retail
- Ad copy generation, product descriptions, and personalized campaigns.
7. Manufacturing
- Generative design for optimized product parts.
Overall Impact:
- Increased productivity and reduced costs.
- Enhanced creativity and faster innovation.
- New challenges around job roles and ethics.
Summary: Generative AI acts as a catalyst across industries, boosting efficiency and creativity while reshaping traditional workflows.
Explain the difference between training and inference phases in Generative AI models.
The lifecycle of a generative AI model involves two distinct phases: training and inference.
Training Phase:
- The model learns patterns from a large dataset.
- Involves adjusting millions/billions of parameters (weights).
- Uses backpropagation and optimization to minimize a loss function:
where is the learning rate. - Computationally expensive and time-consuming (days/weeks).
- Done once (or periodically for updates).
Inference Phase:
- The trained model generates output for new inputs.
- Parameters are fixed (no learning occurs).
- Involves a forward pass through the network.
- Faster and less resource-intensive than training.
- Happens every time a user makes a request.
Comparison Table:
| Aspect | Training | Inference |
|---|---|---|
| Goal | Learn parameters | Generate output |
| Weights | Updated | Fixed |
| Cost | Very high | Lower |
| Frequency | Once/periodic | Every request |
Summary: Training teaches the model by adjusting parameters, while inference uses the frozen model to produce results for new inputs.
Define Generative AI. How does it fundamentally differ from traditional (discriminative) AI systems?
Generative AI refers to a class of artificial intelligence systems capable of creating new, original content such as text, images, audio, video, and code, rather than merely analyzing or classifying existing data.
Key Definition:
- Generative AI learns the underlying patterns and distribution of training data and then uses this understanding to produce novel outputs that resemble the training data but are not exact copies.
Difference from Traditional (Discriminative) AI:
| Aspect | Generative AI | Discriminative AI |
|---|---|---|
| Goal | Generates new data | Classifies or predicts labels |
| Learns | Joint probability | Conditional probability |
| Output | New content (text, image, etc.) | Categories, labels, scores |
| Example | ChatGPT, DALL-E | Spam filter, image classifier |
Summary: While discriminative models answer "What is this?", generative models answer "Can I create something like this?"
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →