Safetensors
English
modernbert
router
classification
reasoning-router-v1 / README.md
AmirMohseni's picture
Update README.md
69262b8 verified
|
Raw
History Blame Contribute Delete
2.93 kB
---
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}}
}
```