Getting Started with AI: A Simple Introduction

Artificial Intelligence (AI) is the simulation of human intelligence in machines that are designed to think, learn, and make decisions like humans.
What is AI really doing?
AI isn't magic — it just predicts the next word based on context. AI like ChatGPT doesn’t "think". It guesses the next word using patterns it learned from massive data — just like autocomplete but smarter.
We all use AI in our daily lives, but most of us have no idea how it works behind the scenes. In this blog, we’ll break it down into simple terms using OpenAI’s GPT as an example.
What does GPT stand for?
GPT = Generative Pre-trained Transformer
A. Generative
Meaning: It can generate or create new things (mainly text).
Example:
Imagine you say:
“Write a birthday poem for my friend.”
Google will search for poems already on the internet.
But GPT will actually create a brand new poem just for you.
Like an artist who paints a new picture based on your idea!
B. Pretrained
Meaning: It has already learned a lot before you talk to it.
Example:
Think of GPT like a student who read thousands of books and articles before the exam.
So when you ask a question, it already knows a lot and can give an answer instantly.
But… if you ask about something that happened after its last study session, it might not know.
Like: “Who won the cricket match yesterday?” → It might not know unless it has real-time access (browsing).
C. Transformer
Meaning: The type of brain or engine GPT uses to understand and generate language.
Example:
Imagine a translator who listens carefully to every word and keeps track of the full conversation to respond smartly and clearly.
That’s what the Transformer architecture does — it helps GPT understand context better than old models.
This tech came from a famous research paper by Google: “Attention Is All You Need” (2017).
In Simple Words:
GPT is like a super-smart writer that:
Has read a ton of stuff already (Pretrained),
Can create new, unique content (Generative),
And uses an intelligent system to understand and respond to you (Transformer).
Understanding the Magic Behind Transformers: From Encoding to Output
Have you ever wondered how ChatGPT or any AI model can understand your words and reply like a human? Let’s break down the tech behind it using simple terms and real-life examples. We’ll explore some essential concepts like encoders, decoders, vector embeddings, self-attention, and more!
1. Encoder & Decoder
Think of communication like sending a message in a secret code. The encoder converts your message into a code, and the decoder converts it back into readable text.
Encoder: Understands the input (your question).
Decoder: Generates the output (the model's reply).
Example: You say, "Translate 'Hello' to French."
Encoder: Turns "Hello" into a coded form.
Decoder: Translates that code into "Bonjour."
In GPT-style models, the focus is mainly on decoders, as the model only generates responses.
2. Tokenization & Vocab Size
Computers don't understand text directly, so the input text is broken into tokens.
Sentence: "The cat sat on the mat."
Tokens: ["The", "cat", "sat", "on", "the", "mat"]
Once tokens are created, each one is mapped to a unique number using a predefined dictionary called the vocabulary.
The vocab size is the total number of unique tokens the model knows.
Each token has a unique ID in that vocabulary — just like words in a dictionary have their own page number.
3. Vector Embeddings
Once tokenized, words are converted into vector embeddings — numerical values that hold meaning.
Example:
"Doctor" and "Nurse" will have embeddings close to each other.
"Dog" and "Doctor" will be farther apart.
So, if you ask the model something about "Doctor", it might naturally look at words nearby on the map like "hospital", "nurse", or "patient".
This helps the model understand semantic relationships (meanings).
Real-life Analogy: If you're viewing "Running Shoes", you'll see suggestions like "Sports Socks", "Fitness Trackers" — not "Office Chairs".
4. Semantic Meaning
Embeddings help capture contextual and semantic meaning. For example:
"Bank" near "River" means riverbank.
"Bank" near "ICICI" means a financial institution.
The model uses surrounding words to figure out the correct meaning.
5. Positional Encoding
Transformers read all words at once, not in order. But word order matters.
Example:
"The cat sat on the mat."
"The mat sat on the cat."
Same words, different meaning.
Positional encoding assigns a position to each word so the model knows the right sequence.
6. Self-Attention
This mechanism helps a word "pay attention" to others in the sentence.
Example:
"He went to the bank to withdraw cash."
"The kids played on the bank of the river."
The model checks nearby words like "withdraw" or "river" to decide the meaning of "bank."
7. Multi-Head Attention
Now imagine instead of one set of eyes, the model uses multiple attention heads to analyze from different angles:
One head focuses on grammar.
Another on emotion.
Another on word position.
This allows the model to capture deeper insights.
Analogy: Like multiple detectives looking at the same crime scene from different perspectives.
8. Softmax Function
Once the model processes everything, it has to choose a word to reply with.
Softmax is a mathematical function that assigns probabilities to each word and picks the one most likely to be correct.
Example:
Probabilities: ["good" (0.70), "bad" (0.10), "okay" (0.20)]
Chosen word: "good"
9. Temperature
Controls the randomness in the output.
Low temp (0.1): Safe, predictable answers.
High temp (1.0): More creative or surprising replies.
Example:
Ask: "Tell me a joke."
Temp 0.1: A very safe, common joke.
Temp 1.0: A weird, fun, unpredictable one!
10. Knowledge Cutoff
The model is trained up to a certain date. That date is its knowledge cutoff.
Example:
- If the model was trained till 2023, it may not know about events in 2024 unless it's connected to real-time data (like browsing).
11. Feedforward Neural Network (FFNN)
After attention mechanisms have done their job, the output is passed through a Feedforward Neural Network. This helps the model refine its understanding and generate more accurate and meaningful responses.
Think of it like polishing a diamond — attention gives you the rough shape, but the FFNN helps cut and polish it into a final, shiny gem.
How it works:
Each token's vector goes through a small neural network.
The network adds non-linear transformations to enhance the model's comprehension.
Analogy: Imagine writing an essay. After gathering all your ideas (attention), you organize and edit them to make your message clear and polished (feedforward).
So in short:
Attention: Finds what's important.
Feedforward: Refines and sharpens that information.
💡 Final Thoughts
From converting your sentence into tokens, turning those tokens into embeddings, using attention to understand meaning, and generating an answer — every step in a transformer is like magic powered by math and data.
Hopefully, this blog helped you understand the inner workings of AI models in a simple and intuitive way.
Let me know in the comments if you’d like a visual version, infographic, or follow-up post!
Subscribe to my newsletter
Read articles from Adarsh Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
