mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #290] [CLOSED] Token embedding in BF16 from the checkpoint (--embd-gguf) #2556
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#2556
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/290
Author: @sergqwer
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:pr/embd-bf16📝 Commits (1)
379908dToken embedding in BF16 from the checkpoint (--embd-gguf)📊 Changes
5 files changed (+110 additions, -6 deletions)
View changed files
📝
include/strata/kernels/iq_kernels.hpp(+2 -0)📝
src/core/native_head.cpp(+1 -1)📝
src/kernels/cuda/iq_kernels.cu(+12 -2)📝
src/program/generate.cpp(+8 -3)➕
tools/embd_bf16_pack.py(+87 -0)📄 Description
Summary
The native path reads the token embedding from the model GGUF, where it is quantized (IQ4_XS in ISTA-DASLab's
IQ2_XS). The checkpoint ships it in BF16.
tools/embd_bf16_pack.pycopiesembed_tokensinto a one-tensor GGUF, bytes unchanged. Only the safetensors shardthat holds it is needed: 3 GB for
Qwen/Qwen3.8-Flash-Next(model-00130-of-00131.safetensors).--embd-gguf PATHmakes the native embedding readtoken_embdfrom that file.iq_embed_rowsandiq_dequant_f32decode BF16 (embed_type_supported).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 of the GGUF's IQ4_XS embedding against the BF16 one: 0.0015 (1K), 0.0089 (2K; the top token changes), 0.0010 (4K), 0.037 (32K); mean 0.012, ~100x the run-to-run noise. On the NVFP4 fork, whose GGUF embedding is Q8_0, the same comparison gave 0.0025. Decode and prompt speed are unchanged (fork); the start takes ~0.2 s more.
Switch
Off unless
--embd-ggufis given.🤖 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.