Skip to content

feat(xla): Add Falcon-H1 parallel attention and Mamba2 blocks - #3414

Merged
inureyes merged 9 commits into
mainfrom
feat/issue-3346-falcon-h1
Nov 25, 2026
Merged

inureyes merged 9 commits into
mainfrom
feat/issue-3346-falcon-h1

Conversation

@inureyes

@inureyes inureyes commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Add original-HF Falcon-H1 execution with parallel attention/Mamba2 followed by a separately normalized MLP. Preserve HF muP placement, optional SSM normalization, independent head widths/biases, and dual KV/recurrent state across prefill, single decode, and ragged decode. Integration retains #3411 MoE and #3413 Mamba1 behavior.

Fix plain CLI completion display losing trailing whitespace: an explicit flush mode preserves raw text while default chat and structured reasoning/tool/Harmony/Muse cleanup remain unchanged. The portable replay compares actual stdout with concurrent non-streaming HTTP and SSE responses; earlier CUDA HTTP evidence compared raw token decoding, not displayed stdout.

Validation at integrated runtime source 8c7b4412d37b91807f8d688ba2f3febbc7a7e41f (base 2e46fc09):

  • Full XLA crate: 560 passed / 22 ignored; byte-exact goldens, every-family layouts, fmt, and narrow clippy pass. Environment-docs checker + 15 Python tests pass after classifying two test-only controls.
  • All 7 display tests and 146 filter tests pass; all 5 CUDA hybrid tests and all 6 Mamba2 tests pass.
  • CPU/CUDA synthetic norm/ragged/recycle gates and real HF40/40 pass; CUDA CLI40/40 passes.
  • Strict displayed stdout: 4/4 nonstream + 4/4 SSE text/count matches, including Germany's exact trailing whitespace; overlapping requests and server cleanup verified.

External HIP acceptance at 852129eb passed numerical, real 40-token CLI, batching/recycling, regression, and release architecture gates. Strict displayed CLI/SSE parity was 3/4 because Germany ended in " \n"; all four raw token decodes matched. That evidence predates this fix and merged shared recurrent plumbing. Request a final-head ROCm replay with explicit hip, gfx1151, and f32 under the ROCm guard; no new HIP run is claimed.

Oracle, provenance, logs, portable replay, and instructions are in spike/openxla/falcon_h1_reference and FINDINGS_falcon_h1.md; bilingual reports document the exact evidence boundaries. HTTP exposes text/counts, not output IDs. Hosted CI is canceled under the local-validation policy.

Refs #3346

@inureyes inureyes added status:in-progress Currently being worked on type:enhancement New features, capabilities, or significant additions priority:medium Medium priority area:architecture Architecture and code structure changes area:inference Generation, sampling, decoding (incl. speculative, DRY) labels Nov 24, 2026
@inureyes

Copy link
Copy Markdown
Member Author

ROCm interim at exact HEAD 852129eb1b4bf45d957f4c63b082d9d0276e4951: library 544 passed / 22 ignored, goldens, fmt/clippy, independent synthetic CPU/HIP parity (all norm modes), Tiny90M HF/CLI 40/40, B4/N8 and cancellation/recycling pass. Fresh CPU HF oracle matches the committed 40 IDs.

Strict displayed CLI/server text parity is 3/4. With prompt The capital of Germany is, 40 tokens and temperature 0, the first mismatch is at character 124: the server retains trailing " \n", while CLI display removes it. All four server responses equal the unfiltered decode of their respective CLI token IDs, including this tail. Source diagnosis: CLI filter_reasoning_for_display uses StreamFilter::flush, which drops held trailing whitespace; raw /v1/completions retains it. This is an output-policy difference, not observed model-token divergence. Please coordinate the shared CLI/server policy before treating strict display-text acceptance as passed.

Reproduction commands, four SSE event streams, CLI stdout/IDs and both comparisons are under /home/devops/Development/mlxcel/acceptance/pr3414/852129eb1b4bf45d957f4c63b082d9d0276e4951/ (server-comparison.json, server-token-decode-comparison.json, pr3414-server-check.py). Remaining regression and literal validate_arch.sh gates are running. No merge or issue closure performed.

@inureyes

Copy link
Copy Markdown
Member Author

Final ROCm results at 852129eb1b4bf45d957f4c63b082d9d0276e4951: the literal scripts/xla/validate_arch.sh --model models/hf/falcon-h1-tiny-90m --device hip --batch 4 --requests 8 --maxcap 24 --oracle <fresh-HF-oracle> completed with exit 0 using release binaries: structural, 40-token oracle and batch reference-exact gates all PASS.

Other completed gates PASS: 544 library tests / 22 ignored, fmt/clippy and goldens; independent synthetic CPU/HIP tests covering three norm modes, multiplier placement, ragged logits and slot reuse; fresh HF oracle and CLI 40/40; B4/N8 170-token batch; cancellation/recycling; five hybrid HIP tests; Mamba2 synthetic and real oracle/batch regressions; real Nemotron-H-4B oracle and B4/N8 regression.

Strict displayed CLI/server equality remains 3/4 due solely to CLI removal of trailing " \n" in the Germany prompt. All four server responses match the unfiltered decode of their CLI token IDs. This does not establish HTTP token-ID equality, and the strict display criterion remains FAILED as detailed in #3414 (comment).

Tiny90M revision e6389502a0b12cd8da894b395ba5bf7436873b16 was downloaded and hash-verified. Evidence: /home/devops/Development/mlxcel/acceptance/pr3414/852129eb1b4bf45d957f4c63b082d9d0276e4951/summary.json and adjacent logs/scripts. All builds and GPU operations used the host guard, sequentially. No source changes, merge or issue closure performed in this validation.

Support original Hugging Face weights with independent attention and SSM dimensions, shared-input parallel mixers followed by a normalized MLP, optional grouped gated normalization, and explicit muP factors. Reuse compact KV and recurrent state plumbing across prefill, single decode, and ragged decode.

Add structural goldens, configuration and weight-layout regression coverage, and a reproducible independent HF synthetic device gate. Hardware and real-checkpoint acceptance remain pending.

Refs #3346
IREE runtime linkage belongs to the root build script. Move the ignored HF parity gate into the root integration-test suite and document its xla-iree,test-utils feature command so it uses the established runtime link recipe.

The core crate passes focused Falcon-H1 tests and all registered structural goldens remain byte-identical.

Refs #3346
Commit the independent native-HF fp32 40-token oracle and checkpoint provenance, add a direct engine token-parity gate, and document explicit HIP device/target/precision selection for external ROCm acceptance. Correct the omitted SSM state-size default to match HF and remove redundant borrows from the shared mixer helper.

Structural goldens, focused Falcon-H1 and recurrent regression tests, loader argument layouts, and original Tiny90M checkpoint shape validation pass locally. Numerical and operational acceptance are tracked separately.

Refs #3346
Record independent HF synthetic parity on CPU and CUDA, original Tiny90M 40-token oracle equality through the engine and CUDA CLI, four concurrent HTTP completions matching CLI text and counts, and batch-four/eight-request reference equivalence. Include command provenance, binary hashes, and server cleanup evidence.

Runtime source 205d0a3 was measured with pinned IREE and test-fast binaries. HIP acceptance remains pending; the issue and PR stay open and in progress.

Refs #3346
Raw completions retained a Germany response's trailing spaces and newline while full CLI display removed them through chat-oriented flush cleanup. Add an opt-in plain-text flush for CLI rendering, retaining existing reasoning, tool, Harmony, Muse, and default chat behavior.

Cover exact trailing whitespace, chunk accounting, primed reasoning, and structured channels. Add a portable four-request 40-token replay that compares actual CLI stdout with HTTP text, and correct the earlier raw-token-decode evidence boundary.

Validation: focused display regressions and 146 StreamFilter tests pass. GPU output replay is recorded separately after rebuilding the integrated candidate.

Refs #3346
The external ROCm mismatch was observed over SSE. Exercise four concurrent completions per transport in the portable replay, preserving text chunks and verifying usage, finish reason, and stream termination. Keep raw SSE events alongside the comparisons.

Validation: Python syntax check passes. Actual GPU replay follows the integrated binary build; this harness change does not claim new hardware evidence.

Refs #3346
@inureyes
inureyes force-pushed the feat/issue-3346-falcon-h1 branch from 852129e to 8c7b441 Compare November 25, 2026 07:36
The environment-documentation gate scans test-only Rust code as well as production code. Record the Falcon-H1 golden writer and original-checkpoint shape-test controls in its reasoned allowlist rather than presenting them as operator settings.

Validation: environment-documentation checker and all 15 Python regression tests pass.

Refs #3346
Record the final CPU/CUDA oracle and affected regression results after integrating Mamba1 and MoE support. Actual displayed CLI stdout matches all four nonstream and four SSE completions, including Germany's trailing spaces and newline. Preserve raw output, responses, binary provenance, and server cleanup evidence.

Correct the earlier HTTP evidence to raw token decoding, document the prior exact-SHA HIP numerical acceptance separately, and request a final-head ROCm replay. Add bilingual technical reports. No runtime source changes follow the tested runtime head.

Refs #3346
@inureyes

inureyes commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Merged as 3cee2854de141b7809129e41a33afcd69d876283. The merged tree contains final candidate 75111a0adb701d89d31c8256ed43167c3118ab7f; runtime source 8c7b4412 passed CPU/CUDA synthetic and real HF 40/40, CUDA CLI 40/40, and strict displayed stdout against all four nonstream plus all four SSE responses. Germany retains its exact " \n" suffix. All 560 core tests, 7 display tests, 146 filter tests, 5 CUDA hybrid tests, 6 CUDA Mamba2 tests, fmt/clippy, and 15 environment-checker Python tests pass. Later commits contain only CI allowlist and evidence/reports.

Please replay ROCm on merge commit 3cee2854de141b7809129e41a33afcd69d876283 for the new common text behavior and combined recurrent code. Prior HIP acceptance at 852129eb applies only to that source; its strict displayed comparison was 3/4. No new HIP result is claimed, and #3346 remains open.

In a validation checkout at that merge commit, use the pinned original Tiny90M checkpoint and set its path in MLXCEL_FALCON_H1_MODEL:

eval "$(scripts/iree/setup-rocm.sh --env)"
export MLXCEL_XLA_DEVICE=hip MLXCEL_XLA_ROCM_TARGET=gfx1151 MLXCEL_XLA_PRECISION=f32
export MLXCEL_ORACLE_PYTHON=spike/openxla/.venv/bin/python
export CARGO_TARGET_DIR="$PWD/target"
scripts/rocm_gpu_guard.sh --hold -- cargo build --profile test-fast --features xla-iree,test-utils --bin mlxcel --bin mlxcel-server
scripts/rocm_gpu_guard.sh --hold -- "$MLXCEL_ORACLE_PYTHON" spike/openxla/falcon_h1_cli_server_check.py --device hip --model "$MLXCEL_FALCON_H1_MODEL" --bin-dir "$CARGO_TARGET_DIR/test-fast" --binary-source-head 3cee2854de141b7809129e41a33afcd69d876283 --out /tmp/falcon-h1-displayed-hip-3cee2854

The replay covers both HTTP transports. Re-run the synthetic/real engine gates from FINDINGS_falcon_h1.md under the ROCm guard with the same explicit HIP environment. HTTP evidence is text/count parity, not HTTP token-ID equality.

Spell out the display, filter, hybrid, and Mamba2 test counts so the successful results cannot be mistaken for partial pass fractions. Numerical parity fractions remain unchanged.

Refs #3346
@inureyes
inureyes marked this pull request as ready for review November 25, 2026 07:42
@inureyes
inureyes merged commit 3cee285 into main Nov 25, 2026
23 of 33 checks passed
@inureyes
inureyes deleted the feat/issue-3346-falcon-h1 branch November 25, 2026 07:42
@inureyes inureyes added status:done Completed and removed status:in-progress Currently being worked on labels Nov 25, 2026
@inureyes

Copy link
Copy Markdown
Member Author

Requested ROCm replay PASS at exact merge commit 3cee2854de141b7809129e41a33afcd69d876283 on gfx1151, explicitly using hip and f32.

The portable displayed-output replay passes 4/4 non-streaming HTTP and 4/4 SSE comparisons against actual CLI stdout, including prompt/completion token counts. Germany preserves the exact trailing " \n"; the previous 3/4 display failure is resolved. Requests overlap within both transports, and the owned server process was reaped. CLI matches the independent HF oracle 40/40. HTTP evidence is text/count parity, not direct HTTP output-token IDs.

Also PASS: 560 XLA library tests / 22 ignored, byte-exact goldens, fmt/clippy; 7 display and 146 filter tests; fresh independent Falcon-H1 CPU/HIP synthetic and real40 gates; B4/N8 and cancellation/recycling; hybrid state tests; Mamba2 single/state-carry and real oracle/batch; Mamba1 oracle/batch; E-bearing MoE oracle/batch; real Nemotron-H-4B oracle/batch.

Evidence, binary hashes, preserved stdout/responses, commands and logs: /home/devops/Development/mlxcel/acceptance/pr3414/3cee2854de141b7809129e41a33afcd69d876283/ (displayed-http/result.json, displayed-http/server-exit.json, summary.json). Original Tiny90M revision e6389502a0b12cd8da894b395ba5bf7436873b16; optimized test-fast binaries. All builds/GPU work were sequential under scripts/rocm_gpu_guard.sh --hold --. No source changes or issue closure performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:architecture Architecture and code structure changes area:inference Generation, sampling, decoding (incl. speculative, DRY) priority:medium Medium priority status:done Completed type:enhancement New features, capabilities, or significant additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant