Local Models & the local-runtime Extension
Kompile lets you run open-weight LLMs, dense embeddings, rerankers, OCR/vision models, and local knowledge graph reasoning directly on your own CPU or GPU hardware — without forcing heavy ML dependencies onto every developer laptop.
By default, Kompile installs as a tiny, backend-agnostic cli-harness. When you want first-party local models on a machine, you overlay Kompile's main local extension: local-runtime (kompile-local-runtime).
In this section (recommended reading order)
| Order | Page | What it covers |
|---|---|---|
| 1 | Local Models & local-runtime (this page) | Installing the local-runtime overlay, hardware detection, kompile local-models, and lease-pooled local chat |
| 2 | How the Local Runtime Works | Platform spins, hardware/compiler backends (Triton, Vulkan, CPU-MLIR, MLX, OpenVINO, ZLUDA), and DynamicShapePlan (DSP) |
| 3 | Embeddings, Serving & Pipelines | How Kompile uses the runtime for RAG embeddings, semantic memory, local LLM serving, OCR/VLMs, and subprocess isolation |
| 4 | Import, Optimization, Fine-Tuning & Abliteration | Inline model_runtime MCP workflows + 23-pass GraphOptimizer, Triton compiler, 8 PEFT methods (LoRA/QLoRA/DoRA/IA³), distillation, 6 alignment algorithms, and training-free abliteration |
| 5 | Model Staging | Dedicated model lifecycle service (:8090) with Angular UI, REST API, .karch archives, and 90+ staging_* MCP tools |
| 6 | Kompile Server · Web UI · REST API | Full multi-process web application (:8080 / :8081 / :8082) for teams and persistent document search |
The main local extension: local-runtime
kompile-local-runtime is the backend-coupled companion overlay that adds Eclipse DL4J / ND4J native acceleration, local model serving, dense embeddings, local document crawling, and knowledge graph reasoning onto a slim cli-harness install.
Check hardware detection & status
kompile install local-runtime --status
kompile local-models statusKompile probes your host platform and hardware (RemoteInstallProbe) and reports the detected backend (cpu, cpu-avx2, cuda-12.6, cuda-12.9, cuda-13.1, vulkan, zluda, zluda-rocm-7.2.4, hexagon, tpu), whether lib/kompile-local-runtime.jar is installed, whether kompile-model-serving is present, and whether kompile-model-staging is reachable on :8090.
Install local-runtime
# Auto-detect host hardware and install the matching backend overlay
kompile install local-runtime
# Or pin a specific hardware backend profile explicitly
kompile install local-runtime --backend cuda-12.9
kompile install local-runtime --backend cpu-avx2
kompile install local-runtime --backend zluda
# Install from a configured mirror / S3 / R2 / local directory source
kompile install local-runtime --from-source <source-name>
# Install from a local JAR / ZIP artifact or build from a Kompile checkout
kompile install local-runtime --local /path/to/kompile-local-runtime.jar
kompile install local-runtime --build-from-source /path/to/kompile-repo
# Or sync local-runtime directly from a paired peer over pinned TLS
kompile sync <peer> --artifacts local-runtimeKompile stages the overlay at <install-root>/lib/kompile-local-runtime.jar with metadata in .local-runtime-info.json. It activates automatically on the next kompile invocation — no extra config flags required.
What local-runtime unlocks automatically
kompile-local-runtime bundles kompile-embedding-anserini (io.anserini:anserini Lucene + SameDiff dense encoders), 18+ document & external source loaders (PDF, Office, Mail/IMAP/Gmail, Slack, Discord, Drive, OneDrive, Confluence, Jira, Notion, Reddit), kompile-graph-reasoning (.kgraph), local serving, and pipelines. That means single-machine local RAG, document search, and knowledge graphs only need local-runtime — no kompile-app server is required, and semantic_memory automatically upgrades from TF-IDF to dense SameDiff embeddings.
When kompile-local-runtime is present on the classpath (InstalledCliExtensions.isLocalRuntimePresent()), Kompile activates five built-in extension families (OptionalToolAvailability.LOCAL_RUNTIME_EXTENSION_IDS):
| Extension ID | Capabilities & MCP Tools Unlocked |
|---|---|
builtin.model | First-party kompile-local chat model serving, model_runtime, subprocess_watchdog, vlm_model_definition (in chat) |
builtin.knowledge | Anserini SameDiff dense embeddings + local hybrid semantic/lexical RAG & .kgraph evidence: knowledge_search, knowledge_status, rag_search, graph_search |
builtin.graph | Local probabilistic knowledge graphs & reasoning: knowledge_graph, ask_graph_*, graph_reason, graph_bayes, graph_embeddings, graph_simulate, process_mining, graph_import/export |
builtin.crawl | Offline document ingestion & extraction: crawl_source, crawl_documents, crawl_discover, crawl_control, crawl_result |
builtin.pipeline | Local unified ML pipelines: pipeline |
TIP
Testing slim/remote-only mode without uninstalling: Set KOMPILE_CLI_REMOTE_ONLY=true (or -Dkompile.cli.remoteOnly=true) to hide the local-runtime built-in extensions for one session without removing the JAR. Set KOMPILE_CLI_REMOTE_ONLY=minimal to also suppress builtin.code.
Managing local models (kompile local-models)
kompile local-models (alias kompile local-model) handles HuggingFace discovery, downloads, cached inventory, standalone model daemons, and peer-hosted models from both slim and full installs:
# 1. Search HuggingFace (defaults to GGUF-ready repos; pass --no-gguf-only for all formats)
kompile local-models search "Qwen2.5-Coder" --limit 10
# 2. Download a model repository into the local cache
kompile local-models download Qwen/Qwen2.5-0.5B-Instruct-GGUF
# Optional: pin a branch/tag/commit with --revision <ref>
# 3. Inspect locally available models (HF cache, ~/.kompile/models, dist models, staging)
kompile local-models list
# 4. Start or stop a persistent local model server
kompile local-models start Qwen/Qwen2.5-0.5B-Instruct-GGUF --port 8091
kompile local-models stop Qwen/Qwen2.5-0.5B-Instruct-GGUF
# Delegate serving to kompile-model-staging (:8090) instead of standalone ServingSubprocessMain
kompile local-models start Qwen/Qwen2.5-0.5B-Instruct-GGUF --via-staging
# 5. Remove a cached model
kompile local-models remove Qwen/Qwen2.5-0.5B-Instruct-GGUF --yes(Pass --json to any kompile local-models command for machine-readable output.)
Where models are stored & gated HuggingFace repos
- Pipeline / HuggingFace cache:
~/.cache/kompile/models/pipelines(override with-Dkompile.models.cacheDir=/path). - Additional discovery roots (
KompileLocalModels):~/.kompile/models, distribution-bundled models, and the active project'sdata/modelsregistry. - Gated HuggingFace models: Kompile resolves tokens from
HF_TOKEN,HUGGING_FACE_HUB_TOKEN, or a storedhuggingfacecredential inkompile auth.
Chatting with local models (kompile-local)
Interactive setup or direct launch
# Interactive setup wizard — pick "Kompile local model", choose a cached model,
# download directly from HuggingFace, or point at a local file/directory
kompile chat --setup
# Or launch directly against a cached local model
kompile chat --provider kompile-local --model Qwen/Qwen2.5-0.5B-Instruct-GGUF --localGPU safety & lease pooling (LocalServingRuntimePool)
Running local LLMs alongside background crawls and subagents can easily OOM a GPU if every caller spawns its own model process. Kompile prevents this with a shared request-scoped lease pool:
- Default capacity = 1 resident model runtime per CLI JVM (
-Dkompile.model.pool.maxRuntimes=1): Chat, MCP crawl, and harness callers share a compatible running subprocess instead of loading duplicate GPU weights. - Keep-warm idle window: Unused runtimes stay warm for 120 seconds (
-Dkompile.model.pool.idleMs=120000) and then release GPU/RAM automatically; long-lived chat sessions hold a lightweight reconnectableBindingand re-acquire a lease on the next turn. - Prefix caching: Standard local chat enables up to 128 MB of local prompt-prefix cache (
STANDARD_CHAT_PREFIX_CACHE_MAX_BYTES) so multi-turn turns stay snappy.
resolve_model & subagents with kompile-local
- Stays local automatically:
SubagentChatConfigexplicitly disables cross-provider auto-routing forkompile-local, so local model IDs are never silently sent to a remote cloud API. - Zero-credential worker route: Local models require no cloud API key (
auth=none), makingkompile-locala zero-cost option for lightweight local subagents or offline sessions:text(Tip: keep/subagent-config route kompile-local/Qwen/Qwen2.5-7B-Instruct-GGUF auth=none /subagent-config max 1/subagent-config max 1or2when sharing a single GPU so local workers don't contend on VRAM.)
Sharing local models across machines (kompile-peer)
Have one workstation with a big GPU and a slim laptop without local-runtime installed? You don't need to install local-runtime on the laptop:
# On the GPU host (with local-runtime installed): expose local models to paired peers
kompile peer listen --allow-models --yes
# On the laptop (slim cli-harness only): discover and chat with peer-hosted models
kompile local-models peers
kompile chat --provider kompile-peer --model <peer>/<model-id>See Peer Sync for pairing devices over pinned TLS and syncing local-runtime or serving artifacts between machines.
Three ways to run local models in Kompile
| Approach | Best For | How to Start |
|---|---|---|
1. kompile-local + local-runtime (standalone) | Local chat, embeddings, crawls, and graph reasoning directly from the CLI with zero background server setup | kompile install local-runtime → kompile chat --provider kompile-local |
2. kompile-model-staging (:8090 / --via-staging) | Full model lifecycle: converting GGUF/ONNX/TF → SameDiff (.sdnb/.sdz), LoRA/PEFT training, Triton graph optimization, .karch archives, hot-swapping production models | Model Staging Guide |
| 3. External OpenAI-compatible local server | Existing Ollama, vLLM, llama.cpp, or LM Studio servers you already run | kompile chat --provider custom --base-url http://127.0.0.1:11434/v1 --auth none --model <model> |
Next steps
- Model Staging — conversion pipelines,
.karcharchives, LoRA fine-tuning, and REST serving on:8090 - Model Management CLI —
kompile model download/convert/export/importand built-in embedding/reranker/VLM catalogs - Peer Sync — sharing
local-runtimeartifacts and peer-hosted GPU models across machines - Quickstarts by Audience — pairing local models with Codex, Claude, Antigravity, OpenRouter, Fireworks, or Together AI