Sentence Similarity
sentence-transformers
Safetensors
English
Chinese
qwen2
mteb
retriever
text-embeddings-inference
custom_code
Run this model with HF Jobs
Run Kingsoft-LLM/QZhou-Embedding on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Kingsoft-LLM/QZhou-Embedding. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Kingsoft-LLM/QZhou-Embedding on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Kingsoft-LLM/QZhou-Embedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Kingsoft-LLM/QZhou-Embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Kingsoft-LLM/QZhou-Embedding", trust_remote_code=True) sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Upload README_zh.md with huggingface_hub
Browse files45 unmodified lines464748495051525354555657585960616263646566676869707172737445 unmodified lines### 训练目标- 检索:使用InfoNCE对比学习loss函数,效仿gte/qwen3-embedding的改进增加q-q对负样例惩罚<br>$$L_{ret}=-\frac{1}{n}\sum_{i} log{\frac{e^{sim(q_i,d_i^+)/\tau}}{e^{sim(q_i,d_i^+)/\tau}+\sum_{j}e^{sim(q_i,d_j^-)/\tau}+\sum_{j≠i}e^{sim(q_i,q_j)/\tau}}}$$- STS:使用Cosent loss:$$L_{cosent}=log \bigg(1+\sum_{sim(i,j)>sim(k,l)}exp(\frac{sim(x_k, x_l)-sim(x_i,x_j)}{\tau})\bigg)$$- CLS:同检索一致使用InfoNCE loss,但In-Batch Negative时由于同类冲突概率大,使用mask机制掩盖不同样本共享的负样例中的同类样本。$$L_{ret}=-\frac{1}{n}\sum_{i} log{\frac{e^{sim(t_i,t_i^+)/\tau}}{e^{sim(t_i,t_i^+)/\tau}+\sum_{n}MASK(t_i,t_{i,n}^-)·e^{sim(t_i,t_{i,n}^-)/\tau}+\sum_{j≠i}MASK(t_i,t_j)·e^{sim(t_i,t_j)/\tau}+\sum_{j≠i}\sum_{n}MASK(t_i,t_{j,n}^-)e^{sim(t_i,t_{j,n}^-)/\tau}}}$$$$其中C_{t_i}=C_{t_i^+}$$$$MASK(t_i, t_j)=\begin{cases}0 & \quad \text{if } C_{t_i}=C_{t_j}, \\1 & \quad \text{otherwise}\end{cases}$$其中${C_{t_i}}$表示样本${t_i}$的类标签,n是单条数据的负样本数。### 特征增强数据合成技术45 unmodified lines4647484950515253545556575845 unmodified lines### 训练目标- 检索:使用InfoNCE对比学习loss函数,效仿gte/qwen3-embedding的改进增加q-q对负样例惩罚<br><div align="center"><img src="assets/formula1.png" width="700" height="110"></img></div>- STS:使用Cosent loss:<div align="center"><img src="assets/formula2.png" width="700" height="110"></img></div>- CLS:同检索一致使用InfoNCE loss,但In-Batch Negative时由于同类冲突概率大,使用mask机制掩盖不同样本共享的负样例中的同类样本。<div align="center"><img src="assets/formula3.png" width="1100" height="180"></img></div>其中${C_{t_i}}$表示样本${t_i}$的类标签,n是单条数据的负样本数。### 特征增强数据合成技术
README_zh.md+3-19