amd_v2 solves the core constraint of Track 1: achieve high accuracy while spending the fewest possible tokens. The system classifies tasks into 8 semantic domains and routes each through a three-stage cascade designed for cost-first inference. Stage 1 uses deterministic algorithms (SymPy for math, VADER for sentiment, spaCy for NER, sandboxed execution for code) to resolve ~30% of tasks with exact answers at $0 cost. Stage 2 runs Ollama locally on AMD hardware with self-consistency verification — if local models are confident (high agreement across 2 runs), the answer returns at $0; if uncertain, it escalates. Stage 3 activates only when local verification fails, dynamically routing to the cheapest capable Fireworks model (Gemma 9B → Qwen 72B → Llama 405B) with capped retries to prevent token waste. The result is a production-ready agent that clears the accuracy gate while maintaining cost discipline. Models and Ollama are bundled in-container (no external dependencies), configuration is environment-driven, and graceful degradation means missing API keys or network outages don't crash the batch — they produce empty, unverified results instead. Tested against 64 synthetic fixtures with 120+ unit tests, the system achieves 100% accuracy at $0.00 cost when local inference is available, demonstrating that hybrid cost-aware routing is both practical and effective.
Category tags: