transformers
Qwen3.8 metal perf
#51217
Open

Qwen3.8 metal perf #51217

tarekziade wants to merge 154 commits into main from qwen3.8-metal-perf
tarekziade
ArthurZucker [compressed-tensors] dequantize while loading through the conversion …
6030455c
ArthurZucker [compressed-tensors] dequantize=True drops w8a8 activation quantizati…
ac8b3c96
ArthurZucker [compressed-tensors] dequantize is the user's flag: base picks the lo…
eaadfac3
ArthurZucker [compressed-tensors] static serialized names and load op, op resolves…
0501fe0f
ArthurZucker [compressed-tensors] deserialize through the conversion mapping: weig…
93b11334
ArthurZucker [quantization] per-layer quantization plan: mixed NVFP4 + FP8 checkpo…
6309e6ea
ArthurZucker [quantization] plan: TypeGuard for the plans
387320fc
ArthurZucker [quantization] no left name boundary: own-name converters use 3 name …
749a2632
ArthurZucker [compressed-tensors] dequantize while loading through the conversion …
14796da4
ArthurZucker [compressed-tensors] dequantize=True drops w8a8 activation quantizati…
81ff283f
ArthurZucker [compressed-tensors] dequantize is the user's flag: base picks the lo…
3acfe149
ArthurZucker [compressed-tensors] static serialized names and load op, op resolves…
acc40ca4
ArthurZucker [compressed-tensors] deserialize through the conversion mapping: weig…
20b3c02e
ArthurZucker [compressed-tensors] keep weights compressed unless dequantize=True
7cf9e8ae
ArthurZucker [quantization] quantize on the fly through a "quantize" load operation
142380e8
ArthurZucker [quantization] bnb dequantizes through the "dequantize" load operatio…
1a3ccb59
ArthurZucker [quantization] every config takes `dequantize`, a loading attribute o…
9cad2c38
ArthurZucker [quantization] gemma dequantizes through the "dequantize" load operation
1f799fc1
ArthurZucker [quantization] remove post-load model.dequantize(): load with dequant…
4e221ebd
ArthurZucker [quantization] "dequantize" load operation for every quantizer
8c93f47c
ArthurZucker [loading] source patterns start on a name boundary; don't dequantize …
d621a7cd
ArthurZucker [quantization] saving goes through the "serialize" load operation (to…
ae153968
ArthurZucker [quantization] hqq "quantize" op; higgs repacks in "deserialize"; fbg…
cfccc9c0
ArthurZucker [loading] non-persistent buffers holding a value keep it when moved o…
baf46a18
ArthurZucker [quantization] sinq saves through "serialize"; fbgemm input_scale_ub …
d07429eb
ArthurZucker [quantization] dequantize fused params stored under their own name; n…
cbb64d83
ArthurZucker [quantization] quantizers import without torch; doc headings without …
2e7276ff
ArthurZucker [quantization] review: `dequantizing` property, one FP4 table, leftov…
47e4ec2c
ArthurZucker [quantization] `dequantizing` holds for configs without the attribute
0e4799db
ArthurZucker [quantization] get_weight_conversions reads `dequantizing`
104943c3
ArthurZucker [quantization] leave NVFP4, fused-experts dequantize, the fp8 chain f…
a5fcfdfe
ArthurZucker [loading] keep WeightTransform.quantization_operation for peft
0e162f00
ArthurZucker [quantization] port bnb dequantize tests to dequantize=True
9311c929
ArthurZucker [quantization] bnb dequantize: undo Conv1D transpose, cast to the den…
4f110910
ArthurZucker [compressed-tensors] test the default load keeps the compressed forma…
c1884c25
ArthurZucker [quantization] say dequantized / unquantized instead of dense
fec5a1f2
ArthurZucker [hqq] swap in empty HqqLinear before loading, load ops fill it in place
3d0dd750
ArthurZucker [quantization] swap modules in one pass through a per-quantizer `quan…
103d28ba
ArthurZucker [compressed-tensors] docs: default load keeps the compressed format a…
ac06ef59
ArthurZucker Merge remote-tracking branch 'origin/compressed-tensors-dequantize-on…
dbfba366
ArthurZucker [quantization] plan: one update_weight_conversions, quantizer sets ea…
5e2c8471
ArthurZucker [quantization] plan: delegate after-load hooks, drop dequantized patt…
165c1f42
ArthurZucker [eetq] dequantize without the kernel: undo the CUTLASS layout in torc…
5e01aa6b
ArthurZucker [quantization] quantizer_for -> get_quantizer
33194b48
ArthurZucker [quantization] dequantize without kernels: torch bnb 4-bit dequant, s…
5ac253ad
ArthurZucker Merge remote-tracking branch 'origin/compressed-tensors-dequantize-on…
49d23434
ArthurZucker Merge remote-tracking branch 'origin/quantize-load-operation' into HEAD
546564b6
ArthurZucker [fp8] bring back replace_with_fp8_embedding
e5314e79
ArthurZucker [fp8] drop replace_with_fp8_embedding again: quantized_module swaps t…
96923370
ArthurZucker [quantization] load ModelOpt per-layer checkpoints (NVFP4, FP8, MXFP4…
d27969b6
ArthurZucker [quantization plan] cleanup: core back near main, NVFP4 experts forwa…
8333cb22
ArthurZucker Merge quantize-load-operation (#50240): quantize is a load operation,…
41722334
ArthurZucker Merge main into mixed-nvfp4-fp8-plan
959185c0
ArthurZucker Split: quantize / dequantize as load operations move to their own PR …
4d4e8b89
ArthurZucker [docs] add a quantized format: from a FineGrainedFP8 config to a new …
c8e86f58
ArthurZucker [fp8] deserialize ue8m0 scales saved as bytes by their bits (MXFP8)
a2ae59f4
ArthurZucker [quantization] docs follow the plan; ModelOpt single quant_algo loads…
6e4953a7
ArthurZucker human text
3a23dd5c
ArthurZucker not a fan yes of this shit
706bebd6
ArthurZucker nits
034c0c37
ArthurZucker unbloat the fuck up
809e9e71
ArthurZucker more unbloat
0377ebe8
ArthurZucker is it simpler?
8d3639d1
ArthurZucker one line
2e6066a2
ArthurZucker trying to simplify
2431bfeb
ArthurZucker simplify ?
adb262b9
ArthurZucker nits
5e175d00
ArthurZucker will this work?
a4f26d2c
ArthurZucker cleanup?
8bc15305
ArthurZucker this should make it simpler overall
5243cca0
ArthurZucker reject stuffs that need more work for now
035a195f
ArthurZucker nits
d5141f8d
ArthurZucker renames
647fb5e4
ArthurZucker nit
aca01928
ArthurZucker super nit
85c8e9e7
ArthurZucker doc and rename
efa360a2
ArthurZucker space
417f08d1
ArthurZucker update
769a6ffb
ArthurZucker up
488376e9
ArthurZucker Update src/transformers/core_model_loading.py
5564888e
ArthurZucker Merge remote-tracking branch 'origin/main' into mixed-nvfp4-fp8-plan
47a6551f
ArthurZucker Merge remote-tracking branch 'origin/mixed-nvfp4-fp8-plan' into mixed…
cf8a3e8b
ArthurZucker Sort the integrations init (init_isort)
5e4d4fbc
ArthurZucker Kimi-K2.5: name the qkv params its converter unfuses
7b1faa50
ArthurZucker ai update for most review comments, cleaning up now
94909526
ArthurZucker Address review: plan out of Auto, schema readers, per-format experts …
94c9abc2
ArthurZucker FP8: drop the MXFP4 paths, MXFP4 experts run on their own interface
ef08fc2e
ArthurZucker Rename renamed_names to checkpoint_renames; TODO for MiniMax M3's moe…
3e87b6b6
ArthurZucker Shorten the FP8 DeepGEMM dispatch comments (noisy_comments)
baabd050
ArthurZucker FP8 dequantize round trip (single format), NVFP4 experts via experts …
4cf548b3
ArthurZucker cleanup some shit
04f6f81c
ArthurZucker up
b9c16953
ArthurZucker Dequantized models save unquantized again (TODO: quantize back)
5a253392
IlyasMoutawwakil Merge remote-tracking branch 'origin/main' into mixed-nvfp4-fp8-plan
aabbd560
IlyasMoutawwakil Quantization plan fixes: bitsandbytes loading, NVFP4 parallelism and …
bb5fc01b
IlyasMoutawwakil Docstrings, spacing and an NVFP4 limitations note; NVFP4 EP test runs…
2baa90ff
ArthurZucker Stream MoE experts from the checkpoint through a device slot cache
09076510
ArthurZucker experts offload: timing stats, count tied params once in the budget
bebcd3f8
ArthurZucker experts offload: approximate LFU policy
a4bec1af
ArthurZucker experts offload: disk -> pinned RAM -> VRAM on a copy stream (CUDA), …
3885bec5
ArthurZucker Metal gather_qmm experts (MetalExperts) streamed quantized; batched_m…
8d64792f
ArthurZucker experts offload: device slot table + one miss op (compile / CUDA-grap…
6d58cb6c
ArthurZucker experts offload: prompts run on a compact bank of the routed slots
99cb9042
ArthurZucker Stream embedding rows from the checkpoint (device_map "disk" on an nn…
1e8bf79a
ArthurZucker experts offload: safetensors prefetch loader for CUDA reads (one plan…
1054c864
ArthurZucker MetalExperts: scales in the activations' dtype (no cast per call)
6eb58949
ArthurZucker Affine-quantized experts on CUDA (Triton gather_qmv, same layout as M…
822b0e1e
ArthurZucker experts offload: opt-in phase tracing; never set a result on a cancel…
36655576
ArthurZucker experts offload: native stacked banks only, one row read copied into …
bc3225bd
ArthurZucker experts offload: fix pinned-pool completeness and the op registry lea…
ae71b994
ArthurZucker experts offload: one prefetch loader per file for a layer's rows (lis…
1d38fd62
ArthurZucker Metal kernels: fake impls for gather_qmm / quantized_matmul so torch.…
affe295b
ArthurZucker experts offload: benchmarks, diagnostics and bench log
b1486d4e
ArthurZucker bench: import dense_quant lazily
04139338
ArthurZucker experts offload: stream banks loaded through a quantizer's identity c…
1790a91b
ArthurZucker bench: print traceback on failure
14705138
ArthurZucker experts offload: stream rows of a table collected under several patterns
30871ab7
ArthurZucker bench: local conversion on MPS, streamed verify
67c9d882
ArthurZucker experts offload: streamed table rows apply their FP8 dequantization s…
b57d9822
ArthurZucker experts offload: no NaN from unfilled slots (MetalExperts masks senti…
355ffa29
ArthurZucker MetalExperts: back to the weight product (where() broke compiled deco…
25462e59
ArthurZucker StaticCache: create cumulative_length on the device (a 0-d .to() sync…
ced4adf1
ArthurZucker experts offload: streamed embedding rows in the replaced embedding's …
27f1e72f
ArthurZucker generate: deferred stop check returns without waiting on the device w…
16ec7655
ArthurZucker Metal kernels for gated delta rule and causal conv1d on MPS; streamed…
22e80a06
ArthurZucker qwen4_exp: vectorize the QSA indexer (no per-query loop, compiles ful…
9cefc7bc
ArthurZucker bench: Qwen3.8 synthetic (real dims, random 4-bit weights saved once)…
af6da62f
ArthurZucker agent: Qwen3.8 on H200 task, streamed logs, per-iteration cap
07ed97c3
ArthurZucker Metal: batch-1 4-bit matvec for thin matrices (Qwen3.8 synthetic deco…
861295d3
ArthurZucker bench: Qwen3.8 synthetic Metal log + stub ablations
c09cf451
ArthurZucker bench: Qwen3.8 Metal negative results (vectorized qmv, fusion, specul…
da8eec59
ArthurZucker Metal experts decode: down projection + routing sum in one kernel (Qw…
a61155fe
ArthurZucker Metal: short-side batch-1 qmv (lanes per row 16/32) for hyper-connect…
52052d1d
ArthurZucker Metal gated delta rule: advance the cache's float32 state in place (n…
9a6ccae3
ArthurZucker Metal gated delta rule: 4 threads per state column
150b7ef2
ArthurZucker Metal ops: dtype/contiguous casts outside the custom ops so compile f…
1b31fa8d
ArthurZucker Metal: fuse sibling projections sharing an input (Qwen3.8 synthetic d…
97dab98a
ArthurZucker Metal gated delta rule: recurrent state in the activations' dtype (bf…
5ad6b7c2
ArthurZucker Metal: every batch-1 4-bit linear through qmv4 (Qwen3.8 synthetic 46.…
29544cde
ArthurZucker Metal: 64-lane expert down kernel, scales cast to the activations' dt…
8798ddb2
ArthurZucker experts offload: routing copy queued before pass 1, decode pass 2 ove…
0d3918a5
ArthurZucker experts offload on MPS: device waits on a Metal shared event while a …
3f2ce59e
ArthurZucker experts offload on MPS: pass 1 overlaps the host's miss check, misses…
7ca11826
ArthurZucker experts offload on MPS: host reads the slots pass 1 gathered, immedia…
292d4f9d
ArthurZucker experts offload: Metal kernels from the Hub (ArthurZ/metal-moe-decode…
dbf8a201
ArthurZucker experts offload on MPS: misses read by safetensors prefetch straight …
e6e02182
ArthurZucker Qwen4 MoE: fused Metal router, deterministic top-k, and a safe offloa…
c49ae70e
ArthurZucker experts offload: decode profiling scripts and NO_COMPILE / DUMP_TOKEN…
f92836e9
ArthurZucker experts offload: honour MAX_AHEAD from the environment, add an in-pro…
de8f59fa
tarekziade tarekziade marked this pull request as draft 1 day ago
ArthurZucker experts offload: measure the handshake, the guess, and the scalar syncs
fb1e3611
tarekziade added a not about crashing
c9fd8845
tarekziade Merge commit 'fb0b0bd018' into qwen3.8-metal-perf
0d784cf2
tarekziade tarekziade force pushed from 92959d79 to 0d784cf2 1 day ago
tarekziade do a per file prefetch, it speeds it up
c4e28a7e
tarekziade ruff
38b83757
github-actions
tarekziade
tarekziade commented on 2026-11-25
tarekziade

Login to write a write a comment.

Login via GitHub

Reviewers
No reviews
Assignees
No one assigned
Labels
Milestone