Back to models
Model Intelligence FileOpen source

cross-encoder/ms-marco-MiniLM-L6-v2 · Hugging Face

The cross-encoder/ms-marco-MiniLM-L6-v2 is a cross-encoder model for text ranking, fine-tuned on the MS MARCO passage ranking dataset. Based on MiniLM with 6 layers, it balances efficiency and accuracy, with over 79.9 million downloads on Hugging Face. It outputs relevance scores for query-passage pairs and supports multiple frameworks including PyTorch, JAX, ONNX, SafeTensors, and OpenVINO. Licensed under Apache-2.0, it is widely used for search re-ranking, question answering, and information retrieval.

Depth
896

word-level signal

Categories
1

topic cluster links

Index status
Live

Jun 26, 2026

Deep Brief

Overview and use cases

Overview

The cross-encoder/ms-marco-MiniLM-L6-v2 model is a cross-encoder designed for text ranking, specifically fine-tuned on the MS MARCO passage ranking dataset. It is based on the MiniLM architecture with 6 layers, offering a balance between efficiency and accuracy. The model is available on Hugging Face under the identifier cross-encoder/ms-marco-MiniLM-L6-v2 and has accumulated over 79.9 million downloads, indicating its widespread adoption in the NLP community. The model card is hosted at Hugging Face.

Capabilities

This model excels at re-ranking passages given a query. It takes a query and a passage as input and outputs a relevance score. Key capabilities include:

  • Text Ranking: Assigns a score (logit) indicating the relevance of a passage to a query. In the example from the model card, scores like 8.6 and -4.3 are produced, where higher positive values indicate higher relevance.
  • Cross-Encoder Architecture: Unlike bi-encoders, cross-encoders jointly encode the query and passage, leading to higher accuracy at the cost of slower inference. This makes it suitable for second-stage re-ranking where a smaller set of candidates is scored.
  • Multi-Framework Support: Available in PyTorch, JAX, ONNX, SafeTensors, and OpenVINO formats, enabling deployment across various environments. The model card lists these formats under the model tags.
  • Integration with Sentence-Transformers: Can be used with the sentence-transformers library for easy integration into existing pipelines. The CrossEncoder class provides a simple API for scoring pairs.
  • Integration with Transformers: Can be loaded directly using AutoModelForSequenceClassification from the transformers library, allowing custom inference pipelines.

Use cases

  • Search Engine Re-Ranking: As a second-stage re-ranker to improve the relevance of initial search results from a bi-encoder or BM25. The model card explicitly mentions usage with ElasticSearch for retrieval and re-ranking.
  • Question Answering: Ranking candidate passages for extractive QA systems. The example in the model card uses a query about Berlin's population.
  • Information Retrieval: Enhancing retrieval pipelines in domains like legal, medical, or enterprise search. The model is trained on MS MARCO, which is a general-domain passage ranking dataset.
  • Research: Benchmarking cross-encoder performance on ranking tasks. The model is a popular baseline for re-ranking experiments.

License & deployment

The model is released under the Apache-2.0 license, as indicated on the Hugging Face model page. This allows for commercial and non-commercial use with attribution. Deployment options include:

  • Hugging Face Transformers: Directly load the model using AutoModelForSequenceClassification and AutoTokenizer. Example code is provided in the model card.
  • Sentence-Transformers: Use the CrossEncoder class for easy inference. This is the recommended approach for most users.
  • ONNX Runtime: Optimize for production with ONNX format. The model is available in ONNX format on Hugging Face.
  • OpenVINO: Deploy on Intel hardware for accelerated inference. The model card includes OpenVINO as a supported format.
  • Inference Providers: The model can be deployed via Hugging Face Inference Endpoints or other cloud services.

Hardware considerations: The model is relatively small (6 layers) and can run on CPU, but GPU acceleration is recommended for production workloads. The exact memory footprint is not specified in the source, but typical MiniLM-L6 models require around 200-300 MB of RAM.

Alternatives

  • ms-marco-MiniLM-L12-v2: A larger 12-layer version for higher accuracy, also available on Hugging Face.
  • ms-marco-TinyBERT-L2-v2: A smaller, faster model for resource-constrained environments.
  • Cohere rerank: Proprietary API-based re-ranking model.
  • ColBERT: Late interaction model that balances efficiency and accuracy, often used as an alternative to cross-encoders.
  • Other cross-encoders: Models like cross-encoder/stsb-roberta-large for semantic textual similarity, or domain-specific variants.

FAQ

Q: What is the difference between a cross-encoder and a bi-encoder? A: A cross-encoder processes the query and passage together as a single input, allowing full interaction between tokens, which leads to higher accuracy but slower inference. A bi-encoder encodes query and passage separately into vectors and uses cosine similarity, which is faster but less accurate. Cross-encoders are typically used for re-ranking a small set of candidates.

Q: What is the output range of the scores? A: The model outputs raw logits (not normalized between 0 and 1). In the example, scores like 8.6 and -4.3 are produced. For ranking, the relative order matters more than the absolute values. To obtain probabilities, one can apply a sigmoid function.

Q: Can this model be used for zero-shot classification? A: While primarily designed for ranking, it can be adapted for classification by treating class labels as passages. However, it is not optimized for that task.

Q: What is the training data? A: The model was fine-tuned on the MS MARCO Passage Ranking dataset, which consists of over 8.8 million passages and 1 million queries from Bing search logs.

Q: Is the model available in other languages? A: The model is trained on English data only. For multilingual ranking, consider models like cross-encoder/mmarco-mMiniLMv2-L6-H384.

Q: How to deploy with ONNX? A: The model is available in ONNX format on Hugging Face. You can load it using onnxruntime and run inference. The model card does not provide specific ONNX deployment code, but the ONNX file can be downloaded from the model repository.

Q: What are the safety considerations? A: The model may reflect biases present in the training data (MS MARCO). Users should evaluate for fairness and potential harmful outputs in their specific use case. No explicit safety evaluation is provided in the source.

Keep Exploring

Related AI models

Model library

lpiccinelli

lpiccinelli/unidepth-v2-vitl14 · Hugging Face

UniDepth v2 (ViT-L/14) is a 0.4B-parameter PyTorch model for monocular metric depth estimation, leveraging a Vision Transformer backbone to predict scale-aware depth maps from single RGB images.

Open sourceUniDepth

Qwen

Qwen/Qwen3-8B · Hugging Face

Qwen/Qwen3-8B is an 8-billion parameter large language model developed by Alibaba Cloud's Qwen team, available on Hugging Face under the Apache 2.0 license. It is designed for advanced text generation, conversational AI, and complex reasoning tasks, featuring support for tool use and long-context understanding.

Open sourcetransformers

google-t5

google-t5/t5-small · Hugging Face

T5-small is a compact, multilingual encoder-decoder transformer model developed by Google and hosted on Hugging Face. Licensed under Apache 2.0, it supports text-to-text generation tasks such as translation, summarization, and question answering across multiple languages including English, French, German, and Romanian. It is optimized for low-latency inference and efficient deployment on various hardware backends.

Open sourcetransformers

Qwen

Qwen/Qwen3-0.6B · Hugging Face

Qwen/Qwen3-0.6B is a lightweight, open-source large language model developed by Alibaba Cloud's Qwen team. Released under the permissive Apache 2.0 license, this 0.6-billion-parameter model is designed for high-efficiency deployment on consumer-grade hardware, including CPUs and low-end GPUs. It features a 32,768-token context window, multilingual capabilities, and native support for tool-use and function calling, making it an ideal candidate for edge computing, real-time chatbots, and resource-constrained environments.

Open sourcetransformers

Ollama

llava

LLaVA (Large Language and Vision Assistant) is an open-source, end-to-end trained multimodal model that combines a vision encoder with a large language model (Vicuna) to enable visual understanding and reasoning. Developed by researchers from Microsoft, the University of Wisconsin-Madison, and Columbia University, LLaVA allows users to interact with images through natural language, supporting tasks such as visual question answering, image captioning, and complex visual reasoning. The latest iteration, LLaVA 1.6, introduces significant improvements in input resolution, visual instruction tuning, and logical reasoning capabilities. It is widely accessible for local deployment via Ollama, offering privacy, offline functionality, and flexible hardware requirements across various model sizes.

Open source

BAAI

BAAI/bge-small-en-v1.5 · Hugging Face

BAAI/bge-small-en-v1.5 is a lightweight, high-performance sentence embedding model developed by the Beijing Academy of Artificial Intelligence (BAAI). Based on the BERT architecture with approximately 33 million parameters, it generates 384-dimensional vector representations optimized for English text. It is widely used for semantic search, retrieval-augmented generation (RAG), and clustering tasks, offering a balance between computational efficiency and accuracy under the permissive MIT License.

Open sourcesentence-transformers

Site Discovery

Keep exploring ToolSeekAI

Move from model intelligence into tools, news, and rankings for a stronger AI decision path.