Archived
museglimmer: the vision tower bounds the config it allocates by
MuseTower::declare read vision_config.num_hidden_layers and the position grid with only a positive check, then handed them to host vectors -- full.assign(depth), L.assign(depth) -- before any weight was consulted. A container stating 2^62 layers threw std::length_error (or bad_alloc just below max_size) out of the declare phase, and nothing between there and main catches: the process died with a SIGABRT and no report, where every other bad config in this file says what it dislikes on stderr and refuses with RAD_E_INVAL. The grid sides were the same story multiplied: pos_emb_height x pos_emb_width is a signed product of container values that can overflow before any comparison could see it. The gate now refuses depth past 128 and a grid side past 512, against published maxima rather than round numbers: the deepest vision encoder ever shipped is 48 layers (ViT-22B, InternViT-6B -- this family's towers are SigLIP-class, tens), and the largest stored position table a side of 92 (SigLIP at 1292 px over patch 14; CLIP 16, SAM 64; native-resolution towers store no side x side table). The caps sit ~2.6x and ~5.5x past those, so they never bite an honest container, and at the cap itself the guarded shapes are harmless: the depth vectors cost KiB and the grid products top out at 2^18, too small to wrap signed 64 before a comparison sees them. museglimmer_test pins both caps at their boundary and far past it -- the grid at both sides together, since one side alone the height==width rule refuses before the cap is consulted. Found by the 2.1.0 review pass (axis: hostile model files); caps sourced against published encoders and tightened at the operator's request, from the first pass's wide 512/4096 margins.
This commit is contained in:
1 parent
4943bba2fb
commit
392746da6b
2 files changed
+35
-4
No files matched your search
@@ -532,6 +532,12 @@ TEST(museglimmer_refuses_a_vision_tower_it_does_not_serve) {
|
||||
{ "vision_config.merge_size", "4", RAD_E_UNSUPPORTED },
|
||||
{ "out_hidden_size", "256", RAD_E_INVAL },
|
||||
{ "vision_config.pos_emb_width", "8", RAD_E_INVAL },
|
||||
/* the counts the declare walks and hosts-allocates by: a container naming a layer count
|
||||
* or grid past what a tower is must refuse, not throw a vector length out of bringup.
|
||||
* 129 is the first depth the bound refuses; the published maximum is 48. */
|
||||
{ "vision_config.num_hidden_layers", "129", RAD_E_INVAL },
|
||||
{ "vision_config.num_hidden_layers", "4611686018427387904", RAD_E_INVAL },
|
||||
{ "vision_config.pos_emb_height", "4611686018427387904", RAD_E_INVAL },
|
||||
};
|
||||
for (const auto& kc : kCases) {
|
||||
MetaKV mk = with_vision(muse_meta());
|
||||
@@ -544,6 +550,18 @@ TEST(museglimmer_refuses_a_vision_tower_it_does_not_serve) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(museglimmer_refuses_a_position_grid_past_its_bounds) {
|
||||
/* One key at a time cannot pin the grid bound: pos_emb_height alone the height==width
|
||||
* rule refuses before the cap is consulted. Both sides together reach it -- 513 is the
|
||||
* first side the bound refuses, against a published maximum of 92. */
|
||||
MetaKV mk = with_vision(muse_meta());
|
||||
mk.set("vision_config.pos_emb_height", "513");
|
||||
mk.set("vision_config.pos_emb_width", "513");
|
||||
RadBuilder b;
|
||||
RadBuildCtx ctx = muse_ctx(0, 1, 64);
|
||||
CHECK_EQ(stderr_of_rc([&] { return museglimmer::declare(&b, mk.meta(), &ctx); }), RAD_E_INVAL);
|
||||
}
|
||||
|
||||
/* ==================================================================== 5. the encoder step */
|
||||
|
||||
/* An encoder pass issues the tower and nothing else, over two 8 x 4 frames (two windows each);
|
||||
|
||||
Reference in new issue
Block a user