A library for running local LLMs. It can load GGUF and easily implement chat functionality. It also supports NPUs (QNN) for fast inference on the NPU.
Choose your platform and run your first local chat completion.
Install the ailia LLM Python package from PyPI.
pip3 install ailia_llm
Haven't installed Python or git yet? Start with Setting up your Python environment (Windows / Mac / Linux).
View on PyPIDownload example.py from ailia-models and run it. The script downloads the Gemma 4 E2B GGUF file on first run and streams a chat completion. For image input, audio input, function calling, or MTP (Multi-Token Prediction), fetch example_vlm.py, example_alm.py, example_tool_use.py, or example_mtp.py from the same folder instead.
wget https://raw.githubusercontent.com/ailia-ai/ailia-models/master/large_language_model/gemma4/example.py
python3 example.py
On Windows, use python instead of python3.
ailia LLM runs local language models on desktop and mobile platforms. Memory requirements scale with model size and quantization.
Minimal examples for streaming a chat completion in your own application.
import ailia_llm
model = ailia_llm.AiliaLLM()
model.open("gemma-4-E2B-it-Q4_K_M.gguf")
messages = [{"role": "user", "content": "あなたの名前は何ですか?"}]
for delta in model.generate(messages):
print(delta, end="")
Guides for NPU inference, tool use, and image and audio input.
Common questions about ailia LLM.
ailia LLM loads GGUF files, the format used by llama.cpp. You can convert Hugging Face checkpoints to GGUF with the convert_hf_to_gguf.py script bundled with llama.cpp, or download pre-converted GGUF weights from Hugging Face.
Llama, Gemma, Mistral, Qwen, Phi, DeepSeek, and other architectures supported by llama.cpp. Compatibility tracks the upstream llama.cpp project.
model.generate(messages) returns an iterator that yields delta strings as the model decodes each token. Iterate over it and append to a buffer (or print directly) for streaming UX.
Memory usage roughly equals the GGUF file size plus the KV cache and intermediate tensors. As a rule of thumb at Q4 quantization: 2B models ≈ 2 GB, 7B ≈ 5 GB, 13B ≈ 9 GB. Use smaller models or higher quantization (Q4 → Q3) on memory-constrained devices.
Yes. ailia LLM uses Metal on iOS and macOS, and Vulkan on Windows. (Unlike ailia SDK / Speech / Voice, ailia LLM does not require cuDNN.) Inference falls back to CPU when no GPU is available. See the Vulkan Setup Guide for details.
Yes. On supported Android and Windows on Arm devices, the QNN backend runs inference on the Hexagon NPU. A GGUF file is converted into an SoC-specific QNN Model on a PC and executed on the device. Gemma 4 E2B / E4B support text, image, and audio input, depending on the SoC. See the ailia LLM NPU (QNN) Guide for details.
Yes. ailia LLM supports VLMs with image input and ALMs with audio input. Load a compatible model and multimodal projector, then pass images or audio with ailiaLLMSetMultimodalPrompt or ailiaLLMSetPromptJson. Check the model's capabilities with ailiaLLMGetMultimodalCapabilities. See the Multimodal Guide for details.
Yes. ailia LLM 1.5.0 and later support Gemma 4 function calling. Define tools with ailiaLLMSetTools and pass the JSON history with ailiaLLMSetPromptJson. After generation, retrieve the response containing tool_calls with ailiaLLMGetResponseJson, then return each result as a message with the tool role. See the ailia LLM Tool Use Guide for details.
Model deep dives, release notes, and tutorials from the ailia tech blog.