Skills · Data & AI

Quantized Export

Unverified32/40

Export a promoted fine-tuned model in the right deployment format — merged safetensors, LoRA-only, GGUF with imatrix, or FP8. Use after a checkpoint passes promotion, when choosing a quantization format for a target device, or when an exported model fails its smoke test.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
Cursor·UnknownWe have not crawled the repo tree, so we will not guess
Codex·UnknownWe have not crawled the repo tree, so we will not guess
Gemini CLI·UnknownThe spec defines no detection rule for Gemini
Copilot·UnknownWe have not crawled the repo tree, so we will not guess
npx agentalley add quantized-export

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

Export a promoted fine-tuned model in the right deployment format — merged safetensors, LoRA-only, GGUF with imatrix, or FP8. Use after a checkpoint passes promotion, when choosing a quantization format for a target device, or when an exported model fails its smoke test.

The whole source

No sign-in, no blur, nothing truncated
quantized-export/SKILL.md223 lines7.8 KBRawView on GitHub
Frontmatter — 2 properties
namequantized-export
descriptionExport a promoted fine-tuned model in the right deployment format — merged safetensors, LoRA-only, GGUF with imatrix, or FP8. Use after a checkpoint passes promotion, when choosing a quantization format for a target device, or when an exported model fails its smoke test.
1---
2name: quantized-export
3description: Export a promoted fine-tuned model in the right deployment format — merged safetensors, LoRA-only, GGUF with imatrix, or FP8. Use after a checkpoint passes promotion, when choosing a quantization format for a target device, or when an exported model fails its smoke test.
4---A5No allowed-tools declared — no way to tell what this skill may touch
5 
6# Quantized Export
7 
8The last stop after `checkpoint-promotion`
9hands off a `PROMOTE` verdict: a checkpoint
10that cleared the four-stage gate still isn't
11deployed until it's exported in the right
12format for its target runtime and proven to
13still work post-export. A `REJECT` verdict
14never reaches this skill — export starts only
15from a promoted checkpoint.
16 
17**Input:** a promoted checkpoint (or LoRA
18adapter) plus the target deployment surface —
19GPU class, serving stack, and whether
20long-context/code/math workloads are in
21scope.
22**Output format:** an exported artifact in
23the chosen format plus a smoke-test diff
24report comparing 3–5 golden outputs
25pre-export and post-export.
26 
27## Format Map
28 
29Pick format by hardware and deployment shape,
30not by habit — the wrong pick either wastes
31throughput headroom or breaks silently on
32specific workloads (see Workload Overrides).
33 
34- **FP8 is the default on Hopper-class GPUs
35 and newer.** It preserves near-bf16 quality
36 at roughly half the memory, and it's the
37 safe first choice whenever the target GPU
38 supports it and no edge-device constraint
39 applies.
40- **AWQ INT4 targets older GPUs** that predate
41 FP8 hardware support. **GPTQ is superseded
42 for new deployments** — don't reach for it
43 on a fresh export; AWQ has better accuracy
44 retention at the same bit width and wider
45 current tooling support.
46- **GGUF with Q4_K_M quantization, built from
47 an imatrix, is the edge/llama.cpp format.**
48 Use it for local or CPU-adjacent
49 deployment, not for GPU-serving
50 throughput — it optimizes for footprint,
51 not tokens/sec on a datacenter GPU.
52- **NVFP4 is for Blackwell-at-scale
53 deployments only — and explicitly NOT on
54 GB10.** NVFP4 on SM121 (GB10) runs **~32%
55 slower than FP8** because the hardware
56 lacks a native `cvt.e2m1x2` path unless the
57 kernel is compiled `sm_121a`. Choosing
58 NVFP4 on a GB10 target is a regression, not
59 an upgrade — pick FP8 there instead.
60- **Merged vs. LoRA-only is a separate axis
61 from quant format.** A merged export folds
62 the adapter into the base weights: larger
63 artifact, no base-model dependency at serve
64 time. LoRA-only keeps the adapter separate:
65 much smaller artifact, but the serving stack
66 must load the exact same base model
67 alongside it — a mismatched or
68 wrong-revision base silently changes
69 outputs. Pick merged when artifact
70 portability matters more than storage; pick
71 LoRA-only when disk footprint or multi-adapter
72 serving matters more.
73 
74### Worked Picks
75 
76The core format-selection tradeoff, read as a
77lookup table for common scenarios:
78 
79| Target | Workload | Format |
80|---|---|---|
81| Datacenter GPU | generic chat | FP8 |
82| Datacenter GPU | long-context/code/math | FP8 or W8A8 — never INT4 |
83| Older GPU generation | generic | AWQ INT4 |
84| Edge device / laptop | llama.cpp serving | GGUF Q4_K_M + imatrix |
85| GB10 | any workload | FP8 via vLLM nightly, or GGUF via llama.cpp locally — skip NVFP4 |
86 
87```yaml
88# quick decision snippet — see the table above for the full map
89hopper_or_newer: fp8
90older_gpu: awq-int4
91edge_llama_cpp: gguf-q4_k_m+imatrix
92gb10_any_workload: fp8-vllm-nightly # never nvfp4 on GB10
93```
94 
95## Workload Overrides
96 
97The Format Map above is a default, not a rule
98that survives every workload. **Long-context,
99code, and math workloads break at INT4** —
100quantization error compounds across long
101sequences and precise token-level reasoning in
102ways that don't show up on short, generic
103prompts. For any of these three workload
104classes, **stay on FP8 or W8A8** even if the
105target hardware would otherwise justify INT4
106on cost grounds.
107 
108- Don't validate this override with MMLU or
109 similar broad-knowledge benchmarks — they
110 don't stress the failure mode. **Measure
111 with the actual task evals** — the goldens
112 and graders from `eval-harness-first`, run
113 through the exported artifact — because
114 INT4 degradation on long-context, code, or
115 math shows up as task-specific failures
116 (dropped context, broken syntax, arithmetic
117 errors) well before it moves a knowledge
118 benchmark.
119- If a task eval regresses after an INT4
120 export on one of these three workload
121 classes, the fix is switching format, not
122 re-tuning the quantization recipe — AWQ
123 and GPTQ variants at the same bit width
124 share the same compounding-error failure
125 mode on these workloads.
126 
127## The Smoke Test
128 
129Export bugs are silent at the file level — a
130malformed export still produces a
131loadable artifact, so file-existence checks
132prove nothing. **The smoke test is
133mandatory for every export, with no
134exception for a format that "should just
135work":**
136 
1371. **Load the exported artifact in its actual
138 target runtime** — vLLM for FP8/AWQ,
139 llama.cpp for GGUF, not a quick
140 sanity load in a different framework than
141 the one that will serve it in production.
1422. **Run 3–5 golden prompts through it** —
143 pull these from the same `eval/goldens.jsonl`
144 `eval-harness-first` maintains, not a fresh
145 ad hoc set.
1463. **Compare each output against the
147 pre-export generation** for the same
148 prompt, same deterministic sampling
149 settings — greedy decoding (temperature 0)
150 and a fixed seed, persisted and reused
151 between the pre- and post-export runs, not
152 just nominally identical config. **For a
153 lossless export, byte match is the gate —
154 any diff is a bug.** For a **lossy**
155 (quantized) export, byte match is expected
156 to fail; the gate is task-grader verdict
157 agreement instead — see
158 `references/export-commands.md`'s
159 Smoke-Test Script Skeleton.
160 
161Run this as a gate, not a manual check:
162 
163```bash
164python smoke_test.py "$EXPORT_PATH" \
165 eval/goldens.jsonl pre-export-outputs.jsonl
166# non-zero exit on any pre/post mismatch
167```
168 
169### Failure Signatures
170 
171What export bugs actually look like, not a
172clean pass/fail flag:
173 
174- **Template mismatch** presents as garbled or
175 run-on output — the chat template baked
176 into the export doesn't match the one the
177 checkpoint was trained and evaluated
178 against, so turn boundaries or special
179 tokens land in the wrong place.
180- **Wrong quantization applied to `lm_head`**
181 presents as off-template or semantically
182 nonsensical output that still looks
183 fluent — the output head lost precision it
184 needed even though the rest of the network
185 quantized cleanly.
186 
187Never ship an export that skipped this step —
188a checkpoint's `PROMOTE` verdict says the
189un-exported checkpoint is good; it says
190nothing about the export pipeline. Re-run on
191any quant-method or runtime version bump, not
192only after the first export. Runnable command
193sequences for every format plus the
194smoke-test script skeleton:
195`references/export-commands.md`.
196 
197## Related Skills
198 
199- `checkpoint-promotion` — the only valid
200 upstream source for this skill. A checkpoint
201 without a `PROMOTE` verdict doesn't reach
202 export.
203- `eval-harness-first` — owns the
204 `eval/goldens.jsonl` this skill's smoke test
205 draws its 3–5 prompts from, and the task
206 evals the Workload Overrides section
207 requires for long-context/code/math
208 validation.
209- `finetuning-method-selection` — its
210 `references/model-catalog.md` is the place
211 to check hardware-class assumptions (which
212 GPU generations a base model targets) before
213 picking a format off the Format Map above.
214 
215**Spark users:** on GB10, GGUF via llama.cpp
216works well for local serving, and FP8 serving
217via vLLM nightly builds is the other proven
218path — NVFP4 is the one format to avoid there
219(see the Format Map exception above). Once the
220`dgx-spark-ops` plugin is installed, defer
221Spark-specific serving and thermal questions to
222its skills rather than re-deriving them here.
223 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Data & AI