GLM-DSA: Fix token corruption due to incorrect RoPE type#2099
Conversation
The DSA lightning indexer hardcoded LLAMA_ROPE_TYPE_NEOX for indexer Q/K positional encoding, but the GLM-5.2 model config.json explicitly sets "indexer_rope_interleave": true, meaning the indexer uses interleaved RoPE (LLAMA_ROPE_TYPE_NORM). GLM-5.1 config.json also sets "rope_interleave": true. The mismatch caused incorrect indexer scores, wrong top-k key selection, and single-character token errors and other corruption that could grow worse with context length. Here the setup is changed to use the model's given rope_type instead of hardcoding NEOX. This fixes GLM-5.2, GLM-5.1, and should be less brittle for future GLM variants.
|
This fixed it for me, thanks! |
|
This fixed it for me as well, thanks! The model is now fully coherent until the context limit is reached (I can only fit 100k), and with |
ikawrakow
left a comment
There was a problem hiding this comment.
Thank you for finding this. The original PR had it hard-coded, so I assumed it needs to be different from the model RoPE type.
I compiled these newest PR bits and ik_llama continues crashing same as before. What cli settings is everyone running for ik_llama and glm5.2 successfully? |
Here's my invocation / runscript with the three quants I've been using. gpu is r6kp, cpu is epyc 9b14 x2 nps4. |
The DSA lightning indexer hardcoded LLAMA_ROPE_TYPE_NEOX for indexer Q/K positional encoding, but the GLM-5.2 model config.json explicitly sets "indexer_rope_interleave": true, meaning the indexer uses interleaved RoPE (LLAMA_ROPE_TYPE_NORM).
GLM-5.1 config.json also sets "rope_interleave": true.
The mismatch caused incorrect indexer scores, wrong top-k key selection, giving single-character/token errors and other corruption that could grow worse with context length.
Here the setup is changed to use the model's given rope_type instead of hardcoding NEOX. This fixes GLM-5.2, GLM-5.1, and should be less brittle for future GLM variants.
Closes #2083