bridge.diffusion.conversion.llada15.llada15_bridge#
Megatron Bridge for LLaDA1.5 (GSAI-ML/LLaDA-*) masked-diffusion LLMs.
Converts between the trust_remote_code LLaDAModelLM HF class and a
Megatron-Core GPTModel. The model is a dense LLaMA-style block with
OLMo-style parameter naming and full RoPE.
Key mapping decisions, anchored to the reference implementation
(modeling_llada.py):
QKV is separate (
q_proj,k_proj,v_proj— seeLLaDALlamaBlock.__init__), not fused. Use :class:QKVMapping, not- class:
ConcatenatedQKVMapping.
The SwiGLU MLP computes
act(ff_proj(x)) * up_proj(x)(seeLLaDALlamaBlock.forward), soff_projis the gate andup_projis the up input for Megatron’s fusedlinear_fc1.The LM head is
model.transformer.ff_out(LLaDA1.5 hasweight_tying: false).Attention output projection is named
attn_out, noto_proj.Layer norms are
attn_norm(pre-attention) andff_norm(pre-MLP), fused into Megatron’s TElinear_qkv/linear_fc1layer_norm_weight.
Module Contents#
Classes#
HF |
API#
- class bridge.diffusion.conversion.llada15.llada15_bridge.LLaDA15Bridge#
Bases:
megatron.bridge.models.conversion.model_bridge.MegatronModelBridgeHF
LLaDAModelLM↔ MegatronGPTModelbridge... rubric:: Example
from megatron.bridge import AutoBridge bridge = AutoBridge.from_hf_pretrained(“GSAI-ML/LLaDA-1.5”, trust_remote_code=True) model_config = bridge.get_model_config()
- MODEL_CONFIG_CLASS#
None
- USE_MODEL_CONFIG_FOR_CONVERSION#
True
- hf_config_to_model_config_kwargs(
- hf_config: transformers.PretrainedConfig,
Convert a Hugging Face LLaDA-1.5 config to builder config kwargs.
The layer spec swaps in the bidirectional
LLaDA15TEDotProductAttention.
- hf_config_to_provider_kwargs(
- hf_config: transformers.PretrainedConfig,
Adapt the canonical builder mapping to the deprecated provider path.
- mapping_registry() megatron.bridge.models.conversion.mapping_registry.MegatronMappingRegistry#