Skip to content

Add GLM-5 DSA TransformerBridge adapter#1430

Open
zeotrix wants to merge 1 commit into
TransformerLensOrg:devfrom
zeotrix:fix/issue-1406
Open

Add GLM-5 DSA TransformerBridge adapter#1430
zeotrix wants to merge 1 commit into
TransformerLensOrg:devfrom
zeotrix:fix/issue-1406

Conversation

@zeotrix

@zeotrix zeotrix commented Jun 22, 2026

Copy link
Copy Markdown

Adds TransformerBridge support for GlmMoeDsaForCausalLM / GLM-5 DSA.

This adds a GLM-MoE-DSA architecture adapter, including a dedicated DSA attention bridge for MLA-style latent attention plus learned top-k sparse-token selection. The adapter is
registered in the required architecture factory and model-registry surfaces, and tiny-random/glm-5.1 is added and verified in the Bridge registry.

Fixes #1406

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshots

Not applicable.

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have not rewritten tests relating to key interfaces which would affect backward compatibility

Validation

Ran:

.venv/bin/pycln --all . --exclude "__init__.py"
.venv/bin/isort --check-only transformer_lens/model_bridge/generalized_components/glm_moe_dsa_attention.py transformer_lens/model_bridge/supported_architectures/glm_moe_dsa.py tests/
unit/model_bridge/supported_architectures/test_glm_moe_dsa_adapter.py tests/integration/model_bridge/test_glm_moe_dsa_adapter.py
.venv/bin/mypy .
.venv/bin/python -m pytest tests/unit/model_bridge/supported_architectures/test_glm_moe_dsa_adapter.py tests/integration/model_bridge/test_glm_moe_dsa_adapter.py tests/unit/tools/
test_model_registry.py -k 'TestGlmMoeDsa or TestGlmMoeDsaBridge or TestRegistrySyncedWithFactory' -q

Result: 11 passed.

Model registry verification:

.venv/bin/python -m transformer_lens.tools.model_registry.verify_models --model tiny-random/glm-5.1

The benchmark reported:

VERIFIED: P1=100.0%, P2=100.0%, P3=85.0%, P4=70.0%

Notes:

- make format and uv run mypy . are blocked locally by a resolver/build issue in the default jupyter dependency group: jupyter-ydoc -> y-py==0.6.2.
- The direct .venv tools above pass.
- verify_models updated supported_models.json and verification_history.json, then exited nonzero during cleanup due to an existing torch.mps.synchronize() call on a machine without an
MPS backend.
- black hung locally even when run only on the touched Python files, so I interrupted it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant