
TERA is a hybrid routing agent built for the AMD ACT II Hackathon (Track 1) that minimizes token consumption on the Fireworks AI platform while preserving output quality. Rather than sending every prompt to the same large model, TERA first classifies each incoming task locally — at zero latency and zero remote token cost — then dynamically selects the most cost-effective Fireworks model capable of handling it. How it works: Local classification — An in-process keyword/heuristic router (with an optional local Gemma model for higher-accuracy classification) sorts each prompt into one of 8 task categories: General, Math, Logic, Summary, Sentiment, NER, Code Debug, and Code Generation. This step runs entirely on-device, contributing nothing to the scored token total. Dynamic model selection — TERA inspects the runtime ALLOWED_MODELS list, ranks models by estimated parameter size/capability, and routes simple tasks (sentiment, summarization, NER) to the cheapest available model while reserving the most capable model for complex reasoning (math, logic, code). Code-specialized models are prioritized automatically when present in the allowed list. If a selected model becomes unavailable or exhausts its quota mid-run, TERA falls back to the next-best model in the chain rather than failing the task. Local reasoning hints — For math and logic tasks, an optional local Gemma pass generates intermediate reasoning notes before the remote call, letting the Fireworks model produce a shorter, cheaper completion. Resilient execution — API calls use exponential backoff for transient failures, and a single task failure no longer aborts the whole run — the pipeline records what it can and still produces valid output for the tasks that succeeded. Deterministic formatting — Model outputs are normalized per task type (clean JSON for NER, stripped code fences, canonical sentiment labels) before being written to the required output schema
13 Jul 2026