⚡ Lightweight Deep Learning, high-performance tensor operations, gradient descent optimizers, and neural layers for the FastJava ecosystem.
FastDL is the Deep Learning engine of the FastJava ecosystem. While FastML focuses on classical, deterministic pattern models with hand-crafted features (Centroids, KNN, SVM), FastDL provides the neural substrate: Multidimensional Tensors, Automatic Differentiation / Backpropagation, Neural Layers (Dense, ReLU, Conv), Optimizers (SGD, Momentum, Adam), and Loss surfaces.
// Quick Start — Example
import fastdl.FastDL;
import fastdl.FastDL.Sequential;
import fastdl.loss.MSELoss;
import fastdl.optim.SGD;
import fastdl.tensor.Tensor;
public class Demo {
public static void main(String[] args) {
// 1. Define Multi-Layer Perceptron (MLP)
Sequential net = FastDL.sequential(
FastDL.dense(2, 8),
FastDL.relu(),
FastDL.dense(8, 1)
);
// 2. Setup Optimizer and Loss
SGD optimizer = FastDL.sgd(net.parameters(), 0.01f, 0.9f);
MSELoss criterion = FastDL.mse();
// 3. Forward Pass & Training Step
Tensor x = FastDL.tensor(new float[]{0.5f, -0.2f}, 1, 2);
Tensor target = FastDL.tensor(new float[]{1.0f}, 1, 1);
optimizer.zeroGrad();
Tensor pred = net.forward(x);
float loss = criterion.forward(pred, target);
net.backward(criterion.backward(pred, target));
optimizer.step();
System.out.printf("Loss: %.4f | Output: %s%n", loss, pred);
}
}- Why FastDL?
- Key Features
- API Quick Reference
- Installation
- Technical Examples & Hero Demos
- Documentation
- Platform Support
- License
- Related Projects
Standard Deep Learning frameworks in the Java ecosystem (like DL4J) suffer from bloated dependencies, complex native bridges, and heavy memory footprints.
FastDL delivers:
- 100% Pure JVM Core with Optional Native SIMD/GPU Acceleration — Instant startup, zero setup friction.
- Microsecond Tensor Operations — Cache-friendly flat arrays with stride-based multidimensional indexing.
- Zero Framework Bloat — Minimalist, PyTorch-like layer and optimizer APIs designed specifically for FastJava.
- 🧱 Dense & Multidimensional Tensors — Zero-copy flat buffers, strides, automatic gradient tracking (
grad). - 🧠 Neural Layers & Modular Sequentials —
Dense,ReLU, custom composable activation layers. - ⚡ Optimizers with Momentum — Stochastic Gradient Descent with velocity momentum tracking.
- 📉 Non-Convex Optimization & Loss Surfaces — Built-in loss metrics (
MSELoss) and minima exploration.
| Method | Description |
|---|---|
FastDL.tensor(shape...) |
Allocates a zero-initialized tensor. |
FastDL.dense(in, out) |
Creates a fully-connected linear layer. |
FastDL.relu() |
Rectified Linear Unit activation layer. |
FastDL.sequential(layers...) |
Chains layers into an executable network container. |
FastDL.sgd(params, lr, momentum) |
Creates an SGD optimizer with momentum. |
FastDL.mse() |
Mean Squared Error loss calculator. |
Add the JitPack repository and dependency to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastDL</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastDL:0.1.0'
}| Case | Java Example | Description |
|---|---|---|
| Non-Convex Loss Surface & Minima Valley | LossSurfaceDemo.java | Real-time interactive simulation of gradient descent and momentum balls escaping local minima |
| Platform | Status |
|---|---|
| Windows 10/11 | ✅ Fully Supported |
| Linux | ✅ Fully Supported |
| macOS | ✅ Fully Supported |
MIT License — See LICENSE for details.
- FastML — Classical Machine Learning and deterministic pattern recognition
- FastAI — High-level unified AI and reasoning substrate
- FastModel — Local GGUF/ONNX model runtimes
- FastGPU — Vulkan and GPU compute acceleration
Part of the FastJava Ecosystem — Making the JVM faster. Small package. Maximum speed. Zero bloat. 🚀