ArmSight
by 0xConsole
README.md
# ArmSight
> **Autonomous AI agent for Arm64 ML model inference optimization.**
> Analyzes ONNX models, applies REAL INT8 quantization, and generates Arm64-optimized deployment packages β all through an MCP-compatible tool interface that an AI agent can call autonomously.
Built for the **[Arm Create: AI Optimization Challenge](https://arm-ai-optimization-challenge.devpost.com/)** (Cloud AI track).
---
## π― The Problem
Deploying ML models on Arm64 (AWS Graviton, Cortex-A, Neoverse) requires platform-specific knowledge: which quantization scheme to use, how to tune thread parallelism for multi-core, when to leverage NEON SIMD, and how to package everything into an Arm64-optimized container. Most developers ship unoptimized FP32 models and leave significant performance on the table.
## π‘ The Solution
**ArmSight** is an autonomous AI agent that:
1. **Analyzes** any ONNX model β operators, layers, precision, parameter count, input/output shapes
2. **Recommends** Arm64-specific optimizations β INT8 quantization, NEON SIMD fusion, thread parallelism, memory layout, ACL provider
3. **Applies** real INT8 dynamic quantization using `onnxruntime.quantization` β producing **measurably smaller** models (typically ~4x size reduction)
4. **Benchmarks** before/after β real inference latency, throughput, and speedup measurements
5. **Generates** a complete Arm64-optimized deployment package β Dockerfile (`linux/arm64`), FastAPI inference server, benchmark script
## π Unique Angle
> *Unlike generic model optimizers, ArmSight exposes its capabilities as **MCP (Model Context Protocol) tools** that an AI agent can call autonomously β `analyze_model`, `optimize_model`, `benchmark_model`, `recommend_optimizations`, `generate_deployment`, `full_pipeline`. This makes ArmSight not just a tool, but an **agent-native** optimization platform.*
## ποΈ Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Web UI (HTML/CSS/JS) β
β Upload ONNX β Analyze β Recommend β Quantize β Benchmark β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β HTTP
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β FastAPI Backend (Python) β
β ββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββββ β
β β Analyzer β βQuantizer β β Recomm. β β Deployment β β
β β (onnx) β β(onnxrt) β β Engine β β Generator β β
β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββββ¬βββββββ β
β ββββββββββββ¬ββββ΄ββββββββββββββ΄ββββββββββββββββ β
β βΌ β
β ββββββββββββββββββββ β
β β MCP Server β β AI agent calls these tools β
β β (tool registry) β autonomously via MCP protocol β
β ββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β Vercel (Serverless) β
β FastAPI on Python runtime β free tier β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
## β‘ Quick Start
### Prerequisites
- Python 3.9+
- An ONNX model file (or use the built-in example model generator)
### Setup (< 5 commands)
```bash
# 1. Clone
git clone https://github.com/0xConsole/arm-sight-agent.git
cd arm-sight-agent
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run locally
uvicorn app.main:app --reload --port 8000
# 4. Open the UI
open http://localhost:8000
```
### Use via API / MCP
```bash
# List MCP tools (what an AI agent sees)
curl http://localhost:8000/mcp/tools | python -m json.tool
# Call the full pipeline autonomously (analyze β quantize β benchmark β deploy)
curl -X POST http://localhost:8000/mcp/call \
-H "Content-Type: application/json" \
-d '{"name": "analyze_model", "arguments": {"model_path": "examples/example_model.onnx"}}'
```
## π οΈ Tech Stack
| Component | Technology |
|---|---|
| Backend | Python + FastAPI |
| Model analysis | `onnx` + `onnxruntime` |
| Quantization | `onnxruntime.quantization.quantize_dynamic` (REAL INT8) |
| Agent interface | MCP (Model Context Protocol) tool pattern |
| Frontend | Vanilla HTML/CSS/JS (no framework) |
| Deployment | Vercel serverless (Python runtime) |
| Target platform | linux/arm64 (AWS Graviton, Cortex-A, Neoverse) |
## β
What's Real vs. Mocked
| Feature | Status | Notes |
|---|---|---|
| ONNX model analysis | β
**REAL** | Uses `onnx` + `onnxruntime` to parse graph, count operators/parameters |
| INT8 quantization | β
**REAL** | `onnxruntime.quantization.quantize_dynamic` β produces genuinely smaller ONNX files |
| Size measurement | β
**REAL** | Byte-level before/after file size comparison |
| Inference benchmarking | β
**REAL** | Actual `session.run()` timing on CPU (mean/p50/p95 latency, throughput) |
| Arm64 recommendations | β
**REAL** | Based on actual model architecture (operators, precision, param count) |
| Deployment package | β
**REAL** | Generates working Dockerfile targeting `linux/arm64` + FastAPI server + benchmark script |
| MCP tool interface | β
**REAL** | Tools are callable via `POST /mcp/call` β any MCP client can invoke them |
**Nothing is mocked.** Every measurement comes from real ONNX runtime operations.
## π Measurable Improvements (Example)
For a typical FP32 ONNX model:
| Metric | Before (FP32) | After (INT8) | Improvement |
|---|---|---|---|
| Model size | ~4.2 MB | ~1.1 MB | **4.0x reduction** |
| Inference latency | ~2.5 ms | ~1.8 ms | **~28% faster** |
| Throughput | ~400 ops/s | ~550 ops/s | **~37% higher** |
*Actual numbers vary by model. The quantization and benchmarking are real β run it on your model to see your results.*
## π³ Generated Deployment Package
The `generate_deployment` tool produces:
```
deploy_package/
βββ Dockerfile # linux/arm64 target, ONNX Runtime with NEON
βββ server.py # FastAPI inference server (optimized session options)
βββ model.onnx # Your (optionally quantized) model
βββ benchmark.py # Latency/throughput benchmark script
βββ docker-compose.yml # One-command deployment
βββ README.md # Usage instructions
```
```bash
# Build and run on Arm64
docker buildx build --platform linux/arm64 -t armsight-inference .
docker run --rm -p 8000:8000 armsight-inference
python benchmark.py http://localhost:8000
```
## π MCP Tool Reference
ArmSight exposes 6 tools via the MCP interface:
| Tool | Description |
|---|---|
| `analyze_model` | Analyze ONNX architecture: operators, precision, params |
| `optimize_model` | Apply INT8 dynamic quantization (real size reduction) |
| `benchmark_model` | Measure inference latency and throughput |
| `recommend_optimizations` | Generate Arm64-specific recommendations |
| `generate_deployment` | Create Arm64 Docker + FastAPI deployment package |
| `full_pipeline` | Run all of the above autonomously |
## π Project Structure
```
arm-sight-agent/
βββ api/
β βββ index.py # Vercel serverless entry point
βββ app/
β βββ main.py # FastAPI app + routes
β βββ analyzer.py # ONNX model analysis
β βββ quantizer.py # INT8 quantization (REAL)
β βββ recommendations.py # Arm64 optimization recommendations
β βββ deployment.py # Deployment package generator
β βββ mcp_server.py # MCP tool registry + dispatch
βββ static/
β βββ index.html # Web UI
βββ requirements.txt
βββ vercel.json
βββ README.md
```
## π License
Apache License 2.0 β see [LICENSE](LICENSE).
## π Links
- **Live Demo:** [https://arm-sight-agent.vercel.app](https://arm-sight-agent.vercel.app)
- **GitHub:** [github.com/0xConsole/arm-sight-agent](https://github.com/0xConsole/arm-sight-agent)
- **Challenge:** [Arm Create: AI Optimization Challenge](https://arm-ai-optimization-challenge.devpost.com/)
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues