--- language: - en - ko license: other license_name: motif-non-commercial-research license_link: https://huggingface.co/Motif-Technologies/Motif-3-Beta/blob/main/README.md library_name: mlx pipeline_tag: text-generation base_model: Motif-Technologies/Motif-3-Beta base_model_relation: quantized tags: - mlx - moe - korean - quantized - apple-silicon - motif - mixed-precision - 4-bit - dwq-teacher - conversational --- > [!NOTE] > ## πŸ“Œ KL 수치 보λ₯˜ 쀑 / KL numbers under review β€” the model itself is fine > > **2026-07-26.** 이 μΉ΄λ“œμ˜ **"KL vs Q8(8bit 레퍼런슀)" μˆ˜μΉ˜λŠ” ν˜„μž¬ 보λ₯˜**ν•©λ‹ˆλ‹€. > 레퍼런슀둜 쓰인 [8bit λΉŒλ“œμ— 결함](https://huggingface.co/avlp12/Motif-3-Beta-Alis-MLX-8bit/discussions/1)이 > ν™•μΈλ˜μ–΄(`mx.split` 2Β³ΒΉ 초과 ν…μ„œ 침묡 손상), **μ†μƒλœ 레퍼런슀λ₯Ό κΈ°μ€€μœΌλ‘œ μΈ‘μ •λœ κ°’**이기 λ•Œλ¬Έμž…λ‹ˆλ‹€. > > The **"KL vs Q8" figures on this card are withheld pending re-measurement**: the 8-bit > build used as the reference has been found defective, so those numbers were measured > against a corrupted baseline. > > **보λ₯˜λ˜λŠ” 것 / withheld:** μŠ¬λΌμ΄μŠ€λ³„ `KL vs Q8` ν‘œ Β· **"DWQκ°€ KL을 58–72% κ°μ†Œ"** μ£Όμž₯ Β· > `eval_ladder.png`의 KL μΆ• > > **영ν–₯ μ—†λŠ” 것 / unaffected β€” 이 λΉŒλ“œ μžμ²΄λŠ” μ •μƒμž…λ‹ˆλ‹€:** > - λͺ¨λΈ ν’ˆμ§ˆ(ν•œκ΅­μ–΄Β·μ˜μ–΄Β·μ½”λ“œ 생성)은 직접 μƒμ„±μœΌλ‘œ κ²€μ¦λ˜μ—ˆκ³  κ·ΈλŒ€λ‘œ μœ νš¨ν•©λ‹ˆλ‹€. > Generation quality is verified directly and stands. > - **ν¬νŒ… νŒ¨λ¦¬ν‹° `KL β‰ˆ1e-7 / token`** 은 μˆ˜μ •λœ **HF torch 레퍼런슀** 기쀀이라 8bit와 λ¬΄κ΄€ν•˜λ©° μœ νš¨ν•©λ‹ˆλ‹€. > The port-parity figure is measured against the fixed HF reference, not the 8-bit build. > - 루프 ν”„λ‘œλΈŒ(distinct-4gram) λ“± **λ ˆνΌλŸ°μŠ€κ°€ ν•„μš” μ—†λŠ” μΈ‘μ •**은 μœ νš¨ν•©λ‹ˆλ‹€. > > 8bit 레퍼런슀λ₯Ό μž¬λΉŒλ“œν•œ λ’€ μž¬μΈ‘μ •ν•˜μ—¬ 이 μΉ΄λ“œμ˜ 수치λ₯Ό κ°±μ‹ ν•˜κ³  이 주석을 λ‚΄λ¦¬κ² μŠ΅λ‹ˆλ‹€. > The reference is being rebuilt; these figures will be re-measured and this note removed. # Motif-3-Beta-Alis-MLX-Dynamic-4.5bpw Apple Silicon (MLX) **mixed-precision** quantization of [Motif-Technologies/Motif-3-Beta](https://huggingface.co/Motif-Technologies/Motif-3-Beta) β€” a **314.84B-parameter** (β‰ˆ13B active) Mixture-of-Experts reasoning model, **text-only**, bilingual **Korean / English** (+ code), with 97.84% of its mass in the routed experts and native **256K** context. This is the **"C6" build: 4.547 bpw measured, 167 GB on disk** β€” the **high-fidelity daily driver** of the family and, at the same time, the **teacher that distilled the [2.3bpw floor build](https://huggingface.co/avlp12/Motif-3-Beta-Alis-MLX-Dynamic-2.3bpw)**. Part of the first community MLX port of Motif-3-Beta in any format. If your Mac has **256 GB or more**, this is the build to run: 4-bit experts with 6-bit attention and an 8-bit KV-A latent recover the base model's behavior at less than half the footprint of the 8-bit reference. ![Which Motif-3-Beta MLX build fits your Mac β€” 2.3bpw / 128 GB / 85 GB, 4.5bpw / 256 GB / 167 GB, 8bit / 512 GB / 312 GB](assets/tier_guide.png) > ⚠️ **Requires a patched `mlx-lm`** with the `motif` model class (see *How to run*). Stock > `mlx-lm` has no Motif support and will not load this checkpoint. > ⚠️ **Non-commercial research license**, inherited in full from Motif-3-Beta (a beta > release). See *License*. --- ## Model at a glance Motif-3-Beta is a **text-generation** LLM (no vision/audio) built on several non-standard components. The port reimplements each for MLX and verifies it against a bug-fixed reference. | | | |---|---| | Base model | [Motif-Technologies/Motif-3-Beta](https://huggingface.co/Motif-Technologies/Motif-3-Beta) β€” 314.84B total / β‰ˆ13B active | | Architecture | Sparse MoE, **53 layers** (0-1 dense, 2-52 MoE); **384 routed experts, top-8** + 1 shared | | Routed-expert mass | **97.84%** of parameters | | Attention | **GDLA** (Grouped Differential Latent Attention): MLA-style low-rank q/kv + differential-v2 + elementwise output gate; 80 heads / 16 KV groups, head_dim 192 | | Sliding window | interleaved SWA β€” window 128 on 40 layers; **13 full-attention layers** carry YaRN, the 40 SWA layers plain rope | | Other components | **mHC** (manifold-constrained hyper-connections, Γ—2/layer); **Grouped PolyNorm** per-expert activation; `rms_norm` eps 1e-6 | | Tokenizer | vocab **220,160**; **stop tokens `{0, 3, 6}`**; chat template **auto-opens ``** | | Context | **256K** (262,144) native | | Bits/weight | **4.547** (measured; per-tensor mixed, experts 4-bit/g64) | | On-disk size | **167 GB** (167 GiB) | | Format | MLX (Apple Silicon); `library_name: mlx` | | Role | daily driver **and** DWQ teacher for the 2.3bpw floor build | ### Recipe (verified from `config.json`) 97.84% of the parameters are routed experts, so expert bit-width sets the size; the per-token critical path and the latent chokepoint get extra bits. | Component | Bits | Notes | |---|---|---| | Routed experts (gate/up/down) | **4-bit g64** | β‰ˆ97.8% of params β€” sets the footprint | | Attention (GDLA projections) | **6-bit g64** | per-token critical path, promoted vs the floor build | | `wkv_a` (KV-A latent down-projection) | **8-bit g64** | latent chokepoint β€” kept high across every profile | | Token embedding Β· LM head | 6-bit g64 | distribution-sensitive | | Router gate Β· mHC Β· `lambda_proj` Β· all norms Β· `act_fn` | **fp (unquantized)** | discrete control paths + normalization | ### Architecture ![Motif-3-Beta architecture: embedding to 53 decoder layers (GDLA attention, mHC hyper-connections, dense/MoE feed-forward with Grouped PolyNorm) to RMSNorm to LM head](assets/architecture.png) --- ## Build ladder | Build | Recipe | Size | bpw | Target | |---|---|---|---|---| | [2.3bpw (FLOOR)](https://huggingface.co/avlp12/Motif-3-Beta-Alis-MLX-Dynamic-2.3bpw) | experts 2b/g128 Β· attn 4b Β· wkv_a 8b | 85 GB | 2.315 | 128 GB Mac | | **4.5bpw (this, C6)** | experts 4b Β· attn 6b Β· wkv_a 8b Β· embed/head 6b Β· router/mHC/norms fp | **167 GB** | **4.547** | **256 / 512 GB Mac** Β· DWQ teacher | | [8bit (Q8)](https://huggingface.co/avlp12/Motif-3-Beta-Alis-MLX-8bit) | all 8b/g64 | 312 GB | 8.503 | 512 GB Mac Β· reference | --- ## How to run Motif support is **not yet in an `mlx-lm` release**. Install from the fork/branch that carries the `motif` model class: ```bash pip install git+https://github.com/avlp12/mlx-lm.git@motif ``` **Python:** ```python from mlx_lm import load, generate from mlx_lm.sample_utils import make_sampler model, tokenizer = load("avlp12/Motif-3-Beta-Alis-MLX-Dynamic-4.5bpw") messages = [{"role": "user", "content": "ν•œκ΅­μ–΄μ™€ μ˜μ–΄λ‘œ μžκΈ°μ†Œκ°œλ₯Ό ν•΄μ€˜."}] prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True) # The chat template auto-opens a block: the model reasons first, then answers. sampler = make_sampler(temp=1.0, top_p=0.95) # recommended; greedy can loop on some prompts print(generate(model, tokenizer, prompt=prompt, max_tokens=1024, sampler=sampler)) ``` **CLI / server:** ```bash mlx_lm.generate --model avlp12/Motif-3-Beta-Alis-MLX-Dynamic-4.5bpw \ --prompt "Explain MoE routing in two sentences." --temp 1.0 --top-p 0.95 -m 512 mlx_lm.server --model avlp12/Motif-3-Beta-Alis-MLX-Dynamic-4.5bpw # OpenAI-compatible ``` - **Sampling:** temperature **1.0**, top-p **0.95** are recommended (greedy can loop on some prompts). - **Stop tokens:** the tokenizer stops on `{0, 3, 6}`; pass all three as stop ids if you drive generation yourself. - **Reasoning mode:** the chat template opens a `` block automatically β€” expected behavior, not a template bug. - **Long context:** on a 256 GB Mac, quantize the KV cache for long prompts (`--kv-bits 8 --kv-group-size 64 --quantized-kv-start 4096`). See *Hardware*. --- ## Method β€” `alis-dwq` pipeline Weights are produced with **[alis-dwq](https://github.com/avlp12/alis-dwq)**, the same pipeline used for the GLM-5.2 (745B) and Hy3 (295B) Alis MLX builds: mixed-bit affine quantization with the experts lowest, the router / mHC / `lambda_proj` / norms kept fp, the `wkv_a` latent chokepoint at 8-bit, and embed/head at 6-bit. At 4-bit-and-above the naive per-tensor recipe is already near-optimal for its size, so β€” unlike the 2.3bpw floor β€” this build ships as a **direct mixed-precision quantization** (no clip-search / DWQ pass on top; those levers are 2-bit-specific and measured neutral-to-negative at this bit-rate). The port itself is **parity-verified**: MLX logits match a **bug-fixed HF reference** to **KL β‰ˆ1e-7 / token** (see *Port notes*). ### Doubles as the DWQ teacher This same checkpoint is the **teacher** for the 2.3bpw floor build's layerwise DWQ distillation (45% Korean calibration mix). A mid-bit teacher is the sweet spot for a 2-bit student β€” sharper than the 8-bit reference where it counts, without over-driving the student β€” and it cut the floor build's KL 58-72% while breaking its code-generation loop. --- ## Evaluation This build is the **high-fidelity tier** and was itself the **DWQ teacher**, so it is **not separately KLD-evaluated against the 8bit (Q8) reference** β€” its distribution is by construction within **teacher-grade fidelity** of it (it is the near-golden target the floor build was distilled toward). The discriminating KL measurements in this family are made *against* the 8bit reference for the more aggressive builds; see the [2.3bpw card](https://huggingface.co/avlp12/Motif-3-Beta-Alis-MLX-Dynamic-2.3bpw) for that ladder. For orientation, that build's KL vs Q8 is EN 0.277 / code 0.100 / KO 0.522 **after** distilling toward this teacher β€” this 4.5bpw build sits well below those figures. ![The 2.3bpw floor build this checkpoint taught: KL vs the Q8 reference and greedy loop-probe across raw / +clip / +clip+DWQ β€” DWQ from this 4.5bpw teacher cuts KL 58-72% and breaks the code loop](assets/eval_ladder.png) *The chart shows what this teacher bought the floor build: it is the teacher, not the student, so it is not itself plotted.* Qualitatively: fluent, coherent bilingual generation (Korean including hanja, English) and code, with the reasoning `` trace intact. General knowledge, code, and bilingual generation are reliable. **Honest caveat (shared across the family):** very-long-tail factual recall can be weak β€” e.g. the model does not reliably reproduce obscure text such as the 4th verse of the Korean national anthem. This is a **base-model property, not a quantization artifact** (the 8bit reference shares it). --- ## Correctness & port notes - **Logit parity.** On a truncated model (fp32, EN/KO/code prompts) MLX matches a bug-fixed HF reference to **KL β‰ˆ1e-7 / token, top-1 100%**. SWA long-context self-consistency is a **bit-exact match** (cached wide forward vs no-cache reference). - **The shipped HF reference had bugs** (documented in the repo discussion [Motif-3-Beta/discussions/6](https://huggingface.co/Motif-Technologies/Motif-3-Beta/discussions/6)): a YaRN RoPE dimension crash, an eager-attention GQA crash, and a `grouped_mm` path that applied expert-0 PolyNorm coefficients to all experts. **Motif Technologies pushed fixes (SHA `d2c9ac6`)** and this port matches the fixed reference. The root cause of the early incoherence was the **Grouped PolyNorm activation** (sigmoid coefficients + `output_scale` 0.5 + routed `bias_clamp`) β€” credit to Motif for the fix. - **One MLX-core bug** is worked around in the port: `mx.split` silently corrupts the tail of a >2Β³ΒΉ-element tensor (the 8 GB bf16 `gate_up`); basic strided slices are used instead. Upstream [ml-explore/mlx#3836](https://github.com/ml-explore/mlx/issues/3836). --- ## Hardware Built for **256 GB (and up) Apple Silicon**. Weights are 167 GB, leaving comfortable headroom for KV cache and prefill activation on a 256 GB machine (274.9 GB total); on a 512 GB machine, long-context prefills run with room to spare. For long context, prefer int8 KV (`--kv-bits 8`). If your Mac has **128 GB**, use the [2.3bpw floor build](https://huggingface.co/avlp12/Motif-3-Beta-Alis-MLX-Dynamic-2.3bpw) instead; for a near-lossless archival reference on 512 GB, the [8bit build](https://huggingface.co/avlp12/Motif-3-Beta-Alis-MLX-8bit). --- ## License Motif-3-Beta ships **no formal license name and no `LICENSE` file**; its model card states, verbatim: > "Permission is granted to use, modify, and redistribute this software for personal, > educational, and non-commercial research purposes only. Commercial use is prohibited > without prior written permission from Motif Technologies." This is a **non-commercial research license** that explicitly permits modification and redistribution for personal / educational / non-commercial research use. A quantized MLX port is a modification-and-redistribution, so it is permitted **provided it stays non-commercial** and carries the same terms. **This derivative inherits that license in full.** The `license: other` / `license_name` fields are a best-effort mapping β€” the authoritative terms are the quoted text and the base model's card. ## Credits & attribution - **Base model:** [Motif Technologies β€” Motif-3-Beta](https://huggingface.co/Motif-Technologies/Motif-3-Beta) (non-commercial research). All architecture β€” GDLA, Grouped PolyNorm, mHC β€” and the trained weights are theirs, as are the reference fixes (SHA `d2c9ac6`). - **MLX & `mlx-lm`:** Apple [ml-explore](https://github.com/ml-explore). - **MLX port, `motif` model class, mixed-precision recipe:** Alis (avlp12), via [alis-dwq](https://github.com/avlp12/alis-dwq). Independent, unofficial derivative β€” not affiliated with or endorsed by Motif Technologies. Provided as-is, without warranty. Research / non-commercial use only. ## Citation > **Alis (avlp12)** (2026). *Motif-3-Beta-Alis-MLX-Dynamic-4.5bpw* β€” 4.547 bpw MLX > quantization of [Motif-3-Beta](https://huggingface.co/Motif-Technologies/Motif-3-Beta) > for 256 GB+ Apple Silicon; the family's high-fidelity daily driver and DWQ teacher.