Skip to main content

KernelLoom

Tests PyPI Python License

KernelLoom runs GGUF and OpenVINO GenAI models on the machine where you start it. It provides a Python API, a small HTTP service, and local RAG components. KernelLoom is alpha software; verify the exact model, runtime, and hardware combination before production use.

The recommended surfaces are the model API, the server, and the RAG pipeline. The lower-level compiler, scheduling, and hardware-planning modules are useful for experiments and host applications, but they are not a promise that every model format can be generated on every device.

What is included

  • GGUF execution through llama.cpp, with CPU tuning, model warmup, and bounded embedding/token caches.
  • OpenVINO GenAI execution through an isolated local worker for exported model directories.
  • A named-model HTTP service with OpenAI-style chat, completion, embedding, and streaming endpoints.
  • A browser control page for model configuration, warm/cache controls, hardware inspection, CPU plans, and RAG collections.
  • Document loading, chunking, local SQLite or optional FAISS retrieval, plus adapters for custom embedders and vector stores.
  • A LangChain chat and embedding adapter for local GGUF models.

Install

Choose the pieces you use rather than installing every optional dependency:

pip install kernelloom
pip install "kernelloom[llama]"              # GGUF execution
pip install "kernelloom[server]"             # HTTP API and browser page
pip install "kernelloom[genai]"              # OpenVINO GenAI text generation
pip install "kernelloom[openvino]"           # generic OpenVINO / ONNX tooling
pip install "kernelloom[langchain]"          # LangChain adapter
pip install "kernelloom[fastembed]"          # local ONNX embedding models
pip install "kernelloom[faiss]"              # local native vector search
pip install "kernelloom[rag]"                # FastEmbed and FAISS together
pip install "kernelloom[all]"                # all of the optional integrations above

[all] is convenient but large. Install it only when the runtime dependencies are appropriate for the target machine.

Quick start

from kernelloom import KernelLoomModel, ModelConfig

config = ModelConfig(
    model_path="./models/qwen2.5-3b-instruct-q4_k_m.gguf",
    model_id="local-chat",
    cpu_profile="latency",
    reserve_cores=1,
    auto_batch_size=True,
    warmup=True,
)

with KernelLoomModel(config) as model:
    print(model.invoke("Explain KV caches in two short paragraphs."))

The CPU profile is a reproducible starting point, not a benchmark result. Measure the model, quantization, context length, and representative prompts on the deployment hardware. See the CPU-first guide.

Local server and browser control

pip install "kernelloom[server,llama]"
kernelloom serve --host 127.0.0.1 --port 11435

Open http://127.0.0.1:11435/. The page uses the same API as applications and does not save settings by itself. It can load and update resident models, show cache and warmup state, inspect local hardware, apply a CPU plan, stream a chat response, and create a RAG collection from already-loaded models.

curl http://127.0.0.1:11435/v1/models/load \
  -H "Content-Type: application/json" \
  -d '{"model_path":"./models/model.gguf","model_id":"local","device":"CPU"}'

The server has no authentication until KERNELLOOM_API_KEY is set. Keep it on loopback for development. If it is reachable by other machines, use a strong key, TLS, firewall rules, and a process account restricted to the model and knowledge paths you intend to expose.

Local RAG

Use separate chat and embedding models. The built-in SQLite store is persistent and simple; the optional FAISS store is an in-memory exact-search store with native vector math. For large collections or approximate nearest-neighbor search, supply a database adapter that fits the workload.

from kernelloom import KernelLoomModel, ModelConfig, RAGConfig, RAGPipeline

chat = KernelLoomModel("./models/chat.gguf")
embeddings = KernelLoomModel(ModelConfig("./models/embed.gguf", embedding=True))
rag = RAGPipeline.local(
    chat,
    embeddings,
    database="./data/knowledge.db",
    config=RAGConfig(namespace="docs", retrieval="mmr", top_k=5, fetch_k=15),
)

try:
    rag.ingest("./docs", metadata={"audience": "developers"})
    answer = rag.ask("How do I start the API?", filters={"audience": "developers"})
    print(answer.answer)
    print(answer.to_dict()["sources"])
finally:
    rag.close()
    chat.close()
    embeddings.close()

RAGAnswer.sources is the retrieval trace. A generated answer can mention source labels in its prompt, but KernelLoom does not verify or enforce citations in model output. Read the RAG guide for persistence, filters, FAISS, custom stores, and server routes.

Local boundary

Core GGUF and OpenVINO execution use local files and local native runtimes. Optional integrations have their own behavior: FastEmbed can download a chosen embedding model on first use unless it is already cached, and custom embedders or vector stores may send text elsewhere. Review each integration before using it in an air-gapped or sensitive environment.

Command line

kernelloom run ./models/model.gguf "Write a haiku about compilers."
kernelloom chat ./models/model.gguf
kernelloom benchmark ./models/model.gguf "Explain KV caches" --runs 5
kernelloom embed ./models/embedding-model.gguf "document text"
kernelloom warm ./models/model.gguf --cpu-profile latency
kernelloom cpu-plan --profile throughput
kernelloom inspect ./models/model.gguf
kernelloom hardware
kernelloom doctor

Documentation

Development and releases

git clone https://github.com/awais-akhtar/kernelloom.git
cd kernelloom
python -m venv .venv
python -m pip install -e ".[dev,langchain,server]"
python -m pytest
python -m build
python -m twine check dist/*

The release workflow is configured to test and attempt a PyPI publish on pushes to main. It builds a unique post-release version, for example 0.4.0.post12; a successful upload still depends on GitHub environment approval, the PyPI token, package validation, and PyPI availability.

KernelLoom is available under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kernelloom-0.4.0.post4.tar.gz (148.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kernelloom-0.4.0.post4-py3-none-any.whl (126.1 kB view details)

Uploaded Python 3

File details

Details for the file kernelloom-0.4.0.post4.tar.gz.

File metadata

  • Download URL: kernelloom-0.4.0.post4.tar.gz
  • Upload date:
  • Size: 148.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kernelloom-0.4.0.post4.tar.gz
Algorithm Hash digest
SHA256 c14a0fe0d9aec55d8b98c6560c2ec3632ef473ec3c026d2da54f7d2432647fb2
MD5 3a30a7959d6d7a7f96ac2d26404bbe94
BLAKE2b-256 99c7524dadf07bd2cf604371a84d6c981538c8fd714da10c839c097c38a4beed

See more details on using hashes here.

File details

Details for the file kernelloom-0.4.0.post4-py3-none-any.whl.

File metadata

File hashes

Hashes for kernelloom-0.4.0.post4-py3-none-any.whl
Algorithm Hash digest
SHA256 12188d72d5a5807a9393abf6d19a238855cc6340da4461a0e072b9bef8e0e508
MD5 807ea6c07cce5eec1ad30ec0f5afa49a
BLAKE2b-256 ef12144d8360b78a14bbefc684406a9a05f3913c5992169780b9b4cca2cf2a19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page