codefuse-ai/F2LLM-v2
Viewer • Updated • 60.1M • 2.71k • 10
How to use fcmeyer/F2LLM-v2-0.6B-bf16-mlx with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("fcmeyer/F2LLM-v2-0.6B-bf16-mlx")
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]How to use fcmeyer/F2LLM-v2-0.6B-bf16-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir F2LLM-v2-0.6B-bf16-mlx fcmeyer/F2LLM-v2-0.6B-bf16-mlx
MLX-native port of codefuse-ai/F2LLM-v2-0.6B (a 0.6B Qwen3-based multilingual embedding model, 1024-dim, last-token pooling, L2-normalized, MRL-trained) for Apple Silicon via mlx-embeddings.
python -m mlx_embeddings.convert --hf-path codefuse-ai/F2LLM-v2-0.6B --mlx-path ./F2LLM-v2-0.6B-bf16-mlx --dtype bfloat16 (mlx-embeddings 0.1.0).model. added per mlx-embeddings convention; no
quantization). 1.1 GB.model.safetensors (+ index), config.json, tokenizer files,
modules.json, config_sentence_transformers.json, 1_Pooling/config.json
(last-token pooling, include_prompt=true).from mlx_embeddings.utils import load
model, tokenizer = load("fcmeyer/F2LLM-v2-0.6B-bf16-mlx")
query_prompt = "Instruct: Given a question, retrieve passages that can help answer the question.\nQuery: "
texts = [
query_prompt + "What is F2LLM used for?",
"We present F2LLM, a family of fully open embedding LLMs.",
"F2LLM 是 CodeFuse 开源的系列嵌入模型。",
]
inputs = tokenizer.batch_encode_plus(
texts, return_tensors="mlx", padding=True, truncation=True, max_length=4096,
)
outputs = model(inputs["input_ids"], attention_mask=inputs["attention_mask"])
embeddings = outputs.text_embeds # pooled + normalized, (3, 1024)
similarity = embeddings[0:1] @ embeddings[1:].T
Notes:
e = e[..., :128]; e = e / max(norm(e), 1e-9).truncation=True keeps the head + appends EOS (verified: first 511 tokens + EOS
at max_length=512).mlx-embeddings Qwen3 fast-SDPA masking behavior (reproduces on the
float32 conversion too, smaller at ~0.14 hidden-state diff vs ~2.4 in bf16), not
a weight error. For max fidelity, pad to similar lengths or encode
length-mismatched inputs separately.10-text suite (query + EN/ZH/RU docs + unrelated + short/long/code/mixed-language):
@misc{f2llm-v2,
title={F2LLM-v2: Inclusive, Performant, and Efficient Embeddings for a Multilingual World},
author={Ziyin Zhang and Zihan Liao and Hang Yu and Peng Di and Rui Wang},
year={2026},
eprint={2603.19223},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2603.19223},
}
Source model card and license (Apache-2.0): https://huggingface.co/codefuse-ai/F2LLM-v2-0.6B
Quantized
Base model
Qwen/Qwen3-0.6B-Base