Skip to main content

Runtime & compute unit selection

Runtime

Choose the inference runtime via runtime_id:
Constants are exposed as RuntimeIdValue (LLAMA_CPP, QAIRT).

Compute unit

Friendly compute-unit aliases forwarded to geniex_resolve_device in the native SDK.
Qualcomm AI Engine Direct only supports NPU. Passing "cpu" or "gpu" with a Qualcomm AI Hub Model logs a warning and falls back to NPU — it won’t error.

Model manager

Models are pulled on-device through the bundled Rust model manager. Do not manually adb push weights — use ModelManagerWrapper.

ModelManagerWrapper

ModelPullInput

HubSource

ModelPaths

Returned by getPaths(). Feed fields directly into LlmCreateInput / VlmCreateInput:
Qualcomm AI Hub pulls on Android require an explicit chipset. The Rust side only auto-detects on Windows on Snapdragon. Use "SM8750" for Snapdragon 8 Elite or "SM8850" for Snapdragon 8 Elite Gen 5.

Data structures

LlmCreateInput

VlmCreateInput

ModelConfig

nGpuLayers is rewritten by the JNI based on compute_unit: cpu forces 0; gpu / npu / hybrid pass the value through (-1 = all layers).

ChatMessage

VlmChatMessage / VlmContent

GenerationConfig

The default maxTokens is 32. Most use cases should set a higher value (e.g. maxTokens = 2048).

LlmStreamResult


llama.cpp (GGUF models)

Runs any GGUF model on CPU, Adreno GPU, or Hexagon NPU. Compute-unit selection is controlled by compute_unit.

LLM

Compute-unit variants

VLM

GGUF VLMs need two artifacts: the LLM weights (model_path) and the vision projection (mmproj_path). Both come from getPaths():
Always pass t.formattedText (the chat-templated prompt) into generateStreamFlow, not the raw user text. The native pipeline treats the prompt as already-templated.

Qualcomm® AI Hub Models (NPU via Qualcomm AI Engine Direct)

Pre-compiled models from Qualcomm AI Hub. NPU-only, pinned to a specific chipset (SM8750 = Snapdragon 8 Elite, SM8850 = Snapdragon 8 Elite Gen 5).

Downloading Qualcomm AI Hub Models

Supported models

LLM

Qualcomm AI Engine Direct rejects nGpuLayers != 0 and nCtx != 0 with PARAM_NOT_SUPPORTED — the KV cache and context length are fixed at compile time by the Qualcomm AI Hub bundle. Leave both at defaults and use max_tokens / enable_thinking only.

VLM

Pass the chat-templated prompt (t.formattedText) to generateStreamFlow, never raw user text. Qualcomm AI Engine Direct VLM treats its prompt as already-templated — raw text produces degenerate output.

Need help?

GitHub Issues

File a bug, request a feature, or browse open issues.

Slack

Developer collaboration and resources.