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.
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.
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.
PyTorch activity
Capture CPU work and PrivateUse1 accelerator activity through PyTorch Profiler.
Scheduling path
Neuron system traces help connect framework operations with runtime handling.
Device timeline
Inspect device time and per-engine activity on NeuronCores in Neuron Explorer.
Capture, synchronize, inspect
TorchNeuron connects standard PyTorch workflows to the Neuron accelerator stack.
Configure capture
Set streams, NeuronCores, and output directory in NeuronConfig.
Profile activity
Pass the config as experimental_config; enable CPU and PrivateUse1 activities.
Synchronize steps
Call torch.neuron.synchronize() before advancing each profiler step.
Open the traces
Export framework and Neuron traces, then inspect system and device timelines.
“Without this synchronization, the profiler can export before the device finishes and leave the Neuron time column empty.” Hugging Face tutorial
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.
Naive PyTorch ops
Build RMSNorm from individual arithmetic and reduction operations.
torch.rms_norm()
Use the built-in operation, lowered to a fused Neuron kernel.
torch.compile
Compile the naive implementation and profile its execution path.
The method is here. The measurements are not.
The supplied material ends during the first profile walkthrough.
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.
What to inspect next
Use the linked TorchNeuron examples to reproduce the profiles.
Compare time columns
Review Self CPU time alongside Neuron device time after synchronization.
Trace the system path
Open a complete output directory for system or combined profiles.
Inspect NEFF + NTFF
NEFF is the compiled executable; NTFF is its hardware instruction trace.
“Follow one operation through Neuron Explorer, from framework dispatch through runtime scheduling to hardware execution on a NeuronCore.” Hugging Face tutorial
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.
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
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.
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.
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