MiniDL 1.4.0
A deep learning library written from scratch in pure Java – tensors, backprop, CNNs, transformers, quantization – plus a handwriting recognition model built on top of it.
Neural network in Java (Man-JAVA)
MiniDL is the library: a neural network toolkit in pure Java with no outside machine learning code. The handwriting recognition model below is one application built from its parts: the same layers, trainer, quantizer, file format and web server.
| Library part | What it gives |
|---|---|
| Tensors and maths | matmul, broadcasting, reshape views, softmax, multi-thread kernels |
| Layers | Dense, Conv2D, pooling, BatchNorm, LayerNorm, Dropout, LSTM, attention, Residual, Embedding |
| Learning | Adam, AdamW, SGD, RMSProp, schedules, clipping, early stopping, autograd |
| Deploy | int8 / int4 / bfloat16, binary files, safetensors, HTTP server |
| Application | Handwriting recognition model (page 2) |
Handwriting recognition model: the network
A 28×28 picture goes through two convolution + pooling stages, then dense layers to 10 scores (0–9). Total: 27,562 weights (107.7 KB as float32).
2. Training curves
3. Accuracy of all five models
4. Digits: confusion matrix
Rows = true digit, columns = predicted. Brighter diagonal = correct. Most confusion: 9 predicted as 4 (6 times).
5. Shrinking the model (quantization)
| Model | Weights KB | Accuracy | Time (s) |
|---|---|---|---|
| float32 | 107.7 | 99.02% | 0.54 |
| bfloat16 (Dense) | 56.4 | 99.02% | 0.61 |
| int8 (Dense + Conv) | 27.6 | 98.99% | 0.95 |
| int4 group 32 (Dense) | 17.8 | 98.83% | 0.89 |
6. All 283 tests passed
Output of java -jar dist/minidl-1.4.0.jar tests, grouped by area (representative checks shown).
7. Extras in this release
MiniDL vs PyTorch: accuracy results
Same idea on both sides: the same CNN layers (digits model: 27,562 weights), same data, 8 epochs. MiniDL numbers come from your run. PyTorch results are filled in for all 5 models (from your Colab run, same CNN layers, 8 epochs). Digits+letters uses slightly different data in PyTorch, so compare that row with care, and times depend on the hardware each run used.