Skip to content

transformer: weight arena undersized for Ternary-Bonsai-2-27B on Metal (GEIST_WEIGHT_MMAP=0) #561

Description

@geisten

Problem

Loading Ternary-Bonsai-2-27B PQ2_0 on Metal with GEIST_WEIGHT_MMAP=0 (arena mode) fails with weight arena exhausted at blk.63.attn_output. The arena comes up about 7.7 MB short. The mmap-alias mode loads, and its logits match cpu_neon.

Reproduced on main a99ab7c, M1 Max. Found while checking #464 against ternary models; main and the #464 branch behave the same.

Likely cause (inferred, not verified)

compute_weight_arena_capacity (src/archs/transformer/weight_load/tensor_views.c) adds a second staging copy plus the F32 copy only for small F16/BF16 matrices, plus 64 MB of headroom. Bonsai's 96 BF16 DeltaNet alpha/beta tensors, together with other widened or derived buffers on Metal, appear to exceed that headroom on the 27B.

Expected

The arena capacity counts every buffer the loader derives on this backend, so arena mode loads the model.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bonsaiBonsai model support, Prism ternary formats, correctness and performance

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions