Altar-1 (4-bit, MLX)

AikidoSec/altar-1 — the 504B expert-pruned GLM-5.3 (REAP: 168 of 256 routed experts kept, INT4 W4A16 on the experts) — converted to MLX format to run locally on Apple Silicon with stock mlx_lm. No additional quantization was applied: the source INT4 codes and scales are copied bit-identically.

Requires ~330+ GB of unified memory. Developed and tested on a Mac Studio M3 Ultra (512 GB). Expect ~13 tok/s decode at any context length, 126–205 tok/s prefill depending on context length.

Usage

pip install mlx-lm>=0.31
mlx_lm.generate --model openvuln/altar-1-4bit-mlx \
    --prompt "The capital of France is" --max-tokens 32
from mlx_lm import load, generate

model, tokenizer = load("openvuln/altar-1-4bit-mlx")
response = generate(model, tokenizer, prompt="Write a haiku about firewalls", max_tokens=64)
print(response)

OpenAI-compatible server:

mlx_lm.server --model openvuln/altar-1-4bit-mlx
# API on http://127.0.0.1:8080/v1

The custom model file (glm_moe_dsa_shared.py)

GLM-5.3's DeepSeek Sparse Attention computes the indexer top-k only on "full" layers; "shared" layers reuse the previous full layer's selection. Materializing per-layer indexer weights (required for a plain checkpoint) changes that behavior and stutters on long contexts. This repo therefore ships glm_moe_dsa_shared.py, which mlx_lm loads automatically via "model_file" in config.json (no trust_remote_code flag needed) to restore true index sharing at run time. Keep the .py file when copying the checkpoint — the model does not load without it.

Fidelity vs AikidoSec/altar-1

  • INT4 codes, scales, and the computed MLX biases are bit-identical to the source (exhaustive audit, ~112k tensor comparisons).
  • kv_b_proj is requantized at the same 4 bits / group 32 by mlx-lm's own sanitize() (146 tensors, max deviation 0.856 of one quantization step; mathematical bound 1.0) — identical to official mlx-lm conversions of this family.
  • The MTP (multi-token prediction) layer that mlx-lm drops is not included.

Performance (Mac Studio M3 Ultra, 512 GB)

context prefill (tok/s) TTFT decode (tok/s) peak memory
128 86 1.5 s 13.7 315 GB
2k (dense) 205 10.0 s 12.6 319 GB
4k 194 21.1 s 13.0 320 GB
8k (DSA sparse) 167 49.0 s 12.3 323 GB
16k 126 2.2 min 12.6 329 GB
64k 44.5 24.5 min 11.7 367 GB
128k 23.7 92.3 min 11.5 406 GB
256k ~12 (est.) ~6.2 h (est., not run) ~11.5 (est.) ~485 GB (est.)

Serving with mlx_lm.server, decode throughput scales with concurrency (MoE batching): 12.4 tok/s single stream, 18.6 at 2 streams, 26.4 at 4.

License

Inherits the GLM-5.3 license through AikidoSec/altar-1 and cyankiwi/GLM-5.3-AWQ-INT4.

Downloads last month
111
Safetensors
Model size
495B params
Tensor type
BF16
·
F32
·
U32
·
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for openvuln/altar-1-4bit-mlx

Base model

zai-org/GLM-5.3
Quantized
(1)
this model