Exa boosts embedding throughput by 50% to index billions of documents on AWS AI chips
In one sentence
Exa improved vector embedding throughput by nearly 50% on AWS Inferentia2 and Trainium2 chips using custom kernels, memory layout optimizations, and an agentic development workflow.
Key points
- Exa optimized its inference infrastructure on AWS Inferentia2 and Trainium2 chips while re-embedding 30 billion priority documents.
- Initial throughput gains came from weight layout optimization, autocast precision downcasting, and pre-built NKI attention kernels.
- Engineers wrote a custom fused SwiGLU MLP kernel to eliminate HBM stalls and tailored the attention kernel to model shapes to cut wasted FLOPS.
- The final implementation achieved a 47% improvement in performance and cost per 1 million documents embedded over the baseline.
- AI agents developed these optimizations within a Flyte-based harness that verified 0.999 cosine similarity, profiled workloads, and ran hardware benchmarks.
In depth
An AI-written overview of the original article, not the article itself.
According to an AWS Machine Learning Blog post, semantic search company Exa optimized its document embedding pipeline on AWS Inferentia2 and Trainium2 chips, improving throughput and cost per million documents by 47%. Notably, these kernel-level optimizations were developed by AI agents in an automated workflow to help Exa index billions of web documents.
Scaling to billions of documents
Exa builds a web index for semantic search, requiring every high-quality document to be embedded into an in-house vector database before serving. At the scale of tens or hundreds of billions of documents, per-document embedding cost is critical.
The optimization effort was triggered when Exa upgraded its document model and needed to re-embed 30 billion high-priority documents. This migration temporarily doubled their embedding load, prompting a hardware and optimization overhaul.
How they achieved 47% gains
Starting from an FP16 data-parallel baseline on Inferentia2, Exa first applied weight layout optimization to remove unnecessary transposes and enabled autocast while maintaining a 0.999 cosine similarity threshold. They then adopted pre-built Neuron Kernel Interface (NKI) kernels for common layers.
To eliminate high-bandwidth memory stalls, they wrote a custom fused SwiGLU MLP kernel. Finally, they reduced wasted FLOPS by tailoring the attention kernel to their exact model shapes and folding operations into single matrix multiplications, resulting in a 47% improvement in performance and cost per million documents.
Agentic workflow and flexible compute
The article notes that AI agents developed all these optimizations inside a Flyte-based harness that compiles NEFF executables, verifies accuracy, and runs 30-minute hardware benchmarks. Different agents handled tasks based on cost, from parameter grid searches to writing custom kernels.
Exa also uses a single Kubernetes control plane to schedule workloads across multiple AWS Regions and instance types based on performance per dollar. This flexibility allowed Inferentia2 optimizations to transfer directly to Trainium2, helping avoid compute shortages.
This summary was generated by AI from the original article and may contain errors; the original is authoritative. Copyright belongs to the original author.