Introduction to Generative AI - Simple Notes

Sojitra DipeshSojitra Dipesh
3 min read

What is ChatGPT?

ChatGPT = Chat + GPT

  • Chat: Talking/conversation

  • GPT: Generative Pre-trained Transformer

Breaking down GPT:

  • Generative: Creates/generates new text

  • Pre-trained: Already learned from lots of data

  • Transformer: A special type of AI model that transforms input into output

How Does AI Generate Text?

Think of AI like a very smart autocomplete system. It predicts the next word until it reaches the end.

Process: Input โ†’ AI Brain โ†’ Output (word by word)

The AI keeps predicting: "What word should come next?" until it decides the sentence/answer is complete (reaches <EOD> - End of Data).

Key Concepts Explained Simply

1. Tokenization ๐Ÿ”ค

What it is: Breaking sentences into pieces (tokens) that the computer can understand.

Simple Example:

  • Human words: "How are you"

  • Computer tokens: [521, 63, 223]

Why needed: Computers don't understand words directly, they need numbers!

Real-world analogy: Like translating English to a secret number code that only computers understand.

2. Vector Embedding ๐Ÿ“Š

What it is: Converting each token (word) into a list of numbers that represents its meaning.

Simple Example:

  • Word "cat" โ†’ [0.2, 0.8, 0.1, 0.9, ...]

  • Word "dog" โ†’ [0.3, 0.7, 0.2, 0.8, ...]

Why needed: The AI needs to understand what words mean and how similar they are to each other.

Real-world analogy: Like giving each word a "personality profile" with numbers showing its characteristics.

3. Positional Encoding ๐Ÿ“

What it is: Adding information about WHERE each word appears in the sentence.

The Problem:

  • "Dog chases cat" vs "Cat chases dog"

  • Same words, completely different meaning!

  • When converted to tokens: [dog, chases, cat] vs [cat, chases, dog]

  • Without position info, AI might mix them up!

The Solution: Add position markers

  • "Dog(position 1) chases(position 2) cat(position 3)"

Real-world analogy: Like numbering seats in a theater - same people, but different seats = different experience.

4. Self-Attention ๐ŸŽฏ

What it is: The AI's way of understanding which words are related to each other in different contexts.

The Problem: Same word, different meanings

  • "River bank" (side of a river)

  • "ICICI bank" (financial institution)

How Self-Attention Helps:

  • When AI sees "River bank": It pays attention to "River" and understands this "bank" means riverbank

  • When AI sees "ICICI bank": It pays attention to "ICICI" and understands this "bank" means financial bank

Real-world analogy: Like a detective looking for clues in a sentence to solve the mystery of what each word really means.

Simple Summary

  1. Tokenization: Convert words to numbers

  2. Vector Embedding: Give meaning to those numbers

  3. Positional Encoding: Remember word order

  4. Self-Attention: Understand context and relationships

The Big Picture: AI reads your question โ†’ Breaks it into number tokens โ†’ Understands what each means โ†’ Remembers the order โ†’ Figures out relationships โ†’ Predicts the best response word by word!

1
Subscribe to my newsletter

Read articles from Sojitra Dipesh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sojitra Dipesh
Sojitra Dipesh