Skip to content
AI & LLM Terminology & Architecture

Lesson 1 of 6 · 22 min

x
1/6

Lesson position in the course — not completion. Use Mark Complete to track finished lessons (saved in this browser).

AI & LLM Fundamentals: Models, Tokens & Context Windows

Artificial Intelligence (AI) encompasses systems that simulate human intelligence. Machine Learning (ML) is a subset of AI where algorithms learn patterns from data rather than following hardcoded rules. Deep Learning uses multi-layer neural networks for complex tasks like image recognition and natural language understanding.

Large Language Models (LLMs) are deep learning models trained on vast text corpora to predict next tokens. Small Language Models (SLMs) deliver lower latency and cost for focused tasks on edge devices. Foundation Models are general-purpose pre-trained base models (e.g. GPT-4, Claude 3.5, Llama 3) that adapt to downstream applications. Multimodal AI processes multiple modalities simultaneously—text, vision, audio, and video.

Text is processed as tokens—sub-word units averaging ~4 characters in English. The Context Window defines the maximum token capacity an LLM can evaluate in a single request. Temperature controls output randomness: low values (0.0–0.2) yield deterministic output, while high values (0.7–1.0) increase variation. When LLMs generate ungrounded or invented facts, it is called a Hallucination. Grounding connects responses to verified data sources, and Guardrails enforce safety, correctness, and business rules.

Before
Ungrounded LLM Prompt (Risk of Hallucination)
1// ❌ Unbounded prompt relying purely on parametric memory2const prompt = "What were our Q3 sales figures for Product X?";3// LLM may invent numbers (hallucination)!
After
Grounded System Prompt with Guardrails & Temperature Control
1// ✅ Grounded prompt with context & strict zero-hallucination guardrail2const systemPrompt = "You are an executive assistant. Answer ONLY using the provided context. If unknown, say 'Information not found'.";3const temperature = 0.0; // Deterministic output

Exercise

Calculate token cost for a 10,000-token prompt at $0.003 per 1K tokens, and write a system prompt enforcing zero-hallucination guardrails.

Check your understanding

  • What is a token in LLM processing?Show answer

    Answer

    A sub-word unit of text (~4 characters or 0.75 words in English) that an LLM converts to numerical IDs for processing.
  • How does Temperature affect model outputs?Show answer

    Answer

    Low temperature (0.0–0.2) selects high-probability tokens for deterministic answers; high temperature (0.7+) increases output diversity.

Progress is saved in this browser.

Next Lesson