Safetensors
English
modernbert
router
classification
File size: 2,925 Bytes
69262b8
 
 
 
 
 
 
 
 
 
 
 
 
 
1196280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69262b8
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
---
license: mit
datasets:
- AmirMohseni/Nectar-filtered
- AmirMohseni/Nectar-Qwen3-8B
- AmirMohseni/qwen-router-mixture-v1
language:
- en
base_model:
- answerdotai/ModernBERT-large
tags:
- router
- classification
---
# Reasoning Router v1

**Model Name:** `AmirMohseni/reasoning-router-v1`  
**Base Model:** [`answerdotai/ModernBERT-large`](https://huggingface.co/answerdotai/ModernBERT-large) (396M parameters)  
**Task:** Binary classification β€” decide whether to use **reasoning mode** for a given text prompt.  

## πŸ“Œ Overview
This model routes incoming prompts to one of two categories:
- **`no_think`** – Reasoning mode should **not** be used (fast, fewer tokens, lower cost).
- **`think`** – Reasoning mode **should** be used (slower, more tokens, potentially higher accuracy).

It is designed to help reduce unnecessary reasoning calls in large language model pipelines, saving computation and cost while maintaining quality.

---

## πŸš€ Usage

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

# Load model and tokenizer
model_name = "AmirMohseni/reasoning-router-v1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

# Inference function
def classify_text(text):
    # Tokenize input
    inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)

    # Get logits
    with torch.no_grad():
        outputs = model(**inputs)

    logits = outputs.logits
    predicted_class_id = logits.argmax(dim=-1).item()
    predicted_label = model.config.id2label[predicted_class_id]

    return predicted_label, logits.squeeze().tolist()

# Example usage
label, logits = classify_text("This is an example input.")
print("Predicted label:", label)
print("Logits:", logits)
```

---

## 🏷 Labels
| Label     | Meaning |
|-----------|---------|
| `no_think` | Reasoning mode should not be used. |
| `think`    | Reasoning mode should be used. |

---

## πŸ“„ Model Details
- **Base Model:** `answerdotai/ModernBERT-large` β€” a 396M parameter encoder model optimized for classification.
- **Training Objective:** Supervised fine-tuning for binary routing classification.
- **Intended Use:** As part of an LLM routing system to decide whether to enable reasoning mode for a query.
- **Languages:** English (primary).

---

## ⚠️ Limitations & Bias
- The model is trained primarily on English data β€” performance may degrade on other languages.
- Predictions are probabilistic; borderline cases may require human validation in high-stakes use cases.
- May reflect biases present in the training data.

---

## πŸ“š Citation
If you use this model, please cite:
```bibtex
@misc{mohseni2025reasoningrouterv1,
    title={Reasoning Router v1},
    author={Amir Mohseni},
    year={2025},
    howpublished={\url{https://huggingface.co/AmirMohseni/reasoning-router-v1}}
}
```