Metal sandbox boosts Apple GPU coding agent efficiency by scheduling commands

Metal Sandbox: Isolated Execution and Command Scheduling for GPU Coding Agents on Apple Silicon

Machine LearningArtificial IntelligenceComputation and LanguageDistributed, Parallel, and Cluster Computing

Summary

Running machine learning tasks on Apple devices requires careful use of their special graphics processors (GPUs). The authors designed Metal Sandbox, a system that helps multiple AI coding agents share GPU time more effectively by scheduling their commands across several Macs. This system keeps each agent’s work private while allowing some commands to run at the same time or move to other computers when waiting. Tests show that this method improves how many commands can be run and reduces delays. The authors also made their system open source for others to use.

What this means in practice

  • For machine learning engineers: Run and test GPU-accelerated model code more efficiently on Apple devices by sharing execution across multiple machines with private environments.
  • For distributed system developers: Coordinate and schedule GPU tasks dynamically across networked macOS nodes to improve utilization and reduce waiting time.

Authors

Haozhe Wang, Lina Chen, Fanqi Wan, Qi Han, Yinmin Zhang, Zheng Ge, Daxin Jiang, Junchi Yan

Abstract

On-device inference requires kernels that make effective use of local accelerators. Efficient training and evaluation of models that generate Apple Metal kernels benefit from native macOS tools and concurrent agent sessions. These sessions alternate between model requests, development commands, and GPU execution, leaving GPU capacity idle for much of a rollout. We present Metal Sandbox, infrastructure that combines restricted per-instance file access, native command execution, and command-level scheduling across interconnected Macs. Each agent retains its workspace and private development environment. Parallel commands can run concurrently, while serial commands share one execution slot per node; eligible waiting commands can migrate to available Macs and return results to the original agent. Integration with Harbor supports task execution, automatic verification, and rollout collection through a common workflow. Controlled experiments on four Mac mini M4 nodes achieve $1.68\times$--$2.05\times$ gains in command throughput under concentrated demand. Sixteen static agent traces give an estimated $2.14\times$ sustained-throughput gain for four sessions per node versus one, assuming continuously replenished sessions and unchanged mean durations. Replaying these measured traces under dynamic scheduling reduces mean tool waiting by 18.8% and batch elapsed time by 22.3%, assuming unchanged phase durations. Metal Sandbox and its Harbor integration are open-source on GitHub.