Description
llama3.java runs Llama 3, 3.1 and 3.2 inference in pure Java, all in a single file with no dependencies. It is the successor to llama2.java, which was based on Andrej Karpathy's llama2.c. The project reads the GGUF model format, uses a Llama 3 tokenizer, and supports Grouped-Query Attention. It supports F16, BF16 and F32 weights and several quantizations, including Q4_0, Q8_0 and K-quant formats. It uses Java's Vector API for fast matrix operations, and has a simple command line with chat and instruct modes. GraalVM native image support and ahead-of-time model pre-loading are included for fast startup. The README says the project is also used to test compiler optimizations on the JVM, particularly Graal. The README links the models to download from Hugging Face, and includes a section for a talk given at Devoxx Belgium in 2024. Java developers who want to run a small local language model without Python are the intended audience.…
Highlights
- Llama 3, 3.1 and 3.2 inference in Java
- Single file with no dependencies
- GGUF model format support
- Quantized weights including Q4_0 and Q8_0
- Chat and instruct command-line modes
Ratings & Reviews
No ratings yet
Be the first to rate Llama3.java.
People also visit
Llama3.java FAQ
What is llama3.java?
A Llama 3 inference program written in pure Java, in a single file with no dependencies.
Which models does it run?
Llama 3, 3.1 and 3.2, in GGUF format, according to the README. Models are downloaded from Hugging Face.
Does it need Python?
No. The README describes it as pure Java.
How do I use it?
Use the command line with --chat or --instruct modes, after downloading a supported GGUF model.
What are the best Llama3.java alternatives?
Popular alternatives to Llama3.java include Llamafile, llama.cpp and Janas. See all Llama3.java alternatives

