
Euclid ML
Euclid ML is my personal, lightweight machine learning framework built entirely in Python with NumPy and CuPy. It's designed to make neural networks easy to understand, experiment with, and build from the ground up. I've developed several projects using Euclid ML to demonstrate its capabilities and explore what can be achieved with a machine learning framework built from scratch.
What it includes
- Automatic differentiation and tensors
- Neural networks with Dense, Conv2D, Pooling, Dropout, and more
- Transformers with multi-head self-attention
- Optimizers including SGD, RMSProp, and Adam
- Loss functions including Cross Entropy, MSE, and Huber
- CPU & GPU support through NumPy and CuPy
- Vectorized operations for faster training
- Extensible architecture for building custom layers and models
Why Euclid?
Euclid isn't trying to replace PyTorch or TensorFlow.
Quite frankly there is no reason to use it, just use
PyTorch.
It was built as a learning project and is written in pure Python
with NumPy and CuPy. Building it has taught me a lot about how
machine learning frameworks actually work.
Projects Built in Euclid
Tiny GPT

TinyGPT is a language model I built using Euclid. The model
consists of 12 Transformer blocks, with 12 attention heads per
block and a feed-forward dimension of 3,072. It uses a model
dimension of 768 and supports a sequence length of 256 tokens.
TinyGPT was trained on the FineWeb-Edu dataset from Hugging Face
for 520,000 iterations, using a learning rate of
1 × 10⁻⁴.
The final model contains
134,436,608 parameters.
Neural Image Compression

My neural image compressor uses a convolutional encoder to compress a 2^n×2^n RGB image into a 48x times smaller latent representation.
A convolutional decoder then reconstructs the original image
from this compact latent. It was trained on 10,000 ImageNet-10
images for 20 epochs using MSE loss and Adam with a learning
rate of 1e-4.
I compare its reconstructions against JPEG at the same
48× compression ratio, with JPEG typically achieving around
2× better MSE.