Update model card
Browse files
README.md
CHANGED
|
@@ -9,6 +9,7 @@ tags:
|
|
| 9 |
- query-complexity
|
| 10 |
- knowledge-distillation
|
| 11 |
- research-computing
|
|
|
|
| 12 |
pipeline_tag: text-classification
|
| 13 |
---
|
| 14 |
|
|
@@ -16,7 +17,9 @@ pipeline_tag: text-classification
|
|
| 16 |
|
| 17 |
Fine-tuned [ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) (149M parameters) for three-class query complexity classification: **LOW**, **MEDIUM**, or **HIGH**.
|
| 18 |
|
| 19 |
-
Built for the [STREAM](https://github.com/uicacer/STREAM) project (Smart Tiered Routing Engine for AI Models) to route queries automatically to the most cost-effective inference tier — local CPU, HPC GPU, or cloud API — at ~
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## What It Does
|
| 22 |
|
|
@@ -51,9 +54,11 @@ complexity = max(result[0], key=lambda x: x["score"])["label"]
|
|
| 51 |
|
| 52 |
## Training
|
| 53 |
|
| 54 |
-
**Knowledge distillation approach**: Claude Sonnet 4.6
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
**
|
| 57 |
|
| 58 |
**Hyperparameters**:
|
| 59 |
|
|
@@ -70,26 +75,41 @@ complexity = max(result[0], key=lambda x: x["score"])["label"]
|
|
| 70 |
|
| 71 |
## Evaluation
|
| 72 |
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|----------|-------------|
|
| 77 |
-
| **Domain-held-out 6-fold CV** | Train on 5 domains, test on 6th. Primary reported metric. |
|
| 78 |
-
| **Similarity-aware split** | Near-duplicate queries (cosine sim > 0.90) kept on same side of split. |
|
| 79 |
-
| **Real-world (LMSYS Arena)** | Evaluated on real user prompts from Chatbot Arena — fully out-of-distribution. |
|
| 80 |
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|-------|--------------|-------|
|
| 89 |
-
| ModernBERT (this model) | ~15ms | CPU, no API dependency |
|
| 90 |
-
| Llama 3.2 3B (LLM judge) | ~390ms | Requires Ollama |
|
| 91 |
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
## Integration in STREAM
|
| 95 |
|
|
@@ -108,7 +128,48 @@ result = judge_complexity("Explain quantum entanglement", strategy="modernbert")
|
|
| 108 |
title = {{STREAM}: Multi-Tier {LLM} Inference Middleware with Dual-Channel {HPC} Token Streaming},
|
| 109 |
author = {Nassar, Anas and Mohr, Steve and Apanasevich, Leonard and Sharma, Himanshu},
|
| 110 |
booktitle = {Practice and Experience in Advanced Research Computing (PEARC '26)},
|
| 111 |
-
year = {2026}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
}
|
| 113 |
```
|
| 114 |
|
|
|
|
| 9 |
- query-complexity
|
| 10 |
- knowledge-distillation
|
| 11 |
- research-computing
|
| 12 |
+
- hpc
|
| 13 |
pipeline_tag: text-classification
|
| 14 |
---
|
| 15 |
|
|
|
|
| 17 |
|
| 18 |
Fine-tuned [ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) (149M parameters) for three-class query complexity classification: **LOW**, **MEDIUM**, or **HIGH**.
|
| 19 |
|
| 20 |
+
Built for the [STREAM](https://github.com/uicacer/STREAM) project (Smart Tiered Routing Engine for AI Models) to route queries automatically to the most cost-effective inference tier — local CPU, HPC GPU, or cloud API — at ~32 ms per query (CPU p50) with no API dependency.
|
| 21 |
+
|
| 22 |
+
Covers **10 domains** representing the full breadth of a research university population: hpc, mathematics, statistics_ml, physics_chemistry, engineering, life_sciences, cs_software, philosophy_ethics, social_sciences, and history_culture.
|
| 23 |
|
| 24 |
## What It Does
|
| 25 |
|
|
|
|
| 54 |
|
| 55 |
## Training
|
| 56 |
|
| 57 |
+
**Knowledge distillation approach**: Claude Sonnet 4.6 labeled 6,000 queries using a reasoning-depth rubric. ModernBERT-base was fine-tuned on those labels. The result runs at ~32 ms per query (CPU p50) with no API dependency — a 5× latency reduction vs. the LLM judge baseline.
|
| 58 |
+
|
| 59 |
+
**Training dataset**: [anasnassar/llm-query-complexity-benchmark](https://huggingface.co/datasets/anasnassar/llm-query-complexity-benchmark) — 6,000 doubly balanced queries across 10 domains × 3 complexity classes (200/domain/class hard cap; 4,800 train / 1,200 test, 80/20 stratified split, seed=42).
|
| 60 |
|
| 61 |
+
**Sources**: Derived from [sentence-transformers/stackexchange-duplicates](https://huggingface.co/datasets/sentence-transformers/stackexchange-duplicates) (Apache 2.0), [cais/mmlu](https://huggingface.co/datasets/cais/mmlu) (MIT), [TIGER-Lab/MMLU-Pro](https://huggingface.co/datasets/TIGER-Lab/MMLU-Pro) (MIT), and [qiaojin/PubMedQA](https://huggingface.co/datasets/qiaojin/PubMedQA) (MIT).
|
| 62 |
|
| 63 |
**Hyperparameters**:
|
| 64 |
|
|
|
|
| 75 |
|
| 76 |
## Evaluation
|
| 77 |
|
| 78 |
+
Evaluated on a fixed 750-query held-out test set (250/class), stratified split, seed=42.
|
| 79 |
+
|
| 80 |
+
| Metric | Value |
|
| 81 |
+
|--------|-------|
|
| 82 |
+
| Accuracy | 64.2% |
|
| 83 |
+
| Macro-F1 | 0.640 |
|
| 84 |
+
| FREE-tier retention | 85.4% |
|
| 85 |
+
| Latency p50 (CPU) | 32 ms |
|
| 86 |
|
| 87 |
+
**Per-class recall (Wilson 95% CI):**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
| Class | Recall | 95% CI |
|
| 90 |
+
|-------|--------|--------|
|
| 91 |
+
| LOW | 70.8% | [66.1%, 75.0%] |
|
| 92 |
+
| MEDIUM | 49.3% | [44.4%, 54.1%] |
|
| 93 |
+
| HIGH | 72.5% | [67.9%, 76.7%] |
|
| 94 |
|
| 95 |
+
## Judge Comparison
|
| 96 |
|
| 97 |
+
| Judge | Latency p50 | Accuracy | Macro-F1 | API dependency |
|
| 98 |
+
|-------|-------------|----------|----------|----------------|
|
| 99 |
+
| ModernBERT (this model) | 32 ms | 64.2% | 0.640 | None |
|
| 100 |
+
| Llama 3.2 3B (LLM judge) | 164 ms | 49.0% | 0.436 | Ollama |
|
| 101 |
|
| 102 |
+
## Threshold-Tunable Routing
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
Rather than a fixed argmax decision, STREAM exposes a tunable threshold θ ∈ [0,1]. A query is routed to cloud when `P(HIGH) ≥ θ`; otherwise to HPC or local. As θ increases, cloud spend drops but HIGH recall decreases — a continuous precision-recall-cost tradeoff.
|
| 105 |
+
|
| 106 |
+
**Budget-aware adaptive routing** automatically raises θ as cloud spend approaches the monthly budget cap:
|
| 107 |
+
|
| 108 |
+
```
|
| 109 |
+
θ_eff(t) = max(θ_base, S(t)/B)
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
where S(t) is cumulative spend and B is the monthly budget.
|
| 113 |
|
| 114 |
## Integration in STREAM
|
| 115 |
|
|
|
|
| 128 |
title = {{STREAM}: Multi-Tier {LLM} Inference Middleware with Dual-Channel {HPC} Token Streaming},
|
| 129 |
author = {Nassar, Anas and Mohr, Steve and Apanasevich, Leonard and Sharma, Himanshu},
|
| 130 |
booktitle = {Practice and Experience in Advanced Research Computing (PEARC '26)},
|
| 131 |
+
year = {2026},
|
| 132 |
+
doi = {10.1145/3785462.3815847}
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
@misc{nassar2026benchmark,
|
| 136 |
+
author = {Nassar, Anas},
|
| 137 |
+
title = {{LLM} Query Complexity Benchmark},
|
| 138 |
+
year = {2026},
|
| 139 |
+
publisher = {Hugging Face},
|
| 140 |
+
url = {https://huggingface.co/datasets/anasnassar/llm-query-complexity-benchmark}
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
% Original source datasets
|
| 144 |
+
@article{hendrycks2021mmlu,
|
| 145 |
+
author = {Dan Hendrycks and others},
|
| 146 |
+
title = {Measuring Massive Multitask Language Understanding},
|
| 147 |
+
journal = {ICLR},
|
| 148 |
+
year = {2021},
|
| 149 |
+
url = {https://huggingface.co/datasets/cais/mmlu}
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
@article{wang2024mmlupro,
|
| 153 |
+
author = {Yubo Wang and others},
|
| 154 |
+
title = {{MMLU-Pro}: A More Robust and Challenging Multi-Task Language Understanding Benchmark},
|
| 155 |
+
journal = {arXiv:2406.01574},
|
| 156 |
+
year = {2024},
|
| 157 |
+
url = {https://huggingface.co/datasets/TIGER-Lab/MMLU-Pro}
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
@inproceedings{jin2019pubmedqa,
|
| 161 |
+
author = {Qiao Jin and others},
|
| 162 |
+
title = {{PubMedQA}: A Biomedical Research Question Answering Dataset},
|
| 163 |
+
booktitle = {EMNLP},
|
| 164 |
+
year = {2019},
|
| 165 |
+
url = {https://huggingface.co/datasets/qiaojin/PubMedQA}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
@misc{stackexchange_dataset,
|
| 169 |
+
author = {Reimers, Nils and Gurevych, Iryna},
|
| 170 |
+
title = {{StackExchange} Duplicate Questions Dataset},
|
| 171 |
+
year = {2019},
|
| 172 |
+
url = {https://huggingface.co/datasets/sentence-transformers/stackexchange-duplicates}
|
| 173 |
}
|
| 174 |
```
|
| 175 |
|