GENAI-SEE
GENAI-SEE
● Dead Neurons: Neurons can "die" (output stays zero) if weights and biases
update negatively, causing them to never activate.
● Exploding Gradients: High learning rates can lead to large weight updates,
destabilizing training.
● Unbalanced Outputs: ReLU outputs are always non-negative, potentially
leading to issues with zero-centered outputs.
● Forward Pass:
○ Inputs are passed through the network to compute the output.
○ The loss (error) is calculated using a loss function.
● Backward Pass:
○ The error gradient is calculated for the output layer (using chain rule
of calculus).
○ Gradients are propagated backward through each layer.
● Weight Update:
○ Weights are adjusted using the gradient and a learning rate (small step
size for updates).
○ w_new = w_old - (lr) *
● Iterative Learning:
○ Process repeats over multiple iterations (epochs) until the model
minimizes the error effectively.
3. Explain RNN? Specify 3 specific use cases where they are effectively applied
and why they are suitable?
1. Text Generation:
○ Why: Captures context from earlier words in a sequence to predict the
next word, enabling text creation.
2. Speech Recognition:
○ Why: Processes sequential audio data, mapping input sounds to text
while considering temporal dependencies.
3. Time Series Forecasting:
○ Why: Learns patterns from past data (e.g., stock prices or weather) to
make future predictions, handling time-based dependencies
effectively.
4. Explain the architecture of AlexNet and what are its use cases in area of
computer vision and impact
Architecture of AlexNet:
1. Input Layer:
○ Takes 227x227 RGB images as input.
2. Convolutional Layers:
○ 5 Convolutional Layers with ReLU activation.
○ Extract features like edges, textures, and patterns.
3. Max-Pooling Layers:
○ 3 Max-Pooling Layers to reduce spatial dimensions
4. Fully Connected Layers:
○ 3 Fully Connected (FC) Layers, including the output layer
○ Uses ReLU and dropout to prevent overfitting.
5. Softmax Layer:
○ Provides probabilities for each class, enabling classification.
6. Key Innovations:
○ Introduced ReLU, dropout, and GPU acceleration, making it faster
and more effective than earlier models.
Use Cases in Computer Vision:
1. Image Classification:
○ Classifies objects in large datasets like ImageNet.
○ Foundation for many advanced image recognition tasks.
2. Object Detection:
○ Identifies specific objects within images.
3. Feature Extraction:
○ Pre-trained AlexNet is used to extract features for transfer learning in
custom tasks.
Impact:
● Activation Function:
Linear (Identity)
○ Why: Output is not restricted to a specific range, which is suitable for
continuous target values.
○ Formula: f(x)=x
○ Chart: A straight line passing through the origin with slope = 1.
2. Binary Classification:
3. Multi-Class Classification:
● Activation Function:
SoftMax
○ Why: Converts logits into normalized probabilities across multiple
classes, summing to 1.
○ Chart: For two classes, it resembles Sigmoid; for more classes,
represents probability distribution.
1. What it is:
○ Gradients become very small during backpropagation, slowing or
stopping the model from learning, especially in deep networks.
2. Why it happens:
○ Activations like sigmoid and tanh squash values into small ranges,
causing gradients to shrink as they propagate backward.
How It Is Addressed:
1. ReLU Activation:
○ ReLU allows gradients to flow better since its derivative is 1 for
positive values, avoiding the vanishing gradient issue.
2. Weight Initialization:
○ Proper initialization helps prevent small gradients from the start.
3. Gradient Clipping:
○ Limits gradients when they are too large (to prevent exploding
gradients), making training stable.
4. Batch Normalization:
○ Normalizes layer outputs to keep activations stable and gradients
flowing properly.
5. Skip Connections:
○ Residual Networks (ResNet) allow gradients to flow directly across
layers, preventing them from vanishing.
● Pooling layers reduce the dimensions (width and height) of the input while
preserving important features.
● Helps control overfitting by down-sampling the data and reducing
computation.
Types of Pooling:
● Max Pooling: Takes the maximum value from each region (filter) of the
input.
● Average Pooling: Takes the average value from each region of the input.
Process:
1. Reducing Dimensions:
○ Pooling reduces the spatial size (height and width) of the input,
helping to decrease the number of parameters and computation.
Impact on Model:
● Reduced Size: Less memory and computation needed for deeper layers.
● Feature Extraction: Helps extract high-level features by focusing on the
most important information within local regions.
10. A CNN layer with an 8x8 filter and 32 filters has 3 input channels.
Calculate the total parameters, including biases
( 8×8×3) × 32 + 32 = 6,176
11. Calculate the number of epochs needed to complete 5000 iterations if the
batch size is 50 and the dataset has 500 samples?
12. Calculate total number of updates required to train a model for 10 epochs,
with a dataset having 2000 samples, and a batch size of 100?
Unit 2
Key Features:
Example :
Prompt: "List three benefits of drinking water, explain how hydration impacts
mental focus, and suggest two tips to increase daily water intake."
3. How "Root Prompt" technique controls the output of LLMs, give one
example
The root prompt technique is a way to control what an AI model says by giving it
a clear and specific starting instruction. This "root" sets the tone, focus, and
purpose of the AI’s response, ensuring the answers stay relevant and useful.
How It Works:
1. Sets the Role: Tells the AI what role to take (e.g., teacher, chef, advisor).
2. Focuses the Topic: Keeps the response on a specific subject.
3. Guides the Style: Makes the AI’s tone or format match the request.
Example:
Root Prompt: "You are a helpful travel guide who gives short, budget-friendly tips
for travelers."
Controlled Output:
The AI will stick to travel tips, focus on budget-friendly activities, and provide
short, helpful answers.
By using a root prompt, you guide the AI to give exactly the kind of answer you
want.
Example
Initial Prompt:
"Explain photosynthesis."
Refined Prompt 1:
"Explain the process of photosynthesis in detail."
Refined Prompt 2:
"Explain the process of photosynthesis in detail, using simple language suitable for
middle school students."
● Iterative refinement ensures that the model's output evolves with your needs,
making it a dynamic and effective strategy in prompt engineering.
● Scalability
○ Efficient Training on Large Datasets: Diffusion models can handle
large datasets more effectively because they gradually refine images
from noise, reducing the need for adversarial training dynamics like in
GANs.
○ Parallelizable Inference: The denoising process can be parallelized,
allowing faster generation once trained.
○ Lower Computational Complexity in Latent Space: Latent
diffusion models (LDMs) operate in a compressed space, making
high-resolution image generation more computationally feasible.
● Diversity of Generated Data
○ High Output Variety: The stochastic noise-to-image process allows
diffusion models to explore a broader range of outputs, leading to
more diverse results.
○ Reduced Mode Collapse: Unlike GANs, which often produce limited
variations (mode collapse), diffusion models generate unique and
varied outputs across different runs.
○ Fine-Grained Control: By adjusting the noise and denoising steps,
users can control the style, content, and level of detail in the generated
images.
● Retriever
○ Purpose: Fetch relevant documents from a database.
○ Input: Query from the user.
○ Output: A ranked list of relevant documents or text passages.
● Generator
○ Purpose: Generate a response based on the retrieved documents and
the user query.
○ Input: Query concatenated with the retrieved documents.
○ Output: A final, coherent, and contextual response.
● Knowledge Base
○ Purpose: Serve as the source of information for retrieval.
○ Content: Structured (e.g., databases, knowledge graphs) or
unstructured data (e.g., text documents, articles, web pages).
○ Interaction: Directly queried by the retriever.
● Interaction Mechanism
○ Query Passing: User query is sent to the retriever.
○ Document Retrieval: Retriever fetches the most relevant knowledge
snippets from the knowledge base.
○ Response Generation: Generator incorporates the retrieved
documents to produce a grounded and enriched response.
Workflow in RAG
1. Bug Detection
○ Identifying and explaining code vulnerabilities.
○ Suggesting fixes for syntax or runtime errors in code snippets.
2. Code Refactoring
○ Optimizing code for better performance, readability, and
maintainability.
3. Coding
○ Autocompleting code
4. Testing
○ Generating unit tests based on given code snippets.
5. Documenting
○ Creating comprehensive documentation, including function
descriptions and usage examples.
6. Designing
○ Translating UML diagrams into code templates.
c. Computer Vision
1. Medical Imaging
○ Identifying tumors or abnormalities in X-rays and MRIs.
2. Autonomous Vehicles
○ Detecting pedestrians, traffic signs, and road conditions.
3. Surveillance Systems
○ Detecting suspicious activities in real-time for security purposes.
e. Data Analytics
f. Product Design
1. Prototype Design
2. Market Research: Analyzing consumer reviews to identify trends and
preferences.
4. Describe the fine-tuning process and how it is beneficial for domain-specific
tasks, provide two examples
Steps in Fine-Tuning
● Enhanced Accuracy
● Cost Efficiency
● Faster Adaptation
● Improved User Experience
Examples of Fine-Tuning
Guardrails are mechanisms designed to ensure that LLMs produce safe outputs,
minimizing harmful behavior.
1. Input Guardrails
● Purpose:
To filter and preprocess user inputs, preventing harmful queries or
exploitation of the model.
● Techniques:
○ Content Filtering: Block offensive, or sensitive input.
○ Rate Limiting: Restrict excessive queries to prevent spamming
2. Output Guardrails
● Purpose:
To monitor and filter model outputs to ensure safe, accurate, and
appropriate responses.
● Techniques:
○ Toxicity Detection: Use classifiers to detect and block harmful
language in responses.
○ Fact-Checking and Verification: Cross-check factual claims using
reliable external knowledge bases.
3. Ethical Guardrails
4. Behavioral Guardrails
● Purpose:
To maintain consistent and context-appropriate behavior in
interactions.
● Techniques:
○ Persona Control: Restrict the model to specific roles (e.g., customer
support, technical assistant).
○ Conversational Limits: Prevent the model from engaging in
philosophical debates or personal opinions.
○ Refusal Protocols: Program the model to decline answering
inappropriate or out-of-scope questions (e.g., “I cannot answer that.”).
6. Model-Level Guardrails
● Purpose:
To enhance accuracy and reduce hallucinations by grounding
outputs in reliable data.
● Techniques:
○ Retrieval-Augmented Generation (RAG): Use external databases or
APIs to provide factual context.
○ Dynamic Knowledge Updating: Continuously integrate up-to-date
information into the system.
● Purpose: To iteratively improve the model based on user input and detected
errors.
● Techniques:
○ Feedback Buttons: Allow users to flag inappropriate or incorrect
outputs.
○ Active Learning: Use flagged data to retrain and improve the model
over time.
● Regulations:
Compliance with data protection laws such as GDPR (EU),
CCPA (California), or HIPAA (USA for healthcare).
● Applications:
○ Avoid processing or storing personally identifiable information (PII)
without user consent.
○ Use anonymization and encryption techniques to safeguard sensitive
data.
○ Implement mechanisms for users to request data deletion or access
(right to be forgotten).
● Regulations:
Requirements under laws like GDPR (Article 22) mandate
explainability in automated decision-making.
● Applications:
○ Clearly disclose when users interact with an AI system.
○ Provide understandable explanations for decisions or outputs,
especially in critical domains (e.g., finance, healthcare).
○ Document and publish model training datasets, methodologies, and
limitations.
● Regulations:
Anti-discrimination laws such as the Civil Rights Act (USA) or
the Equality Act (UK).
● Applications:
○ Audit models for bias in training data and outputs to ensure fairness
across demographic groups.
○ Include diverse and representative data during training to mitigate
systemic bias.
○ Regularly monitor and address any discriminatory patterns in outputs.
● Regulations:
Copyright laws and protections (e.g., DMCA in the USA, Berne
Convention).
● Applications:
○ Avoid reproducing copyrighted text verbatim unless permitted (e.g.,
for fair use or public domain content).
○ Clearly distinguish AI-generated content from human-authored
content, especially in creative industries.
○ Obtain licenses for using proprietary datasets or APIs.
● Regulations:
Compliance with laws against spreading harmful or false
information (e.g., EU Digital Services Act).
● Applications:
○ Use fact-checking guardrails to prevent the generation of
misinformation.
○ Prohibit outputs that incite violence, hate speech, or other harmful
content.
○ Include disclaimers about the reliability of AI-generated responses in
critical domains.
● Regulations:
Laws governing product liability and consumer protection (e.g.,
Consumer Rights Act in the UK).
● Applications:
○ Define and document roles and responsibilities for AI system
providers and users.
○ Implement human-in-the-loop mechanisms for high-stakes
decision-making.
○ Ensure clear policies for recourse in case of harm or errors caused by
LLM outputs.
7. Safety Standards
● Regulations:
Adherence to AI-specific guidelines such as ISO/IEC 22989 (AI
concepts and terminology) or ISO/IEC 23053 (framework for AI
trustworthiness).
● Applications:
○ Validate LLM performance under safety-critical conditions (e.g.,
healthcare, aviation).
○ Include monitoring and fallback mechanisms to mitigate unexpected
behaviors.
● Regulations:
Accessibility laws like the Americans with Disabilities Act
(ADA) or the Web Content Accessibility Guidelines (WCAG).
● Applications:
○ Ensure AI interfaces and outputs are accessible to people with
disabilities.
○ Provide multilingual support to cater to diverse user bases.
3. What are the ethical considerations related to bias and fairness in AI and
evaluate their impact
AI systems, including LLMs, often reflect the biases present in their training data,
design, and deployment contexts. Addressing these biases is essential to ensure
fairness and equity in AI applications.
Key Ethical Considerations
1. Representation Bias
● Definition:
Lack of inclusivity in AI applications for different demographics
or abilities.
● Impact:
○ Exclusion of non-mainstream language speakers or people with
disabilities.
○ Barriers in accessing services or opportunities powered by AI.
5. Feedback Loop Bias
● Definition:
Bias compounded by repeated feedback reinforcing initial
decisions.
● Impact:
○ Self-perpetuating errors (e.g., biased recommendations worsening
over time).
○ Difficulty in identifying and correcting systemic flaws.
6. Ethical Bias
● Definition:
Bias resulting from value judgments embedded by developers or
stakeholders.
● Impact:
○ Outputs reflect the subjective perspectives of model creators.
○ Lack of cultural neutrality in global applications.
1. Societal Impact
● Accountability:
Unfair systems challenge the principle of justice and
accountability.
● Regulatory Non-Compliance: Violations of anti-discrimination laws (e.g.,
GDPR, Civil Rights Act).
● Regularly audit models for biases using fairness metrics and independent
evaluators.
3. Inclusive Design Practices
● Allow users to flag biased or unfair outputs to refine models over time.
4. Why data privacy and security in the context of LLMs are important and
assess their impact on model performance and ethical considerations
Large Language Models (LLMs) are often trained and deployed using vast
amounts of data, which may include sensitive or personal information. Ensuring
data privacy and security is critical for ethical, legal, and performance-related
reasons.
● Importance:
LLMs might unintentionally memorize or expose sensitive
information during training or generation.
● Examples: Leakage of personal details like names, addresses, or credit card
information in responses.
2. Compliance with Legal Regulations
● Importance:
Adherence to laws like GDPR (EU), CCPA (California), and
HIPAA (USA) is necessary to avoid legal repercussions.
● Examples: Non-compliance can lead to heavy fines, reputational damage, or
restricted operations in certain regions.
3. Preventing Data Misuse
● Importance:
Ensuring that data collected for model improvement is used
ethically and not shared or sold improperly.
● Examples: Misuse of training data for surveillance, profiling, or targeted
misinformation.
4. Building Trust with Users
● Importance:
Privacy guarantees foster trust in AI systems, encouraging user
adoption and engagement.
● Examples: Transparency in data handling practices reassures users that their
information is secure.
5. Avoiding Security Breaches
Positive Impacts
1. Improved Reliability:
Secure systems prevent malicious manipulation, ensuring
consistent performance.
2. Data Quality: Ethical handling of high-quality, anonymized data improves
training outcomes without risking privacy.
3. Regulatory Approval: Compliance facilitates deployment in sensitive
domains (e.g., healthcare, finance).
Challenges to Performance
Ethical Considerations
● Consideration:
Users must consent to data usage, and data ownership should
remain with the source.
● Ethical Failure: Using data without proper consent violates autonomy and
trust.
2. Minimization of Harm
● Consideration: Systems must avoid harm arising from data misuse or breaches.
● Ethical Failure: Exposing sensitive details can lead to identity theft or
discrimination.
3. Transparency and Accountability
1. Fairness
● Preventing Discrimination:
AI models are trained on historical data, which often
reflect societal biases. If not addressed, AI systems can perpetuate or even
exacerbate these biases, leading to unfair outcomes.
○ Example: A biased hiring algorithm may favor one gender, race, or
age group over others, which can lead to systemic discrimination in
hiring practices.
● Ensuring Equal Opportunity: Bias detection ensures that AI models treat
all individuals or groups equally, regardless of attributes such as gender,
race, or socio-economic status.
○ Example: Ensuring that credit scoring models do not unfairly
disadvantage specific racial or ethnic groups by training with data that
reflects past discriminatory practices.
2. Accuracy
● Scenario:
A recruitment platform uses an AI system to screen resumes. The
training data used to build the system is predominantly from
male-dominated industries, which leads the AI model to favor male
applicants over equally qualified female candidates.
● Bias Detection: Bias detection algorithms identify this gender bias by
analyzing the gender distribution in hiring decisions and comparing it to the
broader population. Metrics like demographic parity (whether applicants
from different genders are selected at equal rates) can highlight this bias.
● Solution: Bias mitigation techniques such as re-weighting training data or
adjusting the decision threshold can be applied to ensure equal opportunity
for all genders in hiring.
2. Discriminatory Facial Recognition
● Scenario:
A facial recognition system is deployed by a law enforcement
agency. The training data primarily consists of images of light-skinned
individuals, leading the model to perform less accurately on people with
darker skin tones, resulting in more false positives for non-white individuals.
● Bias Detection: Bias detection can identify the disproportionate error rates
between different racial groups by analyzing accuracy metrics (e.g., false
positive/negative rates) across different skin tones.
● Solution: The model can be retrained with more balanced, representative
data that includes diverse skin tones, and additional fairness checks can be
implemented to ensure equitable performance across racial groups.
1. Technical Measures
2. Monitoring Mechanisms
Conclusion