Kwker

Kwker documentation

Kwker makes the work you already run on CPUs quicker: PyTorch models, text generation with LLMs, embeddings, image models, DataFrame group-bys and sorts, and the sorting and top-k calls underneath all of them. Install one package, change one line, and measure the difference on your own machine.

  1. Install. pip install kwker, or the package for Rust, C, C++, JavaScript, Go, Java, C# and 12 more languages.
  2. Add one line. kwker.torch_ops.install(), or the line for your workload: LLMs, embeddings, image models, DataFrames.
  3. Measure it. python -m kwker.bench on your machine, then compare your own program with and without Kwker.

What are you working on?

  • OverviewAccelerate PyTorch

    Speed up PyTorch on the CPU with Kwker - pick your workflow - inference, torch.compile, lower precision, training, whole-model runners or operators.

  • OverviewAccelerate Hugging Face

    Run Hugging Face models faster on the CPU with Kwker - generate text, chat, serve an OpenAI-compatible API, quantize, and embed sentences.

  • TutorialClassify images

    Classify images on the CPU with KwkCNN - check that a torchvision model is supported, run it in float32, then in int8 calibrated on your own photos.

  • OverviewData and analytics

    Speed up data work with Kwker - NumPy without code changes, pandas, Polars and pyarrow tables, DuckDB queries, sparse matrices and files larger than memory.

  • QuickstartQuickstart: Kwker Core

    Sort, select and rank arrays with Kwker Core in Python, Rust, C, C++, JavaScript, Go, Java or C#, every example runnable in your browser.

  • How-to guideEvaluate on your machine

    Measure Kwker on your own hardware and your own code before you adopt it - a machine report, a benchmark against your libraries and a side-by-side run of your program.

Note

This documentation describes the 0.1.0 release. Package names and download links take effect with the release.

Try it

Press Run to run this example in your browser. You can edit it first.

import numpy as np
import kwker

prices = np.array([19.99, 4.50, 120.00, 4.50, 35.25])
kwker.sort(prices)
print(prices)

scores = np.array([7, 42, 3, 99, 15])
values, positions = kwker.top_k(scores, 2, descending=True)
print(values, positions)
[  4.5    4.5   19.99  35.25 120.  ]
[99 42] [3 1]

The Playground has more examples in Python and JavaScript.

Browse the documentation

Every function is listed in the API reference for Python, C, C++, Go, JavaScript / TypeScript, Java, C#, Ruby, R, PHP and Perl. Rust users can run cargo doc -p kwker --open. A function named in these pages links to its entry there. Point at the name to see what it does and its arguments.

What runs where

Platform Engines Packages
Linux x86-64 AVX-512, AVX2, portable Python wheel (with PyTorch extensions), C / C++ archive, .deb, .rpm, Rust crate
Linux ARM64 SVE (64-bit keys), NEON, portable Python wheel, C / C++ archive, .deb, .rpm, Rust crate
Windows x64 AVX-512, AVX2, portable Python wheel, C / C++ zip, Rust crate (clang++)
macOS ARM64 (Apple silicon) NEON, portable Python wheel, C / C++ archive, Rust crate
macOS x86-64 AVX2, portable Rust crate and source builds only

The PyTorch extensions (drop-in kernels, CPU backend, KwkCNN / KwkEncoder / KwkDecoder) are built for Linux x86-64.

Check your installation

PythonRuns on your machine.
import kwker
print(kwker.version(), kwker.isa())     # e.g. 0.1.0 avx512

python -m kwker doctor prints the full picture: CPU, engines, operating system, threads and framework versions, with a warning for anything that limits speed or compatibility.