Downloads · 30 days
245
41% of all-time downloads
ewin-reg/WeMM-Embedding-2B-Apple-Silicon-MLX
WeMM-Embedding-2B-Apple-Silicon-MLX is a feature extraction model from ewin-reg. Use it when you need embeddings to search or compare text. It is set up for mlx. The card lists the license as other.
Native MLX conversion of ewin-reg/WeMM-Embedding-2B-Quantized — the hybrid FP8-protected attention + group-16 INT4 checkpoint — that preserves its mixed-precision allocation instead of flattening everything to one pre…
Downloads · 30 days
245
41% of all-time downloads
All-time downloads
597
Public
Parameters
2.2B
2 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.9 GB · 99%
How the weights are stored.
U322.2B · 100%
From the Hugging Face model README
Native MLX conversion of ewin-reg/WeMM-Embedding-2B-Quantized
— the hybrid FP8-protected attention + group-16 INT4 checkpoint — that preserves its
mixed-precision allocation instead of flattening everything to one precision.
The source checkpoint is curvature-guided: it deliberately keeps the precision-sensitive
path at ~8-bit (FP8 E4M3) and compresses only the quantization-robust masses to INT4.
Uniform 4-bit quantization destroys that — the source README itself documents softmax
attention collapse (D_KL >= 7.50) when Q/K go to 4 bits. This build mirrors the
source allocation exactly (verified: 285/285 modules, 0 missing, 0 extra).
| Set | Modules | Source dtype | This MLX build |
|---|---|---|---|
| Protected | embed_tokens, all 18 linear-attention projections (in_proj_a/b/qkv/z, out_proj), all 6 full-attention self_attn.{q,k,v,o}_proj, mlp.down_proj in all 24 layers | FP8 E4M3 (per-tensor scale) | 8-bit affine, group-64 |
| Compressed | gate_proj + up_proj (24 layers), the full 24-block DeepStack ViT, merger.fc1/fc2 | INT4 group-16 | 4-bit affine, group-32 |
| Untouched | RMSNorms, conv1d, A_log, dt_bias, visual norms | BF16/F32 | BF16/F32 |
Two deviations from the source, both improvements or forced by MLX:
mx.quantize kernel only supports group sizes 32/64/128, so the source's
INT4 group-16 becomes group-32 (the closest supported granularity).Per-module overrides are stored in config.json → quantization, which
mlx_vlm.load() reads back (so the allocation is reproduced at load time — no patched
library needed).
| Size | |
|---|---|
tencent/WeMM-Embedding-2B (BF16) | 5.07 GB |
ewin-reg/WeMM-Embedding-2B-Quantized (FP8 + INT4) | 1.75 GB |
ewin-reg/WeMM-Embedding-2B-Apple-Silicon-MLX | 1.95 GB |
The extra ~200 MB is the group-16 → 32 change plus MLX's separate scales/biases
tensors; it is still far below BF16 and keeps the ViT quantized (many "MLX" ports leave
it in BF16 and balloon to ~2.6 GB).
pip install mlx mlx-vlm # on Apple Silicon; no mlx-cpu needed
import mlx.core as mx
from mlx_vlm import load
model, processor = load("ewin-reg/WeMM-Embedding-2B-Apple-Silicon-MLX")
tok = processor.tokenizer
def embed(text: str) -> mx.array:
enc = tok(text, return_tensors="np")
ids = mx.array(enc["input_ids"])
mask = mx.array(enc["attention_mask"])
cache = model.language_model.make_cache()
h = model.language_model.model(ids, cache=cache) # final hidden states
mx.eval(h)
vec = h[0, int(mask.sum()) - 1, :] # last non-pad token
return vec / mx.linalg.norm(vec) # L2-normalised, 2048-d
v = embed("a photo of a cat sitting on a windowsill")
# Matryoshka truncation (e.g. to 512 dims)
v512 = v[:512] / mx.linalg.norm(v[:512])
Text, images and videos: the same model exposes vision_tower, and the chat template /
processor from the source checkpoint are included, so multimodal inputs work the same way
as the model card's PyTorch snippet (image/video tokens via Qwen3VLProcessor).
mlx_vlm.load(): 0 bit/group-size mismatches; norms remain BF16cos("cat sitting on a windowsill", "kitten resting by the window") = 0.809cos(cat, "quarterly revenue increased by 12% YoY") = 0.295ewin-reg/WeMM-Embedding-2B-Quantized (its own weight-only fake-quant
is lossless with respect to what that model computes at runtime).mlx_vlm convert + a per-module quant predicate derived from the
checkpoint's actual tensor dtypes — not from prose.This build was verified on x86 CPU only. No Apple-Silicon run has happened yet. Anyone reading this should not assume MPS has been tested. The MLX repo is the tested Mac path going forward, replacing the old INT8 workaround repo, which I pulled for exactly that reason.