rax
Learning-to-Rank using JAX.
What it is and what it does
Rax is a Learning-to-Rank library built on JAX that solves the problem of optimizing the relative order of items in a list given a context. Unlike classification or regression, ranking problems care about correctness of ordering rather than absolute predictions. Rax provides off-the-shelf ranking losses (softmax_loss, pairwise_logistic_loss), ranking metrics (mrr_metric, ndcg_metric), and transformations (approx_t12n, gumbel_t12n) that compose with standard JAX transformations.
The library is designed for search, recommendation, question-answering, and dialogue systems where you need to score and rank items. All losses and metrics are purely functional and differentiable, allowing you to use them directly in neural network training pipelines. You can also transform non-differentiable ranking metrics into differentiable losses, enabling gradient-based optimization of metrics like NDCG.
Use it for:
- Ranking documents in search engines by relevance to a query using differentiable ranking losses.
- Building recommendation systems that rank items for a user and optimize for ranking metrics like MRR.
- Training question-answering systems to rank candidate answers by relevance.
- Optimizing dialogue systems to select the best response from a list of candidates.
- Implementing pairwise or listwise ranking losses in JAX-based machine learning pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Rax provides ranking losses and metrics for learning-to-rank problems in JAX, enabling optimization of relative ordering for lists of items given a context.
Yes. Rax fills a clear gap for learning-to-rank in the JAX ecosystem with low install friction, active maintenance, no known vulnerabilities, and permissive licensing. Install it if you're building ranking systems in JAX or need to optimize ranking metrics directly.
Install
rax on PyPI
pip
pip install raxuv
uv add raxpoetry
poetry add raxInstalling rax
Before you install
Low friction installation with three runtime dependencies (jax, jaxlib, typing_extensions). Repository is actively maintained with recent commits and no known vulnerabilities.
License in practice
Apache 2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install rax
import jax.numpy as jnp
import rax
scores = jnp.array([2.2, -1.3, 5.4])
labels = jnp.array([1.0, 0.0, 0.0])
rax.ndcg_metric(scores, labels)
Requires Python 3.9 or later; JAX installation must be completed first per JAX documentation.
Verify before relying
- Whether the package is suitable for production ranking systems or primarily research-focused.
- Performance characteristics when scaling to large ranking lists or batch sizes.
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — jax, jaxlib, typing_extensions |
| Maintenance | actively maintained — 588 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 146,035/month — #11,110 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rax-0.4.0-py3-none-any.whl
Keywords: learning-to-rank, jax, ranking
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
drjaxDrJAX embeds MapReduce programming primitives…
permissive · top 15,000 on PyPI
google-metraxMetrax provides standard evaluation metrics for…
permissive · top 15,000 on PyPI
jraphJraph provides data structures and utilities…
permissive · top 15,000 on PyPI
pytorch-metric-learningProvides metric learning loss functions,…
permissive · top 5,000 on PyPI
ranxranx computes ranking evaluation metrics…
permissive · top 15,000 on PyPI
cluCLU provides utilities and abstractions for…
permissive · top 15,000 on PyPI
dm-haikuHaiku is a neural network library for JAX that…
permissive · top 15,000 on PyPI
jaxJAX is a Python library for automatic…
permissive · top 1,000 on PyPI
equinoxEquinox provides neural network and model…
permissive · top 5,000 on PyPI
ir-measuresProvides a unified Python interface to compute…
permissive · top 15,000 on PyPI