Exa raises embedding throughput by 50 percent, enabling it to index billions of documents on AWS AI chips.
Exa re-embedded 30 billion documents on AWS Neuron chips, using Neuron kernels and agents to improve embedding cost performance by 47 percent.
Key Takeaways
- Exa re-embedded 30 billion documents on AWS Inferentia2 and Trainium2, achieving a 47% improvement in embedding performance and cost per 1 million documents versus its initial baseline.
- Embeddings are central to Exa’s in-house vector database and web index, so per-document cost and throughput directly affect the economics of serving semantic search at scale.
- Starting from a basic data-parallel FP16 Inferentia2 implementation, Exa used weight layout optimization, autocast, NKI kernels, and a custom fused SwiGLU MLP kernel to reduce memory stalls and increase throughput.
- Tailoring attention kernels to the model’s exact shapes cut unnecessary padding FLOPs, while folding operations into single matrix multiplications reduced HBM round trips and resolved core contention.
- Exa also scaled the embedding fleet using Kubernetes pod packing and Trainium2 data parallelism, with agents inside Flyte helping drive the optimization loop.
Meta description: Exa re-embedded 30 billion documents on AWS Inferentia2 and Trainium2, using NKI and agents to improve embedding cost performance by 47 percent.

Tags: Exa, AWS Neuron, vector embeddings, AI infrastructure, cost optimization
Featured image: abstract, friendly illustration of web pages turning into vector embeddings and cloud accelerator chips, with no real people, no logos and no text.
Exa has optimized its embedding infrastructure for AWS Neuron hardware, specifically AWS Inferentia2 and AWS Trainium2, and reports a 47% improvement in performance and cost per 1 million documents embedded against its initial baseline. The result matters because Exa says its in-house vector database must ingest and embed tens or hundreds of billions of documents, making per-document cost a core part of the service rather than a narrow tuning detail.
Why embeddings drive the cost model
Exa says it is building one of the few true web indexes from public web knowledge plus private and synthetic sources. It aims to support semantic search and keep agents and humans grounded in true, high-quality data. Multi-tower semantic machine learning (ML) models place web data and query data in one vector space, so people can ask complex questions in natural language while still using keyword search.
The core system is the in-house vector database. Any structured web document that Exa considers high enough quality must be embedded before it can be served. Exa describes raw web data moving from Crawlers through Parse, Moderate and filter, and Embed, with the result served from the vector database. Because inference runs asynchronously but must handle high volume quickly to serve recent data and shrink the time between discovery and serving, embedding unit economics underlie the work.
A 30 billion document backfill exposed the hardware limits
The company began using the Neuron hardware family with a backfill. Replacing the document model required re-embedding the existing corpus, and Exa selected 30 billion high-priority documents for the new model. During that migration, two parallel pipelines share crawl and parse stages: one embeds with the live model into the live index, while the other re-embeds priority documents with the new model into the new index. That temporary doubling made the project a natural moment to review hardware and optimization choices.
From a basic Neuron build to 1.5× throughput
The reported Inferentia2 performance is based on the smallest instance type, inf2.xlarge, which has one chip and two NeuronCores. Because the workload runs on a single NeuronCore, Exa uses Kubernetes pods that pack onto larger instances without leaving cores idle, giving the embedding fleet container homogeneity. The same process runs on a Trainium2 NeuronCore and scales through data parallelism.
The first Inferentia2 implementation was a straightforward data-parallel FP16 version of the model. From that starting point, Exa used the Neuron SDK and support from the AWS Trainium team to push throughput, measured in docs/sec, as high as possible. A series of optimizations produced roughly a 1.5× throughput improvement.
The first change was weight layout optimization: aligning weight layout with the rest of the model removed transposes that were not needed. Exa also enabled autocast, letting the compiler downcast matrix multiplications to lower precision while preserving dynamic range. The downcast outputs met a correctness gate of 0.999 cosine similarity against the reference, so the accuracy impact stayed within the company's acceptance threshold.
NKI kernels and a fused SwiGLU MLP cut memory stalls
The Neuron Kernel Interface (NKI) library provides optimized kernels for common model layers and operations. Exa used those pre-built kernels to remove obvious inefficiency, and a drop-in attention kernel produced the next performance bump.
The next bottleneck was memory spill. Neuron Explorer profiles showed repeated spill and reload from high-bandwidth memory (HBM), which prevented the Tensor Engine from being fully used during the forward pass. Exa first used a drop-in MLP kernel to profile the limits of the pre-built implementation, then wrote a custom weight-stationary fused SwiGLU MLP kernel that removed the HBM stalls.
For that kernel, Exa used the higher-level NKI language for layout operations, loops, and memory operations, and only used the lower-level NKI ISA for specific tensor operations. Keeping most of the kernel in the higher-level language makes it easier for engineers to understand and debug.
Reducing floating-point operations resolved core contention
Exa then hit a wall. Per-accelerator throughput measured with the other on-chip core idle was significantly higher than throughput with both cores running at the same time. That gap showed that theoretical data-parallel throughput should have been well above realized aggregate performance, pointing to contention between cores.
Profiling and experimentation showed the workload was not yet saturating the Tensor Engine. The remaining headroom came from making the computation leaner. Exa rewrote the attention kernel around the exact shapes in its model to cut floating-point operations (FLOPS) spent on padding. Generic kernels are built for any shape, so they cannot exploit the specific shapes of a given architecture. By tailoring the implementation to the real shape of the model's head architecture, Exa improved attention performance.
Exa also folded attention operations into single matmuls where the generic kernel used multiple instruction steps. That reduced inner-loop operations needed to compute the same values, cut HBM round trips, and produced the final significant speedup. The final version was a 47% improvement in performance and cost per 1 million documents embedded against the initial baseline.
Agents drove the loop inside Flyte
All of these optimizations were developed by agents inside a simple three-part harness that lets them verify correctness, measure performance and profile the workload to find the next direction. Exa used Flyte, an ML ops workflow platform, so each agent runs its own workflow.
The workflow compiles a NEFF Neuron executable and checks a forward pass against a baseline dataset, which must reach 0.999 cosine similarity to the canonical model. It then profiles one forward pass and runs a 30 minute saturation benchmark on real hardware.
The harness supports agents at different costs. Lightweight models handle tedious work such as grid searching compiler parameters, and correctness checks prevent drift. Reasoning agents test complex hypotheses and find bottlenecks, while the strongest code generators write custom kernels to fix them. Matching each agent to its task keeps costs in check, and validation keeps capable agents from drifting. Because many agents do not know the latest features and syntax, neuron agentic development skills also helped.
Flexible compute makes the optimization portable
Exa has so far optimized Inferentia2 for the US West (Oregon) Region (us-west-2), but tuning one hardware family in one Region has hard limits. Spot and on demand availability vary by Region, and organizations with many consumers compete with themselves. Locking into one Region or instance type almost guarantees a compute shortage, and possibly degraded service.
Exa schedules compute across multiple Regions from one Kubernetes control plane. Its scheduler compares performance per dollar across instance types and packs pods onto the cheapest nodes, rescheduling as embedding demand shifts. Each hardware type optimized brings the fleet closer to the global optimum. This is why the Inferentia2 work carried over directly to Trainium2.
Shifting hardware profiles lets Exa free up nodes other teams need or absorb their unused reserved compute. For a long lived model, optimizing across hardware pays off enormously. At Exa's scale, extracting maximum cost-performance from a flexible pool of hardware is what matters, and adding Neuron hardware to that pool while optimizing it with NKI has proven to be a major source of long-term cost savings.
The team behind the work
Summer Devlin is a data infrastructure engineer at Exa Labs, focused on solving messy data problems at web scale.
Jim Burtoft is a Senior Trainium Solutions Architect at AWS and works directly with companies and educational institutions as well as the team at Hugging Face to make it easier to use models on Trainium. Jim is a CISSP, leader of the Neuron Data Science Technical Field Community, and works with the open source community to enable broader use of Neuron and Trainium. Jim holds a bachelor’s degree in mathematics from Carnegie Mellon University and a master’s degree in economics from the University of Virginia.
Pinak Panigrahi works on performance optimization of AI models on AWS Trainium at Annapurna Labs, Amazon.
Venu Geddam is a Senior Technical Account Manager with AWS Enterprise Support, where he partners with strategic customers to run resilient, high-scale workloads on AWS. His work spans EC2 capacity and storage-optimized compute, cost and operational optimization, and the infrastructure behind modern AI and ML platforms — including GPU and Graviton fleets, Amazon SageMaker HyperPod, and Amazon Bedrock. Venu helps engineering teams turn ambitious technical goals into production-ready, operationally sound architectures.
Comments (0)