Learn
NeugenAI course

AI from Scratch

Build a model you understand, then discover something about it you can defend. Start with a message filter you tune by hand, teach it to learn, and build up to a tiny language model that suggests what to type next. Finish by reproducing a research result and writing a paper of your own. No machine-learning background needed; everything runs on a laptop CPU.

๐Ÿ’ป Quests are built on your computer, with Python and the free neugen tool. The course walks you through setting it up.

Join free โ†’ Free ยท create your account in a minute

About this course

Build a model you understand, piece by piece, and see why each piece exists. You start with a filter for unwanted text messages whose numbers you choose by hand, teach it to learn from examples, and grow it into a tiny language model that suggests what someone will type next. The course ends with research: you reproduce a published result, investigate a question of your own and write it up as a paper.

AI on: use AI to explain ideas, check your maths and help with code. What's graded is your understanding. After each submission, an AI examiner asks you to predict outputs, trace small examples by hand and change your own code. If the defense doesn't go well, you can take it again.

You'll need: comfortable Python (functions, classes, loops, files). No machine-learning background: probability, derivatives and matrices are introduced with worked examples when you need them. Any laptop; no GPU.

The first quest ยท step 1

Build a message filter

Unwanted messages are annoying and sometimes dangerous. Build a filter that gives each message a score from a few clues (a link, prize words, capital letters, length), choose its weights by hand, measure how well it works and read the messages it gets wrong. Your first model: a function whose behaviour is set by numbers you choose.

Have a look โ†’
Stage 1

How models learn

Build a message filter, then teach it to learn from examples.

  1. Learning Up next

    Step 1: Build a message filter

    Unwanted messages are annoying and sometimes dangerous. Build a filter that gives each message a score from a few clues (a link, prize words, capital letters, length), choose its weights by hand, measure how well it works and read the messages it gets wrong. Your first model: a function whose behaviour is set by numbers you choose.

    โฑ ~4h ๐Ÿค– AI-on ๐Ÿ’ป On your computer โ—โ—‹โ—‹โ—‹โ—‹
  2. Learning ๐Ÿ”’ Locked

    Step 2: Make the filter learn

    Choosing weights by hand is slow, and you can't do it for a thousand clues. Let the computer choose: try random filters, then improve one with small random changes, and keep what works. On the way, find out why accuracy is a poor guide for search, turn scores into probabilities, and build a loss that tells the search how wrong each message is.

    โฑ ~6h ๐Ÿค– AI-on ๐Ÿ’ป On your computer โ—โ—โ—‹โ—‹โ—‹

    Unlocks after step 1.

  3. Learning ๐Ÿ”’ Locked

    Step 3: Follow the gradient

    Random search found good weights for your message filter, but only by luck and many tries. Measure which way is downhill instead: estimate slopes by nudging one weight, work out the exact gradient of the loss, check one against the other, and train the filter with gradient descent. Then compare it with random search on the same budget, and see what a learning rate that is too large does.

    โฑ ~7h ๐Ÿค– AI-on ๐Ÿ’ป On your computer โ—โ—โ—โ—‹โ—‹

    Unlocks after step 2.

  4. Learning ๐Ÿ”’ Locked

    Step 4: Build a neural message classifier

    A full-length text message is much more likely to be spam than a short one or a very long one. Your linear filter can only say "longer is more suspicious". Build the machinery behind every neural network (a small autograd engine and backpropagation), train a network with a hidden layer on the same four clues, and find out fairly what it gains.

    โฑ ~9h ๐Ÿค– AI-on ๐Ÿ’ป On your computer โ—โ—โ—โ—‹โ—‹

    Unlocks after step 3.

Stage 2

Language

Let the filter read words, then suggest what someone will type next.

  1. Language ๐Ÿ”’ Locked

    Step 5: Teach your message filter to read the words

    Four hand-picked clues miss a third of unwanted messages. Teach the filter to read: split messages into tokens, build a vocabulary from the training messages, turn each message into word counts and learn one weight per word. This is where PyTorch arrives: check its gradients against your own engine, then train a model that classifies raw messages.

    โฑ ~10h ๐Ÿค– AI-on ๐Ÿ’ป On your computer โ—โ—โ—โ—‹โ—‹

    Unlocks after step 4.

  2. Language ๐Ÿ”’ Locked

    Step 6: Build autocomplete by counting

    Suggest the next word of a message, like a phone keyboard. Count which words follow which in thousands of normal messages, turn the counts into probabilities, handle word pairs you have never seen, generate messages, and measure how surprised the model is by new text. Then train a tiny neural network that learns the same probabilities by gradient descent.

    โฑ ~10h ๐Ÿค– AI-on ๐Ÿ’ป On your computer โ—โ—โ—โ—‹โ—‹

    Unlocks after step 5.

  3. Coming soon

    Build neural autocomplete

Stage 3

Transformers

Let the model choose which earlier words matter.

  1. Coming soon

    Let the model select relevant context

  2. Coming soon

    Assemble and train a tiny transformer

Stage 4

Research

Reproduce a published result, investigate your own question and write the paper.

  1. Coming soon

    Reproduce a research result

  2. Coming soon

    Investigate a question of your own

  3. Coming soon

    Write and defend the paper