Saurav NayalSoftware Developer
Thoughts
genaillmaijavascript

How ChatGPT Understands Your Questions?

8 min read

Every day, millions of people ask ChatGPT questions. You type a sentence, hit Enter, and within seconds you get a response that actually makes sense.

But have you ever stopped to wonder what's really happening in those few seconds?

Here's the twist: ChatGPT doesn't understand English the way you do. It can't "read" in the human sense at all. Underneath all the fluent sentences, it's just doing math on numbers — billions of them, at incredible speed.

Let's follow your prompt on its full journey, from the moment you hit Enter to the moment a response appears on your screen.

1. What is an LLM?

LLM stands for Large Language Model — a machine learning model that takes natural language as input and generates a relevant response based on what you've asked.

Here's an easy way to remember what each part of the name means:

  • L — Large: It's trained on a massive amount of text data — basically a huge chunk of the internet, books, articles, and code.

  • L — Language: It takes natural human language as input, not rigid commands or code.

  • M — Model: It's a mathematical model — a giant neural network — that produces a response based on patterns it learned during training.

What problems do LLMs solve?

Before LLMs, computers were excellent at structured tasks (calculations, database lookups, fixed rules) but hopeless at anything involving messy, ambiguous human language. You couldn't just talk to a computer and expect it to understand nuance, intent, or context.

LLMs changed that. They solve problems like:

  • Understanding free-form questions instead of needing exact commands or keywords

  • Holding a natural, flowing conversation that remembers earlier context

  • Summarizing long documents into a few sentences

  • Writing, debugging, and explaining code

  • Translating between languages on the fly

  • Generating ideas, drafts, and creative content from a simple prompt

  • ChatGPT (OpenAI)

  • Claude (Anthropic)

  • Gemini (Google)

  • Llama (Meta)

  • DeepSeek (DeepSeek)

Common applications in daily life

  • Answering questions and explaining concepts

  • Writing emails, blogs, and reports

  • Summarizing long documents or meeting notes

  • Translating languages

  • Generating and explaining code

  • Brainstorming ideas

  • Powering customer-support chatbots and voice assistants

2. What Happens When You Send a Message to ChatGPT?

Here's the full pipeline, step by step:

Let's unpack that:

  1. You type a prompt — e.g., "Explain recursion in JavaScript." At this point, it's just plain text.

  2. The text is tokenized — broken into small chunks (more on this in Section 4).

  3. Tokens become embeddings — each token is converted into a list of numbers that captures something about its meaning.

  4. The Transformer takes over — using a mechanism called attention, it figures out which tokens in your prompt relate to which other tokens, building up a rich understanding of context.

  5. The model predicts the next token — not the whole answer at once, but one token at a time, based on everything seen so far.

  6. This repeats in a loop — each new token is fed back in, and the model predicts the next one, and the next, until it decides the response is complete.

  7. You see the final response — streamed back to you, often token by token, which is why ChatGPT's replies appear to "type themselves out."

Why aren't responses copied from the internet?

This is one of the most common misconceptions about LLMs. ChatGPT isn't searching a database of pre-written answers or quoting some webpage it found.

Every response is generated, token by token, based on probability — the model's best guess, based on its training, of what should come next given everything before it. That's why it can answer brand-new questions nobody has ever asked before, explain things in your exact phrasing, or write code for a problem that's unique to you.

Think of it less like a librarian pulling a book off a shelf, and more like a musician improvising — they've practiced thousands of songs, internalized the patterns, and now they're creating something new in the moment based on that experience.

3. Why Computers Don't Understand Human Language

Here's the uncomfortable truth: computers don't actually understand words.

Text vs numbers

Text is a sequence of characters that may or may not carry meaning to a human reader — "cat," "running," "!" A number, on the other hand, is a precise value: 1, 2, 3.14, -7. Computers are built entirely around arithmetic and logic on numbers. They have no native concept of "happiness" or "JavaScript" — only values they can add, multiply, and compare.

Why computers need everything converted into numbers

At the deepest level, a computer only understands 0s and 1s. Since human language is fundamentally different from that, we need a translation step — converting text into vector embeddings: a list of numbers mapped to each token, capturing some sense of its meaning.

For example, the sentence "I love India" might get mapped (in a hugely simplified illustration) to something like:

These numbers can then be represented in binary (0s and 1s) under the hood — the only language a CPU truly speaks.

Introduction to tokens

This is where tokens come in — the bridge between human language and machine-readable numbers. A token is the smallest unit of text an AI model reads and writes. It can be a whole word, part of a word, a single character, or even a punctuation mark or space.

4. Tokenization

What tokens are

As mentioned above, a token is the smallest chunk of text the model works with - sometimes a full word, sometimes just a fragment of one.

Why tokenization is needed

Tokenization is the process of converting text into a list of tokens, which are then mapped to numbers based on the model's vocabulary (a fixed dictionary of every token the model knows).

It's needed because machines don't understand natural language directly — they only understand numbers. Tokenization is the technique that bridges that gap, letting an LLM "read" your sentence by first chopping it into pieces it can convert into math.

Words vs tokens

A word is a sequence of characters that carries a specific meaning on its own. A token, however, can be a whole word, a fragment of a word, a single space, or punctuation — it's a more flexible, machine-friendly unit than a word.

A common mistake is assuming "1 word = 1 token." In reality:

  • Short, common words are usually a single token.

  • Longer or rarer words often get split into multiple tokens.

Simple examples

Each token then gets mapped to a unique token ID (a number) from the model's vocabulary.

These IDs are what actually flow into the model — not the words themselves.

5. Transformers

What a Transformer is

A Transformer is a deep learning architecture introduced in 2017 (in the landmark paper "Attention Is All You Need") that completely changed how AI understands and generates language. Today, it's the foundation of almost every modern LLM — ChatGPT, Claude, Gemini, and Llama all run on Transformers.

Why it changed AI

Older language models processed text sequentially — one word at a time, left to right — like reading a sentence through a narrow flashlight beam. By the time they reached the end of a long sentence, they'd often lose track of what came at the beginning.

Transformers broke this limitation. Instead of reading word by word, a Transformer looks at all the words in a sentence simultaneously, figuring out which words matter most to each other — no matter how far apart they are.

For example, take this sentence:

"The animal didn't cross the street because it was tired."

What does "it" refer to — the animal or the street? A Transformer's attention mechanism weighs every word against every other word and learns that "it" almost certainly refers to "animal" — because "tired" is a trait far more associated with a living creature than a street.

How it helps understand language

When you send a prompt to an LLM, the Transformer processes it through these fundamental steps:

  1. Tokenization — the text is broken into tokens (words, sub-words, or characters).

  2. Embeddings — each token is converted into a numerical vector the neural network can process.

  3. Positional Encoding — since Transformers process all tokens in parallel (not one at a time), they have no built-in sense of word order. Positional encoding adds extra information to each embedding so the model knows exactly where each token sits in the sentence — "dog bites man" and "man bites dog" use the same words, but order changes everything.

  4. Attention & Processing — the vectors pass through multiple attention layers that mix information across all tokens, building up rich context about how each word relates to the others.

  5. Output Generation — finally, the model uses all that context to predict the single most probable next token, and the cycle repeats until the response is complete.

Why almost every modern LLM uses Transformers

  • They understand context far better than older sequential models.

  • They process entire sentences in parallel, making both training and inference dramatically faster.

  • They scale well — more data and compute generally means better performance.

  • They handle long conversations and documents without losing track of earlier context as easily.

  • They power nearly every state-of-the-art LLM in use today.

Final Thoughts

ChatGPT doesn't understand your question the way a person does — there's no comprehension, no consciousness, no inner "aha" moment. What it does is:

Text → Tokens → Embeddings → Positional Encoding → Attention → Prediction → Response

It converts your words into tokens, those tokens into numbers, adds a sense of order, lets attention figure out what relates to what, and then predicts — one token at a time — the most statistically likely continuation. Do that fast enough, trained on enough data, and the result reads as fluent, context-aware, even thoughtful language.

That's not understanding in the human sense. But it's an astonishingly good imitation of it — good enough to write your code, draft your emails, and explain recursion better than most textbooks.

Next time you ask ChatGPT a question, you'll know exactly what's happening behind the scenes.

Share
© 2026
Get Started