Fix synthetic parity CI failures from transformers 5.13 upgrade - #390
Merged
Conversation
Closed
- MLA configs (deepseek_v2/v3, longcat_flash, deepseek_v2_moe): set num_key_value_heads == num_attention_heads so HF's repeat_kv in SDPA no longer inflates the full-head MLA K/V tensors. - granitemoehybrid: use current HF layer-type names (linear_attention/ full_attention) instead of the removed legacy mamba/attention values, and remap the renamed routed-expert weights (experts.gate_up_proj/down_proj, router.weight) in preprocess_weights. - olmo3: add an atol override for its near-tie FP-accumulation divergence (cosine=0.9999, argmax near-tie). Signed-off-by: copilot
Performance Comparison
|
Move the full MLA kv-heads explanation to a single top-of-file note and reference it concisely from each MLA config entry. Signed-off-by: copilot
Copilot
AI
changed the title
[WIP] Fix CI errors in synthetic parity tests
Fix synthetic parity CI failures from transformers 5.13 upgrade
Jul 8, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates test configs and model-specific adapters to restore synthetic_parity_test.py stability after the transformers 5.13 upgrade, mainly by aligning HF config expectations (MLA KV heads; GraniteMoeHybrid layer-type naming) and loosening tolerance for a numerically sensitive model (Olmo3).
Changes:
- Add an
atoloverride forolmo3to accommodate near-tie FP accumulation divergence while preserving functional parity. - Update DeepSeek/LongCat MLA tiny test configs so
num_key_value_heads == num_attention_heads, preventing HF SDPArepeat_kvfrom inflating KV heads. - Adjust GraniteMoeHybrid test-side HF config layer-type translation and extend
preprocess_weights()to remap GraniteMoeHybrid’s renamed routed-expert and router weight keys.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/synthetic_parity_test.py | Adds olmo3 tolerance override; updates GraniteMoeHybrid HF layer-type mapping to current HF validator expectations. |
| tests/_test_configs.py | Ensures MLA models use full-head K/V by setting num_key_value_heads to match num_attention_heads in tiny configs. |
| src/mobius/models/granitemoehybrid.py | Updates preprocess_weights() to remap GraniteMoeHybrid routed-expert and router weight names across transformers versions. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five
tests/synthetic_parity_test.pycases (olmo3,deepseek_v3,deepseek_v2_2,longcat_flash,granitemoehybrid) broke after the transformers 5.13 upgrade, each from a distinct HF-side behavior change.MLA head-count mismatch —
deepseek_v2,deepseek_v3,longcat_flashHF's SDPA path now applies
repeat_kvwhenevernum_key_value_groups > 1. MLA reconstructs full-head K/V from a latent, so the tiny configs'num_key_value_heads=2caused K/V to be duplicated (4→8 heads) against the 4-head query:RuntimeError: The size of tensor a (4) must match the size of tensor b (8).num_key_value_heads == num_attention_headsfor the MLA entries intests/_test_configs.py(no-op for the mobius MLA path, which ignoresnum_key_value_heads).granitemoehybrid —
tests/synthetic_parity_test.py+granitemoehybrid.pylayer_typesvaluesmamba/attentionare rejected by HF's validator; the test now emitslinear_attention/full_attention, and the redundant_HF_EXTRA_CONFIGoverride forcing legacy names is removed.preprocess_weightsnow remaps them (identical layouts, names only), keeping legacy names for back-compat:Without this remap the ONNX expert weights stayed random (cosine 0.996).
olmo3
Near-tie argmax with
cosine=0.9999,max_abs_diff=0.0146— a benign QK-norm + sliding/full-attention FP-accumulation difference. Added anolmo3: 0.02atol override, consistent with existing entries likegemma3_text.