TorchNeuron: Run PyTorch Models More Easily on AWS Trainium Chips

Research report Amazon Science · Research source, not independently verified by us.

Amazon has introduced TorchNeuron, an open-source PyTorch backend for AWS Trainium systems. It translates PyTorch code into operations that can run on Trainium chips. For developers, this could make it easier to move existing models: Amazon says models already running on other accelerators can work on Trainium with few or no code changes.

The backend adds an optional “adaptive eager” mode to PyTorch. It groups operations into smaller graphs, compiles them, and runs them while other work is already underway. The aim is to overlap some compilation time with execution while preserving the link between code lines and operations that can help with debugging. TorchNeuron also caches generated executable files in memory and on disk. For distributed models, other accelerators can reuse compiled code instead of compiling identical operations again.

Amazon also describes a broad evaluation process. AI agents searched Hugging Face repositories and helped select 841 representative models. The evaluations also produced a registry of tens of thousands of tensor shapes to support faster tests of new software versions. In a test involving a large language model distributed across accelerators, Amazon says caching and shared compilation reduced the time to the first training step by about a third.

The report gives further detail on the runtime optimizations and staged testing approach. Source: Amazon Science

🇬🇧 https://www.amazon.science/blog/the-science-behind-torchneuron-amazons-new-pytorch-backend-for-aws-trainium-chips

Leave a Comment

The weekly brief: selected developments, projects and videos