Repository navigation
Conversation
Stage BF16 weights and decoder constants in FP32 to avoid FP16 overflow and underflow before the runtime cast. Select normalization compute casts from the runtime tensor dtype so FP32 reductions and BF16 outputs remain explicit. Cover real BF16 safetensors, both builder prefixes, and normalization dtype boundaries. BF16 host weight arrays now use four bytes per element instead of two. Signed-off-by: JiaxinD <djx2048@gmail.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Contributor
Author
|
@yifeif-nv Community CPU passed for f179f32; Dev39636402874 passed FP8 but NVFP4 hit CUDA OOM during engine deserialization on L4/TRT11.1. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Llama BF16 checkpoints currently pass through FP16 host storage before the runtime BF16 cast. Valid BF16 values such as ±2^20 and ±2^-30 become infinities or zero. Both decoder builders repeat this narrowing. This is an independently reproduced correctness bug in the existing family, not new model support.
Exit Criteria
Implementation
Change categories
No public API, ABI, format or dependency changes. Rebuild affected BF16 plans to obtain corrected constants.
Validation
Commands and Results
PYTHONPATH=core/builder:. python -m pytest -c /dev/null --rootdir=. --confcutdir=. families/llama/tests/test_builder_variants.py families/llama/tests/test_bf16_storage.py -qpython native-bf16-probe.py --source <tree> --output <result.json>python -m pytest tools/tests/test_architecture.py tools/tests/test_family_impact.py tools/tests/test_public_source_hygiene.py tools/tests/test_pr_metadata.py -qRuff, legal headers, catalog, impact and
git diff --checkpassed.Hardware, Environment, and Revisions
Base
59fe695bdd5cd328bfc276a534cf762beeede787, tested headf179f32c6db3cdda6bc32d5cf90ee83d3ad8ffcf. Windows/Python 3.13 CPU checks; Linux/Python 3.12.3, NVIDIA H200, TensorRT 11.4.0.106 CUDA 13 package for native checks. Five normalized source-file hashes matched the tested archive plus patch. Synthetic BF16 safetensors, no external checkpoint or dataset.Not Run / Remaining Gaps
Dev CI39636402874 on L4/TRT11.1 passed FP8 E2E but NVFP4 failed engine deserialization with CUDA OOM; three later cases were not run. Attribution needs a clean base/head memory comparison. TP, native-KV dual-profile execution and performance qualification remain unverified. The tiny native probe exercises the dense dual-profile path. Windows collection of two additional TensorRT-dependent modules failed because TensorRT is absent there; the native builder suite above ran on H200.
Contributor Self-Review
Manual call-chain review plus independent review found no blocking defect.
Notes For Future Readers
Review mapper, builders, then normalization boundaries. BF16 host weight ndarray elements increase from two to four bytes; peak RSS, GPU memory and latency were not measured. No resource-equivalence claim. If #1427 lands first, its BF16 host-storage expectations in
test_support.pymust follow this FP32 storage contract. No runtime dependency or required merge order.Risk level
Corrects shared Llama-family BF16 staging and normalization boundaries, with increased host storage and incomplete full-model qualification. Draft retained for the unresolved NVFP4 qualification failure and unchanged three-slot review capacity.