[RFC] Backend-pluggable low-precision training for Dense Linear and AutoEP grouped GEMM (Ascend HiFloat8)
Summary
I propose a shared DeepSpeed training quantizer interface for Linear and AutoEP grouped experts. Configuration selects a backend first and then a recipe. PR #8784 adds Ascend HiFloat8 through the official TorchAO extension and adapts the subchannel path merged in #9131 to the same engine interface.
DeepSpeed owns module selection and the training lifecycle. Each backend owns its numerical configuration and GEMMs. TorchAO converts selected modules through public AO configs and one torchao.quantization.quantize_ call. Subchannel retains its existing converter, CUDA Triton kernels, and PyTorch reference path.
Motivation
The Q4 MoE training work focuses on the expert GEMMs after routing. Lower-precision operands let those GEMMs use native low-precision compute. The Ascend HiFloat8 path keeps model parameters, gradients, and EP communication in their existing precision. Quantization and layout work, routing, and communication still affect overall step time, so we measure training throughput and peak memory alongside operator timing.
The RFC feedback calls for per-format module selection and a structure that can grow across platforms. A shared lifecycle with backend-owned recipes gives both AO and subchannel a place under quantization. It also leaves room for formats such as FP8 to have separate recipes on different backends. Configuration feedback · AO and Triton convergence discussion
Architecture
DeepSpeed parses the configuration, selects a TrainingQuantizer adapter, and runs its compatibility checks before module replacement. Both adapters convert after AutoEP and before optimizer setup. AutoEP keeps expert sharding, activation, routing, padding, dispatch, and combine. TrainingQuantizer implementation
flowchart LR
C["quantization config"] --> E["DeepSpeed TrainingQuantizer"]
E --> S["Subchannel before device placement"]
E --> A["TorchAO after device placement"]
S --> T["Existing subchannel converter"]
T --> K["CUDA Triton or PyTorch reference"]
A --> Q["Public AO config + one quantize_"]
Q --> N["Ascend HiFloat8 Linear and grouped GEMMs"]
- TorchAO. The accelerator resolves the optional public
torchao.hifloat8.HiFloat8Configviaget_training_quantization_config(format_name). DeepSpeed builds aFqnToConfigmap for the selected Linear modules and statelessgrouped_mmleaves. AO parses each applicable recipe and applies it through onequantize_call. The expert container still owns its BF16 parameters, so conversion preserves parameter identity and checkpoint keys. The native HiFloat8 path depends on the Ascend extension's dtype, quantization, and GEMM kernels. Ordinary NPU BF16 grouped GEMM comes from a separate accelerator capability. Ascend TorchAO extension - Subchannel. The adapter calls the existing #9131 converter with its typed recipe and at its original conversion point before device placement. Its include/exclude filters, per-GEMM settings, Triton capability checks, and reference fallback retain their existing behavior. Subchannel implementation and validation
Numerical and storage contract
The pinned public HiFloat8 recipe accepts per-tensor scaling. DeepSpeed keeps input/weight/gradient scale denominators 15/15/224 as its training defaults. An explicit null numerical range delegates to AO's native range. AO handles BF16/FP16 working precision and returns converted module outputs and gradients in their original boundary dtypes. HiFloat8 changes GEMM operands while BF16 parameter storage and EP dispatch/combine remain in place.
Subchannel can set forward, dx, and dw independently. Its row/block scaling, stochastic rounding, and optional Hadamard rotation belong to its own recipe. The interface keeps kernel-specific settings with the backend that implements and validates them.
Quick start
Use TorchAO 0.18.x with a compatible official Ascend extension, TorchNPU and CANN. Enable the extension's automatic activation. For a Qwen3.5 text training configuration on four NPU ranks, merge the following fields into the training config.
{
"train_micro_batch_size_per_gpu": 1,
"gradient_accumulation_steps": 1,
"bf16": {"enabled": true},
"zero_optimization": {"stage": 2},
"optimizer": {"type": "AdamW", "params": {"lr": 0.00001, "weight_decay": 0.0}},
"expert_parallel": {"enabled": true, "autoep_size": 4, "preset_model": "qwen3_5_moe"},
"quantization": {
"torchao": {
"hifloat8": {
"enabled": true,
"module_name_patterns": ["*.experts", "*.self_attn.q_proj"],
"module_configs": {
"model.language_model.layers.3.self_attn.q_proj": {"grad_dst_type_max": 15},
"_default": {}
}
}
}
}
}
Pass the config to the normal deepspeed.initialize(model=model, config=ds_config) call. For Dense-only training, omit AutoEP and use the model's Linear module names. Every selector must match an eligible module after AutoEP. Exact names win over the first full-match re: selector, then _default. A recipe dictionary overrides the shared config and a null entry skips that module. A packed expert group uses one recipe. The previous quantization.hifloat8 and top-level hifloat8 spellings remain accepted. HiFloat8 tutorial
The same interface can select the in-tree subchannel path. This example quantizes the selected expert GEMMs to INT8 with unquantized input-gradient GEMMs.
{
"quantization": {
"subchannel": {
"int8": {
"enabled": true,
"modules": ["*.experts"],
"forward": {"block_size": 128},
"dx": {"format": "none"}
}
}
}
}
Subchannel applies the selected recipe to modules matched by modules and exclude_modules. Its flat #9131 configuration continues to work with independent formats per GEMM. The named subchannel.int8 and subchannel.fp8 spellings supply format defaults. HiFloat8's per-module overrides select different policies within one format. This revision enables one backend per engine and rejects overlapping legacy and canonical HiFloat8 declarations. Configuration reference
Results on Ascend 950DT
The throughput tables highlight configurations that improved on their paired BF16 baselines. The PR #8784 results include the other ZeRO-2 configurations.
Official AO: single-node throughput and two-node numerics
Setup. Qwen3.5-122B-A10B on Ascend 950DT NPUs (96 GiB each), AutoEP8, ZeRO-2, sequence cap 1,024, global batch 64, reentrant activation checkpointing, and BF16 parameters and EP traffic in both arms. All 48 layers ran; only the routed and shared expert weights in layers 0 and 47 were updated (about 3.96% of the model). MB is the per-NPU microbatch and GAS is the number of accumulation steps.
The NPU runtime used PyTorch 2.12.0+cpu, TorchNPU 2.12.0.post2, TorchAO 0.18.0, and Ascend driver 25.1.rc3. Single-node pairs used DeepSpeed b0b9296d and CANN 9.2.0. The two-node pair used DeepSpeed f7680af9 and CANN 9.2.0-beta.2. The official Ascend AO pin for both was 539dd693. The interrupted two-node pair used a fixed 3,200-example text SFT corpus, AdamW at 1e-5 with cosine decay, and seed/data seed 42.
| Topology and batch | Paired steps | BF16 tok/s | HiFloat8 tok/s | Throughput change | Peak allocated (GiB), BF16 / HiFloat8 | Peak reserved (GiB), BF16 / HiFloat8 |
|---|---|---|---|---|---|---|
| 1 node × 8, MB8/GAS1, pair 1 | 20 | 8,164.31 | 8,357.71 | +2.37% | 71.273 / 71.273 | 75.225 / 75.244 |
| 1 node × 8, MB8/GAS1, pair 2 | 20 | 8,193.48 | 8,358.77 | +2.02% | 71.273 / 71.273 | 75.225 / 75.244 |
| 1 node × 8, MB8/GAS1, pair 3 | 20 | 8,193.75 | 8,340.93 | +1.80% | 71.273 / 71.273 | 75.225 / 75.244 |
Single-node throughput is input tokens divided by the slowest rank's cumulative training time over steps 6–20. Peak memory is the maximum logged across ranks. Device sharing was observed in single-node BF16 pair 1. Across the three single-node pairs, the largest global loss and gradient-norm differences were 0.1745% / 0.7222%.
Two-node numerical check. Both jobs used 4 NPUs per node, MB2/GAS4, and HCCL with AIV requested. Both were scheduled for 1,000 optimizer steps. BF16 recorded 521 steps and HiFloat8 recorded 32; only steps 1–32 can be paired. Batch fingerprints and initial trainable parameter fingerprints match on all eight ranks, and all recorded gradients in that window were finite. The historical run did not record a complete frozen-weight fingerprint. Global loss differs from BF16 by 0.4037% max / 0.1733% mean; global gradient norm differs by 1.0194% max / 0.4007% mean. A separate 20-step HiFloat8-only smoke completed.

Four-node follow-ups with local experiment changes
Four nodes with eight Ascend 950DT NPUs each, AutoEP32, ZeRO-2, GAS1, BF16 EP communication and no LoRA. All 48 Qwen3.5-122B layers executed; only the expert weights in the listed layers were updated. The MB16 and MB48 rows use a sequence cap of 1,024. These single-pair follow-ups used CANN 9.2.0-beta.2 and started from f7680af9 and the official AO snapshot, with local patches and launch options. The 64K SP16 run quantized only grouped experts; attention projections stayed BF16.
| Run configuration | Paired steps | Input tok/s, BF16 / HiFloat8 | Change | Max loss / grad-norm gap | Peak allocated GiB, BF16 / HiFloat8 | Peak reserved GiB, BF16 / HiFloat8 |
|---|---|---|---|---|---|---|
| MB16, layers 0 and 47 | 16 | 28,799 / 30,022 | +4.25% | 0.576% / 0.589% | 71.13 / 71.13 | 77.90 / 77.90 |
| MB16, layer 47, tuned GDN/attention and HiFloat8 weight cache | 24 | 143,341 / 154,901 | +8.06% | 0.782% / 0.917% | 36.15 / 39.46 | 36.59 / 40.71 |
| MB48, layer 47, tuned path plus NPU reorder fix | 16 | 132,314 / 141,451 | +6.91% | 0.554% / 0.596% | 67.23 / 70.53 | 67.44 / 81.47 |
| MB1, layer 47, SP16, grouped experts only (64K cap) | 12 | 89,555 / 91,275 | +1.92% | 3.008% / 0.761% | 25.49 / 28.72 | 26.26 / 30.36 |
The four-node comparison uses total input tokens divided by the sum of each step's slowest rank time, excluding the first five steps. SP16 token counts remove replicated tokens. The reported gaps are maxima across ranks and steps (per-microbatch training loss and reported gradient norm). Initial parameter and input fingerprints matched in each pair. The tuned MB16 pair reached +8.06% with peak reserved memory increasing from 36.59 to 40.71 GiB. Its HiFloat8 arm used a frozen-weight cache. The tuned rows compare complete configurations, including changes to the weight cache or execution path. They do not isolate HiFloat8 arithmetic or the effect of increasing MB.
Separate four-node ZeRO-3 prototype
A separate local ZeRO-3 prototype on 4 × 8 NPUs (AutoEP32, MB2/GAS1, sequence cap 1,024; expert layers 0 and 47 trainable) recorded 24 paired steps. The maximum loss and gradient-norm gaps were 1.404% and 1.386%; peak allocated and reserved memory were 22.21 / 22.22 and 86.94 / 86.94 GiB, respectively. This run used a local ZeRO-3 patch with prefetch and parameter persistence disabled. See the separate ZeRO-3 branch for the small-model integration work. ZeRO-3 is outside PR #8784's HiFloat8 path.
What the results show
- At MB8/GAS1, the three official AO single-node pairs improved throughput by 1.80%–2.37%. A frozen-expert component test at 2,048 rows per expert measured 11.152 → 10.514 ms of device latency (BF16 → HiFloat8). The single- and two-node runs used different microbatches, accumulation and runtime settings, so a fixed-shape comparison is needed to measure the effect of topology.
- The four-node experiments cover AutoEP32 and sequence caps up to 64K with local changes. Each row is a short training comparison at its listed settings. The separately reported single-node
hif8_perfLoRA result uses its own benchmark branches and is outside this validation. November experiment record - These results cover short paired training windows. The two-node 1,000-step schedule was interrupted. Held-out quality and current-head native NPU and CUDA reruns remain open.
Model and compatibility scope
| Scope | Evidence |
|---|---|
Backend-first integration at 1c7212fd |
Apple M1 CPU, PyTorch 2.12.0: 103 passed, 152 skipped. Three optimizer steps completed through deepspeed.initialize for the default path and CPU subchannel INT8/FP8 reference. Flat and named configurations matched per-step losses and final parameters against b8604777. |
| Earlier official AO HiFloat8 | AO 539dd693: 100 focused tests passed. DeepSpeed f7680af9: 159 passed, 26 CUDA-only skips. Single-device conversion, exact DP2/ZeRO-2 replay, and 20-step AutoEP4 recipe tests passed on Ascend 950DT. |
PR #8784 at 607d11de |
The PR includes the later upstream merge. The native results above predate this head; the CPU results are pinned to 1c7212fd. |
PR #8784 keeps the HiFloat8 ZeRO 0–2 entry point. The official 122B data cover BF16 parameters, ZeRO-2 without CPU/NVMe offload, and short partial-parameter training. Full-parameter SFT, LoRA, offload, compile, prequantized-checkpoint ingestion and end-to-end convergence need their own validation for this integration. The current HiFloat8 path rejects PipelineModule, AutoTP, custom MPU, explicit DeepSpeed MoE, and incompatible expert GEMM overrides.
Upstream proposal and remaining work
- Review the backend and recipe namespace, and the separate conversion stages for AO and subchannel.
- Validate the rebased training interface on Ascend and CUDA. Repeat the matched single-node and two-node Qwen3.5-122B runs on the current head.
- Evaluate additional AO recipes, starting with FP8, while retaining the public config and conversion interface. Define module ownership and overlap before enabling multiple formats or backends in one engine.
- Investigate shape-dependent quantization costs and exposed EP communication with matched runs. Continue the separate ZeRO-3 and checkpoint work.
Source and reproduction
- PR #8784 uses
hazelduan:deepspeed_ao(head607d11de). The backend-first interface was introduced in1c7212fd. - The earlier official AO NPU data uses DeepSpeed
b0b9296dandf7680af9, official Ascend TorchAO539dd693bd15e05563a35e21487cb8cbef850c51, and Swift3e9994baf135f939dffefc9ad4773bae35e2b5b9. Hardware and runtime details are in the experiment record. - The PR description gives the focused CPU command and its tested revision. The configuration reference describes both backend spellings.
AI assistance was used to verify the archived measurements and update this results section.
Earlier experiment records
The October updates and A5 prototype evidence below retain their original source revisions. The performance entries are selected highlights from those runs. Use the architecture, configuration and validation sections above for the current PR.
October 15–19 integration updates, earlier performance data, and compatibility record
2026-10-19 update: AO-owned grouped configuration and handler
Current sources: DeepSpeed 95dd780c, AO e0d59bd (MR31), Swift 3e9994baf.
AO now registers HiFloat8GroupedConfig alongside the Linear workflow. Both recipes use the common numerical base and inherited parsing/validation. DeepSpeed's grouped config/handler file is removed; Engine only selects configurations and invokes the public quantize_ entry point. The provider no longer requires the raw grouped function. No changes to upstream TorchAO's registry or default filter are needed: FQN selection chooses the modules, then configuration type chooses the handler. A plain grouped module was validated without importing DeepSpeed.
- AO HiFloat8/namespace suites: 71 passed, 1 empty-Dense native-contract skip. DeepSpeed focused suites: 342 passed, 32 CUDA-only skips, including CPU reference cases.
- A fresh process imports
torchand publictorchaoAPIs, converts a Linear and a plain grouped module together, and runs native forward/backward. There is no explicittorchao_npuimport and no DeepSpeed module loaded. The grouped configuration derives fromHiFloat8Config. - Actual AutoEP EP2/ZeRO-2: paired 30-step runs plus a reverse-order 100-step pair in each precision, BF16 and HiFloat8 separately. Inputs, losses, gradient norms and all 19 final tensors per rank are exact against the previous paired DS/AO sources. Two layers/four experts, hidden64/intermediate128, batch1/sequence16, seed42 and rank-dependent data seed123+rank, AdamW1e-3, same CPU affinity. This is a small actual AutoEP model, not a full Qwen convergence run.
- NPU allocation peaks were identical before and after: 17,627,648 bytes at initialization and 1,035,863,040 bytes during training. Ordinary BF16 execution code was unchanged.
- DP2/ZeRO-2/GAS2 checkpoint/resume retains exact subsequent losses, parameters and optimizer state. Typed Linear/grouped recipes have equal numerical fields; grouped modules reuse the same grouped recipe. Experts are replicated, so this is not AutoEP checkpoint proof.
- Local CPU focused tests: 40 passed, 82 NPU-dependent skips. The first three reconstructed DeepSpeed commits were also tested independently: 199/6, 6/24 and 10/37 passed/skipped. Changed-file checks cover the full feature diff. Final trees match the validated source, with only a separately checked documentation wording correction after the initial native suites.
Existing histories were reorganized into four functional commits per repository with signed trailers and backups. The consolidated final trees retain the validated implementation; no new PR/MR was created.
| Order | DeepSpeed | AO NPU |
|---|---|---|
| 1 | 98caec79 fix(autoep): preserve Qwen3.5 routing and rank-local checkpoints |
6b034fd fix: preserve NPU auto-activation during TorchAO discovery |
| 2 | 9a87125d feat(npu): expose native grouped GEMM through accelerator capabilities |
ea917fd feat(ops): add differentiable native NPU grouped GEMM |
| 3 | b49b298f perf(autoep): generate large permutation indices on NPU |
a388ef3 feat(hifloat8): register Linear and grouped training workflows |
| 4 | 95dd780c feat(hifloat8): integrate AO-owned quantize_ training handlers |
e0d59bd bench(hifloat8): separate timing, memory and kernel attribution |
Reproduction: /data/dxq/hif8_a5_20260914/experiments/ao_grouped_handler_20261019_01, including the matched old/new DS+AO snapshots, run_all.sh, postchecks.sh, public-import probe and per-rank evidence. This validates the integration refactor on a small actual AutoEP model; the earlier full Qwen partial-training and historical performance records below retain their original scope and baselines.
2026-10-16 update: grouped GEMM selection in the handler
October 16 source revisions: DeepSpeed 6b91ff09, AO 9c6dfb4, Swift 967b47fee.
The engine now constructs GroupedExpertsConfig(policy). The existing handler resolves the accelerator's public HiFloat8 provider and binds its grouped GEMM. Linear and experts still share one quantize_ call. Engine-wide preflight remains before any conversion; there is no new conversion wrapper, registry or configuration field. Ordinary BF16 grouped and AO's numerical kernels are unchanged. The paired AO/Swift commits clarify documentation only.
- Four focused suites on Ascend950PR: 341 passed, 32 CUDA-only skips, including CPU reference cases. Covers the real public
quantize_entry point, policy-only grouped conversion, shared policy identity, unsupported capability failure before mutation, native forward/backward, empty/padded experts and BF16 residuals with FP16 working GEMMs. - Local CPU focused suites: 40 passed, 81 NPU-dependent skips. Changed-file pre-commit passed in DeepSpeed and Swift; documentation snippets and whitespace checks passed.
- Real AutoEP EP2/ZeRO-2, two layers/four experts, hidden size 64/intermediate size 128, batch 1/sequence length 16, seed 42, rank-dependent inputs seeded 123+rank, AdamW at 1e-3: BF16 and HiFloat8 separately, 30 matched baseline/candidate steps. Both ranks have exact input hashes, loss/gradient-norm traces and all 19 final parameter tensors.
- The same matched runs had identical peak allocation: 17,627,648 bytes at initialization and 1,035,863,040 bytes during training. These were before/after-refactor checks on the small model within each precision.
- DP2/ZeRO-2/GAS2: checkpoint at optimizer step 2, resume through step 4; subsequent losses, parameters and optimizer state are exact, and policy identity is retained on both ranks. Experts are replicated here; this does not establish AutoEP checkpoint recovery.
- Tested source files were hashed before and after execution: 1,216 paths per DeepSpeed snapshot and 31 AO paths; the candidate matches the committed source. Used the original Conda/CANN/driver through read-only mounts on cards 0/7, avoiding the high-memory workloads on cards 5/6. All experiment jobs completed normally.
The EP2 evidence uses a small actual AutoEP model, not the full Qwen3.5 model. It validates this initialization change against DS e9e32025. Reproduction record: /data/dxq/hif8_a5_20260914/experiments/grouped_handler_20261016_01 (run_all.sh, source manifests, rank tables, exact configs, per-rank results and comparison.json).
2026-10-15 update: public TorchAO entry point and device separation
October 15 source revisions after the documentation sync: DeepSpeed e9e32025, AO 19e33b0, Swift 00c4aa2ed. These documentation-only commits retain the runtime code validated at DS 7b11cd53, AO 3a162ec and Swift 421625ef; the measurements below were not rerun for the documentation update.
- Dense and GroupedExperts now use one public
quantize_call. AO owns the shared numerical policy; DeepSpeed retains a small adapter for its expert container. - The accelerator returns capabilities. The NPU resolver is
accelerator/npu/hifloat8.py; ordinary BF16/FP16 grouped GEMM lives indeepspeed/ops/npu/grouped_mm.py. The October 8 placement of that high-precision operator in AO is historical. - Removed the intermediate provider class, conversion forwarding API and generic
low_precisionconfiguration. Engine code uses public TorchAO APIs without NPU imports. - Qwen3.5 text-wrapper compatibility and NPU permutation index generation use existing AutoEP extension points and introduce no extra HiFloat8 configuration.
Validation of the current layout on A5: 340 focused tests passed, with 32 CUDA-only skips; the suite also includes CPU reference cases. Local CPU checks passed 249 tests with 123 hardware/optional skips. Native BF16 GroupedExperts forward/backward also passed with both AO namespaces unavailable. DP2/ZeRO-2/GAS2 checkpoint/resume matched subsequent losses, parameters and optimizer state exactly; experts are replicated in that test.
For actual AutoEP EP2/ZeRO-2, matched 30-step runs before/after the file relocation had identical inputs, loss/gradient-norm curves and final parameters in BF16 and HiFloat8 separately. A 100-step HiFloat8 pair with fixed CPU affinity also matched exactly and used the same peak allocation. These checks covered the refactor on a small model. The earlier Qwen3.5 EP4 integration passed its matched 30-step checks; it was not rerun for the byte-identical file relocation.
Compute measurements and memory
The retained experiments answer different questions. The following results are historical measurements reviewed on October 15, not a new benchmark of the latest PR.
| Experiment and comparison | Baseline → candidate | Result |
|---|---|---|
| Sep 15, routed expert GEMM device-task time, BF16 → HiFloat8 | 46.759 → 25.513 ms | 45.44% lower |
| Sep 15, shared-expert Dense GEMM device-task time, BF16 → HiFloat8 | 3.078 → 2.729 ms | 11.34% lower |
| Oct 8, isolated trainable grouped operator FWD+backward, previous HiFloat8 → packed-layout HiFloat8 | 1.075 → 0.729 ms | 32.20% lower |
| Same Oct 8 operator benchmark, peak NPU allocated memory | 422.001 → 363.003 MiB | 13.98% lower; 59.0 MiB saved |
| Sep 28–29, 500-step training, BF16 → HiFloat8, maximum-rank peak NPU allocation | 32.194 → 31.953 GiB | 0.75% lower |
Measurement scope:
- Sep 15 native profile: one warmup step and two active steps, averaging device GEMM task sums over complete ranks 0–2; incomplete rank 3 is excluded. Quantization, layout, activation, communication and launch costs are outside these GEMM totals. Most of the routed GEMM savings came from forward and input-gradient work. This used the older Torch/TorchNPU 2.9 helper path (DeepSpeed
89fe70ef, Swiftc10a9736, TorchNPU36ab0b99), so it is evidence for the native compute opportunity, not a measurement of the current AO integration. - Oct 8 operator benchmark:
E=64, M=2048, K=2048, N=512, trainable weights, three interleaved pairs, 100 timed iterations after 10 warmups per run; median of run P50s. AO9521053→256090d, Torch/TorchNPU 2.11. Memory is the benchmark's peak allocated memory, not an isolated quantized-payload count. This 14% memory reduction compares two HiFloat8 implementations, not HiFloat8 with BF16. The benchmark is available asbenchmarks/profile_hifloat8.py; the packed candidate uses--trans-b. - 500-step training: Qwen3.5-35B-A3B, four Ascend950PR devices, EP4/ZeRO-2, batch 1/rank, accumulation 1, sequence length ≤256. All 40 layers execute; only layer 0/39 routed/shared expert parameters train (12 tensors/rank). Steady-state timing uses steps 11–500 and the slowest rank per step. DeepSpeed
8ab23b4d, AO runtimeac61a4f(publisheda62af9b, identical tree), Torch/TorchNPU 2.11. Across all 500 steps, loss Pearson correlation was 0.999507 and rank-0 gradient-norm correlation 0.997368. Inputs and initial trainable weights matched. There is one long run per precision; this is not full-parameter convergence evidence.
Model and compatibility scope
| Scope | Status |
|---|---|
| Dense Linear and AutoEP GroupedExperts, BF16 parameters, BF16/FP16 working precision | Native forward/backward and public quantize_ tests |
| ZeRO stages 0–2 | Accepted; distributed lifecycle checks include DP2/ZeRO-2 |
| Actual AutoEP EP2 | Current-layout checks described above |
| Qwen3.5-35B-A3B text-only EP4/ZeRO-2 | Earlier paired partial-parameter validation; no full-parameter convergence claim |
| Ordinary BF16/FP16 grouped training on NPU | Independent of AO |
| Other Dense/MoE families | Require model-level validation |
| HiFloat8 with ZeRO-3, PipelineModule, AutoTP, custom MPU, explicit DeepSpeed MoE or fused gate/up override | Rejected |
| TorchAO quantized checkpoint ingestion, AutoEP checkpoint/resume, full-parameter convergence, LoRA, offload/compile, EP8, multi-node, CUDA low-precision validation | Not established by this integration |
October 8–9 prototype results and configuration history
Initial A5 validation report
Environment: Ascend950PR, 128 GiB HBM/device; CANN 9.1.0; driver 25.7.rc1; Python 3.11.15; PyTorch 2.11.0 CPU wheel with TorchNPU 2.11.0; torchao 0.18.0; ms-swift 4.6.0.dev0. Exact fork revisions are linked below.
Functional/numerical gates:
- AO: 32 passed; policy/conversion commit separately passed 31. Coverage: custom ranges/dtypes, BF16 references, weight-version guards, Parameter/mode preservation, saved-tensor hooks and repeated backward.
- DeepSpeed NPU: 83 passed, 26 legacy-helper skips. CPU/import/selection: 47 passed, 109 device/dependency skips. Changed-file pre-commit passed.
- DP2 / ZeRO-2 / accumulation 2: checkpoint at optimizer step 2, resume through step 4; subsequent losses, BF16 parameters and optimizer state were exact on both ranks. Experts are replicated in this lifecycle test; AutoEP checkpoint parity is a separate gate.
Operator measurements
Baseline and candidate both use the existing 15/15/224 HiFloat8 recipe. Three interleaved repetitions, 100 timed FWD+backward iterations after 10 warmups; median of run P50s. M=2048, K=2048, N=512, E=64; Dense weight [512,2048].
| Path | Baseline → candidate | Latency change |
|---|---|---|
| Dense Linear | 0.186 → 0.154 ms | −17.3% |
| Grouped, DeepSpeed weight layout, trainable weights | 1.360 → 1.061 ms | −21.9% |
| Grouped, same layout, frozen weights with dX | 0.868 → 0.557 ms | −35.8% |
Frozen-weight peak allocation decreased 121 MiB; other operator peaks were unchanged. Original weight preparation: approximately 292 µs transpose + 199 µs quantization, versus 57 µs FWD GEMM. The candidate removes the separate transpose kernel. Diagnostic kernel durations are distinct from wall time.
Model measurements
Qwen3.5-35B-A3B: EP2, ZeRO-2, BF16 communication, batch 1/rank, accumulation 1, sequence length ≤256, eager attention, no gradient checkpointing; seeds 42; AdamW, LR 1e-5, cosine schedule, no warmup/weight decay, clipping 1.
Train layers 0 and 39 routed/shared-expert parameters: 12 tensors/rank; all 40 MoE layers execute. Each run has 20 steps, excluding five warmups.
Three matched pairs of the final revision gave 725 → 684 ms end-to-end step P50 (−5.7%), using the median of run P50s and the slowest rank at each step. Individual changes: −5.54%, −6.01%, −5.74%. An earlier prototype pair measured −4.4%.
Both ranks matched inputs, losses, gradient norms and all 12 final BF16 tensors exactly. Peak allocation remained 51.21 GiB/rank. This short partial-parameter experiment, with other devices active, does not establish convergence or multi-node performance.
2026-10-08 update: sole AO ownership and packed dW
Implemented and pushed:
- Native
_NPUGroupedMatmulautograd moved from DeepSpeed totorchao_npu.ops.npu.grouped_mm(BF16/FP16). - HiFloat8 is now owned exclusively by AO. DeepSpeed defaults to
backend="torchao_npu"; the old helper backend is rejected with a migration message. DeepSpeed keeps selection, routing/padding and distributed lifecycle checks. trans_b=Trueaccepts native[E,N,K]parameters and produces dW directly in that layout; empty-rank gradients also live in AO.
Validation: 70 AO and 87 DeepSpeed NPU tests passed. DP2/ZeRO-2/GAS2 checkpoint parity is exact. Qwen3.5 EP2 has two matched 30-step pairs; EP4 has one BF16 and three interleaved HiFloat8 50-step pairs. Every rank matches input/loss/gradient-norm traces and all 12 final trainable BF16 tensors exactly, using the same partial-training scope documented above.
| Comparison against the previous prototype | Result |
|---|---|
| Trainable grouped GEMM, same benchmark dimensions | 1.075 → 0.729 ms; −32.2%, peak allocation −59 MiB |
| EP2 HiFloat8 | Step P50 −1.6% across two pairs |
| EP4 BF16 | Step P50 −0.33%; peak allocation −482 MiB/rank |
| EP4 HiFloat8 | Peak allocation 116.5 MiB/rank lower across three pairs |
The independent gradient-transpose kernel disappeared from the diagnostic trace. No additional model throughput improvement is established by the EP4 sample: most experts are frozen in this experiment, so the dW optimization affects a small part of the model. Weight quantization and routing synchronization remain.
AO implementation: 256090dee33a10ec277d60b0629b86b763b92c5d.
DeepSpeed implementation.
Baseline: AO 9521053, DeepSpeed 48af66b. Use benchmarks/profile_hifloat8.py --trans-b for the native-storage cases. The preceding initial-prototype numbers use a different revision pair and should be interpreted separately.
2026-10-09 update: minimal configuration and precision contract
Recommended BF16/ZeRO-2 configuration (AutoEP selection/topology is configured separately):
{
"bf16": {"enabled": true},
"zero_optimization": {"stage": 2},
"hifloat8": {
"enabled": true,
"backend": "torchao_npu",
"module_name_patterns": ["*.experts", "*.shared_experts.*_proj"],
"min_numel": 65536
}
}
AO provides the established 15/15/224 per-tensor recipe. Missing/null/empty config and the old full JSON remain compatible; optional overrides remain available. These values originated in the PyTorchA training recipe and influence scale/payloads. They are distinct from the native quantizer default. Grouped keyword defaults now derive from the common policy; no GEMM, routing or CUDA/BF16 implementation changed.
compute_dtype is retained: renaming it to output_dtype would omit its pre-quantization cast semantics. Native tests record and call the real operators, confirming HiFloat8-tagged inputs in all three FWD/dX/dW GEMMs for null/BF16/FP16 working precision. BF16 and HiFloat8 grouped paths already share shape/device/offset/layout validation; the existing small DeepSpeed adapter needs no additional abstraction.
Validation: 85 AO tests passed (one empty-Dense native-quantizer skip), 90 DeepSpeed NPU tests passed. BF16-reference numerical gates, empty/uneven experts, both weight layouts, BF16 default-vs-explicit exact output/gradient equality and populated AdamW-state identity passed. DP2/ZeRO-2/GAS2 checkpoint parity remains exact with replicated experts.
Qwen3.5 EP4/ZeRO-2: two interleaved 30-step pairs compare the prior source/full JSON against the new source/minimal JSON, using the same partial-training scope above. All ranks match inputs, losses, gradient norms and final trainable BF16 tensors exactly; native call counts and peak NPU allocation are unchanged (31.19 GiB/rank).
These refactor checks established numerical parity. They did not establish a stable throughput change. Existing repeated grouped weight quantization remains.
Current revisions: AO repository, 397d0f24537923ce3ed904714117073ff4bee537 (runtime change 114acb2; subsequent documentation-only provenance correction); DeepSpeed 2623227b. Rollback: AO c7a82e2, DeepSpeed 0da46635.
Historical source revisions
- DeepSpeed Draft PR #8784: source
hazelduan/DeepSpeed:deepspeed_ao, tested revision2623227bb9285555040845c2a339a027c3d25218. Initial prototype48af66b183d0fe6d60129f1714ffbf15d4e0d7c3, baselinec4b9ee883a5492afce1039b060821fce81f470b9. - torchao_npu Draft MR !31: source
hazeldxq/torchao_npu:deepspeed_ao, revision397d0f24537923ce3ed904714117073ff4bee537(tested runtime114acb2; subsequent documentation-only correction). Earlier policy/conversionab249d330173e8ae4c8a0f6842c987381e5ca1c7, optimization95210535e4b63d68ac78374aa7e1d5bda4616206, baselinee51455174188d0327f04283df9de4742b214a973. - ms-swift branch comparison: source
hazelduan/ms-swift:deepspeed_ao; tested revision46b8711. - Model run data: 400 text examples; SHA-256
769882e1d8e43e249847f1aaa6eb72aa13f6eebdeb850975b9ecc61360922252. Model revision was a local snapshot; it was not independently pinned to a Hub revision.
Historical A5 reproduction commands
Install the paired source revisions in a compatible NPU environment and source CANN. Use idle devices with the matching device visibility and HCCL configuration.
# AO: October operator measurement and native numerical tests.
python benchmarks/profile_hifloat8.py --iterations 100 --warmup 10 \
--trans-b --profile --output /tmp/hif8-profile/results.json
python benchmarks/summarize_hifloat8_profile.py /tmp/hif8-profile \
--output /tmp/hif8-profile/stages.json
python -m pytest test/test_hifloat8_linear_npu.py \
test/test_hifloat8_grouped_npu.py test/test_hifloat8_config_npu.py -q
# DeepSpeed: two-rank lifecycle check with replicated experts.
DS_ACCELERATOR=npu torchrun --nproc_per_node=2 \
tests/unit/runtime/hifloat8_resume_validation.py --output /tmp/hif8-resume
The benchmark records uninstrumented timing before its diagnostic profile. Use the archived A5 revision pair and measurement settings for these commands.
We're integrating low-precision (HiFloat8) training on Ascend NPU through torchao_npu, and this RFC is a very good fit for what we need. torchao, which is released independently under pytorch/ao, already provides the relevant device kernels: float8 on CUDA via torchao.experimental.float8 and HiFloat8 grouped GEMM on NPU. It also provides config_from_dict and packed-tensor conversion, so DeepSpeed wouldn't need to vendor device kernels or config parsing. This also aligns with the Q4 roadmap item, "FP8 GEMM for MoE".
If helpful, a few practices we'd suggest are to keep torchao as an optional dependency with runtime/version checks and a clear install hint, reuse its config deserialization instead of reimplementing it, and check hardware capability and fail closed before modifying modules. It would also be helpful if the pluggable backend could handle checkpoint ingestion: transformers supports TorchAoConfig as a first-class option, but current master has no path to load these checkpoints into ZeRO-3 — the remaining DeepSpeed quantization entry points (deepspeed.linear's FP 6/8/12 config, quantized_initialization INT4/INT8, post_init_quant, zero_quantized_nontrainable_weights) are all DeepSpeed-native formats that don't understand torchao configs.
We've prototyped this layout on NPU using a generic low-precision config plus accelerator hooks, with torchao_npu imports kept under accelerator/npu and op_builder/npu. We'd be glad to share it as a reference if that would be useful.
Thanks for the suggestions. We've updated PR #8784 and the RFC to reflect the current implementation:
- The accelerator exposes
get_hifloat8_provider(). On NPU it lazily returns the publictorchao.hifloat8module, with dependency/version/API checks and installation hints. TorchAO remains optional; this path requires the paired Ascend extension. - Configuration stays under
hifloat8, withbackend="torchao". The intermediateLowPrecisionProviderclass and genericlow_precisionsection have been removed. - Dense Linear and AutoEP GroupedExperts now use one
torchao.quantization.quantize_call withModuleFqnToConfig. There is no provider conversion wrapper. - AO parses the shared numerical policy through
HiFloat8Config.from_dict()and owns HiFloat8 quantization/GEMM autograd. AO definesHiFloat8GroupedConfigon the common numerical base and registers its grouped handler alongside Linear. DeepSpeed only creates the applicable configurations and FQN map; its former grouped handler is removed. The AO handler binds the existinggrouped_mmhook without importing a DeepSpeed expert class. - DeepSpeed checks module selection and training compatibility, then probes the requested native forward/dX/dW kernels before conversion. Conversion runs after AutoEP replacement/device placement and before optimizer setup.
- Ordinary BF16/FP16 grouped GEMM is independent of AO. The accelerator's separate
get_grouped_mm()hook resolves the TorchNPU adapter indeepspeed/ops/npu/grouped_mm.py; the HiFloat8 resolver lives inaccelerator/npu/hifloat8.py.
DeepSpeed retains routing, padding, activation, communication and optimizer/checkpoint lifecycle. The training integration consumes public torchao APIs, with Ascend HiFloat8 as the current implementation; other hardware/formats still need their own integration and validation.
The RFC includes the architecture diagram, quick start and validation scope, including the October 19 AO-handler/public-import validation, matched 30/100-step EP2 runs and the earlier partial-parameter Qwen3.5 runs. Both existing feature branches now have four functional commits, with their validated final trees preserved. TorchAO quantized checkpoint ingestion into ZeRO-3 and AutoEP checkpoint/resume remain unvalidated and outside this PR's established support.
We'd be happy to review your NPU prototype and compare the integration boundaries.
I have a question about config file for discussion. There will be more quantized format than 16-bit format. In 16 bit bf16 and fp16 is popular, but in quantization world there is int8, FP8 (and two FP8 variant), hifloat8, and probably new variants will appear. Are they exclusive to each other, say there will be only one primary quantized data format, then fallback to fp16/bf16/fp32, or there will be mixed quantized data format? I saw the hifloat8 RFC alread has a pattern matching section so thats why I ask.
Besides that, even with parameters of same pattern, does it make sense to allow apply different quantization format to them? i.e. hot experts vs. spare experts. Or maybe for training part we shouldn't go this fine grain. Either yes or no this needs to be a concious decision.
One last maybe trivial comments. I'd propose to have a quantization section and put all sub 8bit (including 8bit) into that section, so this could extended to FP8, int8/int4 or even mixed quantized precision whenever it is needed, each data format has its own subsection under quantization section and its own match pattern. FP16 and BF16 they are so popular so they should keep on top level in config.
@sfc-gh-truwase @PKUWZP @tohtana @minjiazhang @hazelduan @VenusTZZ for discussion.
Thank you for the thoughtful and valuable feedback, and for your patience! Apologies for the delayed reply. We’ve discussed these design choices carefully within the team and would like to propose the following direction.
We agree with introducing a unified quantization section, with per-format module selection and BF16/FP16 remaining at the top level. Different modules, including those of the same type, could use different supported formats according to their numerical and performance needs. Initially, each packed expert group would use one recipe; finer-grained per-expert mixing would need further design and validation.
Device generality is also a key goal for us. We plan to support multiple devices, including NPU, GPU, and XPU, and different AO-supported low-precision formats through a common integration interface, validating each device/recipe combination as it is introduced. Ascend HiFloat8 is our first implementation. DeepSpeed would handle module selection and training compatibility, while AO continues to own numerical configs and handlers, applied through a single quantize_ call.
We’d really appreciate your thoughts on this direction, especially the initial configuration granularity and any device/format combinations you’d like us to prioritize.
It's a very good implementation for quantization with HiFloat8 data format. By altering bit allocation, HiFloat8 provides a tapered precision and a large dynamic range to adapt to the AI data distribution (such as model weights, activations, etc.) and data outliers, respectively. Therefore, when the HiFloat8 is applied to inference and training, the per-tensor scaling can be used for the gradients, activations and weights, the per-channel & per-token can be used for the weights and activations as well.
Due to different data formats have independent bit width and numerical distribution, various quantization strategies should be supported to be configured based on the requirements. So, I agree that we need a unified quantization solution for the low bit-width data format (<8bit) in DeepSpeed. I suggest to considering the following aspects:
- Data Format: In the
quantizationsection, set two subdivisions like single format and block format to deal with two kinds of formats and quantization workflows.HiFloat8,E4M3,E5M2,INT8,INT4, etc. can be put into the single format.HiFloat4,MXFP4,MXFP8, etc. can be put into the block format. The different parts of the block format, such as scaling factors and intra-group data, can be represented using a single format, while the quantization workflow is designed based on the independent structure of the block format.
- Quantization Strategy: For each data format, different quantization strategy should be configurable.
- Mixed precision computation
w8a8,w4a8, etc. - Quantization granularity
per_tensor,per_channel,per_token - Applied model weights, similar to the previous discussion
- Mixed precision computation
- Subsequent compatibility: In this issue, we can only implement HiFloat8 quantization, while retaining scalability for other formats to allow for expansion when needed in the future. This includes supporting other formats in Ascend and various different formats in other hardware, e.g. FP8, HiFloat4, MXFP4/8, etc.
November 22 update on HiFloat8 training with official Ascend TorchAO NPU
We moved the DeepSpeed integration to the official Ascend torchao_npu snapshot and implemented per-module recipes. In the November 9–13 experiments on Qwen3.5-122B-A10B, three single-node 20-step BF16/HiFloat8 pairs passed the numerical checks. The two-node runs have a 32-step common window for comparison. The separate hif8_perf experiment below reached +30.33% throughput on one eight-NPU node. ZeRO-3 validation is on a separate experimental branch.
Integration and configuration
quantization.hifloat8 follows the configuration proposal in this thread. BF16 and FP16 remain top-level. HiFloat8 supports both a shared policy and module_configs overrides. Exact module names take precedence over the first full-match re: selector, then _default. A null module entry skips conversion. The existing top-level hifloat8 form is still accepted. A packed expert group uses one recipe, and HiFloat8 is the implemented format in this iteration.
DeepSpeed selects the modules and passes AO-owned configs in one public quantize_ call. AO parses the numerical policy and implements the low-precision GEMMs and their backward passes. DeepSpeed owns AutoEP routing, BF16 communication, and the training lifecycle. Tested configuration and integration
Qwen3.5-122B-A10B numerical results
Both configurations used eight Ascend 950DT NPUs (96 GiB each), AutoEP8, ZeRO-2, BF16 model parameters and communication, sequence length 1024, global batch 64, and reentrant activation checkpointing. All 48 layers executed. Training updated routed and shared-expert parameters in layers 0 and 47, about 3.96% of model parameters. HiFloat8 covered 48 grouped expert modules and 132 Linear modules. Native Dense and grouped forward and backward calls were observed.
| BF16 vs HiFloat8 | Single node, microbatch 8 / accumulation 1 | Two nodes × 4 NPUs, microbatch 2 / accumulation 4 |
|---|---|---|
| Recorded optimizer steps, BF16 / HiFloat8 | 3 × 20 / 3 × 20 | 521 / 32 (interrupted) |
| Paired optimizer steps used for numerical checks | 3 × 20 | Steps 1–32 |
| Global loss relative difference, max / mean | 0.1745% / 0.0856% | 0.4037% / 0.1733% |
| Global gradient norm relative difference, max / mean | 0.7222% / 0.2531% | 1.0194% / 0.4007% |
Input and initial trainable-parameter fingerprints matched within each pair, and gradients were finite on every rank. The planned 1,000-step runs were interrupted; the paired result is limited to steps 1–32. The historical logs fingerprint the initial trainable parameters; they do not fingerprint the full frozen model. A separate single-node comparison of the earlier integration and the per-module recipe version, both using official AO HiFloat8 with equivalent recipes, matched every rank's 20-step loss and gradient norm and all final trainable-parameter hashes exactly.

Loss is averaged across the eight ranks after summing their gradient-accumulation-scaled microstep losses. The plot uses the full common prefix, including warm-up; after step 32 only BF16 has data.
Official AO training throughput and expert compute latency
| Measurement | BF16 | HiFloat8 | Relative change | Peak allocated GiB, BF16 / HiFloat8 | Peak reserved GiB, BF16 / HiFloat8 |
|---|---|---|---|---|---|
| 122B training, single node B8/G1, pair 1 | 8,164.31 tok/s | 8,357.71 tok/s | +2.37% throughput | 71.273 / 71.273 | 75.225 / 75.244 |
| 122B training, single node B8/G1, pair 2 | 8,193.48 tok/s | 8,358.77 tok/s | +2.02% throughput | 71.273 / 71.273 | 75.225 / 75.244 |
| 122B training, single node B8/G1, pair 3 | 8,193.75 tok/s | 8,340.93 tok/s | +1.80% throughput | 71.273 / 71.273 | 75.225 / 75.244 |
| 122B training, two nodes × 4 NPUs, B2/G4, measured steps 6–32 | 6,419.80 tok/s | 5,971.98 tok/s | −6.98% throughput | 53.985 / 53.965 | 54.848 / 54.984 |
| 122B training, two nodes × 4 NPUs, B8/G1 | — | — | Paired run pending | — | — |
| Frozen expert layer, one NPU, 2,048 rows per expert | 11.152 ms | 10.514 ms | −5.72% latency | — | — |
| Frozen expert layer, one NPU, 512 rows per expert | 3.019 ms | 4.027 ms | +33.41% latency | — | — |
Training throughput uses input tokens divided by the slowest rank's cumulative end-to-end time over steps 6–20 or 6–32. Memory peaks are the maximum across ranks. External device sharing was observed in the first BF16 single-node run. The expert rows report median NPU device time over 30 samples after 10 warm-ups, including the initial forward, recomputed forward and input gradient of one layer with 32 frozen experts. The harness recorded a combined allocation peak across both modes.
Two-node result. Both precisions used microbatch 2 and accumulation 4 in the two-node pair. Compared with single-node B8/G1, this splits the same global batch into four microsteps and reduces the mean rows per expert from about 2,048 to 512. Observed HiFloat8 dynamic quantization calls per rank per optimizer update rose from 1,380 to 5,520, while grouped GEMM calls rose from 438 to 1,752. The isolated expert benchmark reproduces the reversal at the smaller shape, where the GEMM work amortizes less of the quantization and launch overhead.
EP dispatch and combine still transfer BF16. With the smaller microbatch, the training run pays for these exchanges more often, and HiFloat8 compute leaves their payload width unchanged. The shape benchmark establishes one mechanism for the slowdown. Quantifying its share of the observed −6.98%, or the effects of HCCL scheduling and shared load, requires a matched topology comparison at fixed microbatch and a model-level compute and communication trace.
Four-node AutoEP32 follow-up on the official-based integration
These 4 × 8 Ascend 950DT NPU short runs used the official pins as their starting point with local DeepSpeed integration changes; the tuned rows also changed the execution path. They are separate from the unmodified official AO pairs above and from hif8_perf. Qwen3.5-122B-A10B ran all 48 layers with ZeRO-2, sequence cap 1,024 and accumulation 1. Each row compares the two precisions within its own setup. Only the listed expert layers were trainable; these runs did not use LoRA.
| Setup | Paired steps | BF16 input tok/s | HiFloat8 input tok/s | HiFloat8 change |
|---|---|---|---|---|
| Microbatch 2; layers 0 and 47 trainable | 32 | 25,527 | 25,490 | −0.15% |
| Microbatch 16; layers 0 and 47 trainable | 16 | 28,799 | 30,022 | +4.25% |
| Microbatch 16; layer 47 trainable, tuned GDN and frozen prefix | 24 | 143,341 | 154,901 | +8.06% |
| Microbatch 48; layer 47 trainable, tuned GDN and reorder fix | 16 | 132,314 | 141,451 | +6.91% |
Experimental hif8_perf: +30.33% single-node throughput
Code pins: DeepSpeed hif8_perf at fadcf3e3 and TorchAO NPU hif8_perf at a0ead21f. DeepSpeed supplies the AutoEP fusion, routing, and benchmark entry points. TorchAO supplies grouped weight-payload reuse for input gradients and host offload for frozen Linear weights. The FC2 path is enabled by the benchmark launcher.
Configuration. One node with 8 × 96 GiB Ascend 950DT NPUs, AutoEP8 and ZeRO-2, full 48-layer Qwen3.5-122B-A10B. Both arms train rank-8 LoRA (alpha 16, dropout 0) on all routed and shared experts across all layers and freeze the base model. Local microbatch 128, accumulation 1, global batch 1,024, sequence cap 256; AdamW at a constant 1e-5. Both arms use the same checkpoint, batches and GDN implementation. The original F1 BF16 arm uses its regular BF16 communication and compute path, 64-row cross-entropy blocks, and a 1,024 MiB HCCL buffer. The optimized arm applies the changes below. Each run completed 16 optimizer steps; timing covers steps 6–16, using the slowest rank at each step and the same 262,144 input tokens per step.
| Cumulative setup | Mean s/step | Input tok/s | Seconds saved vs previous row | Throughput vs original BF16 |
|---|---|---|---|---|
| Original BF16 | 22.504 | 11,648.71 | — | reference |
| HiFloat8 system stack, before FC2 fusion | 18.531 | 14,146.62 | 3.974 | +21.44% |
| + Fuse FC2 base grouped GEMM with AllToAllV return; send the rank-8 LoRA intermediate and apply LoRA B on the source rank | 18.318 | 14,310.44 | 0.212 | +22.85% |
| + Quantize FC2 output-gradient traffic using receiver scales; fuse dispatch with the grouped input-gradient matmul | 18.001 | 14,562.74 | 0.317 | +25.02% |
| + Use native weighted Top-K token unpermute for the final output combine | 17.267 | 15,181.43 | 0.734 | +30.33% |
The first 3.974 s/step is the combined effect of HiFloat8, source-side quantization before token duplication, fused FC1 dispatch/GEMM, quantized payload and buffer reuse, routing-profile-based expert placement, native input-gradient restoration, non-reentrant checkpointing, frozen Linear host offload, 512-row cross-entropy blocks, and a 256 MiB HCCL buffer. An earlier 20-step tuning series measured 22.558 → 21.388 s/step (−1.170 s for the initial HiFloat8 system stack), then 19.252 s/step (−2.136 s for updated placement and native input-gradient restoration together), then 18.464 s/step (−0.788 s for the larger CE block and smaller HCCL buffer together). Those are grouped measurements from that series; individual effects within each group and interactions with the later FC2 path were not isolated. In the 16-step series, the three FC2 and output-combine changes together saved a further 1.263 s/step. Activation checkpointing remained enabled; the final run did not cache full FC2 outputs for replay.
Numerics and memory. Initial parameter and input fingerprints matched across all eight ranks. Over the 16 paired steps, the global loss relative difference was 0.2818% max / 0.0914% mean, and gradient norm was 1.1871% max / 0.7747% mean. Frozen-weight checks passed. Per-NPU peak allocated/reserved memory (maximum across ranks) went from 79.663 / 80.211 GiB to 76.256 / 77.086 GiB. A separate same-path short repeat measured 17.291 s/step (+30.15% against the same BF16 reference). The comparison measures the full HiFloat8 system stack against original BF16 at this shape. Multi-node performance and paired long-run convergence for these experiment branches remain open.
Focused tests, experimental ZeRO-3, and reproduction
- The earlier packed-weight prototype on Qwen3.5-35B-A3B with Ascend 950PR, EP2 and ZeRO-2 measured an end-to-end step P50 of 725 → 684 ms (−5.7%) across three 20-step pairs. This historical result uses a different model, runtime and metric from the official AO 122B throughput table. Earlier A5 model measurements
- The official AO snapshot passed 100 focused tests. The first DeepSpeed integration passed 144 tests with 26 CUDA-only skips. The per-module version passed 159 with the same skip count. The latter also passed a native distinct-recipe comparison against public AO, exact DP2/ZeRO-2 checkpoint recovery, and 20-step AutoEP4 runs with equivalent and different recipes. The 122B single-node recipe regression pair measured 8,239.83 to 8,235.00 tokens/s (−0.06%) with equal 71.273 GiB allocated and 75.264 GiB reserved peaks.
- The experimental ZeRO-3 branch passed the focused 159-test suite and two four-NPU AutoEP integration cases. DP2 and EP2 with expert DP2 exercised normal initialization,
zero.Init, per-module recipes and checkpoint replay. The 131M Qwen3.5 model ran for 20 steps on four NPUs through Swift and Transformers. Maximum global loss / norm differences were 0.0340% / 0.5490% for HiFloat8 ZeRO-2 vs ZeRO-3 and 0.1143% / 0.7225% for ZeRO-3 BF16 vs HiFloat8. A separate ZeRO-2 run of that model matched uninterrupted training and native optimizer state when resumed in a fresh process from step 10 to 20. Saving AutoEP ZeRO-3 checkpoints with frozen expert parameters and ingestion of prequantized weights remain unsupported in this path. Experimental branch - A later single-node B2/G4 control showed frozen-weight mismatches against the checkpoint before training, including in BF16. Its curves and timing are excluded from the matched results above. A separate BF16 run matched the historical two-node first loss under a different launcher and HCCL configuration. Multi-step single-node vs two-node parity, the cause of the initialization mismatch, and paired two-node B8/G1 still need validation.
- A standalone two-node 122B HiFloat8 smoke also completed 20 steps. The 122B configurations used AdamW at 1e-5 with cosine decay, zero warm-up and weight decay, gradient clipping at 1, seed and data seed 42, and the per-tensor input/weight/gradient recipe 15/15/224. The long runs used a fixed 3,200-example text corpus and a 1,000-step schedule.
- Runtime pins were Python 3.12.14, PyTorch 2.12.0+cpu, TorchNPU 2.12.0.post2, TorchAO 0.18.0, Transformers 5.16.1 and Ascend driver 25.1.rc3. The initial single-node pairs used the November 9 CANN 9.2.0 environment. The recipe regression and two-node 122B runs used CANN 9.2.0-beta.2, with AIV requested for the latter. The official Ascend AO commit was
539dd693bd15e05563a35e21487cb8cbef850c51and Swift was3e9994baf135f939dffefc9ad4773bae35e2b5b9. The initial single-node pairs match DeepSpeedb0b9296dby runtime file hashes. The later recipe and two-node 122B runs usedf7680af9. Initial integration · Per-module recipes
Qwen3.5 is the scope of this iteration. Full-parameter training, held-out accuracy, 1,000-step convergence, and 122B ZeRO-3 are open. DeepSeek-V4-Flash expert computation is a separate candidate for AO-level validation. AI assistance was used to organize and verify this update.
Hi @hazelduan, thanks for the proposal with data. I saw there are two RFCs related to quantization. this RFC and #9132 . This RFC propose to use libao for quantization format extension. While #9132 choose intree triton kernel to support existing quantized formats.
I think these two paths could be converged, while details will need more discussion. Ideally, the solution should be able to extended either on format or accelerator.
Thanks, @delock. I agree that the AO and in-tree Triton paths can share the DeepSpeed integration. PR #8784 now uses a common TrainingQuantizer interface under quantization. It can select torchao.hifloat8 or the existing subchannel path from #9131, including subchannel.int8 and subchannel.fp8. Each backend retains its recipe, kernels, and conversion stage. The TorchAO path still uses a public AO config and one quantize_ call.
Module assignment and GEMM settings are two levels of the design. For example, HiFloat8's module_configs can use a gradient range of 15 for one q_proj, inherit 224 for another, and use null to leave a third in BF16. Subchannel retains its forward, dx, and dw settings within a recipe. The current PR enables one backend per engine. Assigning different low-precision formats to different modules is a follow-up once the supported formats and overlap rules are defined.
For TorchAO, I plan to implement and validate additional scaling modes in AO. Users would select an AO-supported scaling policy in the DeepSpeed recipe, including module overrides where needed. DeepSpeed would pass that setting through the public AO config. The current HiFloat8 recipe supports per-tensor scaling.