Skip to content

New int4-g64 container is ~12% more resource-hungry than per-row int4; possible VRAM-crash correlation (unconfirmed) #326

Description

@woolcoxm

New int4-g64 model container is ~12% more resource-hungry than the old per-row int4; possible link to VRAM crash

Filing this to capture a real resource regression (measured) and a possible related
stability symptom (unconfirmed mechanism — see bottom). Honest about what I know vs
what I'm guessing.

Environment

  • CPU: Intel Core Ultra 9 185H (16c / 22t)
  • RAM: 31.7 GB total
  • GPU: NVIDIA RTX 5070 Ti, 16 GB VRAM (14.4 GB free at idle)
  • Disk: NVMe, ~2.8 GB/s
  • OS: Windows (win32, Git Bash)
  • Engine: c/glm.c at fa821a1, built gcc -march=x86-64-v3 (AVX2, no AVX-512)

What changed between the two models

These are the same GLM-5.2 (744B MoE, 78 layers, 256 experts, 8 active/token,
hidden 6144). The difference is the int4 container only:

old glm52_i4 new glm52_i4_g64 delta
int4 scale scheme per-row (fmt=2) grouped, gs=64 (fmt=4)
one expert on disk 18.9 MB 21.2 MB +12.3%
resident dense weights ~9.9 GB 10.87 GB +9.8%
cold bytes read / token ~11.3 GB 12.7 GB +12.3%
MTP draft heads int4 (0% acceptance) int8 (correct) better

The +12% is the grouped scale array: a scale every 64 elements instead of one per row.
That's a deliberate quality trade (better per-expert numeric range) — which is why we
switched — but it costs resources on every dimension.

Measured gains and losses (same machine, CPU-only, greedy, cold-ish cache)

Honest numbers, not cherry-picked. CPU-only because CUDA now hard-crashes this
machine
(see below), so the GPU path is unavailable for both models.

metric old glm52_i4 new glm52_i4_g64
CPU decode, stock config 0.19 tok/s 0.05 tok/s (config cascade — see note)
CPU decode, properly tuned 0.27 tok/s 0.17 tok/s
expert cache hit rate 1.2–10% 26.6%
experts loaded / token ~575 600 (was 2424 before fix)
prefill (10 tokens) ~37s (21s I/O + 12.6s matmul)
MTP draft acceptance (CPU) 33% 0–8% cold
GPU decode (when CUDA worked) 0.26–0.30 tok/s n/a — crashes

Note on the 0.05: not the model being slow. The auto RAM budget (≈22 GB) starved the
expert cache to cap=1 (one slot/layer), forcing 2,424 expert disk-loads per token.
Setting RAM_GB=28cap=30.17 tok/s. Same model, 3.4×, zero code change.

Things I am NOT claiming

  • I could not find any 0.86 tok/s figure for the old model in the repo. The measured
    old-model GPU speed on this exact GPU is 0.30 tok/s. The 0.86 may be warmer-cache
    or a different run; either way that GPU path is dead now for both models.
  • The repo's headline 0.66 tok/s came from EXPERT_BUDGET=4, which the maintainers
    later quarantined as garbage-producing (commit 35f90b9, "budget=4 → decode is
    literal noise"). Not counting it.

The stability symptom — unconfirmed mechanism

⚠️ I want to be precise here: I have not reproduced the crash in a controlled way,
and the code I read sizes VRAM off the actual model footprint
(expert_bytes_probe reads real safetensors byte counts; g_cuda_dense_projected
accumulates qt_bytes per dense tensor — both reflect the larger g64 model, not the
old one). So I am not asserting a sizing bug. I'm reporting a correlation.

What happens: when loading experts into VRAM on the new g64 model, the computer
crashes
(hard, not a clean exit). It did not do this before. My current hypothesis,
not proof
: because the new container needs ~12% more bytes per expert and ~1 GB more
resident dense, the VRAM/RAM tiers are tighter, and a budget that was comfortable on
the old model now overshoots — but I have not confirmed the engine is mis-accounting
the larger size. It may be a pure resource-pressure crash, or something else entirely.

What I'd want before calling it a bug:

  • a clean repro (exact COLI_CUDA=1 CUDA_EXPERT_GB=... line that crashes),
  • the [CUDA] hot expert tier: ... VRAM X GB (total budget Y GB) line from the log
    right before the crash,
  • confirmation it does NOT crash with a lower CUDA_EXPERT_GB.

Quality

We switched for accuracy — the old model had a repetition problem. By that measure
the new container is the win. I did not rigorously quality-benchmark either model
(this session was speed-focused), and the old model directory has been deleted, so I
have no head-to-head accuracy data. Flagging it as open, not resolved.

What actually moves the needle (both models)

This is a 744B model on consumer hardware; "fast without optimization" was never on
the table (the README's own disk ceiling is ~0.05–0.1 tok/s). To make the new model
genuinely usable:

  1. RAM is the only knob today — push cap from 3 toward 8 and hit rate climbs.
  2. Interactive use warms the PIN set across turns.
  3. int2 for cold experts halves the ~10.5 GB/token expert I/O while keeping the
    hot PIN set at int4. The engine already has the matmul_i2 kernel + converter
    plumbing; it needs a converter fix, an int2 exactness test, and a quality
    measurement. That's the real path to recover the speed the lost GPU took away —
    and it would apply to the old model too.

Working CPU-only recipe (no CUDA)

cd c
SNAP=../glm52_i4_g64 RAM_GB=28 CACHE_ROUTE=1 DRAFT=0 ./glm.exe 75
# → ~0.17 tok/s, ~27 GB peak RSS, cap=3, MTP off (0% acceptance cold)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDifetto verificato nel codice

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions