What Is AWS Inferentia (and Trainium)? Inf2 Sizes and Prices, Trainium3, Inferentia vs Trainium vs GPU, and Running a Model on Inf2
AWS Inferentia and AWS Trainium are Amazon's own AI chips, rented as EC2 instances instead of NVIDIA GPUs. Inferentia is built for inference (running trained models): the current Inferentia2 chip has 32 GB of HBM memory and up to 190 TFLOPS of FP16, and powers Inf2 instances from inf2.xlarge (1 chip, about $0.76 an hour On-Demand in US East) to inf2.48xlarge (12 chips, 384 GB, about $12.98 an hour). Trainium started as a training chip, and the newest Trainium3 (144 GB of HBM3e per chip, in UltraServers of up to 144 chips) is now positioned for both training and large-scale inference. There is no Inferentia3 so far: Inferentia2 is still the newest Inferentia. Both run through the AWS Neuron SDK (PyTorch, JAX, Hugging Face, vLLM), and AWS claims up to 40% better price performance than comparable instances for supported models. They make sense for steady, high-volume inference of popular model architectures; for occasional use or unusual models, Bedrock or a GPU is simpler. Below: the chip generations, Inf2 sizes and prices, Inferentia vs Trainium vs GPU vs Graviton, cost math, how to run a model on Inf2, quotas and the errors you will meet.
The shop's product search used an open embedding model and a small LLM on a GPU instance that ran around the clock. The monthly bill caught Ethan's eye, and someone on a forum said "try Inferentia". Jake's first question was the obvious one: is that a different kind of computer, and will our model even run on it?
New to AI on AWS? The cards below cover Bedrock vs SageMaker, Hugging Face on AWS, Bedrock itself and the two EC2 capacity errors you may meet with AI instances.
What is AWS Inferentia?
What is AWS Inferentia, in plain terms? It is a chip Amazon designed for one job: running trained machine learning models fast and cheaply. When you ask a chatbot a question or search a catalog by meaning, the "inference" step (feeding your input through the model) is what Inferentia accelerates. Training, the far heavier job of creating the model in the first place, is not its purpose.
You never buy the chip. You rent EC2 instances that contain it, exactly as you would rent a GPU instance, and you use the AWS Neuron SDK to compile and run your model on it. Neuron plugs into PyTorch and JAX, and into the Hugging Face and vLLM tools most teams already use, so for supported models the change is closer to "export for Neuron" than "rewrite the model".
Why would AWS build its own chips? Cost and supply. GPUs are expensive and often scarce; a chip designed only for inference can drop parts a GPU needs for graphics and general computing, and pass the savings on. AWS claims Inf2 offers up to 40% better price performance and up to 50% better performance per watt than comparable EC2 instances. Customers report big savings too, such as Leonardo.ai cutting costs by 80% with Inferentia2, though your own results depend on your model.
Jake: "So it's a GPU, but only for running models?"
Ethan: "Close enough. An accelerator built only for inference, with its own software instead of CUDA."
Every generation of Inferentia and Trainium
| Chip | EC2 instances | Built for | Key specs |
|---|---|---|---|
| Inferentia (first generation) | Inf1 | Inference | 4 NeuronCores and 8 GB DDR4 per chip; up to 16 chips per instance; FP16, BF16, INT8 |
| Inferentia2 | Inf2 | Inference, including LLMs split across chips | 2 NeuronCores and 32 GB HBM per chip; up to 190 TFLOPS FP16; up to 12 chips per instance; adds FP32, TF32 and FP8 |
| Trainium | Trn1, Trn1n | Training | First-generation training chip |
| Trainium2 | Trn2, Trn2 UltraServers | Training and inference of large models | The generation many frontier labs train on |
| Trainium3 | Trn3 UltraServers (up to 144 chips) | Training and inference at the largest scale | 144 GB HBM3e per chip at 4.9 TB/s; up to 2x Trainium2's MXFP8 compute; hardware support for mixture-of-experts routing and 4-bit weights |
Two things the table makes clear. First, the naming is about the original purpose: Inferentia for inference, Trainium for training. Second, the newest work has gone into Trainium, and AWS now pitches it for inference too, especially for the very large mixture-of-experts models where Trainium3's memory and routing features matter. For one-instance inference of a model that fits in tens of gigabytes, Inf2 is still the chip you rent.
Is there an Inferentia3? Not as of October 2026. Inferentia2 is the newest Inferentia chip; AWS's newer silicon is Trainium3, which covers large-scale inference as well as training.
AWS Inferentia2 architecture: inside the chip, and what it means for you
The spec sheet is short, and each line matters for a real decision:
- Two NeuronCore-v2 cores per chip. Each core gets half the chip's memory, about 16 GB, which is why a model larger than that has to be split across cores (the
tensor_parallel_sizesetting you will meet below). - 32 GiB of HBM per chip, at 820 GiB/s. Memory size decides which models fit; memory bandwidth decides how fast an LLM produces tokens, because every new token reads the whole set of weights once.
- Compute per chip: 190 TFLOPS at FP16, BF16, cFP8 or TF32, 380 INT8 TOPS, and 47.5 TFLOPS at FP32. The headline number assumes 16-bit or 8-bit math, so plan to run your model in BF16 or FP16, not FP32.
- NeuronLink-v2 joins the chips inside an instance, so a model split across the 12 chips of an inf2.48xlarge behaves as one large accelerator.
- Dynamic shapes, control flow and custom operators are supported in hardware (custom operators run on small built-in GPSIMD engines), which widens the set of models that compile without changes.
A rough rule for LLM speed: divide memory bandwidth by the size of the weights. An 8B-parameter model in BF16 is about 16 GB, so one chip's 820 GiB/s gives an upper bound of roughly 50 new tokens a second for a single conversation. Real numbers come in lower, and batching several conversations together raises the total throughput, which is exactly why steady, busy traffic suits Inferentia better than one user at a time.
Jake: "So the memory number is the one that decides everything?"
Ethan: "For an LLM, nearly. Size says whether it fits; bandwidth says how fast it talks."
Inf2 instance sizes and prices
Four sizes, priced On-Demand in US East (N. Virginia); other Regions differ, and not every Region offers Inf2:
| Size | Inferentia2 chips | Accelerator memory | vCPUs / RAM | Network | On-Demand |
|---|---|---|---|---|---|
| inf2.xlarge | 1 | 32 GB | 4 / 16 GiB | Up to 15 Gbps | About $0.76/hour |
| inf2.8xlarge | 1 | 32 GB | 32 / 128 GiB | Up to 25 Gbps | About $1.97/hour |
| inf2.24xlarge | 6 | 192 GB | 96 / 384 GiB | 50 Gbps | About $6.49/hour |
| inf2.48xlarge | 12 | 384 GB | 192 / 768 GiB | 100 Gbps | About $12.98/hour |
How to pick for your model:
- inf2.xlarge: embedding models, rerankers, BERT-style classifiers, image models and small LLMs (roughly up to 7-8B parameters at 16-bit, which need about 16 GB plus room for the cache). Cheapest way in.
- inf2.8xlarge: the same single chip with far more CPU and RAM, for heavy pre-processing or tokenization next to the model.
- inf2.24xlarge: models that need several chips, such as 30-70B-class LLMs split across 6 chips (tensor parallelism).
- inf2.48xlarge: the biggest models Inf2 can hold, into the hundreds of billions of parameters across 12 chips.
Savings Plans and Reserved Instances apply to Inf2 like any EC2 family, and Spot capacity, when available, cuts the price further for work that can be interrupted; our Spot guide covers handling interruptions.
The number that matters most when you size: NeuronCores. inf2.xlarge and inf2.8xlarge have 2, inf2.24xlarge has 12, and inf2.48xlarge has 24. Serving tools ask for a tensor parallel size, and it has to be no larger than the cores on the instance.
Inf1 vs Inf2: is Inf1 still worth using?
Inf1, the first generation, still appears in searches and in older tutorials, and its low hourly price is tempting: an inf1.xlarge (one first-generation chip) costs about $0.23 an hour On-Demand in US East, against about $0.76 for an inf2.xlarge. Sizes run inf1.xlarge and inf1.2xlarge (1 chip each), inf1.6xlarge (4 chips) and inf1.24xlarge (16 chips).
The differences that decide it:
- Memory: an Inf1 chip has 8 GB of DDR4; an Inferentia2 chip has 32 GB of much faster HBM. Modern LLMs and most current embedding models are a poor fit for Inf1.
- Software: Inf1 uses the older compiler and the original PyTorch Neuron package; Inf2 uses the neuronx compiler and
torch-neuronx. A model compiled for one generation does not run on the other, so moving means recompiling and retesting. - Features: Inf2 adds FP32, TF32 and FP8 support, chip-to-chip links for splitting large models, and hardware support for dynamic shapes and custom operators.
- Tooling: new serving libraries such as vLLM's Neuron backend and Optimum Neuron's LLM export target Inf2 and Trainium, not Inf1.
The practical answer: keep an existing Inf1 workload running while it works and is cheap (small computer-vision or BERT-era classifiers are fine there), and start every new project on Inf2.
Where Inf2 is available, and how to check your quota
Inf2 is not in every Region, and inside a Region not every Availability Zone has it. Check before you design around it, with two AWS CLI commands you can run from any terminal:
aws ec2 describe-instance-type-offerings --region us-east-1 \ --location-type availability-zone \ --filters Name=instance-type,Values=inf2.xlarge \ --query "InstanceTypeOfferings[].Location" --output text aws service-quotas list-service-quotas --service-code ec2 --region us-east-1 \ --query "Quotas[?contains(QuotaName, 'Inf')].[QuotaName,Value]" --output table
The first lists the zones that offer inf2.xlarge in that Region (an empty answer means none). The second shows your Inf quotas; the quota is counted in vCPUs, so an inf2.xlarge needs 4 and an inf2.48xlarge needs 192. A value of 0 means you must request an increase before the first launch, and new accounts often start there.
Three planning habits help here. Pick a Region where at least two zones offer Inf2, so one busy zone does not stop a scale-out. Request quota for your peak, not your first instance, because increases can take a while to approve. And if your data must stay in a specific country, confirm Inf2 is offered there before anyone writes code, since the fallback is a GPU instance with a different software stack.
What is AWS Trainium, and Trainium vs Inferentia
What is AWS Trainium? It is the sister chip, built first for training models, with fast chip-to-chip links so thousands of chips can work on one model together. Trainium2 and now Trainium3 are where AWS has put its biggest investment; large AI labs train frontier models on them. Trainium3 chips each carry 144 GB of HBM3e memory with 4.9 TB/s of bandwidth, and an UltraServer joins up to 144 of them with 20.7 TB of combined memory.
The practical Trainium vs Inferentia answer for most teams:
- Running a model that fits in 32-384 GB for your app (search, chat, classification): Inferentia2 (Inf2). Smaller instances, lower hourly prices.
- Training or fine-tuning a model beyond a few GPUs' worth: Trainium (Trn1 or Trn2 instances), or SageMaker training jobs on them.
- Serving a very large mixture-of-experts model at high volume: Trainium2 or Trainium3 UltraServers, usually a decision for large platforms rather than a single app team.
- Just calling a model: neither; use Amazon Bedrock and let AWS run the hardware.
Both use the same Neuron SDK, so skills and tooling carry over between them.
Inferentia vs NVIDIA GPU vs Graviton
| Inferentia2 (Inf2) | NVIDIA GPU (G5, G6, G6e, P5) | Graviton (C8g, M8g) | |
|---|---|---|---|
| What it is | AWS AI accelerator for inference | General-purpose AI accelerator | AWS Arm CPU, not an AI accelerator |
| Software | Neuron SDK (PyTorch, JAX, Hugging Face, vLLM) | CUDA: runs almost everything | Standard CPU code (Arm builds) |
| Model support | Popular architectures; new or exotic ones may need work | Everything, on day one | Small models only, slowly |
| Entry price | inf2.xlarge about $0.76/hour | g5.xlarge about $1.01/hour | Cents per hour |
| Best for | Steady, high-volume inference of supported models | Flexibility, experiments, newest models, custom kernels | The web and API servers around your model |
Graviton appears in the same searches but solves a different problem: it is Amazon's Arm processor for ordinary computing. A common, cost-effective setup uses all three: Graviton for the web tier, Inferentia for the model behind it, and a GPU only where a model will not run on Neuron.
Jake: "So the catch is software, not speed?"
Ethan: "Mostly. If our model is on the supported list, Inferentia is cheaper. If it isn't, we'd spend the savings on engineering."
Inferentia vs Google TPU and other custom AI chips
AWS is not the only cloud building its own AI silicon, and "Inferentia vs TPU" is a common search once teams compare clouds. The short version:
- Google TPUs are Google's custom accelerators, rented on Google Cloud. Like Inferentia, they use their own compiler stack (XLA, used through JAX, PyTorch/XLA or TensorFlow) rather than CUDA, and like Trainium they cover both training and inference at large scale.
- Microsoft's Maia and Meta's MTIA are custom chips built mainly to run those companies' own services; you meet them indirectly, through products, rather than renting them by the hour.
- AWS Inferentia and Trainium are rented as EC2 instances in your own account, which is their practical difference: you get root on the machine, your own VPC, and the usual EC2 pricing options.
How to choose between clouds' chips? Follow your data and your team, not the chip. If your app, data and skills already live on AWS, Inferentia avoids moving data and learning a second cloud. If you run on Google Cloud and build with JAX, TPUs are the natural fit. In both cases the same lesson applies: custom chips are cheapest for popular model architectures served at steady volume, and every one of them asks for a compile step that a GPU does not.
The software point deserves weight in any comparison. A model you can export with one Optimum Neuron command is a day's work; a new architecture with unusual layers may need support that has not arrived yet. Check your exact model, at your exact precision, before you compare price sheets.
Cost math: when Inferentia pays off
A 24/7 instance runs about 730 hours a month. For a model that fits one chip:
- inf2.xlarge: 730 × $0.76 ≈ $555 a month On-Demand.
- g5.xlarge (one NVIDIA A10G, 24 GB): 730 × $1.01 ≈ $737 a month.
- With a one-year Savings Plan, either drops considerably; the gap stays roughly the same in proportion.
But the hourly price is only half the story; what matters is cost per request. If Inf2 also serves more requests per second for your model (which supported models often do), the saving per request is bigger than the hourly difference. Measure it: run the same load test on both instance types, divide the hourly price by requests per hour, and compare. Then add the one-off engineering time to compile and test on Neuron. For a model you will run for a year, that time usually pays back; for a three-week experiment, it rarely does.
The other comparison is with managed APIs: if your traffic is spiky or small, paying per token on Amazon Bedrock can beat any instance that sits idle at night. Our Bedrock pricing guide helps you estimate that side.
A worked comparison: cost per million requests
Hourly prices compare instances; cost per request compares what you actually buy. This is the method Ethan used for the shop's embedding model, and it fits any model:
- Fix the test: the same model, the same precision (BF16 on both), the same input lengths drawn from real traffic, and the same latency limit (for search, say, 50 ms at the 95th percentile).
- Find the best throughput under that limit on each instance, raising the batch size or concurrency until latency crosses the limit.
- Convert to cost: cost per million requests = hourly price ÷ (requests per second × 3,600) × 1,000,000.
- Add the one-off work: compile, test and pipeline changes, spread over the months you expect to run.
An illustration with round numbers, to show how the formula behaves (your own test gives the real ones): if a g5.xlarge at $1.01 an hour sustains 200 requests a second, a million requests cost $1.01 ÷ 720,000 × 1,000,000 ≈ $1.40. If an inf2.xlarge at $0.76 sustains 250 a second, the same million cost about $0.84. Now the saving is 40%, not the 25% the hourly prices suggest. If the Inf2 test had only reached 150 a second, the cost would be about $1.41 and the move would not be worth the engineering. The hourly price alone can't tell those two outcomes apart; the load test can.
A small Python load test is enough for a first answer. This one sends concurrent requests to an HTTP endpoint and reports throughput and the 95th-percentile latency:
import time, statistics, concurrent.futures, requests
URL = "http://localhost:8080/embed"
TEXTS = ["blue rain jacket, size large"] * 2000
def call(text):
start = time.perf_counter()
requests.post(URL, json={"text": text}, timeout=10).raise_for_status()
return time.perf_counter() - start
t0 = time.perf_counter()
with concurrent.futures.ThreadPoolExecutor(max_workers=16) as pool:
latencies = sorted(pool.map(call, TEXTS))
elapsed = time.perf_counter() - t0
print(f"throughput: {len(TEXTS) / elapsed:.1f} req/s")
print(f"p95 latency: {statistics.quantiles(latencies, n=20)[-1] * 1000:.1f} ms")
Run it from a separate machine in the same Availability Zone, change max_workers to find the point where latency crosses your limit, and use the throughput at that point in the formula above.
Cutting the Inf2 bill further
Once Inf2 wins the comparison, these habits keep the bill falling:
- Savings Plans: a Compute Savings Plan or an EC2 Instance Savings Plan covers Inf2 like other EC2 families; commit only to the baseline you are sure of and leave peaks On-Demand.
- Scale with the day: an Auto Scaling group with scheduled actions can drop to one instance overnight when traffic falls, which on a three-instance fleet removes a large slice of the monthly hours.
- Share a chip: two small models that each need one NeuronCore can run on one inf2.xlarge instead of two instances (on EKS, request
aws.amazon.com/neuroncoreper pod). - Right-size the shapes: compiling for 512 tokens when 95% of requests are under 300 wastes less than compiling for 4,096; route the rare long request to a second model compiled for long inputs.
- Batch where latency allows: batch jobs such as re-embedding the whole catalog overnight should use the largest batch the memory allows; they finish in a fraction of the instance hours.
- Spot for batch work: catalog re-indexing and offline scoring can run on Spot capacity and resume after an interruption.
Should you use Inferentia? A quick checklist
- Is your model architecture supported by Neuron (Llama-family and other popular LLMs, BERT-style encoders, common vision and diffusion models)? If not, stop here and use a GPU.
- Is the load steady, with the instance busy most hours? If it is idle at night, consider Bedrock, SageMaker serverless options, or scaling to zero.
- Will you run it for months, long enough to repay the compile-and-test work?
- Does it fit in 32 GB per chip at your precision, or can it be split across chips?
- Is Inf2 available in your Region, with quota on your account (see errors)?
Five yeses: try it. One or two noes: a GPU or Bedrock is likely the better use of your time. Our Bedrock vs SageMaker guide covers the managed options in between.
Which models run well on Inferentia2?
Question one on the checklist decides everything, so here is what "supported" usually means in practice, by model family:
- Encoders for search and classification (BERT, RoBERTa, DistilBERT and the sentence-embedding models built on them): the easiest wins. They compile in minutes with Optimum Neuron, fit easily on one core, and are exactly the steady, high-volume work Inferentia was built for.
- Popular decoder LLMs (the Llama family and other widely used open models): supported through NxD Inference and Optimum Neuron, from 1B models on one chip to very large ones split across an inf2.48xlarge. Brand-new architectures can lag behind their GPU support by weeks or months.
- Image generation: Stable Diffusion and SDXL pipelines export with Optimum Neuron, which compiles the heavy parts (text encoders, U-Net, VAE) for the chip; image size is fixed at export, such as 1024 × 1024 for SDXL.
- Vision and multimodal models: common vision transformers and CLIP-style encoders work; newer vision-language models vary, so check each one.
- Custom research models with unusual layers: possible through
torch-neuronxand custom operators, but this is where the engineering cost lives.
The quickest test of your own model takes an afternoon: launch an inf2.xlarge, run the Optimum Neuron export with your real shapes, and read the validation summary. If it compiles and the outputs match the CPU version, you are in the cheap category. If the compiler stops on an unsupported operator, you have learned the answer for the price of a few instance hours, before anyone has rewritten a pipeline. Both supported-model lists (Optimum Neuron's architecture reference and the NxD Inference model list) change with each release, so check them on the day you decide, not from memory.
Jake: "Our embedding model is a sentence-transformers one. That's the easy pile?"
Ethan: "The easiest. The chat model is the one to test first, because that's where a missing layer would stop us."
The AWS Neuron SDK, explained
Inferentia has no CUDA. Everything runs through the AWS Neuron SDK, and knowing its parts saves you hours when a tutorial names a package you have never seen:
| Part | What it does | When you touch it |
|---|---|---|
| Driver and runtime | Let the operating system and your process use the chips | Preinstalled on the Neuron AMIs and containers |
Compiler (neuronx-cc) | Turns a model into a NEFF file, the chip's executable format, for fixed input shapes | Indirectly, every time you export a model |
torch-neuronx and JAX support | Run PyTorch and JAX models on Neuron | Custom models and your own code |
| NxD Inference | AWS's library for serving LLMs split across cores and chips | Under vLLM; directly for advanced tuning |
| Optimum Neuron (Hugging Face) | One-command export and familiar from_pretrained loading for Hub models | The easiest start for most teams |
| Tools | neuron-ls (list chips), neuron-top (live use), neuron-monitor (metrics), the profiler | Setup checks, tuning, production monitoring |
| NKI (Neuron Kernel Interface) | Write your own low-level kernels in Python | Only for performance specialists |
Three facts about Neuron that catch people out:
- Compiled models are tied to the chip generation and, usually, to the SDK version. A model compiled for Trainium2 does not run on Inferentia2 and the other way round, and an upgrade of the SDK generally means recompiling. Pin the SDK version in your container and recompile on purpose, not by accident.
- Shapes are fixed at compile time. Batch size and sequence length are baked in. Inputs are padded up to those shapes, so a 4,096-token setting for traffic that is mostly 300 tokens wastes compute on every request.
- Older paths are closing. The
transformers-neuronxlibrary has been replaced by NxD Inference, and Neuron 2.28 was the last release with TensorFlow support for Inf2, so new work belongs on PyTorch (or JAX). Tutorials that start with either of the old paths are out of date.
Jake: "The blog post I found used transformers-neuronx."
Ethan: "Then it's from before the switch. Look for Optimum Neuron or NxD Inference instead, and check the date before you copy anything."
How to run a model on Inf2
The usual path for an open model from Hugging Face:
- Request quota for "Running On-Demand Inf instances" in Service Quotas if your account shows 0 for it.
- Launch an inf2 instance from a Neuron deep learning AMI, which has the Neuron driver, runtime and PyTorch environment ready.
- Check the chips are visible with
neuron-ls, and watch utilization later withneuron-top. - Compile (export) the model for Neuron: Hugging Face's Optimum Neuron library exports supported models, and many popular ones have pre-compiled versions that skip the long first compile. Compilation fixes settings such as batch size and sequence length, so choose them for your real traffic.
- Serve it: vLLM with the Neuron backend (NxD Inference) gives an OpenAI-compatible endpoint for LLMs; Hugging Face's Neuron containers and SageMaker endpoints are the managed alternatives.
- Load test, compare cost per request with your GPU baseline, and only then move production traffic.
For containers, Inf2 works with ECS and EKS once the Neuron device plugin and drivers are on the node; our ECS explainer covers the basics. If you prefer not to manage instances at all, SageMaker can deploy many Hugging Face models to Inf2 endpoints for you, and our Hugging Face on AWS guide compares the routes.
Hands-on: export and run a model with Optimum Neuron
Here is the shortest real path from a Hugging Face model to an answer on Inferentia2. Install the Neuron extra of Optimum on your Neuron AMI or container:
pip install "optimum-neuron[neuronx]"
A small classifier or encoder (the embedding and classification models most search features use). Export with fixed shapes and 16-bit matrix math:
optimum-cli export neuron --model distilbert-base-uncased-finetuned-sst-2-english \ --batch_size 1 --sequence_length 128 \ --auto_cast matmul --auto_cast_type fp16 \ sst2_neuron/
from transformers import AutoTokenizer
from optimum.neuron import NeuronModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("sst2_neuron/")
model = NeuronModelForSequenceClassification.from_pretrained("sst2_neuron/")
inputs = tokenizer("The jacket arrived fast and fits well.", return_tensors="pt")
logits = model(**inputs).logits
print(model.config.id2label[logits.argmax().item()])
The export settings are saved next to the model, so loading needs no extra arguments. The export also checks the Neuron output against the CPU version and prints a validation summary; read it before you trust the model.
A small LLM. Same idea, with a tensor parallel size that splits the model across the two cores of one chip:
optimum-cli export neuron --model meta-llama/Llama-3.2-1B \ --batch_size 1 --sequence_length 4096 --tensor_parallel_size 2 \ llama_neuron/
import torch
from transformers import AutoTokenizer
from optimum.neuron import NeuronModelForCausalLM
model = NeuronModelForCausalLM.from_pretrained("llama_neuron/")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")
tokenizer.pad_token_id = tokenizer.eos_token_id
tokens = tokenizer("Write a two-line product description for a blue rain jacket:", return_tensors="pt")
with torch.inference_mode():
out = model.generate(**tokens, do_sample=True, max_new_tokens=128, temperature=0.7)
for seq in out:
print(tokenizer.decode(seq, skip_special_tokens=True))
Things to know before you press enter:
- LLM exports are slow. Large models can take more than an hour to compile. Save the output folder (to S3 or a container image) so you compile once, not on every start.
- You can compile without paying for Inf2 time. Exports can run on a CPU-only instance if you name the target with
--instance_type inf2; then copy the result to the Inf2 instance. - The limits are hard. Requests cannot use a larger batch than you exported, and prompt plus generated tokens cannot exceed the exported sequence length. Pick both from your real traffic, with a little headroom.
- Pre-compiled models exist. Many popular models have Neuron versions on the Hugging Face Hub (the
aws-neuronorganization), which skip the compile entirely if their shapes suit you.
Serving an LLM with vLLM on Inf2
For a chat feature you want an HTTP endpoint, not a Python script. vLLM runs on Neuron through a plugin backed by NxD Inference, and gives you the same OpenAI-compatible API it offers on GPUs, so your app code does not change when you move. Hugging Face also publishes a ready container image with Optimum Neuron and vLLM installed (ghcr.io/huggingface/optimum-neuron-vllm), which is the quickest way to try it.
The settings that matter on Inferentia:
--tensor-parallel-size: how many NeuronCores to split the model across; no more than the instance has (2 on inf2.xlarge, 24 on inf2.48xlarge).--max-model-len: the longest prompt plus answer you will serve; this becomes a compiled shape, so be realistic.--max-num-seqs: how many conversations are batched together; higher raises total throughput at some cost in per-user speed.- The model folder: point vLLM at a pre-compiled Neuron model when you have one, so the server starts in minutes instead of compiling.
Once it is running, any OpenAI-style client works against it:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "llama_neuron", "messages": [{"role": "user", "content": "Is the blue jacket waterproof?"}], "max_tokens": 100}'
The exact flags and environment variables for the Neuron backend have changed between Neuron releases, so copy them from the quickstart that matches your SDK version rather than from an old blog post. Our vLLM guide covers the server itself.
Inferentia on SageMaker and EKS
SageMaker endpoints. If you would rather not manage instances, SageMaker AI can host a Neuron model on ml.inf2 endpoint instances. You pay a managed premium: ml.inf2.xlarge runs roughly $0.99 an hour against about $0.76 for the bare EC2 instance, in exchange for health checks, scaling and deployment handled for you. Hugging Face's Neuron containers read the model ID, batch size, sequence length and tensor parallel size from environment variables (SM_ON_MODEL, SM_ON_BATCH_SIZE, SM_ON_SEQUENCE_LENGTH, SM_ON_TENSOR_PARALLEL_SIZE), and these must match the values the model was compiled with. Our SageMaker pricing guide covers the rest of that bill.
EKS. Kubernetes needs the Neuron device plugin before pods can see the chips; AWS publishes it as a Helm chart (oci://public.ecr.aws/neuron/neuron-helm-chart). The plugin offers two resources: aws.amazon.com/neuron for whole chips and aws.amazon.com/neuroncore for single cores. A pod that wants one chip asks for it like a GPU:
apiVersion: v1
kind: Pod
metadata:
name: embed-server
spec:
tolerations:
- key: aws.amazon.com/neuron
operator: Exists
effect: NoSchedule
containers:
- name: server
image: 111122223333.dkr.ecr.us-east-1.amazonaws.com/embed-neuron:1.0
resources:
limits:
aws.amazon.com/neuron: 1
Ask for neuroncore instead when a small model only needs one core; two such pods can then share one inf2.xlarge chip. On ECS, the Neuron-optimized AMI and a task definition that maps the Neuron devices do the same job.
Monitoring Inf2 in production
A GPU dashboard will not show Inferentia, so set up Neuron's own tools from day one:
neuron-topon the instance for a live view of each NeuronCore and the device memory, the first thing to open when a load test looks slow.neuron-monitorfor continuous metrics: NeuronCore utilization per core, memory use, errors and execution statistics, as JSON.- Prometheus and Grafana: a companion script converts neuron-monitor's output into Prometheus format; on EKS it runs as a DaemonSet feeding Amazon Managed Service for Prometheus and Managed Grafana.
- CloudWatch: on EKS, the CloudWatch Observability add-on picks up Inferentia and Trainium health metrics for you.
The two numbers to alarm on are NeuronCore utilization and request latency. Utilization stuck near 100% with rising latency means it is time to scale out; utilization under 20% all day means you are paying for an instance that a smaller size, a shared chip or a per-token API would serve for less.
Errors and fixes
VcpuLimitExceededwhen launching inf2: Inf instances have their own vCPU quota, often 0 on new accounts. Request an increase; our vCPU limit guide walks through it.InsufficientInstanceCapacity: no Inf2 capacity in that zone right now; try another Availability Zone or Region, or a capacity reservation. Our capacity guide lists the options.- Compilation fails on an unsupported operator: the model uses a layer Neuron does not support yet. Update the Neuron SDK, look for a pre-compiled or supported variant, or keep that model on a GPU.
- Out of device memory: the model plus its cache does not fit in 32 GB; lower the batch size or sequence length, or split across more chips on a bigger size.
- Slow first start: compiling large models takes a long time; cache the compiled artifacts (in S3 or a container image) so restarts and scale-outs skip it.
- Input shapes rejected at runtime: a request is longer than the sequence length you compiled for; compile for your real maximum, or route long requests elsewhere.
Jake: "The embedding model moved to an inf2.xlarge and the search bill dropped by a third."
Ethan: "And the LLM stayed on the GPU, because its architecture isn't supported yet. Use both. That's fine."
Frequently asked questions
What is AWS Inferentia?
An AI chip designed by AWS for running trained models (inference), available in EC2 Inf1 and Inf2 instances.
What is AWS Trainium?
AWS's AI chip for training models, now also used for large-scale inference; the newest generation is Trainium3.
What is the difference between Inferentia and Trainium?
Inferentia is built for inference on smaller instances; Trainium is built for training and very large-scale inference, with faster chip-to-chip links.
Is there an AWS Inferentia3?
Not as of October 2026; Inferentia2 is the newest Inferentia, and AWS's newer chip is Trainium3.
How much does an inf2.xlarge cost?
About $0.76 an hour On-Demand in US East (N. Virginia), or roughly $555 a month running continuously.
How much memory does Inferentia2 have?
32 GB of HBM per chip; inf2 instances have 1, 6 or 12 chips (32 to 384 GB).
Is Inferentia cheaper than a GPU?
Per hour, inf2.xlarge is cheaper than g5.xlarge; per request, supported models are often cheaper still, but test with your own model.
What software do I need for Inferentia?
The AWS Neuron SDK, which works with PyTorch, JAX, Hugging Face Optimum Neuron and vLLM.
Can I run LLMs on Inferentia?
Yes, popular architectures, from small models on one chip to very large ones split across 12 chips on inf2.48xlarge.
Can I train models on Inferentia?
It is built for inference; use Trainium (Trn1, Trn2, Trn3) for training.
What is the difference between Graviton and Inferentia?
Graviton is AWS's Arm CPU for general computing; Inferentia is an AI accelerator for running models.
Does Inferentia work with Hugging Face?
Yes, through Optimum Neuron, Neuron containers and SageMaker deployments.
Do Savings Plans apply to Inf2?
Yes, like other EC2 instance families, along with Reserved Instances and Spot.
Why can't I launch an inf2 instance?
Usually a vCPU quota of 0 for Inf instances on your account, or no capacity in that zone.
What are AWS Trainium3 UltraServers?
Systems joining up to 144 Trainium3 chips with 20.7 TB of HBM3e for training and serving the largest models.
Should I use Inferentia or Bedrock?
Bedrock for calling models without managing hardware or for spiky traffic; Inferentia for steady, high-volume serving of your own model.
Is Inferentia available in every Region?
No; check Inf2 availability in your Region before planning.
What is a NeuronCore?
The processing core inside Inferentia and Trainium chips; Inferentia2 has two per chip.
What is the AWS Neuron SDK?
The software that compiles and runs models on Inferentia and Trainium: driver, runtime, compiler, PyTorch and JAX support, NxD Inference and monitoring tools.
How many NeuronCores does each inf2 size have?
inf2.xlarge and inf2.8xlarge have 2, inf2.24xlarge has 12 and inf2.48xlarge has 24.
What is the difference between Inf1 and Inf2?
Inf2 uses Inferentia2 with 32 GB of HBM per chip, newer data types and chip-to-chip links; Inf1 has 8 GB per chip and an older software stack.
Can I run vLLM on Inferentia?
Yes, through the Neuron backend built on NxD Inference, with the same OpenAI-compatible API as on GPUs.
How long does it take to compile a model for Inferentia?
Minutes for small encoders; large LLMs can take over an hour, so save the compiled output and reuse it.
Can I compile a Neuron model without an Inf2 instance?
Yes, Optimum Neuron can export on a CPU-only instance when you pass the target instance type, such as inf2.
Does TensorFlow work on Inferentia2?
Neuron 2.28 was the last release with TensorFlow support for Inf2; new work should use PyTorch or JAX.
How do I use Inferentia on EKS?
Install the Neuron device plugin Helm chart, then request aws.amazon.com/neuron or aws.amazon.com/neuroncore in the pod's resource limits.
How much does ml.inf2.xlarge cost on SageMaker?
Roughly $0.99 an hour in US East, more than the bare EC2 inf2.xlarge because SageMaker manages the endpoint.
Is AWS Inferentia a GPU?
No. It is a custom AI accelerator built only for inference, programmed through the Neuron SDK instead of CUDA, though you rent it on EC2 the same way as a GPU instance.
What is the difference between the Neuron SDK and CUDA?
CUDA runs almost any model on NVIDIA GPUs; Neuron compiles supported models ahead of time for AWS chips, with fixed shapes, through PyTorch, JAX, Hugging Face and vLLM.
Is Inferentia better than a Google TPU?
Neither is better in general; Inferentia suits teams on AWS serving supported models, TPUs suit teams on Google Cloud, especially with JAX.
How do I check if Inf2 is available in my Region?
Run aws ec2 describe-instance-type-offerings with the inf2 instance type filter and the availability-zone location type for that Region.
Can Stable Diffusion run on Inferentia2?
Yes. Optimum Neuron exports Stable Diffusion and SDXL pipelines, with the image size fixed at export time.
How do I compare Inferentia and GPU costs fairly?
Load test both at the same latency limit, then compare cost per million requests, not the hourly price.
For readers preparing for an AWS certification
We have been covering AWS certifications alongside our fixes, so here is a short extra for readers studying for one. If you only came for the fix, you already have it; feel free to skip this part.
Exams that test this topic: AI Practitioner (AIF-C01) • Machine Learning Engineer – Associate (MLA-C02) • Cloud Practitioner.
Here are the exam-style questions this topic tends to raise, with the reasoning you need to answer them:
1. Which EC2 instance family uses AWS Inferentia2 chips for low-cost, high-throughput inference?
Inf2.
2. Which AWS chip family is designed primarily for training machine learning models?
AWS Trainium (Trn1, Trn2, Trn3).
3. Which SDK compiles and runs models on Inferentia and Trainium?
The AWS Neuron SDK.
4. A team needs the lowest cost per inference for a steady, high-volume, supported model on EC2. What should it evaluate?
Inf2 instances with AWS Inferentia2.
5. A team only wants to call foundation models through an API without managing instances. Which service fits?
Amazon Bedrock.
6. What is AWS Graviton?
AWS's Arm-based CPU for general-purpose computing, not an AI accelerator.
Exam codes and dates change often. Our AWS certification changes page keeps track of what is current.
The shop's embedding model has run on one inf2.xlarge for a month, with the same search quality and a smaller bill. The chat model stayed on its GPU until Neuron supports its architecture. Jake's summary for the team: "Inferentia is a cheaper engine for models it knows. Check the list before you buy the ticket."
The next step is already on the calendar. Every quarter, when a new Neuron release comes out, Ethan re-runs the Optimum Neuron export for the chat model on a spare inf2.xlarge and reads the validation summary. The day it compiles and matches the GPU output, the same load test decides whether the chat model moves too. Meanwhile, the nightly catalog re-embedding job runs on the same Inf2 instance at a large batch size, so the instance is busy around the clock instead of idling after the shop closes. If you are starting the same journey, copy that order: move the easy encoder first, prove the savings with cost per million requests, and only then spend engineering time on the harder models.
📌 If you keep one line from this page
Inferentia2 (Inf2, from about $0.76 an hour) is AWS's cheaper chip for running supported models at steady volume, Trainium3 is its newest chip for training and very large inference, there is no Inferentia3, and Bedrock or a GPU is simpler for spiky traffic or unsupported models.
Neuron SDK · 32 GB per Inferentia2 chip · request Inf vCPU quota first.
Revision note. Written October 20, 2026, with US East On-Demand prices of that day.