Feed-forward networks
FNN, with configurable hidden layers and activations for classification and regression.
Java 20+ · CPU + optional Metal
Build, train, and run feed-forward, convolutional, recurrent, autoencoder, and Transformer networks on one shared tensor and autograd foundation.
Supported networks
Compose layers, calculate gradients, and train different model types with DeepJ tensors, parameters, and optimizers.
FNN, with configurable hidden layers and activations for classification and regression.
Conv1D, Conv2D, max/average pooling, and global average pooling for channel-first inputs.
RNN, GRU, and LSTM, with explicit hidden state and per-sample sequence lengths.
Compose an encoder and decoder, train a reconstruction objective, and access the latent representation separately.
Bidirectional attention, padding masks, pre-normalized blocks, and masked mean pooling.
DeepJ Origin, Orbit, Prism, Nova, and Loop, with causal language-model training and text generation.
These model types use DeepJ layers, parameters, tensors, and autograd.
Core library
Tensors, gradients, composition, training, and execution belong to the library as a whole.
One shape-aware tensor API for vectors, matrices, images, and sequences, including views and broadcasting.
Record tensor operations and propagate first-order gradients through the same CPU/Metal backend.
Combine existing and new layers with Sequential, activation adapters, dropout, and BatchNorm.
Supervised matrix and ND batching, differentiable losses, AdamW, and explicit training/evaluation mode.
Store network parameters and persistent buffers. Language-model files and resumable checkpoints have separate contracts.
Use Java CPU execution or select Metal on supported Apple Silicon. Network arithmetic shares these backend operations.
Training
Train DeepJ models on CPU or Apple Metal. To share training work across multiple Apple Silicon Macs or CPU machines, use the optional distributed module.
Choose a training API for your model type, then configure minibatches, losses, optimizers, and evaluation mode. The guide also covers language models.
Read guideTrain across multiple machines. Each worker trains a full model copy on different data, then synchronizes gradients before every update.
Read guideInstall
JDK 20 or newer is required.
Add the Maven dependency to your project, or build DeepJ from source.
<dependency>
<groupId>io.github.kirstenali</groupId>
<artifactId>deepj</artifactId>
<version>0.13.0-alpha</version>
</dependency>
Working with DeepJ
Choose layers and activations, preserve the input shape contract, and share parameters when needed.
Read guideCompute a tensor loss, run backward, and update parameters. Select the appropriate batching and evaluation mode.
Read guideStore parameters and persistent buffers, or use the language-model checkpoint APIs for their broader state.
Read guideDocumentation
Find the shape, gradient, training, and persistence contracts before exploring specialist model tools.
Tensors, autograd, model types, training, saving/loading, and backend execution.
Read guideBrowse classes and methods for DeepJ networks, layers, and tensors.
Read guidePortable and full Metal/desktop builds, numerical checks, and coverage requirements.
Read guideLanguage-model tools
Decoder architectures, tokenizers, pretrained checkpoints, and chat interfaces build on the same neural-network library.
Origin, Orbit, Prism, Nova, and Loop support causal training and generation, with attention designs documented by their components.
Decoder referenceThe optional JavaFX app loads local language-model checkpoints, applies saved prompt formatting, and streams generated text.
Desktop guideStreaming chat, generation, checkpoint inspection, themes, and backend diagnostics for supported language models.
CLI referencePublished checkpoints: Frisky 90M and DeepJ TinyStories. Their model cards describe training, loading requirements, and limitations.