Dynamic_Model_Router

Streamlit
application badge
Created by team NA on July 06, 2026
Hybrid Token-Efficient Routing Agent

Dynamic Model Router is a general-purpose AI agent for AMD Developer Hackathon Track 1, built on a simple idea: most tasks don't need a premium model — they need the smallest one that still answers correctly. It reads a batch of tasks and answers each as cheaply as possible, escalating only when it must. A zero-token keyword classifier first infers each task's category (factual QA, math, sentiment, summarization, entity extraction, code, logic) with no model call. Trivial single-step arithmetic and ordering problems are then answered deterministically in pure Python — zero tokens, and precision-first, so anything ambiguous defers to the model rather than risking a wrong answer. Everything else is sent to a Fireworks model. For that model step, the router never hardcodes a model ID: it reads ALLOWED_MODELS at runtime, and at startup probes each live model once to measure its prompt-template overhead, then routes each category to the leanest model that still clears the accuracy gate — keeping a category on a stronger model wherever a cheaper one would fail. Models that aren't actually deployed are detected and routed around automatically. Correctness comes first. Prompts and output limits are matched to the official grading rubric — two-sided sentiment reasons, exact summary formats, complete entity labels — because an answer that saves tokens but fails the gate scores zero. The container always writes a valid, complete results file, even on partial failure. The result is a compliant, reliable router that cut its own token spend by roughly a third on a rubric-strict local evaluation while holding accuracy — spending model tokens only where they genuinely buy correctness.

Category tags: