AI & Intelligent Systems

Hybrid Token-Efficient Routing Agent

AMD Developer Hackathon agent that solves provable tasks deterministically, accepts gated local-model answers, and escalates difficult work to cloud models.

PythonLLM RoutingQwenllama.cppFireworks APIDocker

Overview

Built for Track 1 of the AMD Developer Hackathon ACT II, this agent routes natural-language tasks through a dependable escalation ladder. Conservative deterministic solvers answer only what they can prove, category-specific gates validate eligible local Qwen outputs, and cloud batching handles the remaining work while preserving a strict JSON output contract.

Highlights

  • Uses deterministic solvers for zero-token answers when an independent proof path succeeds.
  • Runs eligible tasks through a local Qwen 3.5 2B model with category-specific validation gates.
  • Escalates rejected or ineligible work to configured cloud models instead of silently accepting weak answers.
  • Supports eight task families: factual Q&A, math, logic, sentiment, summarization, entities, debugging, and code generation.
  • Includes 282 passing regression tests and a 1,000-record synthetic evaluation dataset.

Routing Architecture

Every task passes schema validation and an ordered classifier before entering a three-tier resolution ladder. Each tier has an explicit acceptance boundary, so an unproven answer moves upward instead of being treated as correct.

  • Deterministic solvers handle arithmetic, logic, extraction, and other provable patterns without model tokens.
  • The local tier is category-scoped and accepts an answer only after its proof or contract gate passes.
  • Cloud requests are batched and retried using runtime-configured providers and allowed models.
  • A last-resort placeholder is reserved for genuine provider exhaustion or offline runs with no safe answer.

Task Coverage & Validation

  • Passage-aware factual extraction and validated model fallback.
  • Safe arithmetic with an independent proof path plus deterministic ordering and constraint solving.
  • Constraint-aware summarization, named-entity span completeness, and conservative sentiment classification.
  • AST-aware debugging repairs and contract-aware code generation that abstain on ambiguous inputs.

Local Model & Container Runtime

  • The Docker image pins llama.cpp and packages the Qwen 3.5 2B local model for the grading environment.
  • Environment settings control the local model, eligible categories, cloud endpoint, and allowed model list.
  • The CLI reads a JSON task list and always writes one strict task_id/answer object per input task.

Evaluation & Reliability

  • A 1,000-record synthetic dataset provides 125 deterministic examples for each supported task family.
  • Diagnostic evaluation records the actual resolving tier without changing the submission output contract.
  • Crash-safe output handling keeps results.json valid even when an upstream component fails.
  • The design prioritizes accuracy before token minimization and never relies on hidden evaluation data.