# Eclipse Deeplearning4J: Deep Learning on the JVM

> Deeplearning4J (DL4J) is a multi-library deep learning suite for Java, Scala, and Kotlin that provides a high-level network training API, a C++-backed linear algebra engine, an automatic differentiation framework, and support for importing models from Keras and TensorFlow without leaving the JVM.

**deeplearning4j/deeplearning4j** — Suite of tools for deploying and training deep learning models using the JVM. Highlights include model import for keras, tensorflow, and onnx/pytorch, a modular and tiny c++ library for running math code and a java based math library on top of the core c++ library. Also includes samediff: a pytorch/tensorflow like library for running deep learn...

- Repository: https://github.com/deeplearning4j/deeplearning4j
- Website: http://deeplearning4j.konduit.ai
- Stars: 14,264 · Forks: 3,822
- Language: Java
- License: Apache-2.0
- Published: 2026-09-21 · Updated: 2026-09-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/deeplearning4j-deeplearning4j

## Deep Learning Without Leaving the JVM

Most deep learning frameworks are Python-first. PyTorch and TensorFlow assume a Python runtime, and teams that build services in Java, Scala, or Kotlin face a choice: maintain a separate Python microservice for model inference, or use JNI/gRPC to call into a Python process. Either approach adds an inter-process boundary and complicates deployment.

Deeplearning4J solves this by providing a deep learning stack that runs entirely on the JVM. A Java team can define a network, train it, import a pre-trained Keras model, and run inference all within a single Maven project. Because DL4J runs on the JVM, it works with any JVM language: Java, Scala, Kotlin, Clojure, and others. The README describes the project as targeting "all the needs of a JVM based deep learning application", from raw data loading through network training.

The project is a practical fit for teams that have significant JVM infrastructure, such as Spring Boot services, Apache Spark pipelines, or Android applications, where introducing a Python runtime would require new deployment and monitoring tooling. It is not designed as a research framework for experimenting with novel architectures: that use case is better served by PyTorch's interactive eager mode.

## The Six Libraries in the DL4J Stack

DL4J is not a single library; the README describes a stack of six components.

DL4J itself is the high-level API for building MultiLayerNetworks and ComputationGraphs. It provides layers including dense, convolutional, recurrent, and others, plus custom layer support. It also handles distributed training on Apache Spark.

ND4J is the linear algebra library that underlies everything. The README states it provides over 500 mathematical and deep learning operations. It is backed by LibND4J, a C++ codebase that handles CPU acceleration using AVX2 and AVX-512 vector instructions and GPU acceleration through CUDA with cuDNN, cuBLAS, and OneDNN support.

SameDiff is DL4J's automatic differentiation framework. It uses a graph-based, define-then-run execution model similar to TensorFlow's original graph mode. The README notes that eager execution similar to TensorFlow 2.x and PyTorch is planned. SameDiff supports importing TensorFlow frozen model (.pb) files.

DataVec handles ETL: loading training data from HDFS, Spark, images, video, audio, CSV, and Excel files into the array format that ND4J and DL4J consume.

LibND4J is the underlying C++ library. It is accessed from the JVM through JavaCPP.

Python4J bundles a CPython interpreter inside the JVM, allowing Python code to be called from Java.

## Adding DL4J to a Maven Project

DL4J has many transitive dependencies, so the README states that a build tool is required. Maven is the documented approach. To add DL4J with the CPU backend, add the following dependencies to a pom.xml file:

```xml
<dependencies>
  <dependency>
      <groupId>org.eclipse.deeplearning4j</groupId>
      <artifactId>deeplearning4j-core</artifactId>
      <version>1.0.0-M2.1</version>
  </dependency>
  <dependency>
      <groupId>org.eclipse.deeplearning4j</groupId>
      <artifactId>nd4j-native-platform</artifactId>
      <version>1.0.0-M2.1</version>
  </dependency>
</dependencies>
```

The first dependency brings in the high-level DL4J API. The second, nd4j-native-platform, is the CPU backend. For GPU acceleration, the nd4j-native-platform dependency is replaced with the appropriate CUDA backend artifact, such as nd4j-cuda-11.6 for CUDA 11.6. Switching backends requires no change to application code, only to the dependency declaration.

The README points to a standalone example project at github.com/eclipse/deeplearning4j-examples as a starting point for a complete Maven project. The example repository also contains separate modules for ND4J array operations, SameDiff, DataVec pipelines, ONNX model import, and TensorFlow/Keras import.

## Importing Keras and TensorFlow Models

One practical use of DL4J in Java services is model inference: a data science team trains a model in Python using Keras or TensorFlow, and a Java team needs to serve predictions from that model inside an existing Java service without maintaining a Python sidecar.

The README states that DL4J supports importing Keras models from h5 files, including models produced by tf.keras as of version 1.0.0-beta7. TensorFlow frozen model format (.pb files) can be imported through SameDiff. Import for ONNX, TensorFlow SavedModel format, and additional Keras variants are described in the README as planned.

The example repository at github.com/deeplearning4j/deeplearning4j-examples includes separate module directories for ONNX import and TensorFlow/Keras import, which illustrate the actual API calls required. The README does not provide inline code for model import in the version captured here; the examples repository is the authoritative source.

This import path is the most common production motivation for DL4J. Organizations running inference workloads in Java at scale can avoid the latency and operational complexity of an HTTP call to a Python-based model server.

## Hardware Support and the Limits of JVM Deep Learning

DL4J runs on Windows, Linux, and macOS. Hardware support covers x86 CPUs (x86_64, AVX2, AVX-512), ARM CPUs (arm, arm64, armhf), and PowerPC (ppc64le). CUDA GPU acceleration is supported for CUDA versions 10.0, 10.1, and 10.2, with a specific note that macOS is excluded from GPU support.

The JVM boundary has real costs. Every tensor operation that crosses from Java to LibND4J through JavaCPP incurs JNI overhead. For small batches or models with many small operations, this can dominate runtime. PyTorch and TensorFlow run their computation graphs natively without a JVM in the call path, which gives them a structural advantage in pure throughput benchmarks.

Building from source is documented but the README describes it as non-trivial: prerequisite documentation lives at deeplearning4j.konduit.ai rather than in the README. The test suite runs only on JDK 11 due to Spark compatibility constraints with older Scala versions on JDK 17. Teams targeting newer JDK versions should verify compatibility separately.

The project's Maven artifact coordinates changed from org.deeplearning4j to org.eclipse.deeplearning4j when the project moved to the Eclipse Foundation. Code samples and tutorials from before that migration will have incorrect group IDs.

## DL4J vs. PyTorch: When the JVM Route Makes Sense

PyTorch is a Python-first deep learning framework with eager execution, a large research ecosystem, and broad community tooling. It dominates new model development in research and industry. DL4J does not compete on research productivity or on raw API ergonomics.

DL4J is the practical choice in one scenario: the JVM is the primary deployment target and Python is not already part of the stack. A company running a monolithic Java application that needs to add recommendations or classification should not add a Python microservice for inference if DL4J can serve the same model within the JVM process. The latency, failure domain, and operational complexity of a network call to a Python model server are real costs.

The README also highlights the SameDiff framework as a closer analog to TensorFlow graph mode, for teams that want to author models in Java rather than import them. SameDiff supports TensorFlow frozen model import today and has ONNX import planned. For teams already invested in ONNX as a model exchange format, the ONNX import examples in the companion repository cover that path.

Deep Java Library (DJL), maintained by Amazon, is another JVM deep learning option. Unlike DL4J, DJL delegates execution to native engines including PyTorch, TensorFlow, and MXNet through an abstraction layer, rather than maintaining its own C++ backend. Teams comparing DL4J and DJL should note this difference: DJL relies on the upstream engine's native runtime, while DL4J's LibND4J is its own codebase.

## Maintenance, Licence, and Commercial Support

DL4J is released under the Apache License, Version 2.0. The repository accepted its last push on 2026-09-26, indicating active development at the time of writing.

Commercial support is available from Konduit K.K., the company that actively develops the project, reachable at support@konduit.ai. Community support is handled through forums at community.konduit.ai.

The project does not publish GitHub releases in this repository. Versioned snapshots are available as Maven artifacts, and the current milestone release is 1.0.0-M2.1. The absence of a stable 1.0.0 release reflects a project in active development: API stability between versions should not be assumed, and teams should pin their dependency version and test before upgrading.

## Conclusion

Java and Kotlin teams that need deep learning inside existing JVM services, or that want to import trained Keras or TensorFlow frozen models for inference without a Python runtime, have a clear path with Deeplearning4J. Teams building new models from scratch where Python tooling is acceptable will find PyTorch's eager mode and broader research ecosystem more productive. Before adopting DL4J, verify that your CUDA version matches a supported backend (10.0, 10.1, or 10.2 on non-macOS systems), and check the konduit.ai documentation for any API changes between 1.0.0-M2.1 and the current snapshot.

## FAQ

### What is Deeplearning4J (DL4J)?

Deeplearning4J is a JVM-based deep learning suite that supports training neural networks and importing pre-trained models from Keras and TensorFlow. It is written in Java and backed by a C++ linear algebra library called LibND4J, which handles CPU and GPU acceleration. The README describes it as targeting all needs of a JVM-based deep learning application.

### How does Deeplearning4J compare to TensorFlow?

TensorFlow is a Python-first framework with its own computation graph execution engine. Deeplearning4J runs on the JVM and uses its own C++ backend (LibND4J) for computation. DL4J can import TensorFlow frozen model (.pb) files through its SameDiff framework. For teams that need to run inference inside Java services, DL4J avoids the overhead of calling a separate Python process.

### How does Deeplearning4J compare to PyTorch?

PyTorch is a Python-first framework with eager execution and a large research ecosystem. Deeplearning4J targets JVM languages and uses a define-then-run graph model through its SameDiff component. The README notes that eager execution similar to PyTorch is planned for SameDiff. For new model development where Python is acceptable, PyTorch's ecosystem is broader.

### What are the alternatives to Deeplearning4J for deep learning in Java?

Deep Java Library (DJL) from Amazon is one alternative; it provides a JVM abstraction layer that delegates computation to native engines including PyTorch, TensorFlow, and MXNet. Calling a Python model server over HTTP or gRPC is another common approach for Java services. The choice depends on whether the team needs inference-only (model import covers this) or full training on the JVM.

## Sources

- [deeplearning4j/deeplearning4j on GitHub](https://github.com/deeplearning4j/deeplearning4j)
- [Issues](https://github.com/deeplearning4j/deeplearning4j/issues)
- [License: Apache-2.0](https://github.com/deeplearning4j/deeplearning4j/blob/master/LICENSE)
- [Project website](http://deeplearning4j.konduit.ai)
- [README](https://github.com/deeplearning4j/deeplearning4j/blob/master/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/deeplearning4j-deeplearning4j
