# Profiling TorchNeuron (Part 1): System-level profiling on AWS Trainium.

DevFeed: [Profiling TorchNeuron (Part 1): System-level profiling on AWS Trainium.](<https://devfeed.tech/articles/profiling-torchneuron-part-1-system-level-profiling-on-aws-trainium-92970.md>)

Original publisher: [Read original article](<https://huggingface.co/blog/amazon/profiling-torchneuron-part-1-system-level-profilin>)

Author: Josh Longenecker

Published: 2026-10-21T16:04:43Z

Content type: tutorial

Language: en

Sources: [Hugging Face](<https://devfeed.tech/sources/hugging-face-blog.md>)

Topics: [AWS Trainium](<https://devfeed.tech/topics/aws-trainium.md>), [neuron](<https://devfeed.tech/topics/neuron.md>), [PyTorch](<https://devfeed.tech/topics/pytorch.md>), [Learning](<https://devfeed.tech/topics/learning.md>)

Tags: [aws](<https://devfeed.tech/tags/aws.md>), [aws-trainium](<https://devfeed.tech/tags/aws-trainium.md>), [compile](<https://devfeed.tech/tags/compile.md>), [inference](<https://devfeed.tech/tags/inference.md>), [inference-performance](<https://devfeed.tech/tags/inference-performance.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [performance](<https://devfeed.tech/tags/performance.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [pytorch](<https://devfeed.tech/tags/pytorch.md>), [torchneuron](<https://devfeed.tech/tags/torchneuron.md>), [trainium](<https://devfeed.tech/tags/trainium.md>)

## AI overview

The walkthrough shows how to locate inference time on AWS Trainium with `torch.profiler` and Neuron Explorer. Configure `NeuronConfig` through `experimental_config`, include `ProfilerActivity.PrivateUse1`, and call `torch.neuron.synchronize()` in the profiling loop so device times are captured. Sort `key_averages()` by device time to find costly operations, then use Explorer to trace an operation from PyTorch dispatch through runtime scheduling to hardware execution. In the RMSNorm examples, the naive sequence uses separate operations and takes 2.355 ms of Neuron time; `torch.rms_norm()` fuses them into one kernel at 403.3 μs, while `torch.compile(backend='neuron')` fuses the original function at 375.5 μs. Both fused runs take about one-sixth the naive time in these measurements. The post attributes the reduction to fewer dispatches and avoiding intermediate values. It presents this as a workflow to apply to larger models; device-level engine and roofline analysis is reserved for Part 2.

## Source excerpt

Many ML practitioners have some intuition about how to make models run fast, but fewer know how to analyze why a model is slow. In Part 1 of this series, you will learn how to systematically analyze inference performance and identify where the time is spent. This post starts from scratch and assumes no prior profiling experience. The walkthrough uses AWS Trainium, a purpose-built AI chip for deep learning training and inference workloads, and TorchNeuron, its open source native PyTorch backend.