·AI & ChatGPT

Module 2 Lesson 1: How ChatGPT Processes Prompts

Understanding the technical journey of a prompt from text input to numerical processing and back to text.

How ChatGPT Processes Prompts

To control ChatGPT, you must understand what happens inside the "Black Box" when you hit enter.

1. Step-by-Step Processing

Phase 1: Tokenization

ChatGPT doesn't see words; it sees tokens. If you input "Hello World," the model splits this into numbers. A "token" can be a whole word, a part of a word, or even punctuation.

Phase 2: Vector Embedding

Each token is mapped to a high-dimensional vector (a list of numbers). This vector represents the meaning of the token. "King" and "Queen" will have vectors that are close to each other in this mathematical space.

Phase 3: The Attention Layer

The model looks at your whole prompt and decides which tokens are most relevant to each other. In the sentence "The cat didn't cross the street because it was too tired," the model uses Self-Attention to realize that it refers to the cat.

graph LR
    User[Your Text] --> Token[Token ID]
    Token --> Vector[Vector Embedding]
    Vector --> Attention[Attention Mechanism]
    Attention --> Reasoning[Neural Network Layers]
    Reasoning --> Predict[Next Token Predicition]
    Predict --> Final[Text Response]

2. Probability over Logic

ChatGPT doesn't have a database of pre-written answers. It calculates the probability of the next word based on every word that came before it. This is why the same prompt can sometimes produce different results.


Hands-on: Visualize Tokens

Go to the official OpenAI Tokenizer.

  1. Paste a sentence of your choice.
  2. Observe how common words are often one token, but complex or made-up words are split.
  3. Count how many tokens your favorite quote uses.

Key Takeaways

  • Tokens are the currency of AI.
  • Vectors represent meaning as numbers.
  • The Attention Mechanism allows the model to "understand" context and relationships.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn