Back to directory

Gemma4.java

A fast, dependency-free inference engine for Google's Gemma 4 language models, written in a single pure-Java file with a GGUF parser and a command-line chat interface.

Gemma4.java

Gemma4.java is a single-file, zero-dependency inference engine for all Gemma 4 model families (E2B, E4B, 31B and the 26B-A4B mixture-of-experts variant), based on the existing llama3.java project. It includes its own GGUF format parser, supports several quantization types, uses Java's Vector API for matrix-vector kernels, and offers GraalVM Native Image support with ahead-of-time model preloading for faster first-token latency.

Models are downloaded from Hugging Face as GGUF files, and the engine can be run through jbang, which needs no manual clone or build, directly as a .java file, or built into a standalone jar with a provided Makefile; GraalVM can compile it to a native binary. It runs with a chat or prompt mode and a flag that controls a reasoning mode.

It requires Java 21 or newer and is released under the Apache-2.0 license.

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.