Back to directory

Llama3.java

A single-file, pure Java implementation of Llama 3, 3.1 and 3.2 inference, built as a successor to llama2.java and used to test JVM compiler optimizations.

Llama3.java

Llama3.java implements Llama 3, 3.1 and 3.2 inference in a single Java file, with no external dependencies, as the successor to an earlier llama2.java project based on Andrej Karpathy's llama2.c. Beyond its educational value, the project is also used to test and tune compiler optimizations on the JVM, particularly for the Graal compiler.

It includes a GGUF format parser, a Llama 3-compatible tokenizer, grouped-query attention inference with ad-hoc RoPE scaling for Llama 3.1 and tied word embeddings for Llama 3.2, fast matrix-vector multiplication using Java's Vector API, and support for F16, BF16, F32 weights alongside several quantization formats. It runs through jbang, as a compiled jar built with a bundled Makefile, or with GraalVM Native Image, and includes an interactive chat and instruct mode.

More in Inference

See all 770
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • Lifeboat

    iterate.ai

    A local inference server that puts an OpenAI- and Anthropic-compatible API in front of open-weight language models running on hardware you control, from a laptop to a GPU cluster.

  • Claude S40

    github.com

    An unofficial Claude chat client for 2007-era Nokia Series 40 phones, built as a Java ME app plus a small Go relay server, with web search, reading mode and saved chats.