transformer_lens.model_bridge.supported_architectures.falcon_h1 module¶
Falcon-H1 parallel-hybrid architecture adapter.
Supports FalconH1ForCausalLM (e.g. tiiuae/Falcon-H1-0.5B-Base).
Architecture overview: - Every block runs GQA attention and a Mamba-2 mixer in parallel on the same
input_layernormoutput; their results are summed into the residual stream alongside scalar multipliers. A second norm (pre_ff_layernorm) precedes a SwiGLU feed-forward MLP. This is the parallel hybrid that distinguishes Falcon-H1 from heterogeneous-layer hybrids like NemotronH (one mixer type per layer) — here both branches are present in every block.
RoPE via a model-level
model.rotary_embmodule (very largerope_theta).mamba_rms_norm=falseon the released checkpoints — the Mamba inner gated RMSNorm is absent, soinner_normis declared optional.~12 scalar multipliers (
embedding_multiplier,attention_out_multiplier,key_multiplier,ssm_*_multiplier,mlp_multipliers,lm_head_multiplier…). HF applies all of these in its own forward, so in raw (passthrough) mode the bridge inherits them for free — no weight folding is needed for forward parity. Folding would only matter for compatibility mode.
Key adapter decisions:
- BlockBridge is the block container: the block has two norms
(
input_layernorm+pre_ff_layernorm) and a real post-attention residual, so transformer-shaped hooks (hook_resid_midvialn2) are meaningful — unlike single-norm SSM blocks that needSSMBlockBridge.BlockBridge.forwarddelegates the whole block to HF, so the parallel attn+mamba combine happens natively.
SSM2MixerBridgewraps the Mamba-2 mixer (passthrough forward). Its innerin_proj/conv1d/out_projare mapped for hookability; the gatedinner_normis optional (absent whenmamba_rms_norm=false).applicable_phases = []:verify_modelsis transformer-shaped and does not meaningfully cover SSM hybrids. Correctness is gated by the integration parity test instead (the standard set for Mamba/Mamba2/NemotronH).Generation uses the standard transformer KV-cache path, not the bridge’s stateful-Mamba loop. Falcon-H1’s HF forward carries both attention KV and the Mamba conv/recurrent state inside one unified
past_key_valuescache, so the default path matches HF bit-for-bit. Settingis_statefulwould instead route generation through the pure-Mambacache_paramsconvention, which this hybrid does not use, and diverges from HF after the first decode step.
- class transformer_lens.model_bridge.supported_architectures.falcon_h1.FalconH1ArchitectureAdapter(cfg: Any)¶
Bases:
ArchitectureAdapterArchitecture adapter for
FalconH1ForCausalLM.Parallel hybrid: every block runs GQA attention and a Mamba-2 mixer side by side, then a SwiGLU MLP. Both branches are mapped on every block so each sub-path is independently hookable for ablation studies.
- applicable_phases: list[int] = []¶
- apply_output_logits_transform(logits: Tensor) Tensor¶
Match Falcon-H1’s post-unembedding multiplier.
- component_mapping: ComponentMapping | None¶
- uses_split_attention: bool¶
- weight_processing_conversions: Dict[str, ParamProcessingConversion | str] | None¶