In November 2022, the history of technology hit a major inflection point. ChatGPT arrived like a plot twist in a sci-fi movie, crashing into our living rooms without a trailer.
But if you think about it, we’ve been living with AI for a while. Netflix recommends movies based on your taste, and your phone automatically sorts photos of you and your friends. We’ve been in the era of Deep Learning since the mid-2010s.
So, if we were already used to AI, why did ChatGPT feel like such a shock to the system?
It’s because ChatGPT demonstrated possibilities in a realm we thought was exclusively human: Creativity.
If traditional AI was a diligent administrative assistant, the new wave of AI is an artist. It writes prose in the style of Shakespeare and paints modern cities in the brushstrokes of Van Gogh. The era of Generative AI has officially arrived.
But how exactly is Generative AI different from the AI came before it?
Today, let’s look under the hood of Generative AI from an engineering perspective.
1. Generative AI: Not a Database, But “Compressed Intelligence”
Some people describe AI as a massive database that has simply memorized a ton of data. The classic example of this type of system is a search engine like Google.
Note: While modern search engines heavily utilize AI for ranking and retrieval, the core mental model of “looking up existing records” applies here.
However, thinking of Generative AI as just a “really smart, really big search engine” is a mistake.
Retrieval vs. Generation
When you search for “World War II” on Google, the engine hunts down documents stored in its database and presents them to you. It’s like a librarian finding a specific book on a shelf. The goal is to retrieve what already exists. Success depends on how well it finds the match.
Generation, however, involves a process of Compression and Decompression.
Compression is how the AI interprets and stores data during training. It doesn’t save the training data (books, articles, code) verbatim. The original data is too massive. Instead, the AI compresses this knowledge into abstract concepts. These stored concepts are mathematical representations that humans can’t read; only the AI understands them.
Decompression is the process where the AI recombines these stored concepts to reconstruct them into a form humans can understand.
If you ask, “Write a review of the latest phone in the style of Shakespeare,” the AI doesn’t go look for an existing blog post written by a 17th-century playwright. Instead, it digs into its “brain” to find the abstract concept of “Shakespearean style” and the concept of “smartphone review,” combines them, and translates that combination back into English.
I’m emphasizing this compression/decompression loop because it is the heart of Generative AI: 1) Understanding and storing knowledge in its own compressed format, and 2) Connecting those compressed concepts to reconstruct them into something new.
Compressing the Entire Internet
To build Generative AI, you need data. A staggering amount of it.
The latest models are trained on practically every piece of text and every image available on the public internet. In fact, developers are running out of human-generated data and are starting to look into using synthetic data.
The AI cannot store all this data like a hard drive. Instead, as mentioned, it digests the data, compressing it into its own understanding.
In this process, the original source text disappears. Only the relationships, patterns, and concepts remain in the form of numbers.
This characteristic is why we get Hallucinations. But it’s also why the AI can create sentences and images that have never existed before. In the world of GenAI, hallucination and creativity are two sides of the same coin.
2. Discriminative vs. Generative: Finding Boundaries vs. Learning Patterns
Let’s get a bit more technical. AI models can be broadly categorized based on how they process data: Discriminative and Generative.
Discriminative AI: The Efficient Grader
The AI boom of the last decade — think AlphaGo or Face ID — was mostly built on Discriminative AI. These technologies are optimized for classification.
A classic example is showing the computer a photo and asking, “Is this a dog or a cat?”
The goal of Discriminative AI is to get the right answer. Therefore, it focuses only on information that helps it distinguish between the two. Are the ears pointy? Are the pupils vertical slits? It ignores irrelevant info like “is the background a forest?” or “is the fur fluffy?”
The core technology here is drawing a Decision Boundary. Imagine throwing all the cat photos on one side of a room and dog photos on the other, then drawing a line down the middle. “Anything on the left is a cat; anything on the right is a dog.”
These AIs discard as much information as possible, keeping only what is necessary to maximize efficiency in grading.
Generative AI: The Meticulous Artist
Generative AI, on the other hand, learns the Data Distribution itself. While Discriminative AI looks for differences to tell things apart, Generative AI learns, “This is what a cat looks like,” and “This is what a dog looks like.”
More precisely, it figures out: “Pixels in a cat photo tend to have these specific features (two triangles on top, circles below them…).”
“Learning the data distribution” means understanding the statistical patterns within the data.
- “A cat with three eyes has a probability near zero.”
- “A pixel cluster with pointy ears and fur has a very high probability of being a cat.”
- “A mouth usually appears below the nose.”
It learns these patterns.
Crucially, it doesn’t memorize millions of cat photos. It turns these features into concepts and stores them. Does this sound familiar? Yes, this is the Compression we talked about earlier.
Now the AI knows exactly what a cat looks like. It can tell you the probability of an image being a cat.
But Generative AI goes a step further. It is now an expert on the “concept of a cat.” After attending art school (training), it can draw various cats. It can even draw a cat in a pose or setting it has never seen before. This is the Decompression.
Technical term alert: Compression is often called Encoding, and Decompression is Decoding.
If Discriminative AI is a student taking a True/False quiz, Generative AI is an art student given a blank canvas and told, “Use everything you know about felines to paint a cat that could exist.”
3. Deep Dive 1: Latent Space
We established that Generative AI learns patterns, conceptualizes them, and stores them as numbers. You can think of this as drawing a map of concepts. However, this map isn’t a 2D paper map; it’s a high-dimensional mathematical structure.
We call this multi-dimensional space Latent Space.
Training an AI is essentially filling this vast Latent Space with concepts. “Cat” might sit at coordinates (2, 52, 48…), while “Spacesuit” sits at (221, 21, 33…).
Consider a 1,000 x 1,000-pixel photo of a cat. That’s 1 million pixels. How many of those pixels actually define “cat”? Most are background noise.
The AI doesn’t memorize all 1 million pixels. It extracts the meaningful parts, conceptualizes them, and maps them into Latent Space. In this space, similar concepts cluster together. “King” and “Queen” are close neighbors; “King” and “Sandwich” are far apart.
Now for the fun part. How does AI draw “A cat in a spacesuit in the style of Van Gogh” if it’s never seen that specific image? The answer lies in Latent Space.
Playing with the Map of Meaning
Because this map is made of numbers, we can do math with it.
For example, in vector arithmetic: [King] — [Man] + [Woman] = [Queen]. You literally land on the coordinates for “Queen.”
Similarly, the AI can mathematically add the vectors for [Cat] + [Spacesuit] + [Van Gogh Style].
This calculation lands the AI at a new coordinate in Latent Space. Waiting at that specific coordinate is “A cat in a spacesuit in the style of Van Gogh.”
The key takeaway is that the AI didn’t find this spot during training. It synthesized it by combining concepts it already knew to reach a destination that never existed in its original data.
Now it just has to convert those numbers back into an image humans can see.
4. Deep Dive 2: Probability, Sampling, and the Moment of Creation
How do we turn those numbers into an image or text? This process is called Sampling.
Let’s switch gears from images to Large Language Models (LLMs) like GPT.
The “Guess the Next Word” Game
LLMs are fundamentally built to perform Next Token Prediction. If you input “For lunch today, I ate,” the AI ranks tens of thousands of candidate words by probability.
- a Sandwich (Probability 45%)
- Pizza (Probability 30%)
- …
- a Desk (Probability 0.0001%)
How does it determine these probabilities? By consulting the patterns stored in its Latent Space. It learned during training that “Sandwich” follows “Lunch” far more often than “Desk” does.
Rolling the Dice
If the AI always picked the #1 probability (Sandwich), it would be boring and repetitive — a robotic parrot. To fix this, we let the AI choose from a range of options.
If you run the prompt 100 times, it might pick “Sandwich” 45 times and “Pizza” 30 times. In rare, creative bursts, it might even pick “Desk.”
“For lunch today, I ate a desk” is a hallucination, sure, but it’s also a sentence a human probably wouldn’t think of. That’s creativity.
We can control this randomness using a parameter called Temperature.
- Low Temperature: The AI plays it safe, picking high-probability words. Logical, factual, but dry.
- High Temperature: The AI takes risks. It might skip the sandwich and tell you, “For lunch today, I ate banana-flavored Martian soil.” This is where high creativity (and high insanity) lives.
The Chain Reaction (Autoregressive)
Once the AI picks “Sandwich,” that word becomes part of the input. Now the prompt is “For lunch today, I ate a Sandwich,” and it predicts the next word based on that.
This loop repeats hundreds of times. Even if the starting prompt is the same, the tiny dice rolls along the way mean the story can branch in thousands of different directions. This “chain reaction” is where the generative magic happens.
5. The Two Giants: Transformer and Diffusion
There are two main architectures driving the current generative boom. Let’s look at them conceptually.
1) The Language Revolution: Transformer & Attention
Introduced by Google in 2017, the secret sauce of the Transformer model is the Attention Mechanism.
If a Transformer reads, “He peeled the apple and then ate it,” the Attention mechanism helps the model understand that “it” refers to the “apple,” not “he” or “peeled.”
It understands language not just as a string of words, but through relationships and context. When this context-awareness met massive scale, LLMs gained emergent abilities like translation, coding, and logical reasoning. Quantity turned into quality.
2) The Image Revolution: Diffusion & Denoising
Tools like Midjourney and Stable Diffusion use Diffusion Models.
- Forward Process: Imagine taking a crisp photo and slowly adding static (noise) to it until it’s just gray fuzz.
- Reverse Process: The AI learns to do this backward. You give it a pile of static and say, “Remove a little noise to reveal the image underneath.”
The AI learns Denoising — finding the faint outline of data within the chaos. When you prompt “A cat in a spacesuit,” the AI starts with random noise and, guided by your text, sculpts away the static until a clear image emerges.
6. The Engineer’s Headache: Solving a Problem with No Answer
Behind this magic lies a lot of suffering for engineers.
First, there is no “Right Answer.” In Discriminative AI, if the model says a cat is a dog, it’s wrong. Grading is easy. But if you ask, “Write a funny poem,” how do you grade that? Evaluating performance is subjective, expensive, and slow because it often requires human review.
Second, the War on Hallucinations. Generative AI is a “Probabilistic Parrot.” It is designed to string together plausible-sounding words, regardless of truth. It will lie to your face with total confidence. Engineers have to bolt on solutions like RAG (Retrieval-Augmented Generation) to force the AI to check facts against external databases.
Third, the Infrastructure Bill. Generative AI requires massive computation to learn patterns. Training a top-tier LLM costs hundreds of millions of dollars. Running it burns enough electricity to power a small city. Data centers are turning into giant cooling units to keep thousands of GPUs from melting. Optimizing these models isn’t just about speed; it’s about economic survival.
7. The User’s New Job: Prompt Engineering and Editing
Users have new responsibilities, too.
First, Prompt Engineering. The AI is smart, but it can’t read your mind. To navigate to the exact coordinate in Latent Space you want, you need to provide specific Context, Persona, and Format. You have to learn how to talk to the machine.
Second, The “Editor-in-Chief” Role. Newspaper editors need sharp verification skills. AI code has bugs; AI articles have factual errors. The human role is shifting from creating from scratch to reviewing and curating the AI’s drafts. This includes checking for facts, but also for ethics and bias.
8. Conclusion: Not Magic, Just Math (and a Bicycle for the Mind)
Generative AI isn’t magic. It’s a probabilistic navigation system exploring a map built from humanity’s accumulated data.
It has successfully encroached on the realm of creativity, but it doesn’t replace human creativity — it extends it.
It allows someone who can’t draw to become a visual artist, and it helps a non-coder build an app. It is a tool that lets us travel to places we couldn’t reach on our own.
Go open a prompt window. Throw a weird, nonsensical idea at it. The answer you get might just surprise you.