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.

283/283tests passed
99.02%MNIST digit accuracy
93.71%EMNIST letters A–Z
3.9×smaller with int8

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 partWhat it gives
Tensors and mathsmatmul, broadcasting, reshape views, softmax, multi-thread kernels
LayersDense, Conv2D, pooling, BatchNorm, LayerNorm, Dropout, LSTM, attention, Residual, Embedding
LearningAdam, AdamW, SGD, RMSProp, schedules, clipping, early stopping, autograd
Deployint8 / int4 / bfloat16, binary files, safetensors, HTTP server
ApplicationHandwriting 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)

ModelWeights KBAccuracyTime (s)
float32107.799.02%0.54
bfloat16 (Dense)56.499.02%0.61
int8 (Dense + Conv)27.698.99%0.95
int4 group 32 (Dense)17.898.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.