Token-cost classifier (ChatGPT, 8 buckets, ModernBERT-large)
Fine-tuned from answerdotai/ModernBERT-large to predict how many output tokens ChatGPT will generate for a prompt, before that model is run.
Trained on single-turn English WildChat conversations. Labels are output-token counts from the GPT tokenizer (cl100k_base).
The head is 8-way classification over length buckets. Cut points are in bucket_edges.json (pandas cut bins: counts up to each edge inclusive):
| Bucket | Output tokens |
|---|---|
| 0 | 0–76 |
| 1 | 77–229 |
| 2 | 230–345 |
| 3 | 346–418 |
| 4 | 419–490 |
| 5 | 491–592 |
| 6 | 593–758 |
| 7 | 759 or more |
Training context length: 2048 tokens.
from transformers import AutoModelForSequenceClassification, AutoTokenizer
repo = "Nadi-Boss/token-cost-wildchat-modernbert-8bucket"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=2048)
bucket = int(model(**inputs).logits.argmax(-1))