A machine learning library built from scratch in C++, with Python bindings (in progress).
Prometheus implements the core components of a modern deep learning framework — tensors, automatic differentiation, neural network layers, optimizers, and data utilities — without relying on any external ML dependencies.
Most ML libraries are black boxes. Prometheus is an attempt to understand what's actually happening under the hood — every operation, every gradient, every weight update written by hand.
- N-dimensional tensor with flat data storage
- Element-wise ops: add, subtract, multiply, divide, pow, sqrt, abs, exp, log, clip
- Matrix ops: matmul, transpose, reshape
- Reductions: sum, mean, max, min along an axis
- Factory methods: zeros, ones, randn
- Reverse-mode automatic differentiation
- Computation graph built dynamically on forward pass
backward()via topological sortrequires_gradflag per tensor
Linear— fully connected layerReLU,Sigmoid,Tanh,Softmax— activationsDropout— regularizationSequential— chain layers together
mse_loss— mean squared errormae_loss— mean absolute errorbinary_cross_entropycross_entropy_loss
SGDwith optional momentumAdamRMSprop
DataLoader— batch iteration, shuffling, reshuffle per epochdata_split— train/val/test split with optional shuffleread_csv— load tabular data from CSV into tensorsload_image— load PNG/JPG images as tensors[C, W, H]
accuracy— binary and multi-class
save/load— serialize model weights to binary filetrain— training loop helper
include/ml/
├── tensor.hpp
├── ops.hpp
├── loss.hpp
├── autograd.hpp
├── nn/ — module, linear, activations, dropout, sequential
├── optim/ — optimizer, sgd, adam, rmsprop
├── data/ — dataloader, csv, image loader
├── metrics/ — accuracy, precision, recall etc.
└── utils/ — model_io, trainer
src/ — implementations
tests/ — one test file per component
Requires CMake and a C++17 compiler.
mkdir build && cd build
cmake ..
cmake --build .- Convolutional layers (Conv2D, MaxPool2D)
- Recurrent layers (RNN, LSTM, GRU)
- Attention and Transformers
- Python bindings via pybind11
- GPU support via CUDA