clairic-27b-nvfp4-sm120— Boundary-Protected MixedNVFP4 + FP8for NVIDIA RTX PRO 6000 (SM120)
clairic-27b-nvfp4-sm120 — Boundary-Protected Mixed NVFP4 + FP8 for NVIDIA RTX PRO 6000 (SM120)
Full Technical Specification & Benchmark Report: Read
ENGINEERING_REPORT.mdingeudrik/clairic-sm120-servefor the complete SM120 architecture specification, custom Triton kernel microbenchmarks, 3-repeat concurrency sweeps (N = 32), 8-case selection and 12-case disjoint held-out calibration tables, and controlled ablations.
geudrik/clairic-27b-nvfp4-sm120 is a calibrated NVIDIA ModelOpt Mixed NVFP4 + FP8 checkpoint of Cloudflare/clairic built for NVIDIA RTX PRO 6000 Blackwell (sm_120, 95.03 GiB visible GDDR7) FP4 and FP8 Tensor Cores.
Served through geudrik/clairic-sm120-serve under the published CLI defaults (--kv-cache-dtype auto --mem-fraction-static 0.80 --max-mamba-cache-size 180 --max-running-requests 48 --chunked-prefill-size 16384 --pool-size 24, measured across 3 repeats at N = 32 requests per concurrency level):
- Size: Compresses
model-*.safetensorsfrom 51.75 GiB (55.56 GB) to 20.85 GiB (22.39 GB, 2.48x smaller, -30.90 GiB, omitting inactivemtp.layers.0), or 52.02 GiB to 21.12 GiB (22.68 GB, 2.46x smaller) including the bundled 276.95 MiB (290.41 MB) FP32clair_head.safetensors. - Concurrent Throughput (Engine & Live HTTP): Reaches 1.768 req/s (
[1.730–1.773], 11.27 fields/s, 30,539 effective input tok/s — 7.87x over the 0.225 req/sTransformersEnginereference) atC = 8(p50= 4.09 s,p95= 8.82 s), and 1.748 req/s (11.14 fields/s, 7.78x reference) over warmed FastAPI +uvicornHTTP atC = 8. - Accuracy & Calibration Tradeoff: Scores 50/51 (98.0%, 44/47 ground truth;
case5.closing_inventoryshifts 1000 -> 100 under BF16 KV) on the 8-case selection suite and 76/79 reference agreement / 69/71 (97.2%) ground-truth accuracy on the 12-case disjoint held-out suite (all 3 held-out differences vs. the BF16 reference occur where the BF16 reference failed ground truth andnvfp4succeeded). 3-run median mean absolute confidence drift is 0.0338 (3-run max 0.6860, 1/47 flip at 0.50, 4/47 median[4–5]at 0.80) on selection and 0.0577 (3-run max 0.7974, 4/72 median[3–4]flips at 0.50, 10/72 at 0.80) on held-out. For 51/51 and 79/79 reference agreement or tighter confidence calibration (mean |Δ conf| <= 0.0125), usegeudrik/clairic-27b-fp8-sm120.
Warning — Concurrent Batching (
C > 1) Answer Flips on Low-Margin Prompts: UnderC > 1concurrent load, this 4-bit mixed checkpoint occasionally changes answers on borderline list-extraction fields (~0.4%of responses in mixed invoice workloads;23–31%under targetedC = 2co-batching on multi-item invoices beginning with"Folders; Desk lamps"), whereasC = 1executes a fixed sub-prompt wave schedule and repeats a single output. Revertingpatches/sglang-v0.5.23-clairic-sm120.patchand disabling allgeudrik/clairic-sm120-servehooks (CLAIRIC_FUSED_SAMPLER=0,disable_radix_cache=True,disable_prefill_cuda_graph=True) on stocklmsysorg/sglang:v0.5.23-cu130reproduces identical 8-decimal-place log probabilities and identicalC > 1flips—confirming that the custom SM120 Triton kernels,Sampler/LogitsProcessorhooks,MambaRadixCache,xgrammarbitmasks, and isolated frontend slot pool are not the cause.
- Root cause (
SM120operator & layer trace): FlashInfer's SM120 NVFP4 quantizer and CUTLASS GEMM (fp4_quantize+mm_fp4) and ModelOpt per-tensor FP8 GEMMs are100.00%bit-exact batch-invariant (max_abs = 0.000000across prefillM = 231, 468, 1404and decodeM = 1, 2, 8). Batch-size non-invariance enters at unquantized BF16 projections—starting atlayers.0.linear_attn.in_proj_ba([M, 5120] -> [M, 96]), where cuBLAS changes itssplit-Kreduction strategy with total batch tokensM(max_abs = 0.03125,mean_abs = 0.00192). When a1-ULP BF16 perturbation (rel_rms = 0.00133) enterslayers.4.mlp,0.180%of dynamicfp4_quantizeactivations cross a discrete 4-bit E2M1 step boundary, amplifying relative difference by40.70xin a single NVFP4 MLP versus4.14xin BF16. Compounded across the 52 interior NVFP4 layers, step-0 vocabulary logits shift by up to3.33nats (mean_abs = 0.418) betweenB = 1(M = 231) andB = 6(M = 1404). Where 4-bit quantization and Qwen3.5 BPE boundary splitting ("Folders"splits mass between merged token83565'"F'and1'"'+89582'Folders', whereas"Desk lamps"concentrates on1'"'+67166'Desk') erode item-1 confidence from0.68–0.71(BF16) to0.29–0.55(NVFP4), co-batching flips near-tie prompts.- Deterministic mode & recommended
C > 1alternative: Enabling SGLang--enable-deterministic-inference --linear-attn-prefill-backend triton(batch_invariant_ops) removesC > 1batch variance (collapsing concurrent responses to 1 bit-identical float state), but disablesRadixCacheon FlashInfer attention and shows that this checkpoint deterministically mispredicts3 / 12tested"Folders; Desk lamps"invoices even atB = 1(C = 1passed under default cuBLAS only becauseC = 1's specificsplit-Kperturbation nudged a0.26–0.29-confidence case across zero). For concurrentC > 1production serving, usegeudrik/clairic-27b-fp8-sm120withgeudrik/clairic-sm120-serve(12 / 12"Folders"across all batch shapes at0.55–0.75confidence,0 / 30(0.0%) failures in theC = 2concurrent mixed-load stress test,1.318 req/satC = 8).
Companion Repositories
- Full SM120 Engineering Report & Benchmark Ledger:
ENGINEERING_REPORT.md - Serving Engine, CLI, Quantization & Patch Set:
geudrik/clairic-sm120-serve - Block-128 Dynamic W8A8 FP8 Checkpoint (29.02 GiB total, 51/51 & 79/79 parity, 1.318 req/s
@C=8):geudrik/clairic-27b-fp8-sm120 - Raw Benchmark JSONs & Candidate Responses:
hf://buckets/geudrik/clairic-sm120-work
1. Mixed-Precision Layer Map and Selection Disclosure
Cloudflare/clairic attaches ClairicHead directly to final hidden states (layers.63 post-final_norm) to read <|fim_pad|> slots for compute, duration, estimate, and forecast fields. Keeping the 4 entry MLPs (layers.0..3) and 8 exit MLPs (layers.56..63) in FP8 (+1.31 GiB over an all-64-MLP NVFP4 checkpoint at 19.81 GiB) was selected after comparing bench_sglang_nvfp4_sm120.json (all-64-MLP NVFP4, fp8_e4m3 KV, 50/51 selection, case5.closing_inventory 1000 -> 100, mean_estimate_rel_diff = 0.0080) against bench_sglang_nvfp4_boundary_fp8_sm120.json (boundary-FP8, fp8_e4m3 KV, 51/51 selection, mean_estimate_rel_diff = 0.0192) on the 8-case selection suite (workload_suite.py). Under the published BF16 KV CLI default (sglang_nvfp4_cli_defaults_v2), the boundary-FP8 checkpoint still predicts 100 on case5.closing_inventory (50/51, mean_estimate_rel_diff = 0.0025; the all-64-MLP checkpoint was not re-evaluated under BF16 KV). Out-of-sample generalization is reported separately on the 12-case disjoint held-out suite (heldout_suite.py, 76/79 reference agreement and 69/71 ground truth).
| Layer / Module Group | Precision & Format | Matrices | Role |
|---|---|---|---|
Interior SwiGLU MLPs (layers.4..55.mlp.{gate,up,down}_proj) |
NVFP4 (group_size = 16, packed E2M1 uint8 + FP8 E4M3 per-16 scales + FP32 global & input scales) |
156 (52 blocks) | Executes interior feed-forward GEMMs on SM120 FP4 Tensor Cores |
Interior Gated DeltaNet (layers.6..56 linear-attn {in_proj_qkv,in_proj_z,out_proj}) |
NVFP4 (group_size = 16) |
114 (38 blocks) | Compresses interior linear-attention projections to 4-bit |
Entry & Exit MLPs (layers.{0..3, 56..63}.mlp.{gate,up,down}_proj) |
FP8 (E4M3 calibrated weight & input scales) |
36 (12 blocks) | Keeps entry and final-layer MLP projections in 8-bit |
Boundary Gated DeltaNet (layers.{0,1,2,4,5,57,58,60,61,62} linear-attn) |
FP8 (E4M3 calibrated) |
30 (10 blocks) | Preserves boundary recurrent projections |
All 16 Full-Attention GQA blocks (self_attn.{q,k,v,o}_proj) |
FP8 (E4M3 calibrated) |
64 (16 blocks) | Preserves head_dim = 256 retrieval and span grounding |
lm_head, embed_tokens, and 27-layer ViT (model.visual.*) |
BF16 (unquantized) | 2 + full ViT | Preserves vocabulary logprobs, read_slots, and document OCR |
GDN recurrences (in_proj_a, in_proj_b, conv1d, A_log, dt_bias, norms) & clair_head |
BF16 / FP32 (unquantized) | All recurrences + head | Preserves GDN state recurrence; ClairicHead runs TF32 linear + BF16 router KV on GPU |
Calibration Corpus: Calibrated with NVIDIA ModelOpt 0.47.0 (algorithm = "max") over 24 synthetic samples (18 text + 6 image; disjoint in content from both evaluation suites, drawn from similar programmatic table/manifest templates).
2. Benchmarks on NVIDIA RTX PRO 6000 (sm_120, 95.03 GiB Visible)
Conditions: 1x NVIDIA RTX PRO 6000 Blackwell Server Edition (driver 620.70.06, 2,430 MHz max graphics clock), lmsysorg/sglang:v0.5.23-cu130 (sglang 0.5.23, torch 2.14.1+cu130, triton 3.8.0, flashinfer 0.7.2). Comparison tolerances: exact for discrete/list/object, isclose(rel_tol=1e-4, abs_tol=1e-2) for floats, <= 8% for estimate/forecast. Raw JSONs are bundled in benchmarks/results/v2_audit/.
2.1 Concurrent Scaling, Parity, and Calibration (N = 32 Requests / Concurrency Level)
Configuration (KV / mem_frac / mamba / pool) |
Size (Backbone / Total) | Selection Match (51) / GT (47) | Held-Out Match (79) / GT (71) | Mean (3-Run Max) Abs Δ Conf (Sel / Held) | C=1 req/s (p50/p95) |
C=8 req/s (p50/p95) |
C=16 req/s (p50/p95) |
C=32 req/s (p50/p95) |
|---|---|---|---|---|---|---|---|---|
Ref TransformersEngine BF16 (sdpa, Semaphore(1)) |
51.75 / 52.02 GiB | Ref 51/51 / 45/47 | Ref 79/79 / 66/71 | 0.0000 (0.0000) / 0.0000 (0.0000) | 0.225 (2.27 / 17.62 s) | 0.225 (35.59 / 35.67 s) | 0.225 (71.22 / 71.28 s) | 0.225 (72.26 / 141.85 s) |
clairic-27b-fp8-sm120 CLI Defaults (auto / 0.80 / 180 / 24, 3x med) |
28.75 / 29.02 GiB | 51/51 / 45/47 | 79/79 / 66/71 | 0.0064 (0.1408) / 0.0125 (0.2597) | 0.842 (1.00 / 2.57 s) | 1.318 (5.60 / 11.08 s) | 1.259 (11.53 / 21.97 s) | 1.137 (23.69 / 28.04 s) |
clairic-27b-nvfp4-sm120 CLI Defaults (auto / 0.80 / 180 / 24, 3x med) |
20.85 / 21.12 GiB | 50/51 / 44/47 | 76/79 / 69/71 | 0.0338 (0.6860) / 0.0577 (0.7974) | 1.076 (0.75 / 2.13 s) | 1.768 (4.09 / 8.82 s) | 1.733 (8.35 / 15.33 s) | 1.420 (17.98 / 22.48 s) |
clairic-27b-nvfp4-sm120 Live HTTP (uvicorn + httpx, CLI Def) |
20.85 / 21.12 GiB | 50/51 / 44/47 | Not run over HTTP | 0.0356 (0.4913) / — | 1.084 (0.76 / 2.17 s) | 1.748 (4.04 / 9.04 s) | 1.514 (9.29 / 17.62 s) | Not run over HTTP |
clairic-27b-nvfp4-sm120 + fp8_e4m3 KV (fp8_e4m3 / 0.80 / 180 / 24) |
20.85 / 21.12 GiB | 50/51 / 44/47 | 77/79 / 66/71 | 0.0542 (0.7347) / 0.0360 (0.6190) | 1.077 (0.76 / 2.16 s) | 1.719 (4.22 / 8.20 s) | 1.671 (8.91 / 16.09 s) | 1.634 (16.06 / 19.49 s) |
clairic-27b-nvfp4-sm120 Mode B No-Radix (auto / 0.72 / 96 / 32) |
20.85 / 21.12 GiB | 50/51 / 44/47 | 75/79 / 68/71 | 0.0329 (0.6900) / 0.0441 (0.7304) | 0.650 (0.74 / 6.62 s) | 0.804 (9.86 / 19.58 s) | 0.821 (14.57 / 33.78 s) | 0.825 (19.59 / 38.76 s) |
bench_sglang_nvfp4_boundary_fp8_sm120 (pre-fix, fp8_e4m3 / 0.86 / 370 / 32, N=8..32)* |
20.85 / 21.12 GiB | 51/51 / 41/42 scalar | Not run | 0.0424 (0.5088) / — | 1.074 (0.76 / 2.20 s) | 1.683 (4.30 / 4.75 s) | 1.677 (7.40 / 9.53 s) | 1.788 (14.34 / 17.77 s) |
*bench_sglang_nvfp4_boundary_fp8_sm120.json ran prior to the per-slot tokenizer, 16-bit PID tag, TP-rank-0 guard, and TTL eviction code updates, used N = 8..32 requests per concurrency level, and evaluated only the 42-field scalar ground-truth subset.
2.2 Warm Per-Case Single-Request Latencies (3-Run Medians)
| Case ID | Modality & Schema | Fields | Ref TransformersEngine |
clairic-27b-nvfp4-sm120 (3x Med) |
Speedup |
|---|---|---|---|---|---|
case1_text_invoice |
Text scalars + list + enum | 9 | 3.20 s | 0.66 s | 4.82x |
case2_text_table_objects |
Markdown table object list | 4 | 2.45 s | 0.84 s | 2.90x |
case3_image_receipt |
Receipt PNG + line-item objects | 7 | 6.13 s | 1.12 s | 5.48x |
case4_two_page_po_images |
2-page PO PNGs (85,525 input tok) | 8 | 17.76 s | 2.15 s | 8.27x |
case5_clairic_head_typed |
compute, duration, estimate, forecast |
5 | 0.21 s | 0.10 s | 2.15x |
case6_hybrid_multimodal_ar_and_head |
Receipt PNG + AR + ClairicHead |
5 | 7.12 s | 0.44 s | 16.03x |
case7_long_context_mixed |
2,358-token operations report | 9 | 5.57 s | 1.86 s | 2.99x |
case8_compact_triage |
Compact 4-field triage | 4 | 0.52 s | 0.21 s | 2.51x |
ho04_scan_thermal_receipt_image |
Skewed noisy JPEG receipt | 7 | 6.35 s | 1.46 s | 4.34x |
ho06_two_page_eco_images |
2-page skewed JPEG ECO (82,265 tok) | 7 | 17.32 s | 2.12 s | 8.16x |
2.3 SM120 Triton Kernel Microbenchmarks
| Kernel / Subsystem | Shape & Condition | Reference | SM120 Kernel | Speedup | Peak Extra HBM |
|---|---|---|---|---|---|
fused_span_argmax_prob |
F = 8, S = 65,273, W = 64 |
1.777 ms | 0.064 ms | 27.77x | 257.99 -> 0.13 MiB |
run_fused_greedy_logprob (sampler microbench) |
B = 1 .. 64, V = 248,320 BF16 |
0.085 – 1.146 ms | 0.120 – 0.263 ms | 0.71x – 4.36x | 30.34 -> 0.06 MiB (@B=64) |
fast_read_slots |
rows = 1024, H = 5120, V = 248,320 |
14.236 ms | 6.955 ms | 2.05x | 606.26 -> 485.01 MiB |
ClairicHead (S = 34,808, GPU / E2E w/ CPU) |
6 typed fields, 3 seeds (randn * 0.1) |
704.35 / 2,224.14 ms | 14.64 / 1,568.33 ms | 48.11x GPU / 1.42x E2E | 1,786.54 -> 608.62 MiB |
3. SGLang v0.5.23 Unified Diff Set (patches/)
patches/sglang-v0.5.23-clairic-sm120.patch and patches/apply_sglang_patch.py are bundled in this repository:
python3 patches/apply_sglang_patch.py --check
python3 patches/apply_sglang_patch.py
LogitsProcessor.forward(CLAIRIC_HEAD_DIR): On TP rank 0, interceptsread_typedEXTENDpasses tagged viatoken_ids_logprobs = [248319, 248318, hi, lo](two unassigned tail sentinel IDs + two in-range IDs carrying the integer tag), runsfast_read_layout_gpu_onlyusing the unquantized BF16lm_head.weightstored in this checkpoint, writes the compact FP32 readout vector (3.8–132.8 KiB) to/dev/shm, and evicts stale chunks older than 120 s on subsequentLogitsProcessorcalls.Sampler.forward(CLAIRIC_FUSED_SAMPLER=1): Executesrun_fused_greedy_logprobon post-grammar-mask greedy batches without an extra kernel bitmask (not SGLANG_RETURN_ORIGINAL_LOGPROB), avoiding[B, 248,320]log_softmaxallocations (<= 1.56e-5end-to-end logprob difference vs SGLang's default sampler).
4. Serving and Reproduction Instructions
4.1 Concurrent Serving on NVIDIA RTX PRO 6000 (sm_120)
git clone https://huggingface.co/geudrik/clairic-sm120-serve
pip install -e ./clairic-sm120-serve
hf download geudrik/clairic-27b-nvfp4-sm120 --local-dir /models/clairic-27b-nvfp4-sm120
python3 /models/clairic-27b-nvfp4-sm120/patches/apply_sglang_patch.py
# Mode A (CLI Default — multi-field AR + multimodal + ClairicHead, 81.14 / 90.92 GiB load/peak VRAM)
clairic-sm120-serve \
--model-path /models/clairic-27b-nvfp4-sm120 \
--kv-cache-dtype auto \
--mem-fraction-static 0.80 \
--max-mamba-cache-size 180 \
--max-running-requests 48 \
--chunked-prefill-size 16384 \
--pool-size 24 \
--port 8000
# Mode B (Single-pass ClairicHead or 1-field workloads ONLY — 73.80 / 79.57 GiB load/peak VRAM;
# --disable-radix-cache disables intra-request prefix sharing, slowing 2-page PO from 2.15s med to 6.78s)
clairic-sm120-serve \
--model-path /models/clairic-27b-nvfp4-sm120 \
--disable-radix-cache \
--kv-cache-dtype auto \
--mem-fraction-static 0.72 \
--max-mamba-cache-size 96 \
--max-running-requests 96 \
--chunked-prefill-size 16384 \
--pool-size 32 \
--port 8000
4.2 Reproduce Quantization and Benchmarks
pip install --no-cache-dir --no-deps --target /tmp/tf510 "transformers==5.10.2" "tokenizers==0.22.2" "kernels==0.13.0"
git clone https://huggingface.co/geudrik/clairic-sm120-serve /workspace/clairic-sm120-serve
cd /workspace/clairic-sm120-serve
pip install --no-deps -e .
python3 patches/apply_sglang_patch.py
# 1. Regenerate this 20.85 GiB (21.12 GiB total) Boundary-Protected NVFP4 + FP8 checkpoint
PYTHONPATH=/tmp/tf510 \
python3 quantization/quantize_nvfp4_mixed.py \
--src-dir /models/clairic \
--dst-dir /tmp/clairic-nvfp4
# 2. Reproduce 3-repeat CLI-default evaluation across both selection (8-case) and held-out (12-case) suites
python3 benchmarks/bench_sglang_engine.py \
--label sglang_nvfp4_cli_defaults_v2 \
--model-path /tmp/clairic-nvfp4 \
--head-source-path /tmp/clairic-nvfp4 \
--golden-json benchmarks/results/v2_audit/golden_workload_v2.json \
--heldout-golden-json benchmarks/results/v2_audit/golden_heldout_v2.json \
--output-json /tmp/sglang_nvfp4_cli_defaults_v2.json \
--pool-size 24 \
--kv-cache-dtype auto \
--mem-fraction-static 0.80 \
--max-mamba-cache-size 180 \
--max-running-requests 48 \
--chunked-prefill-size 16384 \
--requests-per-c 32 \
--repeats 3
5. Qualification Scope and Limitations
- Hardware Requirement: Requires NVIDIA Blackwell (
sm_100/sm_120) FP4 Tensor Cores; qualified on 1x NVIDIA RTX PRO 6000 Blackwell Server Edition (sm_120, 95.03 GiB visible) withlmsysorg/sglang:v0.5.23-cu130. - Precision, Nondeterminism & Confidence Tradeoff:
case5.closing_inventory(1000 -> 100) flips on the selection suite under BF16 KV cache, held-out list-gating pass counts vary slightly across repeats (187 vs 195 passes while keeping 76/79 top-level values), and client confidence thresholds experience 1/47 (@0.50) to 4/47 median[4–5](@0.80) flips on selection and 4/72 median[3–4](@0.50) to 10/72 (@0.80) flips on held-out. Usegeudrik/clairic-27b-fp8-sm120when exact reference parity or tighter confidence calibration is required. - Untested:
tp_size > 1,fix_mistral_regex=Truetokenizer loading, real camera/multi-hundred-page production PDFs, and long-duration soak testing.
- Downloads last month
- 306