GLM-4.5: rope_theta read as 10000 instead of 1000000 with transformers-kt 5.x

Author: tcfurrerCreated Sep 24, 2026Updated Sep 24, 2026

Reminder

  • I have read the above rules and searched the existing issues.

System Info

$ lscpu (trimmed) Architecture: x86_64 CPU(s): 28 (WSL2 VM: 14 cores x 2 threads exposed to the guest) Model name: AMD Ryzen 9 9950X3D 16-Core Processor Hypervisor vendor: Microsoft (WSL2, mirrored networking) L3 cache: 96 MiB NUMA node(s): 1 Flags (subset): avx2 avx512_bf16 avx512_bitalg avx512_vbmi2 avx512_vnni avx512_vp2intersect avx512_vpopcntdq avx512bw avx512cd avx512dq avx512f avx512ifma avx512vbmi avx512vl fma (no AMX; kt-kernel uses the avx512_bf16 variant)

$ nvidia-smi NVIDIA-SMI 615.71.08 KMD Version: 616.92 CUDA UMD Version: 13.4 GPU 0: NVIDIA GeForce RTX 5070 Ti (sm_120), 16303 MiB (15726 MiB in use with the model loaded)

$ nvcc --version (CUDA 12.9 toolkit used for JIT/build) Cuda compilation tools, release 12.9, V12.9.86

OS: Ubuntu 24.04.5 LTS under WSL2 (WSL 2.5.10.0, kernel 6.6.87.2-microsoft-standard-WSL2) Memory: WSL limited to 54 GB (52 GiB visible), 32 GB swap Python: 3.12.3

Packages (venv): sglang-kt 0.7.0.post4 (PyPI wheel) kt-kernel 0.7.0.post4 (PyPI wheel) sgl-kernel-kt 0.3.21.post2 (built locally from the submodule source, CUDA 12.9, sm_120a only) transformers-kt 5.6.0.post5 torch 2.9.1 (cu128) flashinfer-python / flashinfer-cubin 0.6.3 triton 3.5.1 numpy 2.5.3

Reproduction

No error message or stack trace: the server starts and serves normally, and nothing is logged.
The only symptom is degraded output beyond ~4k tokens (perplexity explodes, output loops/garbles).

Server command (paths shortened):

PYTORCH_ALLOC_CONF=expandable_segments:True SGLANG_ENABLE_JIT_DEEPGEMM=0 \
python -m sglang.launch_server \
  --model-path <hf-cache>/models--zai-org--GLM-4.5-Air-FP8/snapshots/<hash> \
  --served-model-name glm-4.5-air \
  --kt-method AMXINT4 --kt-weight-path <dir>/GLM-4.5-Air-cpu-int4 \
  --kt-cpuinfer 14 --kt-threadpool-count 1 --kt-num-gpu-experts 0 \
  --mem-fraction-static 0.9 --kv-cache-dtype fp8_e5m2 --context-length 50000 \
  --attention-backend triton --tool-call-parser glm45 --reasoning-parser glm45 \
  --host 0.0.0.0 --port 30000

INT4 CPU weights were made from the original BF16 zai-org/GLM-4.5-Air with:
python kt-kernel/scripts/convert_cpu_weights.py --input-path <bf16 snapshot> --input-type bf16 \
  --output <dir>/GLM-4.5-Air-cpu-int4 --quant-method int4 --cpuinfer-threads 14 --threadpool-count 1 --no-merge-safetensor

Reproduction 1 (no GPU needed; needs only config.json and transformers-kt 5.6.0.post5):

  from transformers import AutoConfig
  cfg = AutoConfig.from_pretrained("zai-org/GLM-4.5-Air-FP8")
  print(getattr(cfg, "rope_theta", 10000))   # prints 10000; config.json says 1000000
  print(cfg.rope_parameters)                  # {'rope_theta': 1000000, 'partial_rotary_factor': 0.5, 'rope_type': 'default'}

Reproduction 2 (with the server running): perplexity by position of ordinary text

  import json, math, urllib.request
  text = open("/usr/share/common-licenses/GPL-3").read()[:26000]      # ~5,500 tokens
  req = urllib.request.Request("http://localhost:30000/generate",
      json.dumps({"text": text, "sampling_params": {"max_new_tokens": 1, "temperature": 0},
                  "return_logprob": True, "logprob_start_len": 0}).encode(),
      {"Content-Type": "application/json"})
  lp = [x[0] for x in json.load(urllib.request.urlopen(req))["meta_info"]["input_token_logprobs"] if x[0] is not None]
  for i in range(3584, len(lp), 256):
      seg = lp[i:i+256]; print(i + 1, round(math.exp(-sum(seg) / len(seg)), 1))

Expected: ~1.0-1.5 at every position.
Actual (before the fix): 1.3 up to position ~3840, then 9.1 (at 4097), 121, 1651, 8266, 24797, 18416.
With rope_theta patched to read config.rope_parameters["rope_theta"]: 1.0-1.3 everywhere, and perplexity stays flat (1.4-2.1 per 4096 tokens) over a 36.6k-token prompt.

Others

Source: kvcache-ai/ktransformers