Get me a coffee…

Sprout — AI Assistant Built From Scratch

My own tokenizer, Transformer and training loop — no pretrained weights, no AI APIs.

Not publicly hosted
Sprout — AI Assistant Built From Scratch
Sprout — AI Assistant Built From Scratch — main screen

Overview

A small AI assistant I built entirely from scratch — my own tokenizer, Transformer and training loop, with no pretrained models or AI APIs. I pre-trained a 5.2M-parameter model on code, instruction-tuned it into a chat assistant that solves 79% of never-seen coding tasks, added Wikipedia web search (RAG) for facts, and wrapped it in a ChatGPT-style web app that runs locally in a locked-down sandbox.

Type
Personal research project
Model
5.2M parameters
Hardware
Laptop CPU only
Year
2026
Category
AI · LLM
Built with
PythonPyTorchTransformersRAGWSL2 Sandbox

Screens

The problem

I wanted to understand language models by building one myself — every part, from the tokenizer to the chat interface — and see how far a tiny model on a laptop CPU can go.

My role

  • Wrote the tokenizer, the Transformer (hand-written attention and LayerNorm) and the training loop in PyTorch.
  • Pre-trained on Python source code, then instruction-tuned it into a chat assistant.
  • Built automatic grading that runs the model's code against hidden tests inside a sandbox.
  • Added Wikipedia search (RAG) for facts, and a ChatGPT-style web app.
  • Runs inside a locked-down WSL2 sandbox with no access to the host's drives.

The pipeline

  1. 01Data prep: clean, dedupe, split
  2. 02Tokenizer
  3. 03Transformer pre-training (5.2M params)
  4. 04Instruction tuning (loss on answers only)
  5. 05Graded exam + best-of-5
  6. 06Wikipedia RAG + web app

Key features

From scratch

No pretrained models, no AI APIs — PyTorch is used only as a maths library.

Auto-graded

Answers are syntax-checked and run against hidden unit tests in an isolated process.

Knows what it doesn't know

Trained to answer “I don't know” for live facts like weather and news.

Web search

Facts come from Wikipedia with a source link, instead of the model's memory.

Results

5.2Mparameters
79%never-seen coding tasks solved
80%never-seen everyday questions answered
2.88validation loss (from 8.36)

What I learned

  • A tiny model only knows what it was taught — retrieval beats memory for facts.
  • Measuring with held-out tests is what made progress visible, not loss alone.
← Previous projectSLASH — Software StudioNext project →SWASH — Your AI Stylist