google/rax

Rax is a Learning-to-Rank library written in JAX.

What it solves

Rax is a library designed for Learning-to-Rank (LTR) problems, where the goal is to optimize the relative order of a list of items (such as documents or recommendations) based on a context like a search query. It provides the necessary tools to handle ranking-specific objectives that differ from standard classification or regression.

How it works

Built on JAX, Rax provides a suite of purely functional implementations of ranking losses and metrics. It allows users to compute metrics like NDCG and MRR, and apply ranking losses such as softmax or pairwise logistic loss. It also includes specialized transformations, such as approx_t12n, which can convert non-differentiable ranking metrics into differentiable losses, enabling gradient-based optimization in JAX.

Who it’s for

This library is for developers and researchers working on search engines, recommendation systems, question answering, and dialogue systems where the order of results is critical.

Highlights

  • JAX-native: Fully compatible with JAX transformations and purely functional.
  • Ranking-specific tools: Off-the-shelf implementations of losses (e.g., softmax_loss) and metrics (e.g., ndcg_metric).
  • Differentiable metrics: Ability to transform non-differentiable metrics into differentiable losses.
  • Broad application: Supports a variety of LTR applications including search and recommendation.

Related

  • Project
  • Project
  • Project
  • Project
  • Project