File size: 1,988 Bytes
12417a0
caf1092
 
 
 
 
 
 
 
 
 
 
 
12417a0
 
 
caf1092
12417a0
caf1092
12417a0
caf1092
12417a0
caf1092
 
 
12417a0
caf1092
12417a0
caf1092
12417a0
caf1092
12417a0
caf1092
 
 
12417a0
caf1092
 
 
 
12417a0
caf1092
 
12417a0
caf1092
 
 
 
 
12417a0
caf1092
 
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
---
license: mit
language:
- en
tags:
- text-classification
- deberta-v3
- prompt-routing
- llm
- onnx
metrics:
- accuracy
- f1
library_name: transformers
---

# DeBERTa-v3-base Prompt Complexity Classifier

A high-performance, lightweight prompt complexity classifier built by fine-tuning `microsoft/deberta-v3-base`. This model categorizes incoming user queries into **3 distinct complexity tiers** to power intelligent prompt routing, optimizing latency and cost in custom AI gateways.

## 📊 Complexity Tiers

* **`TIER_0` (Low Complexity)**: Simple direct lookups, basic factual queries, typos corrections, or short conversational greetings. (Routed to fast, lightweight models).
* **`TIER_1` (Medium Complexity)**: Standard coding tasks, boilerplate generation, scoped bug fixes, or moderate multi-step reasoning. (Routed to balanced mid-tier models).
* **`TIER_2` (High Complexity)**: Advanced software architecture design, deep multi-file debugging, heavy concurrent systems analysis, or complex agentic planning. (Routed to frontier models).

---

## 🚀 Quick Start (Python)

You can easily load and use this model for inference using the Hugging Face `transformers` library:

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

# Load model and tokenizer
model_id = "rohitMukhi/deberta-v3-prompt-complexity-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)

# Test prompt
prompt = "Design a multi-tenant microservices architecture with Redis clustering and strict database isolation."

# Tokenize and predict
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
    logits = model(**inputs).logits
    predicted_class = torch.argmax(logits, dim=1).item()

tier_labels = {0: "TIER_0 (Low)", 1: "TIER_1 (Medium)", 2: "TIER_2 (High)"}
print(f"Predicted Complexity: {tier_labels[predicted_class]}")