Generative Artificial Intelligence(Gen AI) – A beginners’ guide -Himanshu Kumar Nov 2024 Introduction to Artificial Intelligence • Generative AI is a subset of Deep Learning • Deep Learning is a subset of Machine Learning • Machine Learning is a subset of Artificial Intelligence •To gain a clear understanding of Generative AI, basic knowledge of AI, ML, and DL is essential Artificial Intelligence (AI) — From a Kid’s Perspective •AI enables computers to think as humans do •AI enables computers to understand, analyze data, and make decisions without constant human guidance AI Capabilities - Finding a Lost Dog To find your dog, the robot needs human-like intelligence. Following steps needs to be followed: •Identify your dog •Make a strategy to find your dog •Act according to the situation •Think and act like a human Real-world Examples of AI Applications •Virtual Assistants (Siri, Alexa) •Social Media Algorithms (Netflix, Facebook) •Online Shopping Recommendations •Predictive Text and Autocorrect •Healthcare Diagnostics •Language Translation Services •Fraud Detection in Banking AI vs. Human Intelligence Aspect Learning Style AI Humans Learns from data and examples. Crunches Learns by talking, experiencing, and thinking. Soaks up a variety of numbers and patterns. experiences and knowledge. Thinking Speed Fast and efficient on trained tasks. May take time but excels in complex thinking and creativity. Memory Skills Remembers facts and figures. Doesn’t retain emotions and memories. Retains events, emotions, and details. Memories are a mix of good and bad experiences. Feeling Emotions Does not feel emotions; sticks to rules and Experiences a range of emotions, shaping reactions and identity. patterns. Flexibility Factor Smart but rigid; struggles in new situations. Creating Cool Stuff Creates within set limits, like an artist with Masters of creativity; limitless in generating new ideas, art, and a specific canvas. solutions. Adapts to new situations and problem-solving; versatile. Understanding Knows learned info but might miss the Big Picture nuances and context. Understands jokes, feelings, and cultural nuances; a comprehensive understanding of situations. Decision Making Capabilities Uses a blend of logic, feelings, and what’s right to make decisions. Makes decisions based on training and rules. Types of AI - Based on Capability Types of AI — Based on Capability •Narrow AI (Weak AI) •AI Systems designed & trained for a specific task or narrow set of tasks •Eg. Computer playing chess, conversational robots, • email spam filters •General AI (Strong AI)/General AI •Can understand and learn any intellecutal task that a human being can •No such systems currently •Super AI •Represents a degree of intelligence where machines have the potential to exceed human intelligence •Still a hypothetical concept of AI Types of AI - Based on Functionality 1.Reactive Machines •AI systems that operate based on present data •No memory or past experiences • Do not have memory to use past mistakes to inform future decisions Example: Deep Blue (IBM’s chess-playing AI program) 2.Limited Memory •Uses short-term memory to learn from the past and make better decisions for the future Examples: Self-driving cars, recommendation systems (Netflix, Amazon) Introduction to Machine Learning Machine Learning is: • A subset of Artificial Intelligence. • Which enables machines (or computers) to learn from data and make decisions. • It’s already part of our daily lives, from recognizing songs to helping doctors analyze medical images • To put in simple words, it is analogous to teaching a robot (or any machine) by giving lots of example pictures (or any other information) Understanding Machine Learning Types of Machine Learning- Supervised Learning Some-real life examples: • Email Spam Filtering: Classifying emails as spam or not spam. • Image Classification: Identifying objects or patterns within images. • Facial Recognition: Identifying and verifying individuals based on facial features. • Financial Fraud Detection: Identifying potentially fraudulent transactions. • Speech Recognition: Converting spoken language into text. Types of Machine LearningUnsupervised Learning Types of Machine LearningUnsupervised Learning Some-real life examples: •Clustering Customer Segmentation: Segmenting customers based on their purchasing behavior. •Anomaly Detection in Cybersecurity: Identifying unusual patterns or behaviors in network traffic. •Recommendation Systems: Suggesting products, movies, or content based on user behavior. Types of Machine LearningReinforcement Learning Reinforcement Learning is: •Training a computer to make decisions •By rewarding good choices and punishing bad ones •Just as you might train a dog with treats for learning tricks Types of Machine LearningReinforcement Learning Some-real life examples: • AlphaGo: A computer program that uses reinforcement learning to play Go at a superhuman level. • Self-driving cars: Learning to navigate traffic and respond to various driving conditions. • Algorithmic trading: Making decisions on buying or selling financial instruments based on historical and real-time data. Introduction to Deep Learning Deep Learning is: • A subset of Machine Learning. • Based on Artificial Neural Network (ANN), which is based on computational models inspired by the structure and functioning of human brain Biological vs Artificial Neural Network •Biological Neural Network: • Brain composed of billions of interconnected neurons. • Neurons interact, communicate, and enable humans to think and learn. •Artificial Neural Network (ANN): • Computational network inspired by the human brain. • Consists of interconnected nodes (neurons). Architecture of Artificial Neural Network • Primarily consists of three layers — Input Layer, Output Layer and Hidden Layers • Input Layer: Receives data. • Hidden Layers: Process information and learn patterns. • Output Layer: Provides the final result or decision. Working of Artificial Neural Network Imagine a group of kids trying to recognize a panda by sharing their observations. • Each kid focuses on specific features such as black-and-white fur, round face, and distinct eyes. • Individually, they might not fully understand what a panda looks like, • But by combining their insights, they create a collective understanding. Working of Artificial Neural Network Scoring Approach: • To refine their recognition skills, the kids keep track of their accuracy. • If they correctly identify a panda, they gain points; otherwise, they learn from their mistakes. • Similarly, in neural networks, a scoring approach helps adjust the network’s parameters to enhance accuracy over time. To summarize: • In artificial neural network, individual “neurons” specialize in recognizing specific aspects. • When combined, they contribute to recognizing the overall concept (panda). • The network refines its understanding through repeated exposure, similar to kids refining their panda recognition skills over time. Deep Learning •Definition: • ANN with multiple layers between input and output. •"Deep" Meaning: • Capable of learning complex patterns. Important points about Deep Learning Subset of ML: • Deep learning is a subset of machine learning, which is a subset of AI. Inspiration: • Based on how our brains work. Artificial Neural Network (ANN): • Mimics biological neural networks. Learning from Data: • Learns by processing many examples and adjusting connections. Handling Complex Problems • particularly effective for solving complex problems where traditional approaches may struggle. Machine Learning vs Deep Learning Introduction to Generative AI Generative AI is: • A type of artificial intelligence • that can create new things, for example artwork, music, or even realistic images. • without being explicitly told what to create Traditional vs Generative AI • Traditional AI: Focuses on specific tasks or problemsolving • Generative AI: Exhibits creativity similar to human creativity, creates new content, ideas, or solutions Example of Generative AI •What if a computer program could create new things all by itself! •What if the computer program was tasked with creating a completely new animal, say a “lion-cow-butterfly” combination This is Generative AI — A machine (or computer) which has imagination and creativity to draw pictures, tell stories, or even make up new games without anyone showing it how. Evolution of Gen AI and where Gen AI fits in AI Hierarchy Discriminative vs Generative AI • Discriminative AI focuses on learning class boundaries and is used mainly for classification. • Generative AI models the joint probability distribution and is used for both classification and data generation tasks. Discriminative vs Generative AI Discriminative AI • Focuses on learning the boundary between classes • Predicts the probability of a label given the input data • Doesn’t model the distribution of the data • Examples: Logistic Regression, SVM, Neural Networks for Classification Generative AI • Focuses on modeling the joint probability distribution of the data • Can generate new data that is similar to the training data • Can be used for both classification and generation tasks • Examples: Naive Bayes Classifier, Gaussian Mixture Models, VAEs, GANs Generative models The generative models: • learns the underlying set of data and generates new data the closely mimics the original data • are mainly used to create new content, such as images, text, or even music which looks exactly the same as what might be created by humans • Uses unsupervised learning approach Most common generative models are: • • • • Variational Autoencoders (VAEs), Generative Adversarial Networks (GANs) Limited Boltzmann Machines (RBMs) Transformer-based Language Models Real-life applications of Gen AI Text Generation: ChatGPT, Virtual Assistants, Chatbots Image Generation: DALL-E, Image editing, Face generation Video Generation: Entertainment, Advertisements, Training simulations Voice Generation: Natural sounding virtual assistants, Audiobooks Healthcare, Drug Discovery, Gaming, Art Generation, Software Development, Finance Popular Generative AI tools •ChatGPT: Conversational AI by OpenAI •GPT: Engine behind ChatGPT by OpenAI •AlphaCode: AI-powered coding engine by DeepMind •GitHub Copilot: AI-powered code completion tool by GitHub and OpenAI •Bard: Conversational Generative AI chatbot by Google •Microsoft Copilot: AI-powered assistant by Microsoft •DALL-E: Image generation by OpenAI •StyleGAN: High-quality synthetic image generation by NVIDIA Generative AI stack Foundation Layer, L1 •Consists of specialized hardware like GPUs •Focuses on efficient computation and parallel processing •NVIDIA leads in this layer Model Layer, L2 •Includes advanced models like Large Language Models (LLMs) and Visual models •Enables synthesis of novel data instances •OpenAI is the leader in this layer Generative AI stack (contd.) Tooling Layer, L3 •Comprises essential tools and services like ETL processes, vector search, RLHF, and model optimization •Streamlines and optimizes the deployment and utilization of generative AI models •Investments include Segmind; other companies like Portkey and Branch.ai are notable Application Layer, L4 •Encompasses apps developed using APIs from the Model Layer and services from the AI Tooling Layer •Represents the tangible manifestation of generative AI technology •Examples: Notion’s writing assistant, Jasper.ai Introduction to Large Language Models A generative AI system which needs to generate human-like text needs Large language models. Language model is: • a type of machine learning model • which uses various statistical and probabilistic techniques • to predict probability of a given sequence of words in a sentence or phrase. Understanding Large Language Models In simple words, • language model is designed to predict next most suitable word to fill in a blank space in a sentence or phrase, based on the context of the given sentence/phrase. • The most unique and powerful point about large language models is their ability to generate human-like text, summarize, and predict content based on vast amounts of data. Understanding Large Language Models (contd.) • Large Language Models (LLMs) play a crucial role in Generative AI by generating human-like text • LLMs are trained on vast text datasets and use advanced neural network architectures • Applications of LLMs range from virtual assistants and chatbots to translation, text generation, summarization, and sentiment analysis Natural Language Processing Natural Language Processing (NLP) is a subset of AI, which focuses on the interaction between computers and humans through natural language •refers to the process of enabling computers to understand human language and communicate with us in the same language. •uses algorithms to analyze, understand, and generate human language. •helps computers understand the context, and sentiment behind words and sentences. Relation between Natural Language Processing (NLP) and Large Language Model (LLM) Aspect Natural Language Processing (NLP) Subset of AI focusing on human-computer interaction through natural language Large Language Models (LLM) Any model designed for NLP tasks, with a focus on generating human-like text Main Focus Processing and understanding human language Generating and predicting human-like text based on context Techniques Used Wide range: Rule-based methods, machine learning, deep learning approaches Primarily deep learning techniques Definition Predictive Predicts next word or sentence based on Capabilities context and learned patterns Predicts probability of next word in the sequence Architectural Various architectures Basis Primarily based on transformer-based models and artificial neural network Applications Text classification, sentiment analysis, language translation, chatbots Text generation, summarization, translation, sentiment analysis, chatbots Focus Area Broad spectrum of language processing tasks Specific focus on generating human-like text and understanding context Large Language Models and Generative AI • Large Language Model (LLM) are a subset of Generative AI. • While generative AI can generate many types of content such as text, image, video, code, music etc., LLM is focused on generating text only. Real-world Applications of LLMs •Virtual Assistants: Siri, Alexa, Google Assistant •Chatbots: ChatGPT •Language Translation: Google Translate •Text Generation: Story writing, product descriptions, emails •Summarization: Document and article summarization •Sentiment Analysis: Analyzing sentiments in text data •Content Recommendations: Netflix, YouTube, Amazon Some popular LLM Examples •GPT (Generative Pre-trained Transformers): GPT-1 to GPT-4 •BERT (Bidirectional Encoder Representations from Transformers) •LaMDA (Language Model for Dialogue Applications): Now known as Gemini •LLaMA (Large Language Model Meta AI) by Meta AI Challenges in building LLM powered applications Deploying & Managing Applications - Complexity in cloud deployment - Challenges in managing code, prompts, and configuration - Difficulty in tracking and managing model parameters Navigating Cloud Resources - Technical challenges in running hosted model APIs - Cost optimization and GPU management - Adoption of complex techniques for cost reduction Challenges in building LLM powered applications(contd.) Tracking Application Performance - Addressing hallucinations and nonsensical outputs - Balancing prompt context to avoid incorrect answers - Tying model outputs to business metrics for accurate assessment Access Control & Credential Management - Managing credentials and access controls for data systems - Ensuring data privacy and avoiding information leakage Budgeting and Costs - High costs associated with model APIs and cloud GPUs - Importance of managing expenses and setting budgets Other challenges with using LLMs & how to best address them Challenges Concerns Solutions - Bias and Fairness Potential biases in outputs due to training on biased datasets. Privacy and Data Protection Access to extensive text data raises privacy issues. Accountabilit Ethical use and transparency in deploying y and models. Responsibility - Careful selection and processing of training data. Ongoing monitoring and fine-tuning. Implement measures to detect and rectify biased outputs. - Robust data security measures. Anonymizing and encrypting data. Controlling access and regular auditing. - Establish clear guidelines and principles. Prioritize transparency with users and stakeholders. Implement accountability mechanisms for ethical breaches. - Misinformati on and Dual Potential misuse and spread of false information. Use Collaborative efforts among developers, policymakers, and regulators. Promote innovation while safeguarding against misinformation. Introduction to Prompt Engineering Prompt engineering: • includes designing and optimizing prompts • in a strategic manner • to generate more accurate and desired response from AI systems. Instead of asking a general question, prompt engineering involves providing specific instructions or context to get better results. What is a Prompt? •Prompts are the inputs or questions given to AI systems to get specific responses. • Example: "Tell me a story which includes animal characters. The story is targeted for kids." Key Point: The specificity and detail of the prompt guide the AI to generate the desired content. The importance of asking the right questions to AI systems for accurate responses. Techniques in Prompt Engineering 1. Specificity Example: Non-specific: “Tell me about cars.” Specific: “Can you describe the features of electric cars compared to traditional gasoline cars?” 2. Contextualization Example: Non-contextualized: “Write a review of this product.” Contextualized: “Write a review of this product focusing on its performance for outdoor activities.” 3. Fine-tuning Process: Adjust the prompt iteratively based on AI system's output. Examples of good and bad prompts Bad Prompt vs. Good Prompt •Bad Prompt: “Write a short story” • Good Prompt: “Write a short story about a detective solving a mysterious murder case.” •Bad Prompt: “Explain photosynthesis” • Good Prompt: “Explain the process of photosynthesis in plants, including the role of chlorophyll and sunlight.” •Bad Prompt: “What should I do today?” • Good Prompt: “Suggest some fun outdoor activities for a sunny day.” How to write effective prompts? 1.Be Clear and Specific 2.Provide Context 3.Use Examples 4.Ask Specific Questions 5.Include Constraints 6.Test and Iterate 7.Focus on Clarity Over Creativity Credits 8 part article written by Raja Gupta • https://medium.com/@raja.gupta20/generative-ai-for-beginners-part-1introduction-to-ai-eadb5a71f07d Other articles •https://medium.com/all-in-capital/how-to-think-about-generative-ai-7f8f7b10bec7 •https://blog.gopenai.com/large-language-models-llms-a-brief-historyapplications-challenges-c2fab10fa2e7 •https://generatingconversation.substack.com/p/the-easiest-part-of-llmapplications Kindly note: All images have credits within the images, wherever applicable Further suggested reads Kushal Bhagia •https://medium.com/all-in-capital/how-to-think-about-generative-ai-7f8f7b10bec7 Ambika •https://blog.gopenai.com/large-language-models-llms-a-brief-historyapplications-challenges-c2fab10fa2e7
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )