FBTriton Modernizes Table-Batched Embeddings in PyTorch

News PyTorch Blog · Source account, not independently verified by us.

PyTorch describes FBTriton, a Triton implementation of Table-Batched Embedding (TBE) operations used to process embedding tables across many GPUs in recommendation systems. The post reports that its forward and backward kernels outperform legacy CUDA kernels on the workloads tested. TBE combines embedding lookups and pooling across tables in one GPU launch, aiming to reduce launch overhead and improve memory efficiency.

In the forward pass, the kernel gathers requested table rows, optionally applies per-sample weights, and produces pooled outputs. PyTorch provides both a general gather path and a specialized histogram path for certain table shapes. An optional, disabled-by-default validation mode can detect and repair invalid inputs in eligible configurations; other configurations retain the standard validation path.

The backward pass sums gradients for each touched table row and applies one optimizer update per row. Because rows can occur at very different frequencies, FBTriton splits long runs into smaller work units. For one large B200 configuration, an optional preprocessing path reduced combined latency from 79.537 to 66.183 milliseconds, a 16.8% reduction according to the post.

Across 307 shard configurations on GB200, including 283 distinct shapes, median forward speedup was 1.28× over CUDA TBE with FP16 weights and exact row-wise Adagrad. Eleven configurations fell below parity; runs with more than 256 touches were at parity. The post also explains kernel design choices and further optimization opportunities: PyTorch’s FBTriton post

🇬🇧 https://pytorch.org/blog/modernizing-table-batched-embeddings-with-fbtriton

Leave a Comment

The weekly brief: selected developments, projects and videos