Same engines
The native runners themselves
Kiln calls llama.cpp, stable-diffusion.cpp, acestep.cpp, yue2.cpp and whisper.cpp directly: the same C/C++ engines the CLIs and servers use, so you get their speed and their model support.

Open generative models for the JVM
Call models as plain Java methods, on your GPU, inside your JVM.
NewWatch · 2:31: Kiln in two minutesEarly · Apache 2.0 · a Liberation Data project · Download Kiln Studio
Zero overhead
Straight from the JVM to the GPU.
Kiln runs open-weight models in-process, through Java’s Foreign Function & Memory API: language and vision models, speech, images, songs and video, for business, industrial, medical and creative work, or anywhere a specialized model earns its keep. A model is an object, a generation is a method call, and the weights stay on your GPU between calls. There is no Python, no model server, no HTTP, no JSON round trip and no second process.


Kiln in two minutes: open generative models inside your JVM. With captions.
Same engines
Kiln calls llama.cpp, stable-diffusion.cpp, acestep.cpp, yue2.cpp and whisper.cpp directly: the same C/C++ engines the CLIs and servers use, so you get their speed and their model support.
Vulkan today
Vulkan on AMD, Intel and NVIDIA. The same build script knows ROCm, CUDA and Metal, and your Java code doesn’t change when you switch.
One process
A Kiln call is a native function call. Weights stay resident between calls, and tokens stream back to a Java callback as they are produced.
Plain Java API
Open a model in a try-with-resources block, call it as often as you like, and close it to give the memory back.
AutoCloseable: weights are freed on close().System.out::print.chatJson: OpenAI-style messages and tools in, tool_calls out.BufferedImage.// The weights load onto the GPU once, and stay there until close()
try (var llm = new LlamaModel("Qwen3-4B-Instruct-2507-Q4_K_M.gguf")) {
// Tokens stream to your callback as they are produced
llm.chat(List.of(Message.user("Name a country song about a robot.")),
Options.DEFAULT, System.out::print);
}// OpenAI-style messages and tools in, an OpenAI-style message out
String res = llm.chatJson("""
{"messages": [{"role": "user",
"content": "What's the weather in Nashville right now?"}],
"tools": [{"type": "function", "function": {
"name": "get_weather", "description": "Current weather for a city",
"parameters": {"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]}}}],
"temperature": 0, "max_tokens": 128, "seed": 1}""",
null); // or a callback, to stream
// res has content, reasoning_content and tool_calls:
// here, finish_reason "tool_calls" and get_weather for Nashvilletry (var songs = new AceStepModel(lm, textEncoder, dit, vae, true)) {
songs.generate(requestJson).audio().writeWav(new File("song.wav"));
}try (var images = new DiffusionModel(DiffusionModel.Config.builder()
.diffusionModel(flux).vae(vae).llm(textEncoder).build())) {
BufferedImage img = images.generate(
new DiffusionModel.Request("a neon sign", 1024, 1024, 20, 4.0, 7)).get(0);
}Kiln doesn’t download anything: HfCache finds weights in your Hugging Face cache, or pass file paths.
Engines and models
Each module binds one engine. Use one, or put several in the same JVM.
Text
on llama.cpp
Any GGUF language model, and vision models that read images.
Speech
on llama.cpp
Text to speech, with built-in voices or a reference clip.
Images
Diffusion models, including image editing.
Songs
on acestep.cpp
Songs with vocals and lyrics, up to several minutes long.
Songs
on yue2.cpp
Songs, from the engine’s own JSON request.
Transcripts
on whisper.cpp
Speech to text, with a start and end for every word.
Check each model’s license before you use what it makes. Some are non-commercial: YuE2’s weights are CC BY-NC 4.0, for example.
Measured
Everything here ran from Java on Linux, on an AMD Radeon 8060S (Ryzen AI Max+ 395 “Strix Halo”, 128 GB unified memory) with the Vulkan backend.
Backends:
The build script knows the ROCm, CUDA and Metal backends of the underlying engines, but those Kiln builds haven’t been tested yet. Reports and fixes welcome.
| Model | Result |
|---|---|
| Qwen3 4B Instruct (Q4_K_M) | ~60 tokens/s |
| ACE-Step 1.5 XL turbo | 3 min 20 s song in 57 s |
| ACE-Step 1.5 turbo | 60 s song in ~15 s |
| YuE2 3B (Q8_0) | 60 s song in ~60 s |
| FLUX.2 [klein] base 4B (fp8) | 768×768, 12 steps in ~130 s |
| Qwen-Image 2512 (fp8) | 1024×1024, 20 steps in ~13 min |
| Whisper large-v3-turbo (q5_0) | 55 s of speech in 1.8 s, timed word by word |
Against ComfyUI
ACE-Step 1.5 turbo with its 4B LM, writing a 60 s song, on the same machine. Cold is the first run with nothing loaded, weights included. Warm is the second run with the weights resident (seed + 1, so ComfyUI doesn’t return its cached result).
Not quite like for like: ComfyUI ran the bf16 safetensors DiT, Kiln the GGUF Q8_0 weights. One run each, from kiln-bench.
Kiln Studio
Kiln Studio is a desktop app around Kiln: chat with a GGUF model and watch the tokens per second, watch it call tools, make an image or a song, and see what is loaded and how much memory it holds. It runs Kiln in a JVM of its own, with its own Java, and finds the models in your Hugging Face cache.
![Kiln Studio in its dark theme with two windows on its desktop. Behind, the Chat window: Qwen3 4B Instruct answering a request for a haiku about a kiln and one sentence on what a kiln is for, at 68.7 tokens a second, with its time to the first token and token counts. In front, overlapping it, the Image window: FLUX.2 [klein] with its prompt, size and steps, and the image it made, a kiln's orange fire beside shelves of stoneware jars, generated in 2 minutes 17 seconds over 12 steps](/_astro/studio-desktop.DbBnh5CU_Z17NzIP.webp)
Download Kiln Studio.Alpha 0.1.0. Models are not included: fetch them with the Hugging Face CLI, as in Getting started. The macOS builds are signed and notarized, so they open without a Gatekeeper prompt.
Open the .dmg and drag Kiln Studio to Applications.
Or paste one of these into a terminal: it fetches the package and installs it (a software-centre double-click can't open a local package). Needs your GPU's Vulkan driver.
Every release, and its notes, are on GitHub.
How it works
Each engine is built into a single shared library with its own ggml linked in statically and kept private. The engines pin different ggml versions, and this is what lets several of them share one process.
Has a key/value C API, so kiln-sd binds it directly.
Its C API passes structs by value and is mid-migration to a new batch API, so kiln-llama binds a small, stable C layer instead.
C++ only, so each gets a C layer of about a hundred lines: a JSON request in, PCM audio out.
LlamaModel.chatJson takes messages and tools in OpenAI’s format and returns a message with content, reasoning_content and tool_calls. It uses the model’s own chat template and tool-call format, with the same templates and parsers as llama-server.
Keeps models resident between uses, the way ComfyUI does. It unloads idle models least recently used first to stay within a memory budget, can unload after an idle timeout, and gives each model one user at a time.
The Java is the same for every backend. native/build.sh builds the libraries for the one you name.
A long GPU dispatch can trip a laptop driver’s compute timeout, so ACE-Step audio is decoded in 512-frame tiles. Tune it with KILN_ACESTEP_VAE_CHUNK.
Set KILN_VERBOSE=1 to see what llama.cpp, stable-diffusion.cpp and friends print.
Embabel
Embabel Agent plans with goals and actions on the JVM. Kiln runs local models in the same process: chat and tool calls, vision, speech, images, songs and video. Akiln-embabel module, to give Embabel's agents those models, isin progress.
Getting started
Kiln is on Maven Central as org.kiln4j. You need Java 22 or newer (Kiln 0.1.0 itself needs 25), and on Linux your GPU’s Vulkan driver, which desktop installs already have (if not: Installing GPU drivers). Macs need nothing more.
An engine module, and the natives jar for your OS and GPU. Kiln unpacks the engine into its cache and loads it, so there’s no native build. Maven works the same way: see Maven and Gradle.
// build.gradle.kts: an engine module, and the natives jar for the OS and arch building it
val natives = when {
!System.getProperty("os.name").startsWith("Mac") -> "linux-x86_64-vulkan"
System.getProperty("os.arch") == "aarch64" -> "macos-aarch64-metal"
else -> "macos-x86_64-metal"
}
dependencies {
implementation("org.kiln4j:kiln-llama:0.1.0")
runtimeOnly("org.kiln4j:kiln-natives-$natives:0.1.0")
}With the Hugging Face CLI. Kiln downloads nothing itself: HfCache finds the weights in HF_HUB_CACHE, HF_HOME/hub or ~/.cache/huggingface/hub.
hf download unsloth/Qwen3-4B-Instruct-2507-GGUF Qwen3-4B-Instruct-2507-Q4_K_M.ggufA chat reply, streamed token by token from your GPU, inside your JVM. samples/hello-kiln is this as a project to copy, for Gradle and Maven.
var weights = HfCache.find("unsloth/Qwen3-4B-Instruct-2507-GGUF",
"Qwen3-4B-Instruct-2507-Q4_K_M.gguf").orElseThrow();
try (var llm = new LlamaModel(weights.toString())) {
llm.chat(List.of(Message.user("Write a haiku about a kiln.")),
Options.DEFAULT, System.out::print);
}
// run with --enable-native-access=ALL-UNNAMEDFor HIP or CUDA, or to run the repository’s examples: JDK 25, CMake, Ninja, a C++17 compiler and your GPU’s SDK. native/build.sh clones the engines at their pinned commits; point your app at the result with -Dkiln.library.path.
native/build.sh vulkan # or hip | cuda | metal | cpu
./gradlew build
./gradlew single # an LLM writes a song, ACE-Step sings it, FLUX.2 klein paints the cover
./gradlew image --args='klein out.png "a neon sign that says KILN"'Roadmap
kiln-embabel: an Embabel Agent LlmService and LocalModelSource.mlx-c.Flow streaming.Things on the JVM are about to heat up
Open models as Java objects, on your own GPU. Kiln is early: try it, and tell us what breaks.