Skip to main content

gguf-preflight

Check a local GGUF model stack before you point an AI coding agent at it.

A local model can look healthy in a chat window and still break an agent. The server may silently cut off your context, drop tool calls, miss the prompt cache on every turn, or run a quant that writes fluent, broken code. gguf-preflight tests for those failures, gives a verdict, and prints the exact fix for your runtime.

  • Works with Ollama, llama-server, LM Studio, and other local OpenAI- or Anthropic-compatible servers.
  • Ships as a CLI, a Python library, and an MCP server.
  • No account, no telemetry, no GPU kernel code. MIT licensed.

Quick start

You need uv and a running local server.

uvx gguf-preflight check http://localhost:11434 --model qwen3:8b --agent claude-code

Inspect any GGUF without downloading its weights:

uvx gguf-preflight inspect https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/blob/main/tinyllama-1.1b-chat-v1.0.Q2_K.gguf

What it checks

Layer Check Failure code
GGUF header Missing tokenizer, pre-tokenizer, or chat template. Low-bit quant with no importance matrix METADATA_DEFECT
Wire Silent context truncation at 4k and 8k (16k with --deep) WIRE_BUG
Wire Tool calls in streaming and non-streaming mode: empty drops, plaintext leaks, invalid JSON WIRE_BUG
Cache Whether an identical prefix is reused on the next request PREFIX_CACHE_MISS
Agent smoke 10 coding tasks run against hidden tests QUANT_COLLAPSE
Agent smoke 8 strict tool tasks: right tool, types, arguments, forbidden tools QUANT_COLLAPSE
Agent smoke 4 multi-turn tasks: does a turn 1 rule survive to turn 4 QUANT_COLLAPSE
Speed TTFT, prompt tok/s, generation tok/s, cold vs warm prefill (median and IQR) LATENCY_BOTTLENECK

QUANT_COLLAPSE means the stack answers fluently but scores below a suite's failure threshold. That can be a damaged quant. It can also be a model that is simply too small for the tasks. Borderline scores are warnings and do not blame the quant.

Verdicts and exit codes

Verdict Meaning Exit code
GO Nothing failed 0
CAUTION Usable, with warnings 0
NO_GO A check failed 1
INCOMPLETE A core check could not run, for example the GPU ran out of memory 2

Commands

gguf-preflight check <endpoint> --model <name> [--gguf <path-or-url>]
                     [--agent claude-code|cline|generic] [--json] [--out receipt.json]
                     [--deep] [--allow-remote]
gguf-preflight inspect <path-or-hf-url> [--json]
gguf-preflight diff <receipt_a.json> <receipt_b.json> [--json] [--fail-on-regression]
gguf-preflight mcp

Public hosts are refused unless you pass --allow-remote. If your server needs a key, set GGUF_PREFLIGHT_API_KEY. It is never written to a receipt. Set HF_TOKEN for gated Hugging Face repos.

Receipts

--out saves a JSON receipt with the verdict, GGUF metadata, runtime, hardware, every probe result, the fixes, and a hash of the test transcript. Compare two receipts after you change a quant, a flag, or a runtime version:

gguf-preflight check http://localhost:11434 --model my-model --out before.json
gguf-preflight check http://localhost:11434 --model my-model --out after.json
gguf-preflight diff before.json after.json --fail-on-regression

Receipts keep only the file name of local GGUFs, not their folders.

MCP server

The server exposes preflight_check, inspect_gguf, and compare_receipts. It is stricter than the CLI: endpoints must be local, and remote GGUFs must be https Hugging Face URLs.

Claude Code

claude mcp add gguf-preflight -- uvx gguf-preflight mcp

Gemini CLI (~/.gemini/settings.json)

{
  "mcpServers": {
    "gguf-preflight": {
      "command": "uvx",
      "args": ["gguf-preflight", "mcp"]
    }
  }
}

Python library

from gguf_preflight.inspector.gguf_header import inspect_gguf
from gguf_preflight.runner import run_preflight

metadata = inspect_gguf("model.gguf")
receipt = run_preflight("http://localhost:11434", "qwen3:8b", agent="claude-code")
print(receipt.verdict, receipt.failure_codes)

Safety and limits

  • Model-written code runs on your machine. The coding tasks execute the model's Python in a separate process with a timeout, a stripped environment, and an audit hook that blocks network, subprocess, and file-write calls. This is not a security sandbox. Only test models you are willing to run code from, or use a VM or container.
  • tensor_sha256 is a layout fingerprint. It hashes tensor names, shapes, and types, not the weights. Two fine-tunes with the same layout share it.
  • Determinism is best effort. Requests use temperature=0, top_p=1.0, and seed=42. Output can still differ between runs, even on the same GPU, so transcript_sha256 can change without a real regression. Treat a matching hash as strong evidence and a different hash as a prompt to read the diff.
  • Task scores are a smoke test. They catch broken stacks. They do not rank models.

What has been tested

Live runs used Windows 11, Ollama 0.40.12, an 8 GB RTX 5060, and an 8B Q4_K_M model:

Setup Verdict Main finding Full run
Ollama default, 4,096 context NO_GO A 3,933-token prompt was silently cut to 2,050 tokens 126 to 194 s
Model maximum, 40,960 context, 69% on GPU CAUTION Below the 64k guidance for Claude Code, and slow 404 to 428 s

Run time depends mostly on generation speed, so slower or memory-constrained GPUs take several minutes.

Not live-tested yet: llama-server and LM Studio (covered by mocked HTTP tests only), Linux, and macOS.

Development

uv sync
uv run pytest
uv run mypy

Task packs live in suites/ as YAML, so new tasks need no probe code.

License

MIT

Metadata

Release files for gguf-preflight 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gguf-preflight 0.1.0
File Size Uploaded Provenance Actions
gguf_preflight-0.1.0.tar.gz 64.0 kB Without provenance Details for gguf_preflight-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gguf-preflight 0.1.0
File Interpreter ABI Platform Actions
gguf_preflight-0.1.0-py3-none-any.whl Python 3 none any Details for gguf_preflight-0.1.0-py3-none-any.whl

Total release size: 123.0 kB

Release files / gguf_preflight-0.1.0.tar.gz

Download URL gguf_preflight-0.1.0.tar.gz
Size 64.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ff1d3e77dd205a3a64de2c9a94a0e22d263934e662c7f1154f919d3b5ca32729
BLAKE2b-256 checksum
How to use checksums
1e5d9f113a770628af2642d5eba593a237986211a11a675613581a8edc762d90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gguf_preflight-0.1.0-py3-none-any.whl

Download URL gguf_preflight-0.1.0-py3-none-any.whl
Size 59.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c13ee26d800143cfd3ed7ef8dbe2e556fd5f04c05b55f2582a1de4484df92daf
BLAKE2b-256 checksum
How to use checksums
bdea9614fbcaafd1d27004ae5914b7b06dab36d1581da7a3be920f42894f0645
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gguf-preflight 0.1.0

Provenance

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page