Heph — Deep Learning & Classic ML Framework from Scratch
Project information
- Category: Software Development / Artificial Intelligence
- Focus: Autograd Engine Deep Learning Classic ML C++ Systems Programming Python Bindings
- Tech Stack: C++17 CMake pybind11 Python GoogleTest ONNX
- Project date: 2026
- Official Repository
Overview
Heph is a machine learning framework built entirely from scratch in C++17, with no external ML dependencies.
At its core lies a fully-functional reverse-mode automatic differentiation engine: every operation
on a GradTensor dynamically registers a backward function, and a single backward() call
propagates gradients through the entire computation graph via topological ordering.
The neural network stack — linear layers, activations, loss functions, and an SGD optimizer — was validated end-to-end on MNIST, achieving competitive accuracy on a pure C++ MLP with no framework overhead. On top of the autograd engine, Heph provides a full suite of classic ML algorithms (Linear & Logistic Regression, KNN, Decision Tree, Random Forest, SVM, PCA) behind a scikit-learn-style API. The entire library is exposed to Python via pybind11 and distributed as a pip-installable package.
Key Elements
Autograd Engine
$$\frac{d\mathcal{L}}{dx_i} = \sum_j \frac{d\mathcal{L}}{dy_j} \cdot \frac{\partial y_j}{\partial x_i}$$
Dynamic computation graph with reverse-mode AD. Each GradTensor stores its backward function; backward() traverses nodes in reverse topological order to accumulate exact gradients.
Neural Network Stack
$$\theta \leftarrow \theta - \eta \nabla_\theta \mathcal{L}$$
Linear layers, ReLU / Sigmoid / Softmax activations, MSE and Cross-Entropy loss, SGD optimizer with gradient clipping. Full training loop validated on MNIST.
Classic ML Suite
Linear & Logistic Regression, KNN, CART Decision Tree, Random Forest, SVM, PCA/SVD — all behind a unified fit() / predict() / score() API with k-fold cross-validation and standard metrics.
Python Bindings & Distribution
Full pybind11 bindings expose tensors, layers, optimizers, and ML algorithms to Python. Distributed as a pip-installable package and supports ONNX export for cross-runtime inference.
Contacts
Get in touch with me!