Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- Qwen/Qwen3-Embedding-4B
|
| 7 |
+
library_name: sentence-transformers
|
| 8 |
+
---
|
| 9 |
+
## Description
|
| 10 |
+
This is one [CSRv2](https://arxiv.org/abs/2602.05735) model finetuned on [MTEB](https://huggingface.co/mteb)
|
| 11 |
+
reranking datasets with [Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B) as backbone.
|
| 12 |
+
|
| 13 |
+
For more details, including benchmark evaluation, hardware requirements, and inference performance, please
|
| 14 |
+
refer to our [Github](https://github.com/Y-Research-SBU/CSRv2).
|
| 15 |
+
|
| 16 |
+
## Sentence Transformer Usage
|
| 17 |
+
You can evaluate this model loaded by Sentence Transformers with the following code snippet (take SciDocsRR as one example):
|
| 18 |
+
```python
|
| 19 |
+
import mteb
|
| 20 |
+
from sentence_transformers import SparseEncoder
|
| 21 |
+
model = SparseEncoder(
|
| 22 |
+
"Y-Research-Group/CSRv2-reranking",
|
| 23 |
+
trust_remote_code=True
|
| 24 |
+
)
|
| 25 |
+
model.prompts = {
|
| 26 |
+
"SciDocsRR": "Instruct: Given a title of a scientific paper, retrieve the titles of other relevant papers\n Query:"
|
| 27 |
+
}
|
| 28 |
+
task = mteb.get_tasks(tasks=["SciDocsRR"])
|
| 29 |
+
evaluation = mteb.MTEB(tasks=task)
|
| 30 |
+
evaluation.run(
|
| 31 |
+
model,
|
| 32 |
+
eval_splits=["test"],
|
| 33 |
+
output_folder="./results/SciDocsRR",
|
| 34 |
+
show_progress_bar=True
|
| 35 |
+
encode_kwargs={"convert_to_sparse_tensor": False, "batch_size": 8}
|
| 36 |
+
) # MTEB don't support sparse tensors yet, so we need to convert to dense tensors
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
It is suggested that you use our [default prompts](https://github.com/Y-Research-SBU/CSRv2/blob/main/text/dataset_to_prompt.json)
|
| 40 |
+
in evaluation.
|
| 41 |
+
|
| 42 |
+
## Multi-TopK Support
|
| 43 |
+
|
| 44 |
+
Our model supports different sparsity levels due to the utilization of **Multi-TopK** loss in training.
|
| 45 |
+
You can change sparsity model by adjusting the `k` parameter` in the file `3_SparseAutoEncoder/config.json`.
|
| 46 |
+
We set sparsity level to 2 by default.
|
| 47 |
+
|
| 48 |
+
For instance, if you want to evaluate with sparsity level $K=8$ (which means there are 8 activated neurons in
|
| 49 |
+
each embedding vector), the `3_SparseAutoEncoder/config.json` should look like this:
|
| 50 |
+
|
| 51 |
+
```json
|
| 52 |
+
{
|
| 53 |
+
"input_dim": 2560,
|
| 54 |
+
"hidden_dim": 10240,
|
| 55 |
+
"k": 8,
|
| 56 |
+
"k_aux": 1024,
|
| 57 |
+
"normalize": false,
|
| 58 |
+
"dead_threshold": 30
|
| 59 |
+
}
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## CSRv2 Qwen Series
|
| 63 |
+
We will release a series of [CSRv2](https://arxiv.org/abs/2602.05735) models finetuned on common tasks in
|
| 64 |
+
[MTEB](https://huggingface.co/mteb) with [Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B)
|
| 65 |
+
as backbone. These tasks are:
|
| 66 |
+
|
| 67 |
+
- **[Classification](https://huggingface.co/Y-Research-Group/CSRv2-classification)**
|
| 68 |
+
- **[Clustering](https://huggingface.co/Y-Research-Group/CSRv2-clustering)**
|
| 69 |
+
- **[Retrieval](https://huggingface.co/Y-Research-Group/CSRv2-retrieval)**
|
| 70 |
+
- **[STS](https://huggingface.co/Y-Research-Group/CSRv2-sts)**
|
| 71 |
+
- **[Pair_classification](https://huggingface.co/Y-Research-Group/CSRv2-pair_classification)**
|
| 72 |
+
- **[Reranking](https://huggingface.co/Y-Research-Group/CSRv2-reranking)**
|
| 73 |
+
|
| 74 |
+
## Citation
|
| 75 |
+
```bibtex
|
| 76 |
+
@inproceedings{guo2026csrv2,
|
| 77 |
+
title={{CSR}v2: Unlocking Ultra-sparse Embeddings},
|
| 78 |
+
author={Guo, Lixuan and Wang, Yifei and Wen, Tiansheng and Wang, Yifan and Feng, Aosong and Chen, Bo and Jegelka, Stefanie and You, Chenyu},
|
| 79 |
+
booktitle={International Conference on Learning Representations (ICLR)},
|
| 80 |
+
year={2026}
|
| 81 |
+
}
|
| 82 |
+
```
|