Archived
format: bound the geometry the bailing layout products are built from
The layer-count cap made the walk safe; the arithmetic was still open. The rebuild multiplies container-supplied widths in int64 -- heads * (nope + rope) rows for the q_b split, heads * 256 * latent for the fused kv -- and hands the products to sized allocations and a comparison. A wrapped q_b product that coincidentally equalled the tensor's rows would run the split at a wrong per-head boundary (the bytes stayed the file's own, but the weights went to the wrong names); on the 32-bit tier, an overflowed element count truncates through size_t to a small allocation the copy then overruns. The family gate now caps what these products are built from -- heads and the MLA rank at 4096, rope at 256 dimensions, the full query width at 65536, the layer group within the stack; the shipped geometry is 128/64/512 with tens of heads -- and the q_b row product is computed with overflow checks instead of trusted. checkpoint_test pins the wide heads and rank against the honest small stack. Found by the 2.1.0 review pass (axis: hostile model files); widened past the reported site to the fused-kv product the same axes cleared only as file-bounded.
This commit is contained in:
1 parent
3bf9dc9593
commit
5e2e596644
2 files changed
+36
-9
No files matched your search
@@ -3587,19 +3587,19 @@ TEST(a_bailing_gguf_must_promise_a_walkable_layer_count) {
|
||||
* therefore not a slow load but a permanent hang -- and a negative dense prefix opens a
|
||||
* second loop of the same order. Both must refuse at open, quickly, RAD_E_FORMAT. */
|
||||
const std::string dir = fresh_dir();
|
||||
auto bailing_kvs = [](int64_t layers, int64_t dense) {
|
||||
auto bailing_kvs = [](int64_t layers, int64_t dense, int64_t heads = 4, int64_t latent = 512) {
|
||||
return std::vector<GKv>{
|
||||
{ "general.architecture", 8, 0, { "bailingmoe3" } },
|
||||
{ "bailingmoe3.block_count", 10, (double)layers, {} },
|
||||
{ "bailingmoe3.embedding_length", 4, 64, {} },
|
||||
{ "bailingmoe3.attention.head_count", 4, 4, {} },
|
||||
{ "bailingmoe3.attention.head_count", 10, (double)heads, {} },
|
||||
{ "bailingmoe3.feed_forward_length", 4, 128, {} },
|
||||
{ "bailingmoe3.context_length", 4, 4096, {} },
|
||||
{ "bailingmoe3.kda.head_dim", 4, 128, {} },
|
||||
{ "bailingmoe3.rope.dimension_count", 4, 64, {} },
|
||||
{ "bailingmoe3.attention.key_length_mla", 4, 192, {} },
|
||||
{ "bailingmoe3.attention.value_length_mla", 4, 128, {} },
|
||||
{ "bailingmoe3.attention.kv_lora_rank", 4, 512, {} },
|
||||
{ "bailingmoe3.attention.kv_lora_rank", 10, (double)latent, {} },
|
||||
{ "bailingmoe3.expert_feed_forward_length", 4, 256, {} },
|
||||
{ "bailingmoe3.leading_dense_block_count", 10, (double)dense, {} },
|
||||
};
|
||||
@@ -3618,6 +3618,16 @@ TEST(a_bailing_gguf_must_promise_a_walkable_layer_count) {
|
||||
write_gguf(sane, bailing_kvs(4, 1), {});
|
||||
Checkpoint ck3;
|
||||
REQUIRE_EQ(ck3.open(sane), RAD_OK);
|
||||
/* The widths the layout products are built from are bounded too: past the caps they are
|
||||
* vector sizes and wrapped row products, not geometry. */
|
||||
const std::string wide = dir + "/wide.gguf";
|
||||
write_gguf(wide, bailing_kvs(4, 1, 4611686018427387904LL), {});
|
||||
Checkpoint ck4;
|
||||
REQUIRE_EQ(ck4.open(wide), RAD_E_FORMAT);
|
||||
const std::string deep_rank = dir + "/deep_rank.gguf";
|
||||
write_gguf(deep_rank, bailing_kvs(4, 1, 4, 4611686018427387904LL), {});
|
||||
Checkpoint ck5;
|
||||
REQUIRE_EQ(ck5.open(deep_rank), RAD_E_FORMAT);
|
||||
}
|
||||
|
||||
RAD_TEST_MAIN()
|
||||
Reference in new issue
Block a user