Skip to main content
AI EducademyAIEducademy
🌳

AI Foundations

🌱
AI Seeds

AI literacy for the real world

🌿
AI Sprouts

The foundations behind intelligent systems

🌳
AI Branches

Build with today’s AI capabilities

🏕️
AI Canopy

Engineer reliable GenAI systems

🌲
AI Forest

Ship AI products responsibly

🔨

AI Mastery

✏️
AI Sketch

Engineering foundations for AI builders

🪨
AI Chisel

Patterns for solving harder problems

⚒️
AI Craft

Design systems that scale AI

💎
AI Polish

Communicate and lead in the AI era

🏆
AI Masterpiece

Your production AI capstone

🚀

Career Ready

🚀
Interview Launchpad

Navigate the AI engineering job market

🌟
Behavioral Mastery

Tell the story of how you create impact

💻
Technical Interviews

Solve, design, and communicate under pressure

🤖
AI & ML Interviews

Prepare for modern ML and GenAI interviews

🏆
Offer & Beyond

Make a confident, informed next move

View All Programs→

Lab

7 experiments loaded
🧠Neural Network Playground🤖AI or Human?💬Prompt Lab🎨Image Generator😊Sentiment Analyzer💡Chatbot Builder⚖️Ethics Simulator
🎯Mock InterviewEnter the Lab→
JourneyBlog
🎯
About

Making AI education accessible to everyone, everywhere

❓
FAQ

Common questions answered

🧰
AI Tools

Curated tools we use and recommend

✉️
Contact

Get in touch with us

⭐
Open Source

Built in public on GitHub

Pricing
Get Started
AI EducademyAIEducademy

© 2026 AI Educademy. All rights reserved.

Learn

  • Academies
  • Lessons
  • Lab
  • AI Starter Kit
  • Pricing

Community

  • GitHub
  • Contribute
  • Code of Conduct
  • About
  • FAQ

Support

  • Buy Me a Coffee ☕
  • Terms of Service
  • Privacy Policy
  • Contact
  • Sitemap
AI & Engineering Academics›🏕️ AI Canopy›Lessons›Large Language Models - The Engines Behind Modern AI
🤖
AI Canopy • Advanced⏱️ 20 min read

Large Language Models - The Engines Behind Modern AI

Large Language Models - The Engines Behind Modern AI

Large language models have fundamentally changed what machines can do with text, code, and reasoning. In this lesson, we'll pull back the curtain on how they work, why they're so powerful, and where they still fall short.

What Exactly Is an LLM?

A large language model is a neural network trained on enormous quantities of text to predict the next token in a sequence. "Large" refers to the number of parameters - learnable weights that encode patterns from training data.

  • GPT-6 Astra represents the current OpenAI frontier, with model internals unpublished.
  • Llama 4 Scout and Maverick use mixture-of-experts designs with 17 billion active parameters and much larger total parameter counts.
  • Mistral 7B shows that smaller models can punch well above their weight.

These models are trained on hundreds of billions of words drawn from books, websites, code repositories, and academic papers. The sheer scale of data and parameters is what gives LLMs their remarkable versatility.

Tokens, not words: LLMs don't process whole words - they work with tokens, which are sub-word units. The word "understanding" might be split into "under" + "stand" + "ing". A typical English word averages about 1.3 tokens. This tokenisation scheme allows models to handle rare words, technical jargon, and even multiple languages without an impossibly large vocabulary.

🤯

Training a frontier language model can cost hundreds of millions in compute, data, energy, and engineering. That's roughly the budget of a major film - except the "actor" can speak every programming language.

The Transformer Architecture

Every modern LLM is built on the transformer, introduced in the 2017 paper Attention Is All You Need. The key innovation is self-attention - a mechanism that lets the model weigh how important each word is relative to every other word in the input.

How self-attention works (simplified):

  1. Each token is converted into three vectors: Query, Key, and Value.
  2. The model computes attention scores by comparing every Query against every Key.
Lesson 1 of 130% complete
←Back to program
Continue: Prompt Engineering - The Art and Science of Talking to AI→

Discussion

Sign in to join the discussion

Suggest an edit to this lesson
  • These scores determine how much each token "pays attention" to every other token.
  • The weighted sum of Values produces a context-aware representation.
  • The mathematical formula at the heart of attention is:

    Attention(Q, K, V) = softmax(QK^T / √d) × V

    The division by √d (the square root of the key dimension) prevents the dot products from growing too large, which would push the softmax function into regions with extremely small gradients. This simple scaling trick was one of the key insights that made training deep Transformers stable.

    This is repeated across multiple attention heads in parallel, allowing the model to capture different types of relationships simultaneously - syntax in one head, semantics in another.

    Diagram showing the transformer self-attention mechanism with Query, Key, and Value vectors
    Self-attention allows every token to attend to every other token, capturing long-range dependencies.
    🤔
    Think about it:

    If a sentence has 500 tokens, self-attention compares every token with every other - that's 250,000 comparisons per layer. How might this quadratic cost affect what LLMs can process?

    Key Models in the Landscape

    | Model | Creator | Notable Feature | |-------|---------|-----------------| | GPT-6 Astra | OpenAI | Frontier reasoning, coding, research, and multimodal input | | Claude Opus 5.5 | Anthropic | Long-running agentic coding and knowledge work | | Gemini 3.1 Pro | Google DeepMind | Advanced reasoning, coding, and multimodality | | Llama 4 | Meta | Open-weight, native multimodality, long context | | Mistral Large | Mistral AI | Efficient European alternative |

    The field moves extraordinarily fast - by the time you read this, newer models may already exist.

    A crucial distinction in this landscape is between closed-source models (GPT, Claude, Gemini) where only the API is available, and open-weight models (Llama, Mistral) where the model weights are publicly released. Open-weight models allow organisations to run inference on their own infrastructure, fine-tune for specific domains, and inspect the model's behaviour - advantages that matter greatly for privacy-sensitive industries.

    💡

    Not all "open" models are truly open source. Some release weights but restrict commercial use or don't share training data and code. Always check the licence before deploying an open-weight model in production.

    Pre-Training, Fine-Tuning, and RLHF

    LLMs are built in stages:

    1. Pre-training - The model reads vast amounts of text and learns to predict the next token. This stage is enormously expensive and produces a base model that can complete text but isn't particularly helpful.

    2. Supervised fine-tuning (SFT) - Human-written examples of ideal responses teach the model to follow instructions and answer questions properly.

    3. RLHF (Reinforcement Learning from Human Feedback) - Human raters rank model outputs from best to worst. A reward model learns these preferences, and the LLM is trained to maximise the reward. This is what makes models helpful, harmless, and honest.

    🧠Quick Check

    What is the primary purpose of RLHF in LLM training?

    Emergent Capabilities

    As models scale up, they develop abilities that weren't explicitly trained:

    • Complex reasoning - Multi-step logical deduction and mathematical problem-solving.
    • Code generation - Writing, debugging, and explaining code across dozens of languages.
    • Multilingual fluency - Translating and generating text in languages with relatively little training data.
    • In-context learning - Adapting behaviour based on examples provided in the prompt, without any weight updates.

    These emergent properties are one of the most fascinating aspects of scaling - abilities that appear almost "for free" once a model crosses certain size thresholds.

    🤯

    Early frontier models showed the pattern clearly: they could pass hard professional exams while still stumbling on simple arithmetic or counting tasks when the prompt exposed their weaknesses.

    Limitations You Must Understand

    LLMs are powerful but far from perfect:

    • Hallucinations - Models generate confident-sounding text that is factually wrong. They don't "know" facts; they predict likely token sequences.
    • Context window limits - Each model has a maximum input size, from hundreds of thousands to over a million tokens for current frontier systems. Information beyond this window is simply invisible.
    • Cost and latency - Running inference on large models requires expensive GPU clusters. A top-tier frontier query costs significantly more than a small or mid-tier model query.
    • Lack of true understanding - LLMs manipulate statistical patterns in text. Whether this constitutes "understanding" is a deep philosophical debate.
    • Training data cutoffs - Models don't know about events after their training data was collected unless augmented with retrieval systems.
    💡

    Always verify critical facts from LLM outputs against authoritative sources. Treat LLMs as a brilliant but unreliable research assistant - extraordinarily useful, but never the final word on matters of fact.

    🧠Quick Check

    Why do LLMs sometimes produce hallucinations?

    The Scaling Debate

    For years, the dominant belief was that bigger is always better - more parameters, more data, and more compute would steadily improve performance. This "scaling law" held remarkably well through the GPT-2, GPT-3, GPT-4 generation and later frontier systems.

    However, recent research suggests we may be approaching diminishing returns on raw scale alone. The focus is shifting towards:

    • Better data quality over quantity (curated, deduplicated datasets).
    • Inference-time compute - letting models "think longer" on hard problems rather than making the model itself larger.
    • Specialised architectures - mixture-of-experts models that activate only a fraction of parameters per query, improving efficiency without sacrificing capability.

    Wrapping Up

    Large language models represent a genuine paradigm shift in computing. Understanding their architecture, training pipeline, and limitations isn't optional for anyone working seriously with AI - it's foundational knowledge that will serve you well as the field continues to evolve.

    🧠Quick Check

    Which stage of LLM training is the most computationally expensive?

    🤔
    Think about it:

    If an LLM can pass the bar exam but can't reliably count the number of letters in a word, what does that tell us about the difference between human intelligence and language model capabilities?