Getting started
This page takes you from a fresh clone to a song, its lyrics and its cover art, made by three engines in one JVM. Then it shows what your own application needs.
What you need
Section titled “What you need”-
JDK 25. Kiln uses the Foreign Function & Memory API, final since Java 22; it is built and tested on 25.
-
CMake, Ninja and a C++17 compiler, to build the engines.
-
The SDK for your GPU backend. For Vulkan, the Vulkan headers,
glslcand SPIRV-Headers. On Fedora:Terminal window sudo dnf install vulkan-headers vulkan-loader-devel glslc spirv-headers-develChoosing a GPU backend lists what HIP, CUDA and Metal need.
-
The Hugging Face CLI (
hf), to download weights.
Build and run
Section titled “Build and run”-
Build the native libraries.
Terminal window git clone https://github.com/liberation-data/kiln.git && cd kilnnative/build.sh vulkan # or hip | cuda | metal | cpunative/build.shclones each engine at the commit pinned innative/engines.propertiesintoengines-src/, applies Kiln’s patches, and writes one library per engine tobuild/native/<os>-<arch>-<backend>/, for examplebuild/native/linux-x86_64-vulkan/libkiln_llama.so. The first build takes a while.To build only some engines, list them after the backend:
native/build.sh vulkan llama tts. The engines arellama,tts,sd,acestep,yue2andwhisper. -
Build the Java modules.
Terminal window ./gradlew buildThe Gradle build points the examples and tests at
build/native/<os>-<arch>-vulkan/. For another backend, add-Pkiln.backend=hip(orcuda,metal,cpu) to any Gradle command. -
Fetch the weights for the demo.
Terminal window hf download unsloth/Qwen3-4B-Instruct-2507-GGUF Qwen3-4B-Instruct-2507-Q4_K_M.ggufhf download Serveurperso/ACE-Step-1.5-GGUF acestep-5Hz-lm-4B-Q8_0.gguf Qwen3-Embedding-0.6B-Q8_0.gguf \acestep-v15-turbo-Q8_0.gguf vae-BF16.ggufhf download black-forest-labs/FLUX.2-klein-base-4b-fp8 flux-2-klein-base-4b-fp8.safetensorshf download Comfy-Org/flux2-dev split_files/vae/flux2-vae.safetensorshf download Comfy-Org/z_image_turbo split_files/text_encoders/qwen_3_4b.safetensorsKiln never downloads anything itself. See Finding weights for where it looks.
-
Run the demo.
Terminal window ./gradlew singleOne Java program has Qwen3 4B write a short country song, ACE-Step 1.5 sing it, and FLUX.2 [klein] paint its cover. It writes
single/single.wav,single/cover.pngandsingle/lyrics.txt. Pass your own idea with--args='out-dir "what the song is about"'.
More examples
Section titled “More examples”Each example is a Gradle task in kiln-examples. Model options are passed as -P properties.
./gradlew chat --args='"Write a haiku about a kiln"'./gradlew speak --args='out.wav "Hello from the JVM" bm_george' # -Pmodel=zonos3|lfm3-audio|chatterbox-turbo|..../gradlew image --args='klein out.png "a neon sign that says KILN"' -Psteps=12 -Pwidth=768 -Pheight=768./gradlew song --args='song.wav' # -Pdit=xl-turbo for the larger model./gradlew yue2 --args='yue2-song.wav'./gradlew video --args='clip.mp4 "a potter at a wheel, warm light"'The song examples read the requests in kiln-examples/src/main/resources/requests/; pass your own JSON as a second
argument. Each guide lists the weights its example needs.
Finding weights
Section titled “Finding weights”HfCache finds files that hf download has already put in the Hugging Face cache. It looks in HF_HUB_CACHE, then
$HF_HOME/hub, then ~/.cache/huggingface/hub.
import org.liberationdata.kiln.HfCache;
import java.nio.file.Path;import java.util.Optional;
// The file inside any downloaded snapshot of the repository, if there is one.Optional<Path> maybe = HfCache.find("unsloth/Qwen3-4B-Instruct-2507-GGUF", "Qwen3-4B-Instruct-2507-Q4_K_M.gguf");
// The same, or an IllegalStateException that names the hf download command to run.Path gguf = HfCache.require("unsloth/Qwen3-4B-Instruct-2507-GGUF", "Qwen3-4B-Instruct-2507-Q4_K_M.gguf");
// The first of several (repository, path) pairs that is present.Path encoder = HfCache.requireAny( "Comfy-Org/Qwen-Image_ComfyUI", "split_files/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors", "Comfy-Org/HunyuanVideo_1.5_repackaged", "split_files/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors");You don’t have to use it: every model class takes plain file paths.
In your own application
Section titled “In your own application”Your app needs the Kiln modules on its classpath, the native libraries where Kiln can find them, and permission to make native calls.
java -Dkiln.library.path=build/native/linux-x86_64-vulkan \ --enable-native-access=ALL-UNNAMED -jar your-app.jarKiln looks for each library (libkiln_llama.so, or .dylib on macOS) in this order:
-Dkiln.<name>.lib=<file>: an exact file, for example-Dkiln.kiln_llama.lib=/opt/kiln/libkiln_llama.so;- each directory in
-Dkiln.library.path(separated by your platform’s path separator); - each directory in the
KILN_LIBRARY_PATHenvironment variable; - a Kiln natives jar on the classpath (see Maven and Gradle);
- the platform loader’s path (
LD_LIBRARY_PATH,DYLD_LIBRARY_PATHand the system directories).
If it finds none, the first use of that engine’s model class fails with an UnsatisfiedLinkError that says where it
looked.
Set KILN_VERBOSE=1 to see the engines’ own logs; they are quiet by default, apart from errors.
Kiln Studio
Section titled “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 models in your Hugging Face cache.
Models aren’t included: fetch them with hf download as above.
The latest release is alpha 0.1.0:
- macOS, Apple silicon (.dmg) 197 MB
- macOS, Intel (.dmg) 207 MB
- Linux x64, Debian / Ubuntu (.deb) 194 MB
- Linux x64, Fedora / RHEL (.rpm) 164 MB