🧠 AI and LLM Fundamentals
Everything you need to know about how LLMs work, tokens, prompt anatomy, and clarity. The essential foundation for mastering Prompt Engineering.
1. LLM Basics and How They Work
The technology behind generative AI
A Large Language Model (LLM) is an AI model trained on billions of words of text. Through this massive training, it learns language patterns, factual knowledge, and reasoning abilities.
⚙️ The Generation Process
1. Training
Billions of texts
2. Patterns
Identifies rules
3. Prompt
You ask
4. Generation
Token by token
📊 Important Characteristics
- • It is not conscious - It is a sophisticated mathematical tool
- • Probability-based - Chooses the most likely words
- • No persistent memory - Each conversation is isolated
- • Cutoff date - Doesn't know about events that occurred after training
Claude
Strong at reasoning, 200K tokens
GPT-4
Versatile, creative
Gemini
Integrated with Google, 1M tokens
2. Tokens and Context Window
The basic processing units
Tokens are how the LLM "reads" text. A word can be 1 token or several tokens. ~4 characters = 1 token in Portuguese.
📝 Examples
"Hello"
= 1 token
"Brasília"
= 2 tokens (Bras + ília)
📦 Context Window by Model
⚠️ What counts toward the context window:
Your prompt + conversation history + model response + examples provided
3. Prompt Anatomy
The 5 essential components
Context
"You are a physics teacher..."
Task
"Explain the concept of gravity"
Specifications
"Use everyday analogies. Maximum 3 paragraphs"
Examples (optional)
Show the format you want
Restrictions
"Don't use complex mathematical equations"
[CONTEXT] You are a [role].
[TASK] [Clear action].
[SPECS] Format, tone, length.
[RESTRICTIONS] Do NOT do X, Y.
4. Clarity and Specificity
The most important principle
LLMs interpret literally what you write. The more specific you are, the better the results.
1. Be Specific
Details > Generalities
2. Be Direct
Get straight to the point
3. Be Explicit
Don't assume anything
4. Be Structured
Use formatting
❌ Vague
"Talk about SEO"
✅ Clear
"List 5 on-page SEO techniques with practical examples"
5. Conscious Model Selection
Capabilities, context, and cost need to fit the task
Before writing the prompt, identify whether the task requires reasoning, creative generation, file analysis, or a large context window.
Decision question
Which capability is essential for this deliverable—and which would merely be convenient?
Quick test
Compare the same task across two models and record quality, time, and need for corrections.
6. Clarity Lab
Apply the fundamentals to two versions of the same prompt
Write a short request. Then rewrite it with context, a task, the expected format, and a measurable constraint.
Initial version
Keep the request as you would naturally phrase it, and save the response.
Structured version
Compare accuracy, adherence to the format, and the amount of rework needed.
📋 Module 1 Summary
LLMs
Patterns, not knowledge
Tokens
~4 chars = 1 token
Anatomy
5 components
Clarity
Specific > Vague