---
title: all-MiniLM-L6-v2-4bit
canonical_url: "https://www.modelscope.cn/models/mlx-community/all-MiniLM-L6-v2-4bit"
md_url: "https://www.modelscope.cn/models/mlx-community/all-MiniLM-L6-v2-4bit.md"
repository: mlx-community/all-MiniLM-L6-v2-4bit
last_updated: 2025-04-02
license: apache-2.0
pipeline_tag: sentence-similarity
tasks:
  - sentence-similarity
model_type:
  - bert
architectures:
  - BertModel
parameters: 3.6M
tensor_type:
  - U32
  - F16
library_name:
  - sentence-transformers
  - mlx
  - safetensors
  - pytorch
frameworks:
  - pytorch
language:
  - en
inference_backends:
  - "deploy_task emb"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 463
stars: 0
tags:
  - sentence-transformers
  - feature-extraction
  - sentence-similarity
  - transformers
  - mlx
---

# all-MiniLM-L6-v2-4bit

> all-MiniLM-L6-v2-4bit - mlx-community 在 ModelScope 开源的模型。mlx-community/all-MiniLM-L6-v2-4bit

mlx-community/all-MiniLM-L6-v2-4bit 是 ModelScope 魔搭社区上的 3.6M 参数sentence-similarity模型，采用 apache-2.0 许可，可用 deploy_task emb、sglang 0.5.2、vllm 0.9.2 部署。

- **Repository**: mlx-community/all-MiniLM-L6-v2-4bit
- **License**: apache-2.0
- **Tasks**: sentence-similarity
- **Parameters**: 3.6M
- **Inference backends**: deploy_task emb, sglang 0.5.2, vllm 0.9.2
- **Tags**: sentence-transformers, feature-extraction, sentence-similarity, transformers, mlx
- **Downloads**: 463
- **Stars**: 0
- **Last updated**: 2025-04-02

Source: https://www.modelscope.cn/models/mlx-community/all-MiniLM-L6-v2-4bit

---

# mlx-community/all-MiniLM-L6-v2-4bit

The Model [mlx-community/all-MiniLM-L6-v2-4bit](https://huggingface.co/mlx-community/all-MiniLM-L6-v2-4bit) was converted to MLX format from [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) using mlx-lm version **0.0.3**.

## Use with mlx

```bash
pip install mlx-embeddings
```

```python
from mlx_embeddings import load, generate
import mlx.core as mx

model, tokenizer = load("mlx-community/all-MiniLM-L6-v2-4bit")

# For text embeddings
output = generate(model, processor, texts=["I like grapes", "I like fruits"])
embeddings = output.text_embeds  # Normalized embeddings

# Compute dot product between normalized embeddings
similarity_matrix = mx.matmul(embeddings, embeddings.T)

print("Similarity matrix between texts:")
print(similarity_matrix)


```
