Avatar

Gary Constable AKA GhostFrog

Builder of AI Agents, Data Pipelines & Automation Systems

How LLMs Actually Work: The Mental Model Every AI Developer Needs

2025-12-11

πŸ”€ 1. Everything is tokens

LLMs don't see sentences. They see token IDs.
This is why:

  • context length matters
  • long prompts cost more
  • models lose track of earlier text

🧠 2. Attention

Attention lets each token inspect every other token and decide relevance.

Gives you:

  • reasoning
  • relationships
  • instruction following

Also causes:

  • hallucinations (wrong patterns reinforced)

πŸͺœ 3. Transformer layers

Layers refine meaning:

  • lower β†’ syntax
  • middle β†’ facts
  • upper β†’ reasoning

🧩 4. Why LLMs hallucinate

Because they predict, they don’t verify.

Agents fix this with:

  • tools
  • retrieval
  • planning loops

πŸ“¦ 5. Why small models often win

Tools + retrieval > raw model size.

← Back to Blog