Official code and dataset repository for the paper:
"Edge-First AI Agent Intent Routing and Multi-Tier Orchestration for Resource-Constrained IoT Intelligence"
Submitted to IEEE Internet of Things Journal (IEEE IoT-J) Special Issue on AI Agent Enabled Small-Large Model Collaboration for Internet of Things.
DIR-Agent (Edge-First Dynamic Intent Router) addresses the tension between tight edge hardware resource bounds (8GB VRAM footprint) and cloud LLM latency/monetary overheads. DIR-Agent fuses contextual text embeddings, structural intent features (has_code, has_tool, has_json, has_rag), and workflow step indices with a confidence-gated fallback policy to route agent execution steps across a 4-tier model hierarchy.
| Router Algorithm | Exact Match (%) | Pass Rate (%) | Cost Savings (%) | Avg. Cost ($/query) | Avg. Latency (ms) | Combined Score (%) | GPU Peak VRAM (MB) |
|---|---|---|---|---|---|---|---|
| Always-Cloud Baseline | 19.93% | 100.00% | 0.00% | $0.003500 | 750.13 ms | 39.98% | 60.90 MB |
| Always-Edge SLM Baseline | 68.04% | 68.04% | 100.00% | $0.000000 | 35.13 ms | 78.69% | 60.90 MB |
| Rule-Based Heuristic Router | 30.24% | 100.00% | 12.37% | $0.003067 | 663.32 ms | 47.54% | 60.90 MB |
| TF-IDF + Logistic Regression | 75.95% | 85.91% | 76.63% | $0.000818 | 202.20 ms | 79.50% | 60.90 MB |
| Semantic KNN Router | 74.57% | 82.47% | 83.70% | $0.000570 | 163.44 ms | 80.25% | 60.90 MB |
| LightGBM Gradient Boosting | 77.32% | 85.91% | 79.73% | $0.000710 | 189.71 ms | 80.99% | 60.90 MB |
| DIR-Agent (Proposed) | 78.01% | 86.60% | 79.19% | $0.000729 | 189.76 ms | 81.26% | 60.90 MB |
All results reflect real, empirical GPU executions on 970 multi-step agent benchmark cases from TwinRouterBench across 5 scenarios (swebench, bfcl, mtrag, qmsum, pinchbench).
Edge-First-AI-Agent-Intent-Routing/
├── data/
│ ├── static/
│ │ ├── question_bank.jsonl # 970 multi-step agent benchmark cases
│ │ └── manifest.json # Scenario distributions & tier metadata
│ ├── dynamic/
│ │ ├── model_pool.json # Model pool specifications
│ │ ├── model_pricing.json # Locked pricing configurations
│ │ ├── sr_knn_to_pool.json # Dynamic model pool assignment mappings
│ │ ├── tier_to_model.json # Tier 0 to Tier 3 hardware/model allocation rules
│ │ └── ttl_policy.json # Session caching and persistence policy
│ └── README.md # Dataset taxonomy documentation
├── experiments/
│ ├── data_loader.py # Dataset loader & structural intent feature extractor
│ ├── gpu_benchmark.py # Real PyTorch CUDA GPU latency & VRAM benchmark
│ ├── routers.py # Router baseline models & DIR-Agent policy
│ ├── run_experiments.py # Master benchmark runner saving CSV/JSON results
│ └── plot_generator.py # Publication-grade figure generator (PDF & PNG)
├── paper/
│ ├── main.tex # IEEE IoT-J paper LaTeX source
│ ├── IEEEtran.cls # Official IEEE journal class file
│ ├── references.bib # BibTeX citations
│ ├── main.pdf # Compiled 8-page paper PDF
│ └── figures/ # High-resolution vector figures (fig2 to fig5)
├── results/
│ ├── benchmark_summary.csv # Summary metrics CSV
│ ├── experiment_results.json # Full empirical JSON log
│ └── plots/ # Generated figures
├── docs/
│ └── SLM_and_datasets_download_links.md # SLM weights & dataset guide
├── requirements.txt # Python package dependencies
├── LICENSE # MIT License
└── README.md # Repository documentation
Clone the repository and install dependencies:
git clone https://github.com/your-username/Edge-First-AI-Agent-Intent-Routing.git
cd Edge-First-AI-Agent-Intent-Routing
pip install -r requirements.txtExecute the master GPU benchmark suite:
python experiments/run_experiments.pyThis will run real CUDA timing kernels on your local GPU, evaluate all 7 routing strategies on the 970 TwinRouterBench cases, and save the empirical results to results/benchmark_summary.csv and results/experiment_results.json.
Generate publication-grade PDF and PNG plots:
python experiments/plot_generator.pyCompile the paper into main.pdf:
cd paper
pdflatex -interaction=nonstopmode main.tex
bibtex main
pdflatex -interaction=nonstopmode main.tex
pdflatex -interaction=nonstopmode main.texIf you find this codebase or paper useful in your research, please cite:
@article{china2026edgefirst,
title={Edge-First AI Agent Intent Routing and Multi-Tier Orchestration for Resource-Constrained IoT Intelligence},
author={China, Ahmad Alpha and Collaborators},
journal={IEEE Internet of Things Journal},
volume={13},
number={4},
pages={101--108},
year={2026}
}This project is licensed under the MIT License - see the LICENSE file for details.