GLM-5.2 Vision adapter for MLX (MoonViT tower + PatchMerger projector)

Experimental, AI-built — not production software. This adapter and its serving stack were built largely by AI agents under human direction and validated by measurement, not review. Enjoy it, hack on it, review it before you depend on it — and if you'd like to adopt and polish it properly, please do; the author would be delighted and simply doesn't have the time.

The vision half of baseten/GLM-5.2-Vision-NVFP4, converted to MLX-native safetensors so a locally served GLM-5.2 on Apple Silicon can see images — no Blackwell GPUs, no SGLang.

GLM-5.2-Vision bolts the frozen MoonViT-3d encoder from Kimi-K2.6 onto a frozen GLM-5.2 through a trained 49.5M-parameter PatchMerger projector (1152→4608→6144). This repository packages exactly that vision side:

file contents
vision_tower.safetensors MoonViT-3d, 27 layers, 1152-dim (834 MB, frozen upstream weights)
mm_projector.safetensors trained PatchMerger MLP (99 MB)
processor / config files image preprocessing + chat template glue

Because the GLM text backbone is untouched by the vision training, this adapter composes with any GLM-5.2 text quantization — the tower runs on the image, the projector maps patch embeddings into GLM's token space, and the embeddings are spliced into the prompt.

Usage (omlx)

Serving is implemented in the omlx fork: point the model's vision_adapter_dir at this repository's contents in model_settings.json, restart, and send standard OpenAI-style image_url (base64) chat requests to /v1/chat/completions. Verified against 3.5–4.5 bpw GLM-5.2 quants on an M3 Ultra: image understanding works over the plain /v1 API with prefix caching intact.

Known limitation: multi-image prompts can bleed attention between images — single-image prompts are the reliable path today.

Credits

  • Baseten — trained the projector and released GLM-5.2-Vision-NVFP4 (MIT), from which these weights are extracted unchanged.
  • Moonshot AI — MoonViT encoder (Kimi-K2.6).
  • Z.ai — GLM-5.2.

License: MIT, following the source release.

Downloads last month
346
MLX
Hardware compatibility
Log In to add your hardware

Quantized

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

Model tree for josefprusa/GLM-5.2-Vision-MLX-adapter

Base model

zai-org/GLM-5.2
Quantized
(7)
this model