Views
No views yet
gather_qmm kernel, 2.6× faster).aimodel) conversion of zai-org/GLM-4.7-Flash
(text decoder): MLA attention + a 64-expert top-4 sparse MoE (+ non-gated shared expert).
~30B total / ~3B active per token — a strong local coder.zoo/glm-4.7-flash.md).import CoreAIOps; no session, no model plumbing, downloads on first use):let tldr = try await CoreAI.summarize(text, options: .model("glm-4.7-flash"))1git clone https://github.com/john-rocky/coreai-kit
2open coreai-kit/Examples/ChatDemo/ChatDemo.xcodeproj
3# → Run, then pick "GLM-4.7-Flash (MoE+MLA)" in the model picker
4
5# agents / headless (macOS):
6cd coreai-kit/Examples/ChatDemo
7swift run chat-cli --model glm-4.7-flash --prompt "What can you do, offline?"1import CoreAIKit
2
3let chat = try await ChatSession(catalog: "glm-4.7-flash")
4let reply = try await chat.respond(to: prompt)
5// reply: the answer, generated fully on-deviceKitLanguageModel plugs this bundle into the system LanguageModelSession; capabilities (tool calling, guided generation) auto-detect per model.Examples/ChatDemo/Sources/QuickStart.swift
— this exact code as one typed function, no UI; the CLI is an argument shell over it, and
the GUI drives the same ChatSession across turns for its transcript.
Multi-turn? Hold the ChatSession and call respond(to:) per turn — it keeps the
conversation history; streamResponse(to:) yields tokens as they decode.https://github.com/john-rocky/coreai-kit → product CoreAIKitdownloadProgress callback)gather_qmm kernel — 20.3 → 52.4 tok/s (2.6×)GatherMM reads all 64 experts' weights every token; a custom
coreai_torch.TorchMetalKernel reads only the 4 routed experts (4/64) → decode runs at
active-param bandwidth: 52.4 tok/s, 2.6× (the biggest relative gain of the zoo's three MoE
gather ports — a 16× over-read removed).sym8 scheme = the same
symmetric-linear int8 (per-K-block-32) recipe the standard int8 bundle uses, via a bit-exact
gather: 0 introduced flips / 18 vs fp16. Pure speed win at the same quality.| bundle | size | decode tok/s | quality |
|---|---|---|---|
gpu-pipelined/glm_4_7_flash_decode_sym8_gather/ | 30 GB | 52.4 | clean (0 flips/18 vs fp16) ✅ |
COREAI_CHUNK_THRESHOLD=1 llm-benchmark --model gpu-pipelined/glm_4_7_flash_decode_sym8_gather -p 128 -g 256 -n 3conversion/export_glm47_moe_metal_decode_pipelined.py.gather_qmm kernel: community.