Skip to content
Samuel Roland Vroom

Saemil AI

A neural-network engine written from scratch in NumPy, training three unrelated models. A personal build.

Development

Role
Machine learning & full-stack development
Type
Personal project
Stack
Python, NumPy, FastAPI, vanilla JavaScript
Timeline
2026
Figma design file

Summary

Saemil AI is a personal project, not a product or a company. I built it to show what I can do with the tools behind it: a neural-network engine written from scratch in NumPy, with no PyTorch, TensorFlow or scikit-learn doing any learning. The same forward, backward and optimizer code trains three unrelated models: a handwritten-digit classifier, a name generator and a purchase-probability model. Saemil Studio, a FastAPI app with a vanilla-JS page, lets you try all three.

Live site

Saemil Studio on its real FastAPI server, running the trained NumPy models. Draw a digit, generate names, move the shopping-session sliders, then press Explain results.

saemil.samuelrolandvroom.com

Screens

Screenshots of the running site. Every name and number in them is demo data.

Results: the three heads side by side, with the offline explanation
Results: the three heads side by side, with the offline explanation
Vision head: draw a digit, get the top three guesses
Vision head: draw a digit, get the top three guesses
Names head: count, temperature and seed, with a novelty check
Names head: count, temperature and seed, with a novelty check
Tabular head: six session totals, set against the training percentiles
Tabular head: six session totals, set against the training percentiles
Start screen: pick a task, with sessions kept in the sidebar
Start screen: pick a task, with sessions kept in the sidebar
AI bridge: offline template, local CLI or a cloud API, explanation only
AI bridge: offline template, local CLI or a cloud API, explanation only

Backprop by hand

Linear, Embedding and Flatten layers each have an explicit forward and backward pass. Every layer, activation and loss is checked against float64 numerical gradients, and Adam against a reference implementation. The embedding's backward pass uses np.add.at, so a letter that appears twice in one window gets both gradient updates; a plain indexed add would silently drop one.

Is the engine actually general, or just tuned for one task?

Three heads, measured

Each model is scored on a held-out test split against a simple baseline. The digit model reaches 93.3% accuracy (93.75% on the full 10,000-image MNIST test set). The name model's cross-entropy is 2.346 against a unigram baseline of 2.830. The shopping model's log loss is 0.4025 against 0.4306 for the base rate. Each trains on a laptop CPU in under two seconds, and retraining with the default seeds reproduces the model files byte for byte.

Safe files, honest limits

Models save as .npz with a JSON manifest and no pickle; on load, every shape, dtype and layer connection is checked before anything is built, and saves are validated before being swapped in. The studio runs on loopback only with a Host allowlist and a body-size cap. The AI bridge only writes the plain-English explanation, never a prediction, and falls back to an offline template if a provider fails.

Tests & CI

332 tests at 97% line coverage, with warnings treated as errors, plus ruff and mypy. CI runs them on Python 3.10 to 3.13 on every push. The browser and the server centre drawn digits the same way, and a test runs the JavaScript under Node to compare it with the Python version on 66 shared cases.

Want to talk about a project?

Get in touch