File size: 5,700 Bytes
061e977 b219af9 061e977 b219af9 061e977 b219af9 061e977 b219af9 061e977 b219af9 061e977 b219af9 061e977 b219af9 061e977 b219af9 061e977 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
---
language: en
library_name: sentence-transformers
license: mit
pipeline_tag: sentence-similarity
tags:
- cross-encoder
- regression
- trail-rag
- pathfinder-rag
- msmarco
- passage-ranking
- sentence-transformers
model-index:
- name: trailrag-cross-encoder-msmarco-enhanced
results:
- task:
type: text-ranking
dataset:
name: MS MARCO
type: msmarco
metrics:
- type: mse
value: 0.0423588519082496
- type: mae
value: 0.1121706619454281
- type: rmse
value: 0.2058126621669562
- type: r2_score
value: 0.7490766636371498
- type: pearson_correlation
value: 0.9093360796297332
- type: spearman_correlation
value: 0.8886928996060736
---
# TrailRAG Cross-Encoder: MS MARCO Enhanced
This is a fine-tuned cross-encoder model specifically optimized for **Passage Ranking** tasks, trained as part of the PathfinderRAG research project.
## Model Details
- **Model Type**: Cross-Encoder for Regression (continuous similarity scores)
- **Base Model**: `cross-encoder/ms-marco-MiniLM-L-6-v2`
- **Training Dataset**: MS MARCO (Large-scale passage ranking dataset from Microsoft)
- **Task**: Passage Ranking
- **Library**: sentence-transformers
- **License**: MIT
## Performance Metrics
### Final Regression Metrics
| Metric | Value | Description |
|--------|-------|-------------|
| **MSE** | **0.042359** | Mean Squared Error (lower is better) |
| **MAE** | **0.112171** | Mean Absolute Error (lower is better) |
| **RMSE** | **0.205813** | Root Mean Squared Error (lower is better) |
| **R² Score** | **0.749077** | Coefficient of determination (higher is better) |
| **Pearson Correlation** | **0.909336** | Linear correlation (higher is better) |
| **Spearman Correlation** | **0.888693** | Rank correlation (higher is better) |
### Training Details
- **Training Duration**: 21 minutes
- **Epochs**: 6
- **Early Stopping**: No
- **Best Correlation Score**: 0.944649
- **Final MSE**: 0.042359
### Training Configuration
- **Batch Size**: 20
- **Learning Rate**: 3e-05
- **Max Epochs**: 6
- **Weight Decay**: 0.01
- **Warmup Steps**: 100
## Usage
This model can be used with the sentence-transformers library for computing semantic similarity scores between query-document pairs.
### Installation
```bash
pip install sentence-transformers
```
### Basic Usage
```python
from sentence_transformers import CrossEncoder
# Load the model
model = CrossEncoder('OloriBern/trailrag-cross-encoder-msmarco-enhanced')
# Example usage
pairs = [
['What is artificial intelligence?', 'AI is a field of computer science focused on creating intelligent machines.'],
['What is artificial intelligence?', 'Paris is the capital of France.']
]
# Get similarity scores (continuous values, not binary)
scores = model.predict(pairs)
print(scores) # Higher scores indicate better semantic match
```
### Advanced Usage in PathfinderRAG
```python
from sentence_transformers import CrossEncoder
# Initialize for PathfinderRAG exploration
cross_encoder = CrossEncoder('OloriBern/trailrag-cross-encoder-msmarco-enhanced')
def score_query_document_pair(query: str, document: str) -> float:
"""Score a query-document pair for relevance."""
score = cross_encoder.predict([[query, document]])[0]
return float(score)
# Use in document exploration
query = "Your research query"
documents = ["Document 1 text", "Document 2 text", ...]
# Score all pairs
scores = cross_encoder.predict([[query, doc] for doc in documents])
ranked_docs = sorted(zip(documents, scores), key=lambda x: x[1], reverse=True)
```
## Training Process
This model was trained using **regression metrics** (not classification) to predict continuous similarity scores in the range [0, 1]. The training process focused on:
1. **Data Quality**: Used authentic MS MARCO examples with careful contamination filtering
2. **Regression Approach**: Avoided binary classification, maintaining continuous label distribution
3. **Correlation Optimization**: Maximized Spearman correlation for effective ranking
4. **Scientific Rigor**: All metrics derived from real training runs without simulation
### Why Regression Over Classification?
Cross-encoders for information retrieval should predict **continuous similarity scores**, not binary classifications. This approach:
- Preserves fine-grained similarity distinctions
- Enables better ranking and document selection
- Provides more informative scores for downstream applications
- Aligns with the mathematical foundation of information retrieval
## Dataset
**MS MARCO**: Large-scale passage ranking dataset from Microsoft
- **Task Type**: Passage Ranking
- **Training Examples**: 1,000 high-quality pairs
- **Validation Split**: 20% (200 examples)
- **Quality Threshold**: ≥0.70 (authentic TrailRAG metrics)
- **Contamination**: Zero overlap between splits
## Limitations
- Optimized specifically for passage ranking tasks
- Performance may vary on out-of-domain data
- Requires sentence-transformers library for inference
- CPU-based training (GPU optimization available for future versions)
## Citation
```bibtex
@misc{trailrag-cross-encoder-msmarco,
title = {TrailRAG Cross-Encoder: MS MARCO Enhanced},
author = {PathfinderRAG Team},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/OloriBern/trailrag-cross-encoder-msmarco-enhanced}
}
```
## Model Card Contact
For questions about this model, please open an issue in the [PathfinderRAG repository](https://github.com/your-org/trail-rag-1) or contact the development team.
---
*This model card was automatically generated using the TrailRAG model card generator with authentic training metrics.* |