libdl
0.0.1
Simple yet powerful deep learning
|
The goal of this tutorial is to train and evaluate a ranking model (in our case "monoBERT" as described by [6]) on the MS MARCO Passage [5] dataset. But keep in mind that everything discussed here can, of course, also be adapted to other models, other datasets, different training regimes (in-batch negatives, distillation, ...).
We start of by defining our ranking model.
Ranking models are not different from any other ranking model. Thus, you can use any of the other facilities (dataset, optimizer, loss objectives, trainers, ...) to also train and evaluate your ranking model. But, for your convenience, and to reduce the amount of boilerplate such that you can quickly get started working on what is interesting, novel, and important, we provide some general implementations for you as well. We will discuss these in the following.
libir provides two dataset types:
ir::PointwiseDataset
, where each instance is a tuple \((q, d, r)\) consisting of a query \(q \in \mathcal{Q}\), document \(d \in \mathcal{D}\), and relevance label \(r \in \mathbb{R}\). Such a dataset can be used for training the ranking model "pointwise", i.e., as a relevance classifier. But also admits pairwise training using some negative sampling strategy (e.g., in-batch negatives).ir::PairwiseDataset
, where each instance is a triple \((q, d^+, d^-)\) consisting of a query \(q\in\mathcal{Q}\), a positive (more relevant), and a negative (less relevant) document \(d^+, d^-\in\mathcal{D}\).It may look like there is a mismatch here since we previously defined ranking models to solely be mappings \(\mathcal{Q}\times \mathcal{D} \to \mathbb{R}\) and the ir::PairwiseDataset
has the signature \(\mathcal{Q}\times \mathcal{D} \times \mathcal{D}\) but herein lies the magic of separation of concerns: Choose the signature that makes sense for your ranking model and use a trainer adapter to specify how it should be trained.
Output