Archived
feat(qwen4exp): support U4 gate with W6NL down experts
This commit is contained in:
1 parent
590dbcc178
commit
d1b5a45e31
20 files changed
+618
-79
No files matched your search
+13
-1
@@ -99,6 +99,18 @@ const std::vector<NamedTable>& named_tables() {
|
||||
14.0f, 16.0f, 18.0f, 20.0f, 22.0f, 24.0f, 26.0f, 30.0f,
|
||||
-0.8125f, -2.5f, -4.0f, -5.5f, -7.5f, -9.0f, -11.0f, -12.0f,
|
||||
-14.0f, -16.0f, -18.0f, -20.0f, -22.0f, -24.0f, -26.0f, -30.0f } },
|
||||
/* Candidate W6NL: 32 positive E4M3-exact magnitudes followed by their negatives. Fitted
|
||||
* to group-64 absmax-normalised FWHT-128 BF16 Flash-Next down-weight samples. This is a
|
||||
* weight-error pilot, not a claim of improved model quality. The high code bit is the
|
||||
* sign, and libr4d's layout verifies this complete table before serving it. */
|
||||
{ "w6nl", { 0.875f, 2.75f, 4.5f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f,
|
||||
9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f,
|
||||
18.0f, 20.0f, 22.0f, 24.0f, 26.0f, 28.0f, 30.0f, 32.0f,
|
||||
36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f,
|
||||
-0.875f, -2.75f, -4.5f, -6.0f, -6.5f, -7.0f, -7.5f, -8.0f,
|
||||
-9.0f, -10.0f, -11.0f, -12.0f, -13.0f, -14.0f, -15.0f, -16.0f,
|
||||
-18.0f, -20.0f, -22.0f, -24.0f, -26.0f, -28.0f, -30.0f, -32.0f,
|
||||
-36.0f, -40.0f, -44.0f, -48.0f, -52.0f, -56.0f, -60.0f, -64.0f } },
|
||||
/* A one-bit weight: a sign and the block's scale. */
|
||||
{ "binary", { -1.0f, 1.0f } },
|
||||
/* BitNet's ternary weight, a two-bit code with one code unused. */
|
||||
@@ -117,7 +129,7 @@ bool parse_table(const char* s, std::vector<float>* out, std::string* why) {
|
||||
char* end = nullptr;
|
||||
const float v = std::strtof(p, &end);
|
||||
if (end == p || !std::isfinite(v)) {
|
||||
if (why) *why = fmt("table=%s is neither nf4, iq4nl, w4nl, w5nl, binary, ternary nor a "
|
||||
if (why) *why = fmt("table=%s is neither nf4, iq4nl, w4nl, w5nl, w6nl, binary, ternary nor a "
|
||||
"`;`-separated list of values", s);
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* table=T a scalar codebook: each code indexes a table of values, which a block's scale
|
||||
* multiplies. nf4 (QLoRA's NormalFloat), iq4nl (llama.cpp's IQ4_NL values),
|
||||
* w4nl (the rotated expert grid libr4d's w4nla8h kernel decodes), w5nl (its
|
||||
* 32-level form, libr4d's w5nl64a8h),
|
||||
* 32-level form, libr4d's w5nl64a8h), w6nl (the 64-level candidate),
|
||||
* binary {-1, +1}, ternary {-1, 0, +1}, or the values themselves, `;`-separated.
|
||||
* The codes are the narrowest unsigned width that indexes it.
|
||||
* group=N one scale per N columns of a row -- block [1 x N]
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
"code dtype: i2..i8, i16, i32 (signed, symmetric), u1..u8, u16 with zero= (asymmetric), " \
|
||||
"fp8_e4m3, fp8_e5m2, fp6_e2m3, fp6_e3m2, fp4_e2m1" }, \
|
||||
{ "table", RAD_P_STR, nullptr, \
|
||||
"a codebook the codes index: nf4, iq4nl, w4nl, w5nl, binary, ternary, or values " \
|
||||
"a codebook the codes index: nf4, iq4nl, w4nl, w5nl, w6nl, binary, ternary, or values " \
|
||||
"separated by ;" }, \
|
||||
{ "vq", RAD_P_STR, nullptr, \
|
||||
"a vector codebook file: one codeword a line, its integers (-127..127) separated by " \
|
||||
|
||||
Reference in new issue
Block a user