LLM inference server for KV-cache and quantization research: int8/fp8/int4 KV caches that keep the layers low-bit storage would break in full precision, 4-bit GPTQ, EAGLE-3 speculative decoding, HuggingFace parity tests on 16 model types, and OpenAI, Anthropic and Ollama APIs on one port
pip install turing-engine==2.2.1
Storing an LLM's KV cache in 8 or 4 bits fits more tokens on a GPU, but on some models it silently breaks the output : vLLM's fp8 cache takes Qwen2.5-1.5B-Instruct from 57% to 2% on GSM8K. Turing Engine is an LLM inference server that finds the layers a low-bit cache would break, keeps them in full precision, and lets you measure what every KV-cache or quantization change costs on real models.
Low-bit KV caches that stay correct. int8, fp8 and int4, with the damaged layers found at startup and nothing to tune. The int4 cache holds 2.4× the tokens of a 16-bit one at +0.02 nats.
Fast on one GPU. On an NVIDIA L4, 4-bit decoding is 1.09–1.34× vLLM's speed; in fp16 and with EAGLE-3 draft heads it is level with vLLM or a little ahead ( how it compares ).
Checked against HuggingFace. Logits match on 16 model types, and 13 GGUF files agree with llama.cpp.
OpenAI, Anthropic and Ollama APIs on one port , plus LangChain, LlamaIndex and LiteLLM clients.
Runs where you work. NVIDIA GPUs, Apple Silicon, x86 and ARM CPUs; pip, Docker, Helm or KServe.
A CPU backend on llama.cpp ( turing serve --backend libllama ): GGUF models on CPUs and Apple GPUs behind the same APIs, including MoE models larger than RAM ( CPU backend ).
Small enough to change. Paged KV, Triton kernels, GPTQ and speculative decoding in a few Python modules, with the eval scripts to measure a change.
It loads HuggingFace checkpoints, llama.cpp GGUF files and its own 4-bit .tgate4 directories. It is built for trying KV-cache and quantization changes against real models, not for production serving ( how it compares ).
What's new · Get started · What it is good for · How it compares · More ways to run it · Models · Features · Documentation
EAGLE-3 draft heads ( --draft-head ): Qwen3-8B with a published head runs at 101.0–102.4% of vLLM with the same head in 13 of 15 cells on an L4.
fp8 KV cache ( --kv-cache-dtype fp8 ), calibrated like int8 and int4: at 16K-token prompts 99.0–101.3% of vLLM's fp8, and it keeps Qwen2.5-1.5B-Instruct at 56.6% on GSM8K where vLLM's fp8 drops it to 2.4%.
4-bit MoE : turing convert packs the experts too and Marlin kernels run them (Qwen1.5-MoE at 101–127% of vLLM); --moe-expert-slots computes some experts on the CPU, which fits Mixtral-8x7B on a 24 GB GPU.
Shorter steps : overlapped decode, CUDA graphs for prefill, and a warm-up before the server listens.
A CUDA image that starts on a GPU. v2.0.0-cuda lacks the C compiler Triton needs; v2.1.0-cuda has it.
Everything else, with the measurements behind it, is in the changelog .
Wheels with the C++ extension and the libllama backend are built for Linux x86_64 and aarch64 and macOS arm64 (13.3 or later); elsewhere (Windows, Intel Macs, older macOS) pip builds the extension from the source package, which needs a C++20 compiler. From a clone: pip install -e . .
Or run the server in Docker ( docs/docker.md ):
2. Chat in the terminal
3. Serve OpenAI, Anthropic and Ollama APIs on one port
OpenAI ( /v1/chat/completions , /v1/completions , /v1/embeddings ), Anthropic ( /v1/messages ) and Ollama ( /api/chat , /api/generate , /api/pull , …) clients can point at . The server listens on 0.0.0.0 by default and needs no key unless started with --api-key (or TURING_API_KEY ).
Low-bit KV caches that do not silently break the model. When a pool stores KV in int8, fp8 or int4, Turing measures at startup which layers that format damages (each layer's K and V are round-tripped alone and the change in the -token distribution is measured on random tokens, in a few seconds) and keeps those layers in the model's dtype; outlier key channels are scaled down for int4. On Qwen2.5-1.5B-Instruct vLLM's default fp8, per-token fp8 and per-token int4 caches collapse (GSM8K 0.6–2.4%); Turing's int8, fp8 and int4 keep it working with no setting:
vLLM fp8 with layer 0 skipped by hand matches Turing's quality at 0.80–1.07× Turing's time per request (int4 to fp8), which is the point: the calibration finds that layer automatically. vLLM's per-token int8 and int4 caches are in the full table . It is also packaged on its own for vLLM users, under Apache-2.0: packages/kv-layer-guard . Validated on six instruct models (Qwen2.5 1.5B and 7B, Llama 3.2, Gemma 2, Phi-3.5, Mistral), including one limit it does not catch ( benchmarks §2 ).
Correctness you can check. The exact model reproduces HuggingFace's logits on 16 model families in the tests, 13 of them also on real checkpoints ( models & hardware ); 13 real GGUF files agree with llama.cpp.
A codebase small enough to change. Paged KV pool, Triton decode kernels, GPTQ, TEAL sparsity, prefix caching, speculative decoding and the OpenAI, Anthropic and Ollama APIs are a few Python modules and kernels, with a standalone C++ engine beside them. The eval scripts ( scripts/eval_kv_quality.py , turing eval-accuracy , turing eval-niah , the Turing-vs-vLLM and llama.cpp benchmarks) run any idea against real models.
Limitations: tensor and pipeline parallelism are tested as CPU processes only, not on multiple GPUs; the largest dense model run end to end is Qwen3-8B, and the largest MoE model Mixtral-8x7B in 4 bits with some experts on the CPU.
Is it faster than vLLM or llama.cpp? On one NVIDIA L4 with models of 0.4B to 8B parameters it is ahead of vLLM in fp16 by a few percent and at 4 bits with its default settings by more, and behind in the settings listed below. Same model and prompts (Qwen2.5-1.5B-Instruct, 512-token prompts, 256 new tokens):
fp16: Turing is at 101–103% of vLLM's throughput at batch 1–64 (the median of three runs of each engine, taken in turn; repeated runs of one setting differ by up to 3%), and at 101–114% on SmolLM2 at 1,024-token prompts.
First token: a prompt arriving alone gets its first token sooner than on vLLM (18 against 28–29 ms on SmolLM2-360M, 27 against 32 ms on Qwen2.5-1.5B, 68 against 71–73 ms on SmolLM2-1.7B). In a burst of 32 or 64 SmolLM2 prompts the mean first token is 10–16% sooner than vLLM's when both engines take 8,192 tokens per step and from 5% sooner to 2% later when both take 2,048.
4 bits (the LM head in 4 bits too, the default): Turing is 1.34 / 1.26 / 1.09× vLLM and 1.25 / 1.81 / 1.54× llama.cpp at batch 1 / 8 / 64 (the three engines in turn on one L4, within one boot). This quantizes one more matrix than vLLM's GPTQ checkpoint does; GSM8K 51.8% against vLLM's 50.2% (each ± 2.2%), and the 4-bit head adds 0.007–0.009 nats of -token NLL on three models ( results_quality_head_cuda.json ).
4 bits with the LM head in fp16 ( --no-quantize-lm-head ): Turing is at 100–102% of vLLM. llama.cpp is 1.05× faster at batch 1; Turing is faster than llama.cpp at batch 8 and 64 (1.46× and 1.42×).
16K-token prompts, fp16 KV at equal memory: Turing is 1.06–1.40× faster per request than vLLM, more at larger batches. With one byte per value, at the same step budget, Turing's fp8 cache is at 99.0–101.3% of vLLM's fp8 and its int8 at 97.0–99.0%; vLLM's fp8 keeps no layer in fp16 and wrecks this model's output (above), and with layer 0 kept in fp16 as Turing keeps it Turing's fp8 is at 103.5–106.2% and its int8 at 100.7–103.8%.
Speculative decoding: with prompt lookup (8 drafts) Turing is at 100–121% of vLLM's n-gram speculator on code, rewrite and chat prompts; with a published EAGLE-3 head on Qwen3-8B it is at 101.0–102.4% of vLLM with the same head in 13 of 15 cells. The other two are within the spread of vLLM's own runs: code with chains of 7 at 4 requests at 99.3–99.8%, and chat at 4 requests at 98.3% of vLLM's fastest of four processes and 100.2% of their mean (vLLM's outputs, and with them its speed, change from one process to the ).
MoE models: OLMoE in bf16 is level with vLLM at batch 1 and 8 and 3% behind at batch 32; Qwen1.5-MoE in 4 bits is at 101–127% of vLLM on Qwen's GPTQ checkpoint (99.1–101.5% with its LM head in fp16, as in that checkpoint; 100.0–102.6% converted with --symmetric , the grid of that checkpoint). Mixtral-8x7B does not fit a 24 GB GPU in 4 bits: with two of each layer's eight experts computed on the CPU ( --moe-expert-slots 6 ) it runs at 13.7 / 16.5 tok/s at batch 1 / 2, against 13.2 / 14.0 for llama.cpp with 26 of its layers on the GPU.
Cold start: from process start to first token Turing takes 25.4 s from a cold page cache and 10.0 s warm, against vLLM's 51.7 s and 34.2 s (vLLM ran in an earlier run, alongside a Turing build that took 27.4 s and 12.1 s: 1.9–2.8× sooner); llama.cpp with its 4-bit GGUF takes 7.1 s and 1.3 s.
Details and every other setting are in the comparison ; the results files and the commands that produced them are in benchmarks/ . These are one GPU and five models: for production serving (multi-GPU, larger models, a longer track record) use vLLM, SGLang or TensorRT-LLM; on a laptop, llama.cpp or Ollama.
Quantize to 4-bit once, serve the result
Standalone C++ engine ( turing-cli )
It runs Llama-layout GGUF models (RMSNorm, SwiGLU, RoPE, grouped-query attention) on the CPU with AVX2 or NEON, with an optional int8 KV cache ( --kv-cache-dtype int8 ).
Tensor and pipeline parallelism
Sharded weights and KV pages over torch.distributed . The tests run TP 2/4, PP 2 and TP 2 × PP 2 as CPU (gloo) processes and compare logits with a single process; multi-GPU (NCCL) runs are not tested yet.
tests/test_hf_parity.py checks prefill, chunked prefill, decode and batched decode against HuggingFace (atol 1e-3) for 25 configurations of these model types: llama , mistral (sliding window), qwen2 , qwen3 , gemma , gemma2 (soft-capping), gemma3_text (local/global RoPE), phi (Phi-2), phi3 (incl. LongRoPE), gpt2 , opt (incl. post-LN and projected embeddings), gpt_neox , mixtral , qwen2_moe , qwen3_moe and olmoe . RoPE scaling types: default, linear, dynamic, YaRN, LongRoPE, Llama 3 and proportional. Any other architecture is refused before download ( hf_loader.FAMILIES , ArchitectureRegistry ); weights never fall back to random values. Every family except OPT also loads from GGUF (Mistral and Mixtral through llama.cpp's llama architecture). Details: models & hardware .
Tested on NVIDIA GPUs (CUDA, Triton kernels, CUDA graphs; benchmarked on an L4), Apple Silicon (MPS) and x86_64 and arm64 CPUs. --device also accepts rocm (PyTorch's HIP build), and auto-detection picks xpu or vulkan when PyTorch reports them; those backends are untested.
The turing.experimental package holds research components outside the serving path: cross-model KV transfer, clean_base lineage, k-slot pooling, an MoE expert-offload runner and hybrid linear/softmax attention (needs a model trained with it). What each does, and how it performed on real models, is in experimental components .
LangChain and LlamaIndex have their own packages (Apache-2.0, no dependency on the engine):
LiteLLM, KServe, Helm and llm-d: integrations .
Getting started: Quickstart · Docker
User guide: Serving & API · Models & hardware · Integrations · Kubernetes & llm-d
Performance: Comparison · Benchmarks
Internals: Architecture · Experimental components
Project: Changelog · Contributing · Security policy · Licensing
Turing Engine is licensed under the Business Source License 1.1 (BSL 1.1) .
Free for non-production use : development, local testing, academic research, personal single-GPU workstations and benchmarking ( LICENSE , Additional Use Grant). Production use (multi-GPU clusters, commercial hosting, revenue-generating API traffic) needs a separate commercial license.
packages/ is under the Apache License 2.0 now: kv-layer-guard (the KV layer calibration, usable with vLLM), langchain-turing and llama-index-llms-turing .
Converts automatically to Apache 2.0 on August 24, 2030 or the fourth anniversary of the first public release (as LICENSE §3 states).
Release files for turing-engine 2.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation .
Source distribution (sdist)
Built distributions (wheels)
Total release size: 109.9 MB
Release files / turing_engine-2.2.1.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp313-cp313-manylinux_2_28_aarch64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp313-cp313-macosx_13_0_arm64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp312-cp312-manylinux_2_28_aarch64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp312-cp312-macosx_13_0_arm64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp311-cp311-manylinux_2_28_aarch64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp311-cp311-macosx_13_0_arm64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp310-cp310-manylinux_2_28_aarch64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / turing_engine-2.2.1-cp310-cp310-macosx_13_0_arm64.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Security for turing-engine 2.2.1
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
All 13 files in this release have been uploaded with provenance metadata.
Attestation for turing_engine-2.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp313-cp313-manylinux_2_28_aarch64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp313-cp313-macosx_13_0_arm64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp312-cp312-manylinux_2_28_aarch64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp312-cp312-macosx_13_0_arm64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp311-cp311-manylinux_2_28_aarch64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp311-cp311-macosx_13_0_arm64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp310-cp310-manylinux_2_28_aarch64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Attestation for turing_engine-2.2.1-cp310-cp310-macosx_13_0_arm64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
Release history Release notifications | RSS feed
Nov 29, 2026 13 release files Full provenance
Nov 29, 2026 13 release files Full provenance
Nov 26, 2026 13 release files Full provenance
Nov 26, 2026 10 release files Full provenance
Nov 20, 2026 10 release files Full provenance
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
