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:

Technique Token Savings Best For
transcode ~99% Text extraction, OCR tasks
crop 50-90% Region-specific queries
full_low ~87% General understanding
preserve 0% 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

Class Precision Recall F1-Score
transcode 0.95 0.92 0.93
crop 0.92 0.97 0.94
preserve 0.97 0.90 0.93
full_low 0.89 0.96 0.92

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.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

@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}
}
Downloads last month
558
Safetensors
Model size
33.4M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for chopratejas/technique-router

Finetuned
(121)
this model