chopratejas/technique-router
212k
Technique Router (MiniLM)
A fine-tuned MiniLM classifier that routes image queries to optimal compression techniques for the Headroom SDK.
Model Description
This model classifies natural language queries about images into one of four optimization techniques:
Training Data
- Base examples: 145 human-written queries
- Expanded dataset: 1,157 examples (via template expansion + synonyms)
- Split: 85% train, 15% validation
Performance
- Validation Accuracy: 93.7%
- Model Size: ~128MB
Per-Class Performance
Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model
model_id = "chopratejas/technique-router"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()
# Classify a query
query = "What brand is the TV?"
inputs = tokenizer(query, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=-1)
pred_id = torch.argmax(probs, dim=-1).item()
confidence = probs[0][pred_id].item()
technique = model.config.id2label[pred_id]
print(f"{query} -> {technique} ({confidence:.0%})")
# Output: What brand is the TV? -> preserve (73%)With Headroom SDK
from headroom.image import TrainedRouter
router = TrainedRouter()
decision = router.classify(image_bytes, "What brand is the TV?")
print(decision.technique) # Technique.PRESERVEIntended Use
This model is designed for:
- Routing image analysis queries to optimal compression techniques
- Reducing token usage in vision-language model applications
- Enabling cost-effective image understanding at scale
Limitations
- English language only
- Optimized for common image understanding queries
- May not generalize well to domain-specific terminology
Citation
@misc{headroom-technique-router,
title={Technique Router for Image Token Optimization},
author={Headroom AI},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/chopratejas/technique-router}
}