AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

Hugging Face’s first TorchNeuron profiling tutorial walks through measuring RMSNorm inference on AWS Trainium. It describes how to capture CPU, runtime and device traces, then compare three implementations; the supplied source does not include the profiling results.

Hugging Face has published Part 1 of a TorchNeuron profiling series, a tutorial for tracing how RMSNorm inference runs on AWS Trainium. It explains how to collect PyTorch, Neuron runtime and device traces, then compare three implementations of the operation; the source material describes the method but does not report which implementation was fastest.

The walkthrough uses TorchNeuron, an open-source PyTorch backend for Trainium, and PyTorch’s profiler. The tutorial says TorchNeuron supports standard PyTorch workflows including eager execution and torch.compile, and connects with the Neuron Kernel Interface for custom operators. It explains that Neuron registers through PyTorch’s PrivateUse1 extension point, which allows an accelerator backend without a dedicated dispatch key such as CUDA’s.

For profiling, the tutorial configures NeuronConfig to select data streams, NeuronCores and an output directory, then passes it to torch.profiler.profile as experimental_config. It also uses NeuronProfiler to export the framework trace alongside Neuron system traces. The example enables CPU and PrivateUse1 activities, correlates device time with the profiler table, and synchronizes the device in the loop before advancing each profiler step.

The comparison covers three versions of RMSNorm: a naive sequence of PyTorch operations, the built-in torch.rms_norm() lowered to a fused Neuron kernel, and the naive version compiled with torch.compile. The source says the examples use the same inputs, profiler configuration and schedule. It points readers to the TorchNeuron examples directory for reproduction and describes Neuron Explorer as the browser-based tool for inspecting system traces, device timelines and per-engine activity.

At a glance
reportWhen: Published as Part 1 of a profiling seri…
The developmentHugging Face published a first-part tutorial for profiling RMSNorm inference on AWS Trainium with TorchNeuron and Neuron’s tracing tools.
Profiling TorchNeuron (Part 1): System-Level Profiling on AWS Trainium
Hugging Face Tutorial · Part 01

Profiling TorchNeuron: System-Level Profiling on AWS Trainium

A practical walkthrough for tracing RMSNorm inference across the PyTorch framework, Neuron runtime, and Trainium hardware—plus a clear look at what the source does and does not report.

OperationRMSNormInference profiling example
AcceleratorTrainiumAWS Neuron device
Input4 × 512bfloat16 tensor
ResultsNot givenNo timing table or winner supplied
01 / Why trace?

Follow work across the Neuron stack

Slow inference is a symptom. A trace helps investigate where time is spent.

The tutorial combines profiler timing with system traces to follow an operation from framework dispatch through runtime scheduling to execution on a NeuronCore. That context can help teams investigate whether delays appear in framework work, runtime handling, or device execution.

Framework

PyTorch activity

Capture CPU work and PrivateUse1 accelerator activity through PyTorch Profiler.

Runtime

Scheduling path

Neuron system traces help connect framework operations with runtime handling.

Hardware

Device timeline

Inspect device time and per-engine activity on NeuronCores in Neuron Explorer.

02 / Trace workflow

Capture, synchronize, inspect

TorchNeuron connects standard PyTorch workflows to the Neuron accelerator stack.

1

Configure capture

Set streams, NeuronCores, and output directory in NeuronConfig.

2

Profile activity

Pass the config as experimental_config; enable CPU and PrivateUse1 activities.

3

Synchronize steps

Call torch.neuron.synchronize() before advancing each profiler step.

4

Open the traces

Export framework and Neuron traces, then inspect system and device timelines.

Key detail
“Without this synchronization, the profiler can export before the device finishes and leave the Neuron time column empty.” Hugging Face tutorial
03 / Comparison setup

Three ways to run RMSNorm

The examples use the same inputs, profiler configuration, and schedule.

The naive operation squares the input, computes the mean of squares, adds epsilon, applies reciprocal square root, then scales by the input and a weight. The schedule waits two steps, warms up one, records one active step, and runs across four calls.

01 · Eager sequence

Naive PyTorch ops

Build RMSNorm from individual arithmetic and reduction operations.

02 · Fused kernel

torch.rms_norm()

Use the built-in operation, lowered to a fused Neuron kernel.

03 · Compiled

torch.compile

Compile the naive implementation and profile its execution path.

Same input: 4 × 512 bfloat16 Wait 2 · Warmup 1 · Active 1 4 profiler calls
04 / Evidence check

The method is here. The measurements are not.

The supplied material ends during the first profile walkthrough.

What can be concluded

A repeatable comparison workflow

The tutorial shows how to capture profiler tables and traces, then repeat the process for each RMSNorm version. It does not include key_averages() output, Neuron Explorer findings, or timing measurements.

Fastest version? Not established by the source.
CPU or device time? No measured comparison is provided.
Generalizes to full models? Not demonstrated by this small example.
05 / Reading the traces

What to inspect next

Use the linked TorchNeuron examples to reproduce the profiles.

Profiler table

Compare time columns

Review Self CPU time alongside Neuron device time after synchronization.

Neuron Explorer

Trace the system path

Open a complete output directory for system or combined profiles.

Device-only profile

Inspect NEFF + NTFF

NEFF is the compiled executable; NTFF is its hardware instruction trace.

Trace path
“Follow one operation through Neuron Explorer, from framework dispatch through runtime scheduling to hardware execution on a NeuronCore.” Hugging Face tutorial
Key questions

What the tutorial answers

What does the tutorial cover?

Profiling RMSNorm inference on AWS Trainium with PyTorch Profiler and Neuron tools, including CPU and device timing.

Which implementations are compared?

Individual PyTorch operations, torch.rms_norm() lowered to a fused kernel, and the naive version compiled with torch.compile.

Does it say which version is fastest?

No. The supplied source gives no timing results or performance ranking.

Why synchronize the device?

Synchronization lets the device finish before trace export; otherwise, the Neuron time column may be empty.

Tracing Work Across the Neuron Stack

The tutorial addresses a practical distinction for machine-learning teams: recognizing that inference is slow is different from identifying where time is spent. A profiler table can show Neuron device time alongside Self CPU time, while a system trace can follow an operation from framework dispatch through runtime scheduling to hardware execution on a NeuronCore. Together, those views can help practitioners investigate whether delays appear in framework work, runtime handling or device execution.

That is useful when evaluating alternative implementations of the same operation. A built-in fused operation and a compiled sequence may change the work sent to the accelerator, but this source offers a method for comparing them, not evidence of a performance winner. The distinction matters for teams deciding whether to adopt a particular implementation or spend time optimizing a model.

Amazon

AWS Trainium GPU accelerator

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Three RMSNorm Implementations

RMSNorm is used here as a small example with a clear sequence of arithmetic and reduction operations. The naive implementation squares its input, computes the mean of the squares, adds an epsilon, applies reciprocal square root, and scales the input by that result and a weight. The source uses a 4-by-512 bfloat16 input on a Neuron device and profiles repeated calls under a shared configuration.

The profiler schedule is set to wait for two steps, warm up for one, and record one active step across four calls. According to the tutorial, this leaves initial setup out of the recorded iteration. The instructions also say to call torch.neuron.synchronize() in the loop so the device finishes before export; without synchronization, the Neuron time column may be empty. Neuron Explorer can open a complete output directory for a system or combined profile, or matching NEFF and NTFF files for a device-only profile. The source describes NEFF as the compiled executable and NTFF as its hardware instruction trace.

“How to follow one operation through Neuron Explorer, from framework dispatch through runtime scheduling to hardware execution on a NeuronCore.”

— Hugging Face tutorial

Amazon

PyTorch Profiler tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Performance Results Are Not Included

The supplied source ends during the first profile walkthrough and does not include the resulting key_averages() table, Neuron Explorer findings, timing measurements or comparison among the three implementations. It does not establish which version uses less device time or CPU time, or whether the measured results generalize beyond the example inputs and setup. No publication date is supplied, and the source does not state when the series’ next part will appear.

Amazon

Neural network profiling hardware

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Compare the Captured Traces

The next step within the described walkthrough is to inspect the exported profiler table and trace, then repeat the same process for the built-in and compiled RMSNorm versions. Readers can use the linked example scripts to reproduce the profiles and Neuron Explorer to inspect device and runtime activity. The source identifies the series as Part 1 but gives no schedule or details for a subsequent installment.

Amazon

Hugging Face RMSNorm inference

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Where I land

I see this as a useful measurement tutorial because it connects profiler numbers to a trace of framework, runtime and hardware activity. That can give practitioners a clearer basis for investigating slow inference than timing a model call alone. The source, however, establishes a workflow rather than a performance conclusion.

The strongest counterargument is that a walkthrough centered on one small RMSNorm example may not tell teams much about their own full models, where shapes, batching and other operations affect results. I would revise my assessment if published measurements showed repeatable comparisons across representative workloads, with the inputs, software versions and hardware configuration documented. Until then, the value here is the profiling method, not a demonstrated speedup.

Key Questions

What does the TorchNeuron tutorial cover?

It shows how to profile RMSNorm inference on AWS Trainium with PyTorch Profiler and Neuron’s tools, including how to compare CPU and device timing.

Which RMSNorm versions are compared?

The tutorial describes a sequence of individual PyTorch operations, the built-in torch.rms_norm() lowered to a fused Neuron kernel, and the naive implementation compiled with torch.compile.

Does the source say which version is fastest?

No. The supplied material explains the profiling setup but includes no timing results or performance ranking.

Why does the example synchronize the Neuron device?

The tutorial says synchronization lets the device finish before the profiler exports its trace. Without it, the Neuron time column may be empty.

Source: Hugging Face

You May Also Like

NVIDIA Cosmos3-H-Dreams: Bringing Clinical Surgery To Life Through Generative Simulation

NVIDIA says Cosmos3-H-Dreams generates interactive cholecystectomy scenes from instrument actions, running on one RTX PRO 6000 GPU.

AI Automation Software For Small Businesses: A Prime Big Deal Days Guide

What AI automation tools actually cost, which tasks to automate first, and how to pick the right software for your small business — with real examples.

Introducing GPT-6.1 Sol

OpenAI’s page is titled “Introducing GPT-6.1 Sol,” but no article text or launch details were provided for verification.

Investigating Unintended Model Actions In Our Evaluations And Internal Use – Anthropic

Anthropic’s headline signals an investigation into unintended model actions during evaluations and internal use, but details and findings are unavailable.