/inferencekit:evaluating-quantizationfrom inferencekit
Measures memory, speed, and quality trade-offs of compressed model formats on target hardware. Use when evaluating quantization or fitting a model on cheaper hardware.
Ships in inferencekit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Quantization can reduce memory and traffic, but conversion/dequantization can erase the speed benefit and outputs may change. This skill answers one question with evidence: on this GPU and this workload, which format is fastest at a quality loss the user accepts? The answer is a pair, speed and quality, measured on the same configuration. A faster number on its own is not a result.
Choose the modality before the checks. For image/audio, use affordability; for video, use video checks. Record precision per component, peak weights/activations/scratch memory and complete output work. Text token metrics and GSM8K below apply only to text. Other tasks need a registered quality adapter.
Reuse starting choices: balanced permits numerical changes with preserved task quality; speed permits stronger approximations within agreed bounds. Neither authorizes a different architecture. Search current implementations for the exact device and shapes before assuming a smaller format has a fast kernel.
Use when a format or published quant may be worth it, when fewer bytes per token would help (in any ceiling band; exact byte cuts belong to optimizing-kernels), when the model does not fit or capacity needs KV room, or when optimizing-inference's model.precision_allowed lists several formats. Not for same-precision engine comparisons, training a quantization recipe, or ranking different models.
GPU approval: steps 1-4 are GPU-free. Launching, bench rounds, gates and quality runs occupy a GPU: only with budget.approved: true in intake.yaml or an explicit yes to a stated cost (GPU, $/h x hours, cap), including a full-precision reference on a second, larger GPU.
For consumer VRAM/unified memory limits or minimum-memory baselines under latency and quality gates, also read affordability.
Evidence rule 8 (evidence-rules.md) forbids comparing speed across precisions as an engine result. This skill allows it under three conditions:
cross-precision: format trade-off, not an engine comparison. The speed ratio comes from bench rounds (<metric>_ratio_to_best, paired CI95) and is quoted as a ratio with its CI, never with improved / regressed.model.* (the full-precision reference; precision_allowed bounds the formats, others NOT RUN; kv_cache_dtype_allowed: [fp8] tests an FP8 KV cache), hardware.*, goals.*, buckets and workload.* (contexts and concurrency the KV must hold), budget.wall_clock_h (drop rows to fit, never rounds or quality), fidelity (a format below the stored one needs fidelity: lossy and its precision_allowed / kv_cache_dtype_allowed entry, in its own block: fidelity.md), quality.budget (replaces the tier defaults), quality.reference (a vLLM endpoint for the full-precision model; required when it does not fit the target GPU). constraints: quality margins: <tier> kl=<nats> top1=<fraction> gsm8k=<points> (tiers fp8, int4, gguf5-8, sub4), offload: allowed. No intake: ask for the same facts in one message. Margins are agreed before measuring; non_interactive takes the tier defaults (references/measure-and-score.md, section 4), logged in QUESTIONS.md.
prompt_logprobs). Why: two quants agreeing with each other proves nothing.max_tokens, chat template and temperature 0 for every row and the reference (speed at the workload's sampling).Record every runnable variant's timing alongside its gate verdict. Apply these gates to interpretation and selection:
inferencekit gates run FAILs for the row: its speed is void;offload: allowed in constraints: the row is NOT RUN (does not fit), never quietly offloaded.Quantization check:
- [ ] 1. Claim, speed threshold and quality margins per tier written down (state.decisions or the plan)
- [ ] 2. Candidates: quant-scout -> repo@sha, format, size, provenance, engines (inferred), one table
- [ ] 3. Fit + ceiling per candidate, GPU-free: roofline --method headers (safetensors) or
scripts/gguf_bytes_per_token.py (GGUF) -> bytes/token, predicted ceiling ratio vs the reference, VRAM need
- [ ] 4. Shortlist <= 6 (engine, format) rows that fit and are worth timing; every dropped row gets a reason
- [ ] 5. Approval; launch each row, smoke test, prove format + KV dtype from the log; one manifest entry per row
- [ ] 6. Speed: one bench rounds call over all rows (reference row included) -> ratio_to_best + CI; gates per row
- [ ] 7. Quality: reference A/A trajectories; trajectory per row; quality score per margin tier; gsm8k per row,
paired with the reference
- [ ] 8. Pareto table, recommendation with its trade-off, labels, NOT RUN rows; claims-skeptic on the draft
1-2. Candidates (GPU-free). Run the quant-scout subagent once per model (Claude Code: inferencekit:quant-scout; elsewhere follow that file yourself): official checkpoints first, then the most used community quants, pinned, with recipe, size and engines (inferred, sourced). It never picks a winner. Formats: references/formats.md.
3. Fit and predicted ceiling (GPU-free). inferencekit roofline --model <repo> --revision <sha> --method headers --context <ctx> --kv-dtype <dtype> --gpu-bw <ev_bw or GB/s> per safetensors candidate at each bucket context; for GGUF, python3 scripts/gguf_bytes_per_token.py --repo <repo> --file <name.gguf> --revision <sha> plus the reference's kv_bytes (and state_bytes) at the same context. Fields, the Qwen3-8B worked example and the batch and compute-bound cases: references/bytes-and-fit.md.
4-6. Measure speed (same harness, every row). Launch each row with the engine's recipe for that format, prefix caching off, CUDA graphs on, and prove from the startup log the quantization method, GEMM kernel family and KV dtype it resolved (a weight-only fallback is its own row). One manifest holds every row, each downloading its own pinned checkpoint (references/measure-and-score.md, sections 2-3). One bench rounds call interleaves all rows for paired ratio CIs; for capacity measure N* per row (KV room often decides it, and W4A16 can lose once compute-bound). inferencekit gates run per row while its server is up.
7. Score quality against the full-precision reference (proving-correctness; commands in references/measure-and-score.md, section 5): reference trajectories twice (A/A floor), one per row on its exact speed configuration, quality score per margin tier (below 4 bits: the 4-bit margins unless a sub4 margin was agreed first), quality gsm8k per row paired with the reference (reasoning often degrades before KL looks alarming), quality niah for FP8 KV or long-context claims. Without logprobs the trajectory is text only: top-1 and NLL are scored by re-tokenizing it, KL and TV are not; GSM8K still counts.
8. Report. The Pareto table (all rows, losses, misfits and NOT RUN included) and the recommendation: the fastest row by the conservative end of its speed CI whose quality is PASS on every pre-registered check and which fits. If no quantized row passes, recommend the reference precision; if the fastest passing row's ratio CI includes 1, the format has no proven speed benefit (state any memory benefit). One sentence with both numbers, labelled. Table, frontier rule and wording: references/measure-and-score.md, sections 6-7.
Big model on a small GPU (references/small-gpu.md): fit every candidate at the claim's context and concurrency; start with the least aggressive format; quality needs a costed vLLM reference on a larger GPU (none: quality UNPROVEN in the headline); offload only with offload: allowed, labelled and measured, never projected.
MCP tools: roofline, inspect_evidence, validate_manifest, bench_rounds, run_gates, quality_trajectory, quality_score, quality_gsm8k, quality_niah, report. Check flag spellings with inferencekit <command> --help.
bench rounds ratios are derived with their CI.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub kittenml/inferencekit --plugin inferencekit9 skills in this plugin
/benchmarkingMeasure end-to-end inference latency, throughput, memory and cost against tuned baselines with balanced rounds and quality evidence. Use for engine/config comparisons and performance claims. Route text, image, audio and video to their own client timers and protocols; isolate device measurements./inference-triageRoute inference performance questions for text, image, audio, video and other models to the cheapest useful evidence: latency, throughput, memory, hardware cost or quality. Use when unsure where to start; select tools for NVIDIA, AMD, Apple Silicon or CPU and preserve resource authorization./optimizing-inferenceOptimize a model for faster responses, more requests, less memory or cheaper hardware. Ask simple quality and budget questions, research current implementations, tune the strongest supported baseline, investigate compiler/kernel bottlenecks and prove end-to-end results. Covers text, image, audio and video with modality-specific checks; accepts an intake or written brief./optimizing-kernelsProfile-driven loop for building or patching inference engines and kernels on NVIDIA, AMD, Apple Silicon or CPU. Use after baseline tuning and profiling to close a measured bottleneck with one change, a correctness check and an end-to-end screen. Covers custom engines, fusion, attention, matrix kernels and memory traffic; routes to the hardware's supported tools./profilingFinds where inference time goes and why a kernel is slow on NVIDIA, AMD ROCm, Apple Metal and CPUs, routing to vendor timelines then supported kernel analysis; nsys only or the PyTorch profiler when GPU counters are blocked. Use for "where does the time go", "why is decode/prefill slow", "GPU idle", "launch overhead", "which kernel", "is this kernel memory-bound", "nsys", "ncu", "torch profiler", "profile". Never proves a speedup./proving-correctnessVerify correctness and agreed quality after engine, kernel, precision or model changes. Use before a performance claim and for quick exploration screens. Select exact, task or perceptual checks for text, image, audio, video and other supported tasks; keep missing evidence UNPROVEN.Other plugins' skills for the same job