AISep 19, 202613 min read

Introduction To Generative AI

Generative AI is a type of artificial intelligence that can create new content, such as text, images, and music. It is different from traditional AI, which is used to analyze data and make predictions.

Traditional AI vs Generative AI:

Traditional AI also known as narrow or weak AI, is designed to perform a specific task. It's like a skilled worker who is trained to do one job very well. It uses rules-based-systems, decision trees, and machine learning algorithms to make decisions. How it works:

Input Data -> Processing(Rules, Decision Trees) -> Output(Prediction, Classification)

Simple example is Email Spam Filter which is trained on dataset of emails to learn patterns and characteristics of spam emails. Limitations: Not very good to handle complex, dynamic or uncertain situations Requires a lot of data to train and can be biased if data is incomplete or inaccurate Not creative or innovative as it's limited to rules and patters its trained on.

Generative AI: It is a type of AI that can generate new, original content, such as images, music, or text. It's like a creative artist who can come up with new ideas and concepts. Uses Neural Networks and Deep Learning Algorithms to learn patterns and relationships in data. How it works:

Input Data -> Encoder(Neural Network) -> Latent Space (Vector Representation) -> Decoder (Neural Network) -> Output (Generated Content)

A great example of generative AI is a language model like ChatGPT. It's trained on a massive dataset of text to learn the patterns and relationships between words, phrases, and sentences. When you ask it a question or provide a prompt, it generates a response based on its understanding of the context and the patterns it's learned. Advantages: It can handle complex, dynamic, or uncertain situations more effectively. It can generate new, original content, such as images, music, or text. It can learn from incomplete or inaccurate data and still produce good results.

Traditional AIGenerative AI
Siri or Google AssistantChatbots
Facebooks Face RecognitionLanguage Translation (Google Translate)
Netflix's movie recommendationsArt Generation Tools (DallE, midjourney)

Why GenAI Now ?

It did not appear overnight - it's the result of 3 major technological breakthroughs.
Why-GenAI-Now
Why-GenAI-Now
  1. Data Explosion:

    • We have unprecendented volumes of digital data, which serves as training material for GenAI models.
    • Sources like Social Media(Twitter, Redit), Books, Research Papers, YouTube, WikiPedia, Open Source Code (GitHub), etc
    • A stat says that GPT-4 was trained on trillions of tokens from diverse domains
    • It's like teaching a student who has read every book in a massive library, watched every TED talk, and browsed the internet
  2. Compute Power:

    • Hardware Evolution: High-performance GPUs (NVIDIA A100, H100), TPUs (by Google), and AI-specific chips can handle the vast computations needed to train large models.

    • Cloud Scalability: Services like AWS, Azure, GCP let researchers and startups access this compute power without owning it.

    • Impact: What used to take months of processing can now be done in days or hours.

🔧 Think of it like giving AI a supercharged brain and a 10,000-core processor.

  1. Transformer Architecture:
    • Introduced in paper Attention is All You Need in 2017
    • Replaced older models like RNNs and LSTMs for sequence understanding
    • Key idea is to use self-attention to focus on relevant parts of input while processing (like how you pay attention to key sentenes when reading)
    • Results:
      • BERT (Google)
      • GPT (OpenAI)
      • PaLM (Google)
      • Gemini (Google DeepMind)

What are Foundation Models

-> There are a lot of terms that are currently in trend like Machine Learning, Deep Learning, Foundation Models, Generative AI, Large Language Models. Let's put an end to this confusion and put these terms in place. -> One thing common here is they are related to the field of AI which refers to simulation of human intelligence in machine. It has various forms.
Foundation Models
Foundation Models

-> AI -> Machine Learning (Developing algorithms which allows computers to learn from data and make predictions). Here we have supervised learning where models are trained on known data and unsupervised learning where models find patterns in data with predefined labels and reinforcement learning which is a feedback based learning.

-> AI -> Machine Learning -> Deep Learning. It focuses on Artificial Neural Networks with multiple layers. Not all machine learning is deep learning.

-> AI -> Machine Learning -> Deep Learning -> Foundation Models. These are large neural networks trained on huge amount of data and act as a base foundation for applications. These models can be from image recognition to language translation to content generation.

-> AI -> Machine Learning -> Deep Learning -> Foundation Models -> LLM. These are specific type of foundation models which are centred around processing and generating human like text. Based on the use case, they can be trained to produce data like Video, Audio and Image etc.

High Level Architecture:

Foundation Models HLD
Foundation Models HLD

Architecture Behind Foundation Models

Transformer architecture is the backbone behind the Foundation Models

-> Transformer is a neural network architecture designed to handle sequential data like language, code, images without relying on RNNs. It uses self- attention mechanism to weigh the importance of different words or tokens in a sentence or sequence.

What is Self-Attention Mechanism:

It basically allows model to dynamically focus on different parts of the input, regardless of position. For eg, The cat sat on the mat, and it was soft. The word "it" needs to refer to mat, not the cat. With self-attention, the model can learn which word it refers to based on context - rather than by fixed position like in older RNN models.

Encoder-Decoder vs Decoder-only

Encoder Decoder
Encoder Decoder

These are basically the model designs used in foundation models especially language models.

Encoder-Decoder (Gemini, Google Translate)

  • Used for tasks that involve input -> output transformation like:
    • Translation: English -> Hindi
    • Summarization: Long Paragraph -> Summary
    • Q&A: Question -> Answer
  • How it works:
    • Encoder takes input text, converts to vectore embeddings and understands context deeply
    • Decoder uses vectors from encoders to generate final anaswer token by token

Decoder-Only (GPT-3, GPT-4, LLaMA, ChatGPT)

  • Used for text generation from scratch where only prompt is given
  • How it works:
    • Only a Decoder is used
    • It takes a prompt (e.g., “Once upon a time”) and predicts the next word based on what it has seen before.
    • It keeps generating one token at a time
FeatureEncoder-DecoderDecoder-Only
StructureTwo Parts: Encoder + DecoderOnly Decoder
Use CaseTranslation, Summarization, Q&AChat, Story Writing, Code Generation
Data FlowInput -> Embedding -> OutputPrompt -> Output
EgGemini, FLAN-T5GPT, LLaMA

Pretraining and Fine-Tuning

Pretraining is where models are trained using self-supervised learning - no labels, just predicting what comes next or what's missing. There are 2 key objectives :

Next Token Prediction

NTP
NTP
Tokens are the building blocks of text, and the vocabulary is like dictionary that language model uses to understand and generate text. Tokenization is the core task for language models. It involves the model predicting the most likely next word or "token" in a sequence, given the preceding context.

Masked Language Modeling

Masked Language Models are a type of machine learning model designed to predict missing or "masked" words in a sentence. These models are trained on large datasets of text where certain words are intentially hidden during training. The goal of the model is to guess the hidden word based on the surrounding context. This approach helps the model learn the relationships between words and develop a deeper understanding of language structure.
MLM
MLM

RLHF (Reinforcement Learning with Human Feedback)

(Explain how i am planning to use this in PromptOS) -> Even after pretraining + fine-tuning , models may lack alignment. RHLF helps to train models to behave like human assistants -> Steps:

  1. Human annotators rank output from model
  2. A reward model is trained from this feedback
  3. Model is further fine tuned via Reinforcement Learning. In reality, it is currently used in ChatGPT, Claude, Gemini for improved dialogue safety, tone, etc.

Emerging Techniques (LoRa, RAG)

LoRa is Low Rank Adaptation of Large Language Models which is a popular and lightweight training technique that significantly reduces the number of trainable parameters. It works by inserting a smaller number of new weights into the model and only these are trained. This makes training with LoRA much faster, memory-efficient, and produces smaller model weights (a few hundred MBs), which are easier to store and share. Explain Flux Lora with demo

Key Capabilities of Foundation Models

-> FM are not just about generating text. They are moving from single-purpose to general-purpose, multimodal assistants that understand and generate across domains.

Language Generation

  • Generating fluent, coherent, and context aware human like text - from essays to poetry.
  • Based on next-token prediction
  • Uses decoder-only transformers
  • Predicts word by word with learned probabilities

Translation and Summarization

  • Handled by encoder-decoder models like T5, mBART.
  • For translation: Encoder understands source language → Decoder generates in target language.
  • For summarization: Long input is compressed and regenerated as a short summary.

Conversational AI

  • Natural language interaction with users in the form of chats, voice assistants, and Q&A.
  • Built using decoder-only models (GPT-style) fine-tuned with RLHF for alignment and safety.
  • Maintains context and memory (chat history window).
  • Often integrated with tools/plugins/RAG for real-time or grounded answers.

Image Captioning and Generation

  • Captioning: Describing what’s in an image.
  • Generation: Creating new images from text.
  • Uses Vision + Language Transformers
  • Image encoding via CNN -> Text decoder
  • Text to image via DALL-E, Stable Diffusion

Code Generation

  • Writing or completing code from natural language instructions or partially written code.
    • Trained on large-scale code datasets (GitHub, Stack Overflow)
    • Uses decoder-only LLMs (e.g., Codex, Code LLaMA, Gemini Pro 1.5)
    • Includes multi-line understanding and syntax/context awareness

Multimodal Integration (Vision + Language + Audio)

  • Ability to process and understand multiple forms of input — images, text, audio, video — together.
    • Powered by Multimodal Transformers (e.g., Gemini, GPT-4o, Sora, Flamingo).
    • Combines different encoders (for text, vision, audio) and joint attention layers.
    • Often uses fusion techniques like early-fusion or late-fusion depending on task. (Create a sora video to present in front of them along with a prompt)

Applications of Foundation Models

Education

  • Me personally using NoteBook LM for my end sem preparation
  • Research Paper Summarization using Perplexity
  • Lecture Content Generation

Business Automation

  • Automating email, reports, customer responses
  • AI copilots in tools (Excel, MS Teams, Gmail)
  • eg Notion AI

Customer Support

  • Tell what scogo ai has done. Its the best example

Creative Arts & Media

  • Generating art, music, film scenes, or marketing content
    • DALL·E: Creating illustrations for books
    • Sora (OpenAI): Making short videos from text
    • Midjourney: Magazine covers and fashion designs

Software Development & Engineering

  • Debugging is easier
  • Explaining legacy codebases in human language
    • GitHub Copilot suggests real-time code
    • Gemini generates scripts for automation

Risks and Ethical Concerns

🛑 Major Risks

RiskExplanationExample
⚖️ Bias & FairnessModels reflect biases in their training dataDiscriminatory job descriptions, sexist translations
🤥 HallucinationsConfidently generates false informationFabricated citations in research or legal text
🔐 Privacy & Data LeakageModel may memorize and regurgitate private dataAI accidentally revealing sensitive patient data
💣 Misinformation & DeepfakesUsed to spread fake news, images, or videosFake political videos via Sora or DALL·E
🎣 Prompt Injection / JailbreakingUsers can trick the model into unsafe behaviorsBypassing filters to get harmful responses
📉 Over-relianceUsers may blindly trust AI without verificationStudents using ChatGPT to write entire assignments

Hands-on Demos / Tools (Throughout the session will be given)

Future of Foundation Models

Agentic AI (Autonomous AI Agents)

  • Models that take actions, plan tasks, and act on your behalf
  • https://jules.google/
  • AutoGPT: Plans a task and executes it step-by-step

Continual Learning / AutoML

  • Models that improve over time or adapt to new data without retraining from scratch.
  • Google’s Gemini 1.5 supports longer memory & contextual learning
  • Fine-tuned ChatGPTs that evolve with usage

⚔️ Open Source vs Proprietary Models

CriteriaOpen Source (e.g., LLaMA, Mistral)Proprietary (e.g., GPT-4, Gemini)
✅ TransparencyFull access to weightsClosed black-box
⚙️ CustomizationFine-tune and self-hostLimited options
🔐 Data PrivacyFully local options possibleDepends on cloud vendor
⚡ PerformanceNeeds infra investmentHigh-performance out-of-box
💡 ExamplesOpen LLaMA, Mistral, FalconGPT-4, Claude, Gemini