---
title: "Profiling TorchNeuron (Part 1): System-level profiling on AWS Trainium."
description: "A beginner-friendly walkthrough of system-level profiling for PyTorch on AWS Trainium using TorchNeuron."
url: "https://swe.quest/articles/profiling-torchneuron-part-1-system-level-profiling-on-aws-trainium-034696b775aee014"
canonical: "https://huggingface.co/blog/amazon/profiling-torchneuron-part-1"
source: "Hugging Face"
published: "2026-10-21"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["performance","inference","hardware","python"]
---

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

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2026-10-21, 9 min read, How-to. Original: [https://huggingface.co/blog/amazon/profiling-torchneuron-part-1](https://huggingface.co/blog/amazon/profiling-torchneuron-part-1)

## Summary

A beginner-friendly walkthrough of system-level profiling for PyTorch on AWS Trainium using TorchNeuron. It covers configuring torch.profiler with NeuronConfig and NeuronProfiler, reading the key\_averages() table, and tracing a single operation through framework, runtime and hardware lanes in Neuron Explorer. Three RMSNorm implementations are profiled. Naive eager ops take 2,355 µs of device time across 6 dispatches. torch.rms\_norm lowers to one fused kernel at 403 µs, and torch.compile discovers the same fusion at 376 µs, roughly one-sixth of the naive cost because gaps between dispatches and intermediate tensors are eliminated.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- PyTorch basics
- torch.compile
- ML inference concepts ([easy posts on Machine learning](https://swe.quest/tags/machine-learning.md?difficulty=easy))

## Keywords

AWS Trainium, TorchNeuron, Neuron Explorer, torch.profiler, torch.compile, RMSNorm, NEFF, PrivateUse1

## Related posts

- [The science behind TorchNeuron, Amazon’s new PyTorch backend for AWS Trainium chips](https://swe.quest/articles/the-science-behind-torchneuron-amazon-s-new-pytorch-backend-for-aws-trainium-c2048563f9b5b6ed.md): Amazon Science · 2026-10-22 · Medium · 5 min read · Compilers, Hardware, Testing, Model training, Python
  TorchNeuron is an open-source PyTorch backend that runs existing PyTorch code on AWS Trainium with little or no change.
- [Profiling in PyTorch (Part 1): A Beginner's Guide to torch.profiler](https://swe.quest/articles/profiling-in-pytorch-part-1-a-beginner-s-guide-to-torch-profiler-de0c791495fa22c4.md): Hugging Face · 2026-05-29 · Medium · 27 min read · Performance engineering, Machine learning, Python, Debugging
  torch.profiler produces two artifacts: a statistical table showing where time goes and a Chrome/Perfetto trace showing when CPU and GPU events happen.
- [TorchNeuron: running HF models on AWS Trainium is easier than ever](https://swe.quest/articles/torchneuron-running-hf-models-on-aws-trainium-is-easier-than-ever-99ae731bb5ca0252.md): Hugging Face · 2026-10-19 · Medium · 7 min read · Hardware, Model training, Inference & serving, Python
  TorchNeuron is a PyTorch plugin that exposes AWS Trainium as a native \`neuron\` device with eager execution, \`torch.compile\`, and native distributed APIs (DTensor, FSDP2, TP), replacing the PyTorch XLA–based path that required lazy tensors and static graphs.
- [Does Your Model Run on AWS Trainium? Look It Up](https://swe.quest/articles/does-your-model-run-on-aws-trainium-look-it-up-4ce5c68bb56caf0e.md): Hugging Face · 2026-10-23 · Medium · 3 min read · Inference & serving, Hardware, Machine learning
  A Hugging Face Space reports whether popular Transformers models run unmodified on AWS Trainium via the TorchNeuron PyTorch backend.
- [Host overhead is killing your inference efficiency](https://swe.quest/articles/host-overhead-is-killing-your-inference-efficiency-42291cc0b68e5c36.md): Modal · 2025-11-18 · Medium · 7 min read · Inference & serving, Performance engineering, Hardware
  GPU idle time while the CPU prepares work (host overhead) shows up as low GPU kernel utilization and directly multiplies inference cost; 50% overhead means GPU spend is 2x what it could be.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
