Expand description
Weight name mapping from HuggingFace safetensors to typed layer structures.
Maps the 72 unique weight patterns from Qwen3-Next-80B-A3B-Instruct-NVFP4 into structured per-layer weight references.
Refactor wave 4a (2026-05-03): split into weight_map/ sub-modules.
Structs§
- Attention
Weights - Full attention layer weights (12 layers in Qwen3-Next).
- Dense
Expert Weight - BF16 expert weight (before NVFP4 quantization).
- Dense
Weight - BF16 dense weight (no quantization).
- Expert
Weight - MoE expert weights (shared across all 512 experts per layer).
- Fp8Dense
Weight - FP8 E4M3 dense weight (runtime-quantized from BF16).
- Fp8Expert
Weight - FP8 expert weight: gate/up/down projections as FP8 block-scaled weights.
- Fp8Weight
- FP8 E4M3 checkpoint weight loaded directly from safetensors.
- Fp8Weight
Transposed - FP8 E4M3 weight with transposed layout for coalesced prefill GEMM.
- Model
Weights - All model weights organized by layer.
- MoeWeights
- MoE layer weights.
- MtpWeights
- MTP (Multi-Token Prediction) head weights (all BF16 from safetensors).
- Nemotron
Expert Weight - Nemotron-H 2-projection expert (up_proj + relu² + down_proj, no gate_proj).
- Nemotron
MoeWeights - Nemotron-H MoE layer weights.
- Nemotron
SsmWeights - Nemotron-H Mamba-2 SSM weights.
- Packed
Q2Weight - Keep-packed ternary Q2_0 weight: a single contiguous buffer of raw PrismML
block_q2_0blocks ([fp16 d][group/4 bytes of 2-bit codes],value = (code-1)*d), row-major over[n, k]. The scale is INLINE (one fp16 per group ofgroupelements) — there is no companion scale tensor, unlike NVFP4/FP8. Consumed by the nativeq2_0_gemvdecode kernel, which reads the scale from each block. Built from aWeightDtype::PackedQ2_0store tensor underATLAS_GGUF_NATIVE_Q2=1; the buffer is owned by theWeightStore, so this struct only borrows the pointer (no free on drop). - Quant
Expert Weight - Per-expert weights in any supported quant format.
- Quantized
Weight - NVFP4 quantized weight: packed E2M1 data + FP8 block scales + FP32 per-tensor scale.
- SsmWeights
- Linear attention (SSM / Gated Delta Net) layer weights (36 layers).
- SsmWeights
Qwen35 - Qwen3.5 SSM weights with separate projections.
Enums§
- Layer
Weights - All weights for one transformer layer.
- Nemotron
SsmQuant - SSM weight quantization format detected at load time.
- Nvfp4
Variant - Weight quantization variant (on-disk format).
- Quant
Weight - Quantized weight for any supported format.
- Weight
Quant Format - Runtime tag for the actual quantization format of a weight buffer in
GPU memory. Distinct from on-disk format (which
Nvfp4Variantdescribes). Used to assert at kernel-call sites that the weight matches what the kernel expects — preventing silent leaks like FP8-block-scaled data being passed through a NVFP4 GEMM, or single-scale FP8 being passed through a kernel that expects per-row scales.
Functions§
- detect_
nvfp4_ variant - Detect the weight quantization variant from the weight store.
- load_
fp8_ block_ scaled_ as_ fp8weight - Load an FP8 E4M3 block-scaled checkpoint weight as a native
Fp8Weight. - load_
fp8_ weight - Load an FP8 E4M3 checkpoint weight with per-row f32 scales.
- quantize_
to_ fp8 - Quantize a BF16 dense weight to FP8 E4M3 on GPU.
- quantize_
to_ fp8_ blockscaled - Quantize an
[n, k]BF16 dense weight to block-scaled FP8 E4M3 on GPU.