Commit ยท
62a5c8a
1
Parent(s): 0b55df4
docs: update project description, training data details, and usage instructions in README
Browse files13 unmodified lines141516171819202117181920212223282425262758 unmodified lines868788938990919210 unmodified lines10310410511010610710810940 unmodified lines15015115215715815916016116215315415513 unmodified lines
# Query Classifier ONNX (ModernBERT-large Fine-Tuned)
**Primary use case:** Efficient LLM routing. This classifier predicts query complexity so applications can dispatch simple requests to inexpensive models while reserving larger reasoning models for difficult tasks.
A lightweight ONNX sequence classification model fine-tuned to categorize user prompts into **`low`**, **`medium`**, or **`hard`** complexity levels.
This model is designed for use as a **pre-routing filter in LLM cascades**, allowing systems to dynamically route simple queries to smaller/cheaper models (e.g., Llama-3-8B or Flash models) and reserve frontier LLMs (e.g., Claude 3.5 Sonnet, GPT-4o) for complex, multi-step queries.A CPU-optimized ONNX sequence classification model fine-tuned from **ModernBERT-large** to classify user queries into **`low`**, **`medium`**, and **`hard`** complexity levels. It is designed for LLM routing, enabling applications to dispatch simple requests to smaller, lower-cost models while reserving larger reasoning models for complex, multi-step tasks.
---
## ๐ Model Details
- **Base Architecture**: [`answerdotai/ModernBERT-large`](https://huggingface.co/answerdotai/ModernBERT-large) (`ModernBertForSequenceClassification`)- **Training Data**: Fine-tuned on a curated dataset of **1,800 user queries** spanning factual questions, code generation requests, reasoning puzzles, and technical tasks.- **Training Data**: Fine-tuned on a manually curated dataset of **1,800 user queries** spanning factual QA, programming, reasoning, mathematics, and technical problem solving.- **Model Format**: Int8 quantized ONNX (`model.onnx`, ~397 MB).- **Inference Runtime**: Pure **ONNX Runtime + Hugging Face Rust `tokenizers`** โ zero PyTorch or `transformers` runtime dependencies are required for inference.
58 unmodified lines
## ๐ Quickstart: Pure ONNX Runtime Usage
You can use this model in Python without installing heavy frameworks like PyTorch or Transformers.The model can be used directly with ONNX Runtime without requiring PyTorch or Transformers for inference.
### 1. Installation
10 unmodified linesfrom huggingface_hub import hf_hub_download
# Repository detailsREPO_ID = "prvn-ramesh/query-classifier-onnx" # Update with your HF username/repoREPO_ID = "prvn-ramesh/query-classifier-onnx"
# 1. Download model artifacts from Hugging Face Hubmodel_path = hf_hub_download(repo_id=REPO_ID, filename="model.onnx")40 unmodified lines
---
## ๐ License
This model repository and weights are licensed under the **[Apache 2.0 License](LICENSE)**.
---
## ๐ Citation & Acknowledgements
- Base model: [ModernBERT](https://huggingface.co/answerdotai/ModernBERT-large) developed by **Answer.AI** and **LightOn**.README.md+4-14