CoolFace
Modelpublic

chopratejas/technique-router

sourceHugging Faceapache-2.0updated 8mo agoView on Hugging Face
2likes12kdownloads
Model Card

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:

TechniqueToken SavingsBest For
transcode~99%Text extraction, OCR tasks
crop50-90%Region-specific queries
full_low~87%General understanding
preserve0%Fine details, counting

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

ClassPrecisionRecallF1-Score
transcode0.950.920.93
crop0.920.970.94
preserve0.970.900.93
full_low0.890.960.92

Usage

python
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

python
from headroom.image import TrainedRouter

router = TrainedRouter()
decision = router.classify(image_bytes, "What brand is the TV?")
print(decision.technique)  # Technique.PRESERVE

Intended 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

bibtex
@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}
}