laguna¶
laguna
¶
Laguna (LagunaForCausalLM, poolside's Laguna).
Llama's tree and Llama's block: model.{embed_tokens, layers[i].{input_layernorm,
self_attn, post_attention_layernorm, mlp}, norm} and lm_head, the residual
added in the block, which returns a bare tensor. What differs is inside the
sublayers:
- Per-block head counts.
num_attention_heads_per_layergives each block its own number of query heads (48 on the full-attention blocks and 64 or 72 on the sliding-window ones in the released checkpoints); the key/value heads andhead_dimare the same everywhere.layers[i].self_attn.num_headsis that block's count, read off the module; the root'snum_headsis the config's top-levelnum_attention_heads. - Gated attention. q/k norms before the rotary (partial on the full blocks),
the shared eager forward, then a softplus gate (
g_proj, per head or per channel) on the interface's output beforeo_proj:attention_head_outputsare ungated andattention_outputis the gated projection the block adds. - Mixture of experts.
mlp_layer_typesnames the dense blocks (LagunaMLP,intermediate_sizewide) and the sparse ones (LagunaSparseMoeBlock: routed expertsmoe_intermediate_sizewide, timesmoe_routed_scaling_factor, plus a shared expert, as one tensor). The shared expert (mlp.shared_experts) is aLagunaMLPtoo, so it is anMlp; itsmlp_outputis unavailable, since the block adds the mixture's sum.