Epitomsoft Academy · Module 1 of 6

How modern AI really works

Open the black box: neural networks, transformers, tokens and embeddings – and why large language models are so capable, and where they still fail.

What you will learn

From neurons to large language models

Before you can build with AI, you need an accurate mental model of what it is doing. This module explains modern AI from first principles, using intuition and small runnable examples rather than heavy maths.

  • Explain how a neural network learns from data
  • Describe the transformer architecture and the role of attention
  • Understand tokens, embeddings and context windows
  • Explain pre-training, fine-tuning and reinforcement learning from human feedback
  • Recognise hallucinations and other limitations – and why they happen

Module at a glance

  • Format: live online sessions + hands-on lab
  • Level: Beginner
  • Prerequisites: Basic Python; high-school maths
  • You will build: A tokenizer explorer and a tiny text-generating model

Topics

Key concepts, explained with examples

Neural networks in plain English

A neural network is a stack of simple functions with millions or billions of adjustable numbers (weights). Training nudges those weights, step by step, to reduce prediction errors – a process called gradient descent.

Example: A spam filter sees thousands of labelled emails; each wrong guess slightly adjusts its weights until “free prize!!!” reliably scores as spam.

Tokens and tokenization

Models do not read words – they read tokens: frequent chunks of text mapped to numbers. Pricing, speed and the context limit are all measured in tokens.

Example: “Epitomsoft builds AI” may become 5–6 tokens such as “Ep”, “itom”, “soft”, “ builds”, “ AI”. Rare words use more tokens than common ones.

Embeddings: meaning as numbers

Each token or sentence can be turned into a vector – a list of numbers – where similar meanings sit close together. This powers semantic search and recommendations.

Example: The sentences “How do I reset my password?” and “I forgot my login” land close together, even though they share almost no words.

Attention and the transformer

The transformer (2017) lets every token “look at” every other token and decide which ones matter. Stacking many attention layers lets models capture grammar, facts and reasoning patterns.

Example: In “The server crashed because it overheated”, attention helps the model link “it” to “server”, not to “crashed”.

Next-token prediction and sampling

A language model predicts a probability for every possible next token. Settings such as temperature control how adventurous the choice is.

Example: After “Our cloud migration was a”, the model might rate “success” 62%, “challenge” 21%, “disaster” 3%. Low temperature almost always picks “success”.

Pre-training, fine-tuning and RLHF

Pre-training on huge text corpora teaches general knowledge; fine-tuning specialises the model; reinforcement learning from human feedback (RLHF) teaches it to be helpful and follow instructions.

Example: A base model continues text; the chat version you use was further trained on examples of good answers and human preference ratings.

Context windows and memory

A model only “sees” what fits in its context window for that request. It has no memory between conversations unless an application stores and re-sends information.

Example: A 200-page contract may exceed the window; applications split it, summarise sections, or retrieve only the relevant pages.

Why models hallucinate

Models generate plausible text, not verified facts. When information is missing or rare, they may confidently produce something wrong.

Example: Asked for a court case that does not exist, a model may invent a realistic-sounding citation – which is why grounding and verification matter.

Worked example

See tokens and probabilities for yourself

Two small, free, open-source examples you can run on a laptop.

Example 1 – Tokenization with the open-source tiktoken library

# pip install tiktoken
import tiktoken

enc = tiktoken.get_encoding("cl100k_base")       # an open-source tokenizer
tokens = enc.encode("Epitomsoft builds AI solutions")
print(tokens)                                     # list of integer token IDs
print(len(tokens), "tokens")
print([enc.decode([t]) for t in tokens])          # see how the text was split

Example 2 – How temperature changes the next-token choice

import numpy as np

# Model scores (logits) for three candidate next words: "cloud", "data", "banana"
logits = np.array([2.0, 1.0, 0.1])

def softmax(x, temperature=1.0):
    e = np.exp(x / temperature)
    return e / e.sum()

print(softmax(logits, 1.0))   # ≈ [0.66 0.24 0.10]  – balanced
print(softmax(logits, 0.5))   # ≈ [0.86 0.12 0.02]  – low temperature: more focused
print(softmax(logits, 2.0))   # ≈ [0.50 0.30 0.20]  – high temperature: more random

Hands-on lab

Build a tiny GPT from scratch

Following Andrej Karpathy’s open-source nanoGPT, you train a small character-level model on a text of your choice and watch it learn.

  • Tokenize a small dataset (for example, public-domain Shakespeare)
  • Train a mini transformer on a laptop or free cloud notebook
  • Generate text at different temperatures and compare
  • Visualise the training loss and explain what it means
  • Present: “what my model can and cannot do – and why”

Key terms

Vocabulary to master

  • Neural network
  • Weights & parameters
  • Gradient descent
  • Token
  • Embedding
  • Vector
  • Attention
  • Transformer
  • Logits
  • Temperature
  • Context window
  • Pre-training
  • Fine-tuning
  • RLHF
  • Hallucination

Check your understanding

Module 1 quiz

Score 70% or more to pass. Pass all six module quizzes to unlock your Frontier AI certificate on My progress.

Further learning

Free & open-source references

Original research, open-source projects and free courses – all free to access.

Ready to master frontier AI?

Join the Epitomsoft Academy advanced programme – tell us about yourself and we will be in touch.