Exa boosts embedding throughput by 50% to index billions of documents on AWS AI chips

Exa, which builds a semantic web index, has published an account of reworking its document-embedding pipeline for AWS Neuron hardware — Inferentia2 and Trainium2 — and reports a 47% improvement in performance and cost per one million documents embedded against its initial baseline, alongside roughly 1.5x throughput from a sequence of kernel and compiler optimizations. The work was described by Exa engineers together with AWS staff on the AWS Machine Learning Blog.
The trigger was a model migration. Exa moved to what it describes as a superior document model and selected 30 billion high-priority documents to re-embed. Because the live index keeps embedding with the old model while the new index is being filled, the load temporarily doubles — two parallel pipelines sharing the crawl and parse stages, one writing to the live index and one to the new one. That spike is what pushed the team to revisit hardware and tuning choices.
Exa's baseline was deliberately plain: a data-parallel FP16 implementation of the model on Inferentia2, using the Neuron SDK. The unit of deployment is a single NeuronCore, so pods pack onto larger instances without leaving cores idle and the same container image runs across the fleet; the Trainium2 path is the same process scaled by data parallelism. Reference figures are given for the smallest instance, inf2.xlarge, which carries one chip and two NeuronCores.
The first gains came cheaply. Weight layout optimization removed unnecessary transposes by aligning weight layout with how the surrounding model is scheduled and laid out. Autocast then let the compiler downcast matrix multiplications to lower precision while preserving dynamic range. Accuracy was held to a gate of 0.999 cosine similarity against the reference model, which the downcast outputs met.
Next came the Neuron Kernel Interface (NKI), a library of optimized kernels for common layers. Exa used pre-built kernels to clear obvious inefficiencies and got a further bump from a drop-in attention kernel. The bigger bottleneck was memory spill: Neuron Explorer profiles showed heavy spill and reload from high-bandwidth memory keeping the Tensor Engine underused through the forward pass. Exa wrote a custom weight-stationary fused SwiGLU MLP kernel to remove those stalls, keeping most of the kernel in higher-level NKI — for layout, loops and memory operations — and dropping to the lower-level NKI ISA only for specific tensor operations, which the team says keeps the code debuggable.
A contention problem defined the last phase. Throughput measured with one on-chip core idle was well above what two cores running together delivered, implying the cores were interfering and that the workload was not saturating the Tensor Engine. Rather than chase more parallel efficiency, Exa cut the arithmetic: it rewrote the attention kernel around the exact shapes of its model so less work went to padding, and folded attention operations into single matmuls where the generic kernel used multiple instruction steps. That reduced inner-loop operations and HBM round trips, and produced the final large speedup.
This is a familiar pattern in accelerator tuning. Generic kernels must handle any tensor shape, so they carry overhead that a model-specific implementation can simply delete; the trade-off is that a hand-tuned kernel is tied to one architecture's dimensions and has to be revisited when the model changes. Holding correctness to a tight cosine-similarity threshold is the sensible guardrail here, because kernel and precision changes can degrade embedding quality in ways that only show up in retrieval results, not in loss curves.
The optimization work was itself largely done by agents. Each ran inside a three-part harness on the Flyte workflow platform: compile a NEFF Neuron executable, check a forward pass against a baseline dataset at the required 0.999 cosine similarity, profile a single forward pass, then run a 30-minute saturation benchmark on real hardware. Agents were matched to tasks by cost — lightweight models grid-searched compiler parameters, reasoning agents tested hypotheses and hunted bottlenecks, and the strongest code generators wrote custom kernels. Exa notes that neuron agentic development skills helped because many agents did not know current features and syntax.
Exa also emphasizes flexibility over single-hardware optimization. Inferentia2 work so far targets the US West (Oregon) Region, us-west-2, and the company argues that locking into one Region or instance type invites shortages and degraded service, since spot and on-demand availability vary by Region and internal teams end up competing for the same pool. Exa schedules across Regions from one Kubernetes control plane, with a scheduler that compares performance per dollar across instance types, packs pods onto the cheapest nodes and reschedules as demand shifts. It says the Inferentia2 work carried over directly to Trainium2 and lets it release nodes other teams need or absorb their unused reserved capacity.
Why it matters: Teams indexing at tens or hundreds of billions of documents face embedding cost as a first-order product constraint, and this account shows that per-document cost can move by nearly half through compiler flags, kernel work and scheduling rather than new models. The agent harness — compile, validate against a similarity threshold, profile, benchmark — is a reusable template for anyone tuning inference on unfamiliar accelerators, and the multi-Region, per-dollar scheduler is a practical answer to capacity contention. A reasonable inference is that similar gains are available on other non-GPU accelerators, at the cost of maintaining custom kernels per model shape.
Based on reporting from the original publisher. Visit the source for full context and later updates.
Publisher excerpt
Exa's neural search engine is backed by an in-house vector database, so the unit economics of embedding tens of billions of web documents drive the business. This post shares how Exa optimized embedding inference on AWS Neuron hardware (Inferentia2 and Trainium2) with custom NKI kernels, reaching a 47% gain in performance and cost per million documents.