Running 5G L1 signal processing on AWS Trainium
How I rebuilt a 5G cell-tower signal chain to run on AWS Trainium, clean-room, using agentic development to write the low-level chip code in days instead of months. A builder's account with a reference architecture, real NKI kernels, and measured results

The views and opinions expressed in this article are my own and do not represent the official positions of Amazon Web Services (AWS).
A clean-room port of the NVIDIA Aerial cuPHY approach to the Neuron Kernel Interface, built with
AI agents and verified on Trainium2 hardware.
Read the interactive version. The pipeline, the reference architecture, and the measured latencies are also a live, animated playbook: https://d30oqr04x249gc.cloudfront.net/Source code. Full kernels, NumPy references, and conformance tests: https://github.com/gubaruch/neuron-aerial
What this work builds on
Nokia and NVIDIA have shown that the 5G physical layer runs on a programmable AI accelerator.
Nokia's AI-RAN white papers describe the path from concept to commercialization on NVIDIA's
Aerial. This work answers one question that follows: if 5G L1 belongs on an AI accelerator, can it
also run on AWS AI silicon like Trainium? This is a question of customer choice. Operators and
vendors run this workload where it fits their price/performance, power, and supply needs.
One blocker has kept this hard. Writing custom kernels for a new accelerator takes rare expertise
and months of work. NKI, the Neuron Kernel Interface, is newer than CUDA. AWS's
neuron-agentic-development skills, driving Claude Code, changed that math for me. I hand-built
verified kernels in days, not quarters.
Clean-room. I read NVIDIA Aerial (Apache-2.0) for algorithm understanding only. I copied no CUDA or C++. Every kernel is an independent implementation validated against my own NumPy reference. This is a methodology demonstration, not a product.
What the pipeline does
A phone sends data over the air. The signal arrives at the tower distorted by the channel, faded,
phase-rotated, and buried in noise. The 5G uplink physical layer, PUSCH, turns that signal back
into the exact bits the phone sent. The chain runs OFDM demodulation, channel estimation, MMSE
equalization, QAM demapping, descrambling, rate dematching, LDPC decoding, and a CRC check.
On a GPU you write these kernels in CUDA. Aerial cuPHY does exactly that. On Trainium the
equivalent surface is NKI, a Python-embedded kernel language that compiles to the Trainium Tensor,
Vector, and Scalar engines with an explicit 128-partition on-chip memory model.
Reference architecture
At runtime, Trainium sits as an inline L1 accelerator behind a fronthaul gateway. The gateway (the
DU) terminates the O-RAN 7.2x eCPRI fronthaul, which is the hard-real-time, PTP-synced transport.
It hands IQ samples and soft bits to the Neuron device for the compute-heavy PHY and reads the
decoded transport block back. Trainium does compute. It does not do fronthaul transport.
(O-RAN 7.2x eCPRI, PTP-synced) ┌──────────┐ IQ ┌─────────────────────┐ │ Radio │ ──────► │ Fronthaul gateway │ │ Unit │ │ (DU) │ └──────────┘ └─────────┬───────────┘ IQ / soft │ bits CRC-checked ▼ transport block ▲ ┌───────────────────────────────────────────────────────────┐ │ AWS Trainium2 - inline L1 accelerator (NKI kernels) │ │ │ │ OFDM ► Channel ► MMSE ► QAM ► Rate ► LDPC ► CRC │ demod est equalize demap dematch decode │ │ (Tensor) (Vec+Tns) (Vector) (Vec/Scl) (Tensor) (Vec) │ │ │ │ intermediates SBUF-resident · 128-partition tiling · PSUM │ └───────────────────────────────────────────────────────────┘ │ decoded transport block ▼ L2 / MACEach stage maps to a Trainium engine, shown in the table below.
Stage | Trainium mapping | Engine |
|---|---|---|
OFDM demod | DFT as matmul, twiddles resident in SBUF, contraction tiled over 128 partitions, PSUM-accumulated | Tensor |
Channel estimate | LS at pilots, then interpolation as a matmul by a precomputed matrix (linear or MMSE by swapping the matrix) | Vector + Tensor |
MMSE equalizer | Closed-form analytic inverse, branch-free, subcarriers batched on the partition axis | Vector |
QAM demapper | Max-log-MAP LLRs via masked-min over the constellation, compile-time masks, no branching | Vector / Scalar |
Rate dematch | Circular-buffer combining as a scatter matmul, no gather/scatter | Tensor |
LDPC decode | Layered min-sum, parity structure unrolled at trace time, code blocks batched on partitions | Vector |
A pattern repeats across the chain. Nearly every stage is a matmul on the Tensor engine or an
elementwise operation with the batch dimension on the 128 partitions, and control flow stays
static. On any AI accelerator, that layout is what makes the port predictable and the latency
deterministic.
The build method
I used one rule: never write a device kernel before its plain-NumPy reference passes conformance.
The order per kernel runs NumPy golden reference, then simulator equivalence, then device run.
Hard outputs like decoded bits and CRC must match the reference exactly. Soft outputs like LLRs
match within a documented tolerance. I never loosened a tolerance to pass a test.
I drove the build with Claude Code and the AWS Neuron NKI skills, with a real Trainium2 instance
in the loop. The NKI skills front-loaded expertise the model would otherwise lack: the writing
skill knew the matmul and batch-on-partitions idioms, and the debugging skill turned raw compiler
errors into targeted fixes. The loop was a general model equipped with domain skills, iterating
against real silicon.
The method is not mine. AWS researchers described the compile-verify-fix-on-Trainium approach in
NKI-Agent (arXiv:2607.04395) , by Junjie Tang, Jun Huan, Hao
Zhou, Yuhao Zhang, and Lin Wang, and shipped it as the
neuron-agentic-development skills. Their
result: a model's single-shot NKI solve rate is low, but the same model inside a compile-verify-fix
loop on real Trainium compiles and verifies at far higher rates. My results corroborate that claim
on a real workload.
What real hardware caught
Two kernels passed the NKI functional simulator and still failed to compile for silicon.
The OFDM DFT kernel combined two matmul results with a single subtract. That reads two accumulator
(PSUM) inputs in one instruction, which the compiler forbids. The fix copies each matmul result
from PSUM to SBUF before combining. The QAM demapper sliced an SBUF tile at a partition that was
not a multiple of 32, which violates bank alignment. The fix loads the row from HBM so it lands at
partition 0. The simulator missed both. The device compiler caught both at once.
This is the reason to keep real hardware in the loop. A port that trusts a simulator ships kernels
that do not compile. With silicon in the loop, each failure became a five-minute fix. The
reference-first rule caught two more issues before silicon: single-limb BF16 twiddle factors
missed the 1e-3 accuracy budget at 1.3e-3 (fixed with a two-limb representation at 1.9e-6), and a
1 - 2*x sign map wrapped for unsigned bytes, where 1 - 2 equals 255.Measured on silicon
I benchmarked five kernels on the trn2.3xlarge with nki.benchmark. These are small-dimension
component microbenchmarks, not a full-slot budget.
Kernel | NeuronCore latency (p50) |
|---|---|
Precode | 18 us |
QAM demapper | 29 us |
LDPC decode (32 code blocks, 10 iterations) | 30 us |
MMSE equalizer 2x2 | 32 us |
OFDM DFT (N=512) | 35 us |
The number that matters for a RAN engineer is not the absolute latency. It is that p99 equals p50
on every kernel. Static control flow produces no data-dependent latency spikes. Deterministic
compute is the property a real-time slot budget needs.
A neural receiver on the same accelerator
I trained a small MLP demapper to imitate the classical max-log-MAP demapper, compiled it to
Trainium with torch_neuronx.trace, and compared bit-error rates on identical symbols. The neural
demapper tracks the classical one within 1% BER across the SNR sweep, with 100% bit-agreement at
high SNR. The same accelerator runs the hand-written DSP kernels and a learned neural receiver.
Where this fits Nokia's AI-RAN framework
I map this proof-of-concept onto Nokia's published vision. This is illustration, not affiliation.
Nokia frames the space through the AI-RAN Alliance's three pillars, and this work touches two.
AI-and-RAN means RAN and AI workloads share tensor-optimized compute. Nokia's papers describe a
general-purpose accelerator substrate with spare AI compute for workloads beyond RAN. A full 5G L1
chain running as NKI kernels on Trainium shows that this shared substrate can be AWS AI silicon.
AI-for-RAN means AI enhancing the radio, up to the AI-native air interface. Nokia's roadmap runs
from the traditional chain to a Neural Demapper to a full Neural Receiver. This project sits on the
first two rungs: the traditional NKI chain plus a neural demapper on the same device. Nokia reports
a CNN-based mapper delivering a 2 dB BER improvement over a non-ML receiver. My neural demapper
tracking the classical one within 1% BER corroborates that this block runs on Trainium.
What this is and is not
This work is not real-time-validated. The benchmarks run at component scale, not a full 273-PRB,
4096-FFT, Z=384-LDPC slot. At real dimensions a single-core fp32 chain will exceed a 0.5 ms slot,
with the LDPC decoder as the pole. The path to real-time is known: INT8 LDPC, a fused graph,
multi-core parallelism, and BF16. That path is not done.
This work is validated against my own NumPy reference, not against NVIDIA's HDF5 test vectors. I
confirmed sign and bit-ordering conventions by round-trip. Direct Aerial-vector conformance is the
next step. There is no GPU head-to-head on identical vectors. Any comparison to published Aerial
numbers is cross-published and labeled as such. This work is not affiliated with or endorsed by
Nokia, NVIDIA, or the AI-RAN Alliance.
Why it matters
Nokia and NVIDIA proved the direction. Customers are served best when they have choice in L1
acceleration, so a vendor targets the accelerator that fits their power, cost, and supply needs,
because the PHY is written portably against a clean reference. This project is one data point
toward that: a full 5G receive chain, clean-room, on a non-GPU AI accelerator, built in days
because AI agents closed the verification loop against real silicon.
Acknowledgments
This work rests on my AWS colleagues' foundations. The AWS Neuron team behind
NKI-Agent defined the compile-verify-fix-on-Trainium method.
The neuron-agentic-development
maintainers built the NKI skills that put domain expertise in the agent's hands. The Neuron and NKI
team built the kernel interface and neuronx-cc toolchain. The method is theirs. The clean-room 5G
port, and any mistakes in it, are mine.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article