amzn/pecos

PECOS - Prediction for Enormous and Correlated Spaces

What it solves

PECOS addresses the challenge of fast learning and inference in problems with extremely large output spaces (up to 100 million candidates), such as extreme multi-label ranking (XMR) and large-scale retrieval. It allows a system to quickly identify a small set of relevant outputs (typically 10-100) from a massive candidate pool.

How it works

PECOS is a modular framework that provides different algorithmic approaches to handle large-scale output spaces:

  • X-Linear: Uses recursive linear models to traverse a hierarchical label tree, moving from the root to leaf node clusters to find the top-k relevant labels.
  • XR-Transformer: A Transformer-based framework that fine-tunes pre-trained models recursively on multi-resolution objectives to generate relevant labels or create task-aware embeddings.
  • ANN Search (HNSW): Implements the Hierarchical Navigable Small World Graphs algorithm for approximate nearest neighbor search, supporting both sparse and dense input features with SIMD optimization.

Who it’s for

It is designed for developers and researchers working on large-scale retrieval systems, extreme multi-label classification tasks, and any application requiring high-performance inference across millions of potential outputs.

Highlights

  • Supports output spaces of up to 100 million candidates.
  • Provides a fast real-time inference implementation in C++.
  • Integrates with Hugging Face Transformers for the XR-Transformer module.
  • Features thread-safe graph construction and parallel inference for ANN search.

Related

  • Project
  • Project
  • Project
  • Project
  • Project