Skip to content

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).

OrderPageWhat it covers
1Local Models & local-runtime (this page)Installing the local-runtime overlay, hardware detection, kompile local-models, and lease-pooled local chat
2How the Local Runtime WorksPlatform spins, hardware/compiler backends (Triton, Vulkan, CPU-MLIR, MLX, OpenVINO, ZLUDA), and DynamicShapePlan (DSP)
3Embeddings, Serving & PipelinesHow Kompile uses the runtime for RAG embeddings, semantic memory, local LLM serving, OCR/VLMs, and subprocess isolation
4Import, Optimization, Fine-Tuning & AbliterationInline model_runtime MCP workflows + 23-pass GraphOptimizer, Triton compiler, 8 PEFT methods (LoRA/QLoRA/DoRA/IA³), distillation, 6 alignment algorithms, and training-free abliteration
5Model StagingDedicated model lifecycle service (:8090) with Angular UI, REST API, .karch archives, and 90+ staging_* MCP tools
6Kompile Server · Web UI · REST APIFull 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 ​

bash
kompile install local-runtime --status
kompile local-models status

Kompile 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 ​

bash
# 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-runtime

Kompile 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 IDCapabilities & MCP Tools Unlocked
builtin.modelFirst-party kompile-local chat model serving, model_runtime, subprocess_watchdog, vlm_model_definition (in chat)
builtin.knowledgeAnserini SameDiff dense embeddings + local hybrid semantic/lexical RAG & .kgraph evidence: knowledge_search, knowledge_status, rag_search, graph_search
builtin.graphLocal probabilistic knowledge graphs & reasoning: knowledge_graph, ask_graph_*, graph_reason, graph_bayes, graph_embeddings, graph_simulate, process_mining, graph_import/export
builtin.crawlOffline document ingestion & extraction: crawl_source, crawl_documents, crawl_discover, crawl_control, crawl_result
builtin.pipelineLocal 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:

bash
# 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's data/models registry.
  • Gated HuggingFace models: Kompile resolves tokens from HF_TOKEN, HUGGING_FACE_HUB_TOKEN, or a stored huggingface credential in kompile auth.

Chatting with local models (kompile-local) ​

Interactive setup or direct launch ​

bash
# 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 --local

GPU 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 reconnectable Binding and 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: SubagentChatConfig explicitly disables cross-provider auto-routing for kompile-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), making kompile-local a zero-cost option for lightweight local subagents or offline sessions:
    text
    /subagent-config route kompile-local/Qwen/Qwen2.5-7B-Instruct-GGUF auth=none
    /subagent-config max 1
    (Tip: keep /subagent-config max 1 or 2 when 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:

bash
# 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 ​

ApproachBest ForHow to Start
1. kompile-local + local-runtime (standalone)Local chat, embeddings, crawls, and graph reasoning directly from the CLI with zero background server setupkompile 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 modelsModel Staging Guide
3. External OpenAI-compatible local serverExisting Ollama, vLLM, llama.cpp, or LM Studio servers you already runkompile chat --provider custom --base-url http://127.0.0.1:11434/v1 --auth none --model <model>

Next steps ​

  • Model Staging — conversion pipelines, .karch archives, LoRA fine-tuning, and REST serving on :8090
  • Model Management CLI — kompile model download/convert/export/import and built-in embedding/reranker/VLM catalogs
  • Peer Sync — sharing local-runtime artifacts and peer-hosted GPU models across machines
  • Quickstarts by Audience — pairing local models with Codex, Claude, Antigravity, OpenRouter, Fireworks, or Together AI

Released under the Apache-2.0 License.