AiTechWorlds
AiTechWorlds
Transformers, attention, embeddings, tokens, context windows β all explained in plain English.
A Large Language Model (LLM) is an AI trained on vast amounts of text to predict the next token in a sequence. Models like GPT-4, Claude, Gemini, and LLaMA are LLMs.
"The quick brown fox" β ["The", " quick", " brown", " fox"] = 4 tokensThe context window is the maximum number of tokens a model can "see" at once β including your prompt AND the response.
| Model | Context Window |
|---|---|
| GPT-3.5 | 16,385 tokens |
| GPT-4o | 128,000 tokens |
| Claude 3.5 Sonnet | 200,000 tokens |
| Gemini 1.5 Pro | 1,000,000 tokens |
LLMs are built on the Transformer architecture (introduced in 2017).
Attention(Q, K, V) = softmax(QK^T / sqrt(d_k)) x V
Q = Query matrix
K = Key matrix
V = Value matrix
d_k = dimension of key vectorsControls randomness of outputs.
| Value | Effect |
|---|---|
| 0.0 | Deterministic, always same answer |
| 0.5 | Balanced creativity |
| 1.0 | Creative, more varied |
| 2.0 | Very random, often incoherent |
Limits token selection to top % of probability mass.
top_p = 0.9 means consider tokens that make up 90% of probabilityMaximum number of tokens in the response.
Embeddings are numerical representations of text in high-dimensional vector space. Similar concepts are close together.
# Example: using OpenAI embeddings
from openai import OpenAI
client = OpenAI()
response = client.embeddings.create(
model="text-embedding-3-small",
input="Hello world"
)
vector = response.data[0].embedding # 1536-dimensional vectorWhen an LLM confidently states false information, it's called hallucination.
Causes:
Mitigation:
User Query
β
[Vector Database Search]
β
Relevant Documents Retrieved
β
LLM receives: Query + Retrieved Context
β
Accurate, grounded response| Provider | Models | Best For |
|---|---|---|
| OpenAI | GPT-4o, o1 | General purpose, coding |
| Anthropic | Claude 3.5, Claude 4 | Long context, analysis |
| Gemini 1.5, 2.0 | Multimodal, long context | |
| Meta | LLaMA 3.1, 3.3 | Open source, self-hosting |
| Mistral | Mistral Large, Codestral | European, code |
Advertisement
Get more notes like this daily on Telegram!
Free study notes, cheat sheets & AI tips
Last reviewed on June 13, 2026 by the AiTechWorlds Notes Team. Free cheat sheet β no signup required.
Advertisement
Join AiTechWorlds on Telegram and get daily AI tips, prompt engineering templates, coding resources, and exclusive content β 100% free!
No spam. Leave anytime.