mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #283] [CLOSED] Prompt path: BF16 projections get the activation's BF16 remainder too #2551
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2551
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/283
Author: @sergqwer
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:pr/prefill-bf16-split📝 Commits (1)
39db5dePrompt path: BF16 projections get the activation's BF16 remainder too📊 Changes
3 files changed (+119 additions, -54 deletions)
View changed files
📝
include/strata/prefill/kernels.hpp(+10 -7)📝
src/prefill/kernels.cu(+65 -29)📝
src/prefill/prefill.cpp(+44 -18)📄 Description
Summary
The prompt path fed BF16-rounded activations (2^-9 relative) to the BF16-weight projections, where decode feeds FP32.
Most of these projections feed discrete choices: the router (top-10), the indexer (block selection), SSM alpha/beta,
the shared-expert gate, the PLE key/value and the hyper-connection. A token whose router logits are close can pick
another expert on the prompt path than decode would.
Each such projection now takes x as
hi + lo, both BF16 (lo = bf16(x - hi)), in two GEMMs summed in FP32. Thatgives ~16 mantissa bits, decode's FP32 x to within ~1e-5. The kernels that write the BF16 images (
gr_norm*,gr_silu,gr_mix*,to_bf16) write the remainder alongside.STRATA_PREFILL_BF16X2picks the scope:2(default) all but the hyper-connection,1all,0off.Measured
Measured on current main (0.1.29,
d6708a4) with ISTA-DASLab's IQ2_XS, RTX 5090 32 GB, Ryzen 9 9950X3D, 128 GB DDR5, Windows 11. KL is first-token KL divergence (STRATA_DUMP_FIRST_LOGITS, #276); two runs of main itself differ by 0 on 5 of 6 short prompts and by 0.00013 on the sixth. First-token KL against mode 1 (every projection split):Mode 2 roughly halves the error on the shorter prompts. At 32K both stay 0.07 away from mode 1 and pick another first
token, so the hyper-connection's split is what matters there. Mode 2 is the default because on the NVFP4 fork mode 1
cost 8% of prompt speed (4,360 vs 4,726 tok/s; mode 2 4,726 vs 4,776 off). If 32K accuracy matters more than that,
mode 1 is the better default. It is a one-line change, and your call.
Switch
STRATA_PREFILL_BF16X2=0is main's behaviour,1splits every projection.🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.