Generative AIby Dhruv Narang

1. What Is a Large Language Model (LLM)?

Definition

A Large Language Model is an AI model trained on huge amounts of text that can understand and generate human language. It is the engine behind ChatGPT, Claude and Gemini.

  • Large: billions of parameters, trained on a huge amount of text
  • Language: reads and writes human language
  • Model: a program that learned from data, not from written rules

Fun fact: Training GPT-4 cost OpenAI more than $100 million (₹800+ crore), as CEO Sam Altman said in 2023.


2. How an LLM Thinks Predicts

Prompt: "The capital of India is ..." goes into the LLM (a Transformer neural network), which gives a probability for every token in its vocabulary.

The capital of India is
→
LLMTransformer neural network
→
Probability for every token in the vocabulary
New81%
Delhi15%
Mumbai1%
others<1%
It guesses, it doesn't "know"

Every possible next word gets a probability. The model picks one from the top.

It learned by itself

It read huge amounts of text and kept guessing the next word. No one labelled the data.

A new answer each time

Because it picks from probabilities, the reply can change every time you ask.


3. What Are Parameters?

Definition

Parameters are the weights and biases inside a model. They are numbers the model learns during training, and together they store everything it knows. "8B" means 8 billion of them.

Weights decide how much each input matters. Biases shift the result up or down.

Number of parameters (B = billion)
GPT-2
1.5B
Llama 3 · small
8B
Llama 3 · medium
70B
GPT-3
175B
Llama 3 · large
405B
GPT-4, Claude and Gemini: not disclosed

Bigger is smarter: more parameters usually means a more capable model.


4. What Is a Token?

Definition

A token is the small piece of text an LLM reads and writes. It can be a whole word, part of a word, or a symbol. The model never sees letters or words, only the number (ID) of each token.

Text
I am learning LangChain
↓ split into tokens
Tokens
I am learning LangChain
↓ each token has a fixed ID
Token IDs
4093975242783020848

Why do we need tokens? Computers only work with numbers, so text has to become numbers first. Letters would make every text very long. Whole words would need a huge vocabulary and would break on new words. Tokens are the middle way. Cost, speed and the context window are all counted in tokens.

Rule of thumb: 1 \text{ token} \approx 0.75 \text{ words} (about 4 characters in English). Try it yourself at platform.openai.com/tokenizer.

Every company has its own tokenizer (its own algorithm and vocabulary), so the same text can become different tokens and IDs in different models.

Recap: what happens after the ID? Each ID is looked up in a table and becomes a list of numbers (an embedding). The Transformer works on these numbers and gives a score to every token in the vocabulary. The scores become the probabilities you saw above, and the model picks the next token.

Vocabulary size is the number of different tokens a model knows. GPT-2 had about 50k (50,257). Llama 3 has about 128k, and newer models go higher.

What about other languages? The vocabulary is shared by all languages, so there is no separate English vocabulary. Languages like Hindi get fewer whole-word tokens, so the same sentence breaks into more pieces. That costs more tokens and fills the context window faster.