Java 20+ · CPU + optional Metal

Neural networks, built for Java.

Build, train, and run feed-forward, convolutional, recurrent, autoencoder, and Transformer networks on one shared tensor and autograd foundation.

  • N-dimensional tensors
  • Automatic differentiation
  • MIT licensed

Choose a network. Keep the same foundation.

Compose layers, calculate gradients, and train different model types with DeepJ tensors, parameters, and optimizers.

01

Feed-forward networks

FNN, with configurable hidden layers and activations for classification and regression.

02

Convolutional networks

Conv1D, Conv2D, max/average pooling, and global average pooling for channel-first inputs.

03

Recurrent networks

RNN, GRU, and LSTM, with explicit hidden state and per-sample sequence lengths.

04

Autoencoders

Compose an encoder and decoder, train a reconstruction objective, and access the latent representation separately.

05

Transformer encoders

Bidirectional attention, padding masks, pre-normalized blocks, and masked mean pooling.

06

Decoder Transformers

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.

One foundation for every network.

Tensors, gradients, composition, training, and execution belong to the library as a whole.

01

N-dimensional tensors

One shape-aware tensor API for vectors, matrices, images, and sequences, including views and broadcasting.

02

Automatic differentiation

Record tensor operations and propagate first-order gradients through the same CPU/Metal backend.

03

Composable layers

Combine existing and new layers with Sequential, activation adapters, dropout, and BatchNorm.

04

Training utilities

Supervised matrix and ND batching, differentiable losses, AdamW, and explicit training/evaluation mode.

05

Saving and loading

Store network parameters and persistent buffers. Language-model files and resumable checkpoints have separate contracts.

06

CPU and optional Metal

Use Java CPU execution or select Metal on supported Apple Silicon. Network arithmetic shares these backend operations.

Explore the core guides

Bring DeepJ to your Java project.

JDK 20 or newer is required.

Add the Maven dependency to your project, or build DeepJ from source.

Maven0.13.0-alpha
<dependency>
    <groupId>io.github.kirstenali</groupId>
    <artifactId>deepj</artifactId>
    <version>0.13.0-alpha</version>
</dependency>

Text generation is part of DeepJ, too.

Decoder architectures, tokenizers, pretrained checkpoints, and chat interfaces build on the same neural-network library.

Decoder architectures

Origin, Orbit, Prism, Nova, and Loop support causal training and generation, with attention designs documented by their components.

Decoder reference

Desktop chat

The optional JavaFX app loads local language-model checkpoints, applies saved prompt formatting, and streams generated text.

Desktop guide

Command line

Streaming chat, generation, checkpoint inspection, themes, and backend diagnostics for supported language models.

CLI reference

Published checkpoints: Frisky 90M and DeepJ TinyStories. Their model cards describe training, loading requirements, and limitations.