# Model Card: sigridjineth/ko-reranker-v1.1-preview **Note: This is a preview release.** The model is currently under development and may undergo further changes as we refine and improve its performance. ## Training Data This model is trained on [sigridjineth/korean_nli_dataset_reranker_v0](https://huggingface.co/datasets/sigridjineth/korean_nli_dataset_reranker_v0), which aggregates several publicly available datasets, ensuring rich linguistic diversity: - **kor_nli (train)**: [https://huggingface.co/datasets/kor_nli](https://huggingface.co/datasets/kor_nli) - **mnli_ko (train)**: [https://huggingface.co/datasets/kozistr/mnli_ko](https://huggingface.co/datasets/kozistr/mnli_ko) - **ko-wiki-reranking (train)**: [https://huggingface.co/datasets/upskyy/ko-wiki-reranking](https://huggingface.co/datasets/upskyy/ko-wiki-reranking) - **mr_tydi_korean (train)**: [https://huggingface.co/datasets/castorini/mr-tydi](https://huggingface.co/datasets/castorini/mr-tydi) - **klue_nli (train)**: [https://huggingface.co/datasets/klue/klue](https://huggingface.co/datasets/klue/klue) These combined resources ensure coverage across a wide range of topics, styles, and complexities in Korean language data, enabling the model to capture nuanced semantic differences. ## Key Features - **Hard Negative Mining**: Integrated [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3) to mine challenging negatives. This approach sharpens the model’s ability to distinguish subtle contrasts, boosting robustness and improving ranking quality. - **Teacher-Student Distillation**: Leveraged [BAAI/bge-reranker-v2.5-gemma2-lightweight](https://huggingface.co/BAAI/bge-reranker-v2.5-gemma2-lightweight) as a teacher model. The student reranker learned from teacher-provided positive/negative scores, accelerating convergence and achieving better final performance. ## Intended Use - **Search & Information Retrieval**: Improve document ranking for Korean-language search queries. - **Question Answering (QA)**: Enhance QA pipelines by reordering candidate answers for improved relevance. - **Content Recommendation**: Refine recommendation engines that rely on textual signals to deliver more accurate suggestions. ## Limitations & Future Work - **Preview Release**: The model is still in the refinement phase. Expect future updates to improve stability, generalization, and performance. - **Need for Evaluation**: Developing and standardizing benchmarks for generalized Korean retrieval tasks (especially for rerankers) will be an ongoing effort. ## Usage (transformers>=4.36.0) ```python import torch from transformers import AutoModelForSequenceClassification, AutoTokenizer model_name_or_path = "Alibaba-NLP/gte-multilingual-reranker-base" tokenizer = AutoTokenizer.from_pretrained(model_name_or_path) model = AutoModelForSequenceClassification.from_pretrained( model_name_or_path, trust_remote_code=True, torch_dtype=torch.float16 ) model.eval() pairs = [ ["中国的首都在哪儿","北京"], ["what is the capital of China?", "北京"], ["how to implement quick sort in python?","Introduction of quick sort"] ] with torch.no_grad(): inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512) scores = model(**inputs, return_dict=True).logits.view(-1, ).float() print(scores) # Example output: # tensor([1.2315, 0.5923, 0.3041]) ``` ## Usage with Infinity [Infinity](https://github.com/michaelfeil/infinity) is an MIT-licensed inference REST API server that can easily host and serve models. For instance: ```bash docker run --gpus all -v $PWD/data:/app/.cache -p "7997":"7997" \ michaelf34/infinity:0.0.68 \ v2 --model-id Alibaba-NLP/gte-multilingual-reranker-base --revision "main" \ --dtype bfloat16 --batch-size 32 --device cuda --engine torch --port 7997 ``` ## References ``` @misc{zhang2024mgtegeneralizedlongcontexttext, title={mGTE: Generalized Long-Context Text Representation and Reranking Models for Multilingual Text Retrieval}, author={Xin Zhang and Yanzhao Zhang and Dingkun Long and Wen Xie and Ziqi Dai and Jialong Tang and Huan Lin and Baosong Yang and Pengjun Xie and Fei Huang and Meishan Zhang and Wenjie Li and Min Zhang}, year={2024}, eprint={2407.19669}, archivePrefix={arXiv}, primaryClass={cs.CL}, url={https://arxiv.org/abs/2407.19669}, } @misc{li2023making, title={Making Large Language Models A Better Foundation For Dense Retrieval}, author={Chaofan Li and Zheng Liu and Shitao Xiao and Yingxia Shao}, year={2023}, eprint={2312.15503}, archivePrefix={arXiv}, primaryClass={cs.CL} } @misc{chen2024bge, title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation}, author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian and Zheng Liu}, year={2024}, eprint={2402.03216}, archivePrefix={arXiv}, primaryClass={cs.CL} } ```