This project delivers an intelligent routing agent engineered to balance strict enterprise accuracy requirements against cloud API token consumption. Built to comply with an evaluation environment restricted to a 4 GB RAM and 2 vCPU footprint, the system relies on an intentional two-step isolation architecture that separates intent classification from task execution. At the core of the local optimization strategy is an ultra-lightweight, 4-bit quantized Gemma 4 (Effective 2B) parameter model running locally via llama-cpp-python. When an evaluation payload enters the pipeline, the local model acts strictly as a zero-token-cost binary classification gate. It evaluates incoming prompts across eight distinct capability domains. Direct, low-complexity natural language tasks - such as sentiment analysis, named entity recognition, basic definitions, and text summarization - are processed and answered entirely in-house, incurring a total external token cost of zero. Conversely, when the local gate detects complex algorithmic patterns, multi-step mathematical reasoning, code debugging specs, or deductive logic puzzles, it flags the task as COMPLEX and routes it to the premium Fireworks AI cloud infrastructure. By isolating the routing logic and utilizing defensive system constraints like strict stop-token structures and max-token caps, this architecture minimizes proxy token overhead while ensuring maximum accuracy for more demanding requests.
Category tags: