Hybrid Token-Efficient Routing Agent

Created by team AmyA on July 11, 2026
Hybrid Token-Efficient Routing Agent

This is a hybrid, token-efficient AI agent for AMD Developer Hackathon Track 1, handling all eight required task categories: factual knowledge, math reasoning, sentiment, summarisation, named entity recognition, code debugging, logical/deductive reasoning, and code generation. The core strategy is local-first inference: every prompt is first attempted with a quantized SmolLM3-3B model (Q4_K_M GGUF, ~1.9 GB) running on CPU via llama.cpp inside the container, with no GPU dependency. Local answers count fully toward accuracy while consuming zero Fireworks API tokens, directly improving the token-efficiency score. A lightweight classifier (keyword heuristics, with a local-model fallback) routes each task. Math and logic tasks use self-consistency sampling (majority voting across multiple local generations) to catch cases where the small model disagrees with itself. Code tasks use a self-reflection loop: draft, check, revise. The agent escalates to Fireworks — using models read dynamically from ALLOWED_MODELS, never hardcoded — only when local confidence is low, self-consistency samples disagree, or the category is known to be weak for a 3B model. This minimizes token usage while preserving accuracy on harder cases. The container is a multi-stage, CPU-only Docker image with model weights baked in at build time via a Hugging Face API discovery step with filename fallbacks, so the running container needs no external network access for local inference. It reads /input/tasks.json, writes /output/results.json, and respects the 2 vCPU / 4 GB grading constraints with a per-task deadline guard to stay under the 30-second and 10-minute limits.

Category tags: