Supra-Router-51M · Multi-Task Infrastructure Routing Model
logo
About the Model
Supra-Router-51M is an ultra-lightweight, high-speed infrastructure traffic controller optimized for localized edge orchestration. With only 51.7 million parameters, this micro-LLM acts as a defensive gateway for multi-model ecosystems, accurately determining when user requests can be processed locally by an Edge SLM or when they must be triaged to a cloud-hosted frontier intelligence layer.
The model was built by fine-tuning a pre-trained 51M base on the SupraLabs/Prompt-Routing-Dataset (992 rows). Rather than acting as a naive binary classifier, the model uses Multi-Task Sequence Generation to map out the underlying properties of a prompt before predicting the final routing token, anchoring its attention heads to robust language and structural logic features.
Multi-Task Decision Sequence
To run inference, wrap your user query inside the structural framing tokens used during training (Task: [Prompt]\nAnalysis: ). The model will output a deterministic, pipe-separated string containing the full telemetry of the prompt's cognitive requirements:
By forcing a sub-100M parameter model to calculate the semantic domain, structural complexity, and technical flags before it emits the final Route token, the network effectively runs an internal feature-activation map. This multi-task sequence prevents localized weight collapse and guarantees stable routing boundaries.
Checkpoint Selection: Peak generalization was reached during Epoch 3 (eval_loss: 0.1342). To eliminate late-stage micro-model memorization and validation drift, the training state was automatically rewound and saved at this numerical peak.
Precision: bfloat16
Hardware Footprint: Optimized sequence processing length of 3840 tokens, ensuring rapid inference execution with negligible CPU/GPU overhead (sub-millisecond generation speeds).
Inference & Gateway Implementation
Use this direct script to test or wrap the model inside a live production orchestrator or FastAPI gateway. It enforces greedy decoding (do_sample=False) for maximum decision stability.
python
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
34MODEL_ID ="SupraLabs/Supra-Router-51M"56print("[*] Initializing local infrastructure router...")7tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)8model = AutoModelForCausalLM.from_pretrained(9 MODEL_ID,10 dtype=torch.bfloat16,11 device_map="auto"12)13model.eval()1415# Example prompt showcasing keyword-trap evasion16user_prompt ="Write a movie script about a chef who gets lost at sea."1718# Format to match internal SFT attention alignment19formatted_input =f"Task: {user_prompt}\nAnalysis: "20inputs = tokenizer(formatted_input, return_tensors="pt").to(model.device)2122with torch.no_grad():23 outputs = model.generate(24**inputs,25 max_new_tokens=128,26 do_sample=False,27 pad_token_id=tokenizer.pad_token_id,28 eos_token_id=tokenizer.eos_token_id
29)3031generated_ids = outputs[0][inputs["input_ids"].shape[1]:]32print(tokenizer.decode(generated_ids, skip_special_tokens=True).strip())
Proven Benchmarks & Defensive Boundaries
During edge validation testing, Supra-Router-51M demonstrated robust resilience against adversarial prompt strings:
Keyword Trap Evasion: Successfully identifies semantic context rather than matching tokens. Prompts containing words like "script" or "calculus" are correctly parsed as creative writing (not programming/math code) and routed locally to the small model when complexity is low.
Complexity-Driven Safety Net: In instances where programming syntax or technical boundaries are ambiguous (e.g., complex regex or architectural database frames), the model naturally scales its evaluation metrics to Complexity: 3, automatically triggering a big model route override.
Deterministic Offloading: Safely captures multi-step logic paths, calculus concepts, and code generation scripts, instantly assigning them to cloud-scale frontier endpoints.