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/*

Every PyPI release uses an explicit major.minor.patch version. Update the version to the next release (for example, 0.4.0 to 0.4.1), commit it, and push it to main. The publish workflow checks PyPI first and stops if that version already exists, so the next release must be bumped normally instead of reusing the same release number. 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.1.tar.gz (149.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.1-py3-none-any.whl (126.0 kB view details)

Uploaded Python 3

File details

Details for the file kernelloom-0.4.1.tar.gz.

File metadata

  • Download URL: kernelloom-0.4.1.tar.gz
  • Upload date:
  • Size: 149.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.1.tar.gz
Algorithm Hash digest
SHA256 9644bb460e84ad335c44645f0d59d9866064b09b56180f9fe723b93f2be689e2
MD5 a405d662ad8a03b0b7ad469782f4ca50
BLAKE2b-256 189565739ff513c0365385cca5572ab666170763b8f6d68048309bca3326672c

See more details on using hashes here.

File details

Details for the file kernelloom-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: kernelloom-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 126.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kernelloom-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da7f6389a4ee2bedcda36c276cc61fd6ed643dcabc8f6742c2d074dffc536645
MD5 50dfced5c7c17b9b4c936e8ba4103c39
BLAKE2b-256 16ed115ffca5c584020c263c85e9dcf2d3d8936ee5603f1557fa530c8ea501ac

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