Skip to content

Add XTR retriever with token-level scoring and imputation#197

Closed
robro612 wants to merge 2 commits intolightonai:mainfrom
robro612:xtr-retrieval
Closed

Add XTR retriever with token-level scoring and imputation#197
robro612 wants to merge 2 commits intolightonai:mainfrom
robro612:xtr-retrieval

Conversation

@robro612
Copy link
Copy Markdown
Contributor

Summary

  • Add retrieve.XTR class for XTR retrieval on non-PLAID indexes (e.g. ScaNN)
  • Add score_xtr() scoring function with multiple imputation strategies (min, zero, mean, percentile, power_law)
  • Optimized scoring path: pre-allocated numpy arrays, skipped torch.unique() for string doc IDs, bulk .tolist() conversion, is_rectangular hint for imputation
  • Export score_xtr from pylate.rank and XTR from pylate.retrieve
  • Update examples/evaluation/beir_dataset.py to support XTR retrieval and configurable model/index options
  • Add unit tests for XTR scoring (test_xtr_scoring.py) and retriever (test_xtr_retriever.py)

Depends on #195 and #196

Test plan

  • python -m pytest tests/test_xtr_scoring.py -v
  • python -m pytest tests/test_xtr_retriever.py -v
  • python examples/evaluation/beir_dataset.py --model_name robro612/xtr-base-en-pylate --index_type scann --retrieval_type xtr --dataset_name nfcorpus --do_encode_and_index — nDCG@10 should be ~33.1

@raphaelsty
Copy link
Copy Markdown
Collaborator

Hi @robro612, same question here, would it be possible to have a small benchmark with ndcg@10 and qps ?

…(non-plaid).

This supports multiple imputation functions: min (default), zero, mean, percentile, or power_law. Although min is default and highly suggested.
- Fix broken doctest in xtr.py (missing add_documents call)
- Fix progress bar total using ceil division
- Use torch.isinf for robust missing-score detection in score_xtr
- Rename misleading variable neg_b -> slope in power-law imputation
- Export Base from indexes.__init__ and use public API in colbert.py
- Add unit tests for _compute_imputation_scores (rectangular, ragged, edge cases)
- Add beir_dataset_xtr.py eval script supporting both ColBERT and XTR retrieval
- Fix test_xtr_retriever.py: name -> index_name kwarg for ScaNN
@robro612
Copy link
Copy Markdown
Contributor Author

Updated some stuff to hopefully head off some minor feedback. Still depending on the prefix token logic landing before I can test it proper. I added the extra beir_xtr example but will remove it in the final commit for this.

@robro612 robro612 closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants