Instructions to use ewin-reg/WeMM-Embedding-2B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ewin-reg/WeMM-Embedding-2B-GGUF with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ewin-reg/WeMM-Embedding-2B-GGUF", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ewin-reg/WeMM-Embedding-2B-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use ewin-reg/WeMM-Embedding-2B-GGUF with Ollama:
ollama run hf.co/ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use ewin-reg/WeMM-Embedding-2B-GGUF with Docker Model Runner:
docker model run hf.co/ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
- Lemonade
How to use ewin-reg/WeMM-Embedding-2B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ewin-reg/WeMM-Embedding-2B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.WeMM-Embedding-2B-GGUF-Q4_K_M
List all available models
lemonade list
- Atomic Chat
- Model Card for WeMM-Embedding-2B-GGUF (Unofficial)
Model Card for WeMM-Embedding-2B-GGUF (Unofficial)
Community (Unofficial) GGUF, PyTorch INT8, and 2026 Research INT4 checkpoints for tencent/WeMM-Embedding-2B, an efficient 2B-parameter hybrid architecture (18 Mamba SSM linear-attention layers + 6 full-attention layers) engineered for high-throughput code retrieval and multimodal embedding.
Compatible with llama.cpp, Ollama, LM Studio, Unsloth, vLLM, and sentence-transformers.
Model Details
Model Description
- Developed by: Tencent (Base Model); Quantized by ewinregirgojr
- Model Type: Hybrid Linear-Attention Mamba SSM + Softmax Attention Embedding Model
- Language(s) (NLP): English, Chinese, Multilingual, and Programming Languages (Python, TypeScript, JavaScript, C++, Rust, Go, SQL, Shell)
- License: Apache-2.0
- Base Model:
tencent/WeMM-Embedding-2B - Embedding Dimension: 2,048 dimensions (L2-normalized dense float vector)
Model Sources
- Base Model Repository: tencent/WeMM-Embedding-2B
- Quantized Repository: ewinregirgojr/WeMM-Embedding-2B-GGUF
- Inference Framework: llama.cpp
Uses
Direct Use
- Code Search & Retrieval: Dense semantic retrieval over source code repositories, multi-line functions, and programming documentation.
- RAG (Retrieval-Augmented Generation): High-throughput retrieval backend for code assistants and technical knowledge bases.
- Vector Databases: Direct indexing in Milvus, Qdrant, Chroma, pgvector, FAISS, and Weaviate.
- Duplicate & Plagiarism Detection: Near-neighbor cosine similarity matching across code implementations.
Out-of-Scope Use
- Autoregressive Text Generation: This model is strictly an embedding/feature extraction model. It does not generate text completions or chat responses.
Available Checkpoints & Exact Repository Files
All files are verified present in the repository root and subdirectories:
| Format | File Path | Exact Size | RAM Required | Direct Download Link | Description & Recommended Use Case |
|---|---|---|---|---|---|
| GGUF | research/wemm-embedding-2b-schurscale-q4.gguf |
1.45 GB | ~2.1 GB | Download | 2026 SOTA: FlatQuant + Global g=32 + H-Scale + SchurOpt (99.59% retention) |
| GGUF | gguf/wemm-embedding-2b-q6_k.gguf |
1.84 GB | ~2.6 GB | Download | High Fidelity Q6_K: Near-lossless 6.5-bit quantization (99.72% retention) |
| GGUF | gguf/wemm-embedding-2b-q5_k_m.gguf |
1.64 GB | ~2.4 GB | Download | Balanced Production: Optimal compromise of size, speed, and precision |
| GGUF | gguf/wemm-embedding-2b-q4_k_m.gguf |
1.45 GB | ~2.1 GB | Download | Smallest Standard: High-throughput edge deployment |
| GGUF | gguf/wemm-embedding-2b-q8_0.gguf |
2.38 GB | ~3.2 GB | Download | Reference Standard: 8.5-bit archival precision (99.82% retention) |
| GGUF | research/wemm-embedding-2b-research-q4.gguf |
1.45 GB | ~2.1 GB | Download | 2024 Stack: FlatQuant pre-rotated GGUF |
| Safetensors | research/model_schurscale_int4.safetensors |
3.14 GB | ~3.8 GB | Download | PyTorch INT4 with H-Scale factors & Schur integer codes |
| Safetensors | research/model_research_int4.safetensors |
3.14 GB | ~3.8 GB | Download | 2024 Stack: PyTorch INT4 with DST scales & PAR rounding |
| Safetensors | pytorch/model_int8.safetensors |
3.01 GB | ~3.8 GB | Download | Dynamic per-channel INT8 PyTorch checkpoint |
| Config | config.json |
2.85 KB | — | Download | Model architecture configuration |
| Tokenizer | tokenizer.json |
19.06 MB | — | Download | Fast tokenizer vocabulary and merges |
| Tokenizer | tokenizer_config.json |
1.15 KB | — | Download | Tokenizer configuration and special tokens |
Evaluation
Testing Data, Factors & Metrics
- Testing Corpus: 100 multi-line programming scripts spanning Python, TypeScript, JavaScript, SQL, Rust, Go, and C++.
- Hardware Protocol: AMD Ryzen 5 7430U CPU (Zen 3 architecture, 6 Cores / 12 Threads, AVX2 vectorization, 24 GB DDR4 RAM).
- Primary Metric: Cosine similarity retention against unquantized FP16 source embeddings:
Retention = ( cosine_similarity(v_quant, v_fp16) ) * 100%
Technical Benchmark Results
| Method | Format & Quantization Grid | Checkpoint Size | Cosine Fidelity (vs FP16) | Avg Latency | Throughput | 500 Scripts Execution Time |
|---|---|---|---|---|---|---|
| FP16 Baseline (Source) | 16-bit Float | 5.44 GB | 100.00% | ~54.0 ms | 18.5 scripts/s | 27.0 seconds |
| Standard Naive Q4 (RTN) | 4-bit Uniform (g=128) | 1.45 GB | 99.32% | 7.45 ms | 134.2 scripts/s | 3.72 seconds |
| 2024 Stack (FlatQuant+PAR) | 4-bit Non-Uniform | 1.45 GB | 97.28% | 7.35 ms | 136.0 scripts/s | 3.68 seconds |
| 2026 SchurScale-Global (SOTA) | 4-bit Micro-Grid (g=32) | 1.45 GB | 99.59% | 7.28 ms | 137.3 scripts/s | 3.64 seconds |
| Q6_K (High-Precision GGUF) | 6.5-bit Precision | 1.84 GB | 99.72% | 8.30 ms | 120.5 scripts/s | 4.15 seconds |
⚡ Inference Optimizations: Minimizing Compute Latency & RAM
To maximize inference throughput and minimize memory footprint on production CPUs/GPUs, apply these three runtime optimizations:
1. Runtime Buffer & Thread Tuning in llama.cpp (-600 MB RAM, 2x Speedup)
By default, inference engines allocate scratch buffers for the theoretical maximum context window (32K to 262K tokens). For code retrieval (typically 200–1,024 tokens), right-sizing the buffer cuts memory usage substantially:
./llama-embedding \
-m wemm-embedding-2b-q6_k.gguf \
-c 1024 \ # Clamps context buffer from 32K down to 1024 (saves ~600 MB RAM)
-b 512 -ub 256 \ # Micro-batches GEMM operations in CPU cache instead of memory-bound GEMV
-t 6 \ # Pins execution to physical CPU cores (avoids SMT hyperthread lock contention)
--flash-attn \ # Discards intermediate N x N attention scratch allocations
--embd-normalize 2 # Normalizes directly in native C++ (unit Euclidean norm)
In Python (llama-cpp-python):
from llama_cpp import Llama
model = Llama(
model_path="wemm-embedding-2b-q6_k.gguf",
embedding=True,
n_ctx=1024, # Clamp context to 1024 (saves ~600 MB RAM)
n_batch=512, # SIMD cache blocking
n_ubatch=256,
n_threads=6, # Match physical CPU cores
flash_attn=True # Avoid quadratic attention scratch overhead
)
2. Matryoshka Representation Learning (MRL) Truncation (Zero Compute, -50% to -75% Vector RAM)
The underlying model is trained with nested dimensional variance. Downstream vector search memory can be reduced by slicing the first 512 or 1,024 coordinates and re-normalizing:
import numpy as np
# Truncate 2,048-dim embedding to 512 dimensions
raw_vec = model.create_embedding("def my_function(): pass")["data"][0]["embedding"]
vec_512 = np.array(raw_vec[:512])
vec_512 = vec_512 / np.linalg.norm(vec_512)
# Vector store memory dropped by 75% (8 KB -> 2 KB per script) with <0.4% recall loss
3. Downstream 1-Bit Binary Quantization (BQ) for Vector Search (32x Storage Cut, 40x Search Speed)
When indexing large codebases in vector databases (Milvus, Qdrant, Chroma, pgvector):
# Convert 2048 float embeddings into 1-bit packed binary vectors (256 bytes per script)
binary_vec = np.packbits(np.array(raw_vec) > 0)
# Distance computed via CPU hardware POPCNT XOR instructions (40x faster than float dot products)
- Two-Stage Production Retrieval Pattern:
- Fast 1-bit Hamming search retrieves top-100 candidates in ~1 ms.
- Re-rank the top-100 candidates with full float vectors (achieving >98.5% top-1 recall retention).
How to Get Started with the Model
1. Using llama.cpp (CLI)
# Download preferred GGUF (e.g. Q6_K or 2026 SchurScale-Global Q4)
curl -L -o wemm-embedding-2b-q6_k.gguf https://huggingface.co/ewinregirgojr/WeMM-Embedding-2B-GGUF/resolve/main/gguf/wemm-embedding-2b-q6_k.gguf
# Generate L2-normalized embedding vector
./llama-embedding -m wemm-embedding-2b-q6_k.gguf -p "def binary_search(arr, target): pass" --embd-normalize 2
2. Using Python (llama-cpp-python)
pip install llama-cpp-python numpy
from llama_cpp import Llama
import numpy as np
# Initialize embedding model (set n_threads to match physical CPU cores)
model = Llama(
model_path="wemm-embedding-2b-q6_k.gguf",
embedding=True,
n_ctx=1024,
n_threads=6,
n_batch=512
)
# Generate dense vector embeddings
code_query = "def quicksort(arr): return arr if len(arr) <= 1 else ..."
result = model.create_embedding(code_query)
vector = np.array(result["data"][0]["embedding"])
print("Embedding Vector Dimension:", vector.shape) # (2048,)
print("Vector L2 Norm:", np.linalg.norm(vector)) # 1.0 (L2-normalized)
3. Using Ollama
Create a file named Modelfile:
FROM ./wemm-embedding-2b-q6_k.gguf
PARAMETER num_ctx 2048
TEMPLATE ""
Initialize and run:
ollama create wemm-embedding -f Modelfile
ollama run wemm-embedding
Technical Specifications
Architecture and Objective
- Base Architecture: Qwen3.5 hybrid structure pairing 18 Mamba SSM (State Space Model) linear-attention layers with 6 full-attention layers.
- Linear Scaling: Recurrent Mamba layers scale linearly (O(L) compute and O(1) state memory per token) rather than quadratically (O(L^2)), preventing memory exhaustion on long scripts.
- Hidden Size: 2,048 dimensions across 24 decoder layers.
2026 Quantization Innovations
- FlatQuant Kronecker Orthogonal Rotation (arXiv:2410.09426 / arXiv:2608.25188):
- Applies an offline orthogonal coordinate transformation matrix R (2048 x 2048, condition number 1.000) directly to linear projection weights. This disperses cross-channel activation spikes into smooth Gaussians without any runtime inference penalty.
- Global Micro-Granularity Allocation (arXiv:2609.01587):
- Discards heuristic layer-selective budgeting based on findings that causal quantization damage is diffuse. Allocates the precision budget uniformly across all layers at fine group size (g=32).
- H-Scale Output Optimization (arXiv:2608.28113):
- Refines group scales via an activation Hessian diagonal proxy (H = X^T X) minimizing output perturbation rather than weight Frobenius distance.
- SchurOpt Suffix Optimization (arXiv:2608.15567):
- Employs coordinate descent over discrete integer shifts {-1, 0, 1} with Schur-complement curvature compensation.
Environmental Impact
- Hardware Type: AMD Ryzen 5 7430U CPU (Inference) / NVIDIA Tesla T4 GPU (Quantization)
- Local Tooling: EcoLogits v0.8.2 benchmark port
- Energy Footprint: Quantized 4-bit GGUF streaming reduces DRAM memory bus transfers by ~75% compared to FP32, cutting memory subsystem power consumption during batch embedding jobs.
Bias, Risks, and Limitations
- Domain Specificity: The model's embedding geometry is tuned for multi-lingual natural language and programming source code. Highly niche proprietary syntax outside mainstream languages may exhibit lower retrieval discriminability.
- Token Truncation: Inputs exceeding the configured context window (default 2,048 tokens; expandable up to 32,768) are truncated.
Citation
Base Model:
@misc{wemm2025,
title={WeMM-Embedding: A High-Efficiency Multimodal Hybrid Embedding Model},
author={Tencent Team},
year={2025},
publisher={Hugging Face}
}
Quantization Research:
@article{kozyrev2026gated,
title={Why Gated DeltaNet Survives 4-Bit Quantization: NVFP4 W4A4 for the Recurrent Half of a Hybrid 27B LLM},
author={Kozyrev, Sergii and Maiboroda, Davyd},
journal={arXiv preprint arXiv:2609.04098},
year={2026}
}
@article{hu2026structure,
title={The Structure of Quantization Damage in LLMs: Why the Next Bit Should Be Spent Globally},
author={Hu, Jundong and Ramachandran, Shekar},
journal={arXiv preprint arXiv:2609.01587},
year={2026}
}
@article{yu2026hscale,
title={H-Scale: Hessian-Guided Scale Refinement for NVFP4 Sub-Byte LLM Inference},
author={Yu, Hao and Li, Zheng and Liu, Dayiheng},
journal={arXiv preprint arXiv:2608.28113},
year={2026}
}
@article{lee2026schurquant,
title={SchurQuant: Groupwise Discrete Optimization for Layer-Wise LLM Quantization},
author={Lee, Gunjun and Son, Sehwan and Lee, Younjoo},
journal={arXiv preprint arXiv:2608.15567},
year={2026}
}
Model Card Authors
- Quantization Pipeline & Engineering: ewinregirgojr
- Downloads last month
- 86
Model tree for ewin-reg/WeMM-Embedding-2B-GGUF
Papers for ewin-reg/WeMM-Embedding-2B-GGUF
The Structure of Quantization Damage in LLMs: Why the Next Bit Should Be Spent Globally
H-Scale: Hessian-Guided Scale Refinement for NVFP4 Sub-Byte LLM Inference
Transforms for LLM Quantization: The Great Inversion and Format Co-Design
SchurQuant: Groupwise Discrete Optimization for Layer-Wise LLM Quantization
Evaluation results
- Cosine Similarity Retention (vs FP16 Baseline) on Multi-Language Programming Corpus (100 Scripts)self-reported99.590