How kanav14/ai-workload works
ai-workload is a two-Mac LLM inference router that chooses a host based on swap pressure, exposes generation and status endpoints, and provides a dashboard. Its principal request flow measures swap, selects a Mac, and forwards a chat-completion request to that Mac’s llama.cpp server. Separately, a coordinator starts and monitors both servers, while an experiment runner benchmarks routing and records system conditions. The API and coordinator implement separate routing decisions. The empty system_monitor.py and unsampled data files are not expanded; source evidence limits other inferred connections.
Main entry points: api.py Generation and status API · experiment.py Benchmark runner · coordinator.py Server lifecycle and monitor · rebalancer.py Swap rebalancer
Components 14
Serving and dashboard
- Generation and status API
api.py - Live dashboard
api.py - Local swap probe
api.py - Remote swap probe
api.py
Node coordination
- Server lifecycle and monitor
coordinator.py - Swap rebalancer
rebalancer.py
Benchmarking
- Benchmark runner
experiment.py
Runtime records
- Routing log
data/routing_log.csv - Experiment results
data/experiment_results.csv - System measurements
data/system_log.csv
Other components
- Generation client
- Mac 1 macOS
- Mac 2 over SSH
- llama.cpp servers
Connections 19
- Generation client → Generation and status API: submits prompt
api.py - Generation and status API → Local swap probe: measures swap
api.py - Generation and status API → Remote swap probe: measures swap
api.py - Local swap probe → Mac 1 macOS: runs sysctl
api.py - Remote swap probe → Mac 2 over SSH: runs SSH probe
api.py - Generation and status API → llama.cpp servers: routes completion
api.py - llama.cpp servers → Generation and status API: returns completion
api.py - Live dashboard → Generation and status API: fetches status
api.py - Generation and status API → Routing log: reads event count
api.py - Server lifecycle and monitor → Mac 1 macOS: probes swap
coordinator.py - Server lifecycle and monitor → Mac 2 over SSH: probes and starts server
coordinator.py - Server lifecycle and monitor → llama.cpp servers: starts servers
coordinator.py - Server lifecycle and monitor → Swap rebalancer: checks and chooses node
coordinator.py - Swap rebalancer → Routing log: writes decision
rebalancer.py - Benchmark runner → Mac 1 macOS: measures swap and temperature
experiment.py - Benchmark runner → Mac 2 over SSH: probes swap over SSH
experiment.py - Benchmark runner → llama.cpp servers: sends benchmark request
experiment.py - Benchmark runner → Experiment results: appends run results
experiment.py - Benchmark runner → System measurements: appends measurements
experiment.py