Repository navigation
feat(xla): add Nemotron-H hybrid KV and recurrent state carry - #3408
Conversation
|
ROCm gfx1151 validation passed at executable HEAD
All builds/device work used ROCm evidence: |
Map attention blocks to compact KV rows while threading Mamba2 state through prefill and both decode engines. Add schedule-aware weights and checkpoint validation, grouped SSM norm, and relu2-only blocks with explicit rejection of the deferred MoE router. The library and IREE runtime compile locally. Synthetic structural and execution gates are provided; real-model ROCm token, CLI and serve acceptance remains pending. Refs #3344
Honor the checkpoint's SSD chunk size so the real 4B model retains its HF reduction partition. Make the tiny fixture's five blocks and chunk size explicit, add parser regression coverage, and attach the independent HF fp32 token oracle with reproducible provenance. Five targeted structural tests pass. The original synthetic integration target passed all five local-task tests; ROCm and real-model XLA parity remain pending. Refs #3344
The existing failure hook stopped after K on hybrids and never reached the recurrent-state writes. Add a test-only mode that fails after KV and the first SSM tensor, then verify that both partial-store cases invalidate the slot and recover through a fresh admit. All five synthetic hybrid tests pass on IREE local-task, including both injected failure modes. Production graphs and numerical behavior are unchanged. Refs #3344
Capture CLI token parity, overlapping HTTP completion parity, Mamba2 and hybrid regressions, and prompt-cache exclusion at source `93ddebad`. Preserve the exact result and provenance artifacts while leaving ROCm acceptance pending. Validation: - Captured JSON artifacts match their source files and parse with `jq` - English, Korean, and validation documents pass body validation Refs #3344
Distinguish the six-test single-sequence target, five-test Mamba state-carry target, and separate five-test hybrid target. Add the missing single-sequence reproduction command and label each captured result explicitly. Validation: - English, Korean, and validation documents pass body validation - Evidence counts match the captured CUDA logs Refs #3344
e145049 to
a6ccf54
Compare
MLXCEL_FREEZE_NEMOTRON_H (added in #3408) makes a cfg(test) test rewrite the committed Nemotron-H StableHLO goldens. It was neither documented nor allowlisted, so check_env_var_docs.py failed on main and turned the env var docs, python tooling and Windows jobs red. It now sits in the allowlist beside MLXCEL_FREEZE_GOLDENS and MLXCEL_FREEZE_MOE.
Nemotron-H now parses its hybrid schedule and emits NoPE attention, grouped Mamba2, and relu2-only blocks. Prefill, single-sequence decode, and ragged decode carry compact attention-only KV alongside recurrent state; checkpoint validation and weight ordering follow the same schedule. Recurrent configurations retain the f32 default and prompt-cache/APC exclusion.
The synthetic fixture exercises two SSM groups, two KV heads, unequal attention and hidden widths, staggered admission, slot recycling, torn stores, and failed-decode invalidation. MoE
Eblocks still explicitly require #3345.Validation: XLA and IREE/test-support runtime checks pass; five hybrid structural tests, all registered byte-exact goldens, 27 recurrent regression tests, and all five synthetic IREE tests pass on both local-task and CUDA (NVIDIA GB10, driver 580.178.04), with the latter run at
93ddebad382478540fdfc987fbca655744be941d. The partial-store test covers failure after K and after both KV plus the first SSM tensor. Modified Rust files pass formatting. Focused XLA-library clippy passes with-D warnings. The completecargo test --profile test-fast -p mlxcel-xla --libregression run passes 539 tests with 21 ignored; device gates are recorded separately.Real Nemotron-H 4B CUDA execution at
93ddebad382478540fdfc987fbca655744be941dmatches the independent HF fp32 oracle 40/40. B4 with eight requests also passes against single-sequence references for all 170 generated tokens. These runs use context 256 and the test-fast build profile; batch throughput was 4.974 tok/s versus 6.02 sequential, so no performance improvement is claimed. Raw logs and bilingual technical reports are committed. The later documentation-only commit does not change tested executable code.The CLI also matches the HF oracle 40/40. Four concurrent HTTP completions match separately captured CLI text and token counts (24 generated tokens each); the API does not expose token IDs, so no HTTP token-ID claim is made. Server settings were B4,
--ctx-size 2048, and explicit XLA capacity 256 with prompt caching/APC disabled. CUDA Mamba2 regressions pass (xla_ssm_single_seq: 6;xla_ssm_state_carry: 5), and the new prompt-cache exclusion unit test passes. Logs and reproducible commands are committed.ROCm gfx1151 acceptance passed independently at executable source
93ddebad382478540fdfc987fbca655744be941d: regenerated HF oracle, IREE-HIP and CLI 40/40, B4/N8, four concurrent streaming HTTP text comparisons, hybrid tests, SSM probes, and Mamba2 synthetic/real-checkpoint regressions. ROCm HTTP IDs and usage counts were not collected. See the acceptance record. Rebase onto current main changes no XLA executable, state, shim, or server source relative to the validated source; the XLA difference is a cache-path unit-test portability correction. The official checkpoint isnvidia/Nemotron-H-4B-Base-8Katfaba3b731ad7ea5781b9518ae75fb610a94affcf. Its checkpoint chunk size is preserved. An independent HF fp32 CPU 40-token oracle and provenance are committed underspike/openxla/nemotron_h_reference/; run HF and XLA f32 sequentially.ROCm validation instructions are in
spike/openxla/NEMOTRON_H_VALIDATION.md. Record the exact PR HEAD for every result; later changes to config, graph, weights, or the shim invalidate numerical results from older heads.Closes #3344