Passage Ranking using TFR-BERT

View on TensorFlow.org Run in Google Colab View source on GitHub Download notebook

TensorFlow Ranking can handle heterogeneous dense and sparse features, and scales up to millions of data points. However, building and deploying a learning to rank model to operate at scale creates additional challenges beyond simply designing a model. The Ranking library provides workflow utility classes for building distributed training for large-scale ranking applications. For more information about these features, see the TensorFlow Ranking Overview.

This tutorial shows you how to build a ranking model that uses BERT for scoring. BERT is a highly effective pretrained module to effective encode textual features into contextualized word embeddings. We use BERT to initialize the ranking model and finetune the model using a ranking loss.

ANTIQUE dataset

In this tutorial, you will build a ranking model for ANTIQUE, a question-answering dataset using BERT as the scoring function. Bidirectional Encoder Representations from Transformers (BERT) is a transformer-based machine learning technique which has proven to be effective in many natural language processing (NLP) tasks. Recent work on TFR-BERT has shown BERT to be an effective scoring function for learning-to-rank tasks.

Given a query, and a list of answers, the objective of the ranking model is to rank the answers with optimal rank related metrics, such as NDCG. For more details about ranking metrics, review evaluation measures offline metrics.

ANTIQUE is a publicly available dataset for open-domain non-factoid question answering, collected from Yahoo! answers. Each question has a list of answers, whose relevance are graded on a scale of 0-4, 0 for irrelevant and 4 for fully relevant. The list size can vary depending on the query, so we use a fixed "list size" of 50, where the list is either truncated or padded with default values. The dataset is split into 2206 queries for training and 200 queries for testing. For more details, please read the technical paper on arXiv.

Setup

Download and install the TensorFlow Ranking and TensorFlow Model Garden packages.

pip install -q tensorflow-ranking tf-models-official

Import TensorFlow Ranking and useful libraries through the notebook.

import os
import tensorflow as tf
import tensorflow_ranking as tfr
from official.nlp.configs import encoders
from tensorflow_ranking.extension.premade import tfrbert_task

Data preparation

Download training and test data.

wget -O "/tmp/train.tfrecords" "https://ciir.cs.umass.edu/downloads/Antique/tf-ranking/antique_train_seq_64_elwc.tfrecords"
wget -O "/tmp/test.tfrecords" "https://ciir.cs.umass.edu/downloads/Antique/tf-ranking/antique_test_seq_64_elwc.tfrecords"
--2022-04-26 22:37:07--  https://ciir.cs.umass.edu/downloads/Antique/tf-ranking/antique_train_seq_64_elwc.tfrecords
Resolving ciir.cs.umass.edu (ciir.cs.umass.edu)... 128.119.246.154
Connecting to ciir.cs.umass.edu (ciir.cs.umass.edu)|128.119.246.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8743528 (8.3M)
Saving to: ‘/tmp/train.tfrecords’

/tmp/train.tfrecord 100%[===================>]   8.34M  15.9MB/s    in 0.5s    

2022-04-26 22:37:08 (15.9 MB/s) - ‘/tmp/train.tfrecords’ saved [8743528/8743528]

--2022-04-26 22:37:08--  https://ciir.cs.umass.edu/downloads/Antique/tf-ranking/antique_test_seq_64_elwc.tfrecords
Resolving ciir.cs.umass.edu (ciir.cs.umass.edu)... 128.119.246.154
Connecting to ciir.cs.umass.edu (ciir.cs.umass.edu)|128.119.246.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 692072 (676K)
Saving to: ‘/tmp/test.tfrecords’

/tmp/test.tfrecords 100%[===================>] 675.85K  4.35MB/s    in 0.2s    

2022-04-26 22:37:08 (4.35 MB/s) - ‘/tmp/test.tfrecords’ saved [692072/692072]
mkdir -p /tmp/tfrbert
wget "https://storage.googleapis.com/cloud-tpu-checkpoints/bert/v3/uncased_L-12_H-768_A-12.tar.gz" -P "/tmp/tfrbert"
mkdir -p /tmp/tfrbert/uncased_L-12_H-768_A-12
tar -xvf /tmp/tfrbert/uncased_L-12_H-768_A-12.tar.gz --strip-components 3 -C "/tmp/tfrbert/uncased_L-12_H-768_A-12/"
--2022-04-26 22:37:08--  https://storage.googleapis.com/cloud-tpu-checkpoints/bert/v3/uncased_L-12_H-768_A-12.tar.gz
Resolving storage.googleapis.com (storage.googleapis.com)... 74.125.141.128, 173.194.210.128, 173.194.211.128, ...
Connecting to storage.googleapis.com (storage.googleapis.com)|74.125.141.128|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 405351189 (387M) [application/octet-stream]
Saving to: ‘/tmp/tfrbert/uncased_L-12_H-768_A-12.tar.gz’

uncased_L-12_H-768_ 100%[===================>] 386.57M  72.9MB/s    in 5.3s    

2022-04-26 22:37:14 (72.9 MB/s) - ‘/tmp/tfrbert/uncased_L-12_H-768_A-12.tar.gz’ saved [405351189/405351189]

tmp/temp_dir/raw/vocab.txt
tmp/temp_dir/raw/bert_model.ckpt.index
tmp/temp_dir/raw/bert_model.ckpt.data-00000-of-00001
tmp/temp_dir/raw/bert_config.json

Overview of TFR-BERT in Orbit

BERT-based ranking models (TFR-BERT) have been shown to be effective for learning-to-rank tasks when using raw textual features for query and passages in MSMARCO passage ranking dataset.

Orbit is a flexible, lightweight library designed to make it easy to write custom training loops in TensorFlow. TensorFlow Ranking provides support for implementing ranking models, particularly for BERT based ranking models using Orbit.

Create a Ranking Task for TFR-BERT

We create a ranking task for TFR-BERT model which can be trained using Orbit. The steps to build this are:

  1. Define Feature Specifications
  2. Define datasets
  3. Setup data and task configurations

Specify Features

Feature Specification are TensorFlow abstractions to capture information about each feature. These help developers and model researchers understand and use a model.

Create feature specifications for context features, example features, and labels, consistent with the input formats for ranking, such as ELWC format.

SEQ_LENGTH = 64
context_feature_spec = {}
example_feature_spec = {
    'input_word_ids': tf.io.FixedLenFeature(
        shape=(SEQ_LENGTH,), dtype=tf.int64,
        default_value=[0] * SEQ_LENGTH),
    'input_mask': tf.io.FixedLenFeature(
        shape=(SEQ_LENGTH,), dtype=tf.int64,
        default_value=[0] * SEQ_LENGTH),
    'input_type_ids': tf.io.FixedLenFeature(
        shape=(SEQ_LENGTH,), dtype=tf.int64,
        default_value=[0] * SEQ_LENGTH)}
label_spec = (
    "relevance",
    tf.io.FixedLenFeature(shape=(1,), dtype=tf.int64, default_value=-1)
)

Define Datasets

We define data configurations for training and validation data, which specifies parameters such as path, batch size, and dataset format. These configurations are used to create training and validation datasets.

# Set up data config
# We use a small list size here for demo purposes only. Users can use a larger
# list size on a machine with more memory to train TFR-BERT.
train_data_config = tfrbert_task.TFRBertDataConfig(
    input_path="/tmp/train.tfrecords",
    is_training=True,
    global_batch_size=8,
    list_size=2,
    dataset_fn='tfrecord',
    seq_length=64)

validation_data_config = tfrbert_task.TFRBertDataConfig(
    input_path="/tmp/test.tfrecords",
    is_training=False,
    global_batch_size=8,
    list_size=2,
    dataset_fn='tfrecord',
    seq_length=64)

Define Task

We define a task configuration which defines the training and validation dataset along with the model. This configuration creates a TFRBertTask object that can be trained using Orbit.

# Set up task config
task_config = tfrbert_task.TFRBertConfig(
    init_checkpoint='/tmp/tfrbert/uncased_L-12_H-768_A-12/bert_model.ckpt',
    train_data=train_data_config,
    validation_data=validation_data_config,
    model=tfrbert_task.TFRBertModelConfig(
        encoder=encoders.EncoderConfig(
            bert=encoders.BertEncoderConfig(num_layers=12))))

# Set up TFRBertTask
task = tfrbert_task.TFRBertTask(
    task_config,
    label_spec=label_spec,
    dataset_fn=tf.data.TFRecordDataset,
    logging_dir='/tmp/model_dir')

Train and evaluate the model

We define the training loop here to train and evaluate the model. We define the metrics, create train and eval datasets and train the model for a specific number of training steps.

metrics = task.build_metrics()
model = task.build_model()
task.initialize(model)
train_dataset = task.build_inputs(task_config.train_data)
vali_dataset = task.build_inputs(task_config.validation_data)
train_iterator = iter(train_dataset)
vali_iterator = iter(vali_dataset)
optimizer = tf.keras.optimizers.Adam(lr=1e-6)

NUM_TRAIN_STEPS = 100
EVAL_STEPS = 10
for train_step in range(NUM_TRAIN_STEPS):
  task.train_step(next(train_iterator), model, optimizer, metrics=metrics)
  train_metrics = {m.name: m.result().numpy() for m in metrics}
  print("Training metrics for epoch: " + str(train_step) + " ", train_metrics)

  if train_step % EVAL_STEPS == 0:
    task.validation_step(next(train_iterator), model, metrics=metrics)
    vali_metrics = {m.name: m.result().numpy() for m in metrics}
    print("Validation metrics for epoch: " + str(train_step) + " ",
          vali_metrics)
2022-04-26 22:37:19.269349: E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
/tmpfs/src/tf_docs_env/lib/python3.7/site-packages/keras/optimizer_v2/adam.py:105: UserWarning: The `lr` argument is deprecated, use `learning_rate` instead.
  super(Adam, self).__init__(name, **kwargs)
Training metrics for epoch: 0  {'MAP': 1.0, 'NDCG@1': 0.82142854, 'NDCG@5': 0.9429751, 'NDCG@10': 0.9429751, 'MRR@1': 1.0, 'MRR@5': 1.0, 'MRR@10': 1.0}
Validation metrics for epoch: 0  {'MAP': 1.0, 'NDCG@1': 0.79761904, 'NDCG@5': 0.93803066, 'NDCG@10': 0.93803066, 'MRR@1': 1.0, 'MRR@5': 1.0, 'MRR@10': 1.0}
Training metrics for epoch: 1  {'MAP': 1.0, 'NDCG@1': 0.75396824, 'NDCG@5': 0.9242913, 'NDCG@10': 0.9242913, 'MRR@1': 1.0, 'MRR@5': 1.0, 'MRR@10': 1.0}
Training metrics for epoch: 2  {'MAP': 1.0, 'NDCG@1': 0.7529762, 'NDCG@5': 0.9237745, 'NDCG@10': 0.9237745, 'MRR@1': 1.0, 'MRR@5': 1.0, 'MRR@10': 1.0}
Training metrics for epoch: 3  {'MAP': 1.0, 'NDCG@1': 0.7357143, 'NDCG@5': 0.91838205, 'NDCG@10': 0.91838205, 'MRR@1': 1.0, 'MRR@5': 1.0, 'MRR@10': 1.0}
Training metrics for epoch: 4  {'MAP': 0.9895833, 'NDCG@1': 0.703373, 'NDCG@5': 0.9070981, 'NDCG@10': 0.9070981, 'MRR@1': 0.9791667, 'MRR@5': 0.9895833, 'MRR@10': 0.9895833}
Training metrics for epoch: 5  {'MAP': 0.9910714, 'NDCG@1': 0.70493203, 'NDCG@5': 0.90704143, 'NDCG@10': 0.90704143, 'MRR@1': 0.98214287, 'MRR@5': 0.9910714, 'MRR@10': 0.9910714}
Training metrics for epoch: 6  {'MAP': 0.9921875, 'NDCG@1': 0.7016369, 'NDCG@5': 0.90634537, 'NDCG@10': 0.90634537, 'MRR@1': 0.984375, 'MRR@5': 0.9921875, 'MRR@10': 0.9921875}
Training metrics for epoch: 7  {'MAP': 0.9861111, 'NDCG@1': 0.712963, 'NDCG@5': 0.90931976, 'NDCG@10': 0.90931976, 'MRR@1': 0.9722222, 'MRR@5': 0.9861111, 'MRR@10': 0.9861111}
Training metrics for epoch: 8  {'MAP': 0.9875, 'NDCG@1': 0.7416667, 'NDCG@5': 0.9183878, 'NDCG@10': 0.9183878, 'MRR@1': 0.975, 'MRR@5': 0.9875, 'MRR@10': 0.9875}
Training metrics for epoch: 9  {'MAP': 0.9886364, 'NDCG@1': 0.74567103, 'NDCG@5': 0.9201477, 'NDCG@10': 0.9201477, 'MRR@1': 0.97727275, 'MRR@5': 0.9886364, 'MRR@10': 0.9886364}
Training metrics for epoch: 10  {'MAP': 0.9895833, 'NDCG@1': 0.75793654, 'NDCG@5': 0.92377925, 'NDCG@10': 0.92377925, 'MRR@1': 0.9791667, 'MRR@5': 0.9895833, 'MRR@10': 0.9895833}
Validation metrics for epoch: 10  {'MAP': 0.99038464, 'NDCG@1': 0.7619048, 'NDCG@5': 0.9248973, 'NDCG@10': 0.9248973, 'MRR@1': 0.9807692, 'MRR@5': 0.99038464, 'MRR@10': 0.99038464}
Training metrics for epoch: 11  {'MAP': 0.98660713, 'NDCG@1': 0.764881, 'NDCG@5': 0.9254843, 'NDCG@10': 0.9254843, 'MRR@1': 0.97321427, 'MRR@5': 0.98660713, 'MRR@10': 0.98660713}
Training metrics for epoch: 12  {'MAP': 0.9791667, 'NDCG@1': 0.759127, 'NDCG@5': 0.9229174, 'NDCG@10': 0.9229174, 'MRR@1': 0.9583333, 'MRR@5': 0.9791667, 'MRR@10': 0.9791667}
Training metrics for epoch: 13  {'MAP': 0.98046875, 'NDCG@1': 0.7518602, 'NDCG@5': 0.920607, 'NDCG@10': 0.920607, 'MRR@1': 0.9609375, 'MRR@5': 0.98046875, 'MRR@10': 0.98046875}
Training metrics for epoch: 14  {'MAP': 0.9816176, 'NDCG@1': 0.7580533, 'NDCG@5': 0.9228358, 'NDCG@10': 0.9228358, 'MRR@1': 0.9632353, 'MRR@5': 0.9816176, 'MRR@10': 0.9816176}
Training metrics for epoch: 15  {'MAP': 0.9826389, 'NDCG@1': 0.7615741, 'NDCG@5': 0.9239547, 'NDCG@10': 0.9239547, 'MRR@1': 0.9652778, 'MRR@5': 0.9826389, 'MRR@10': 0.9826389}
Training metrics for epoch: 16  {'MAP': 0.98355263, 'NDCG@1': 0.76096493, 'NDCG@5': 0.92386365, 'NDCG@10': 0.92386365, 'MRR@1': 0.96710527, 'MRR@5': 0.98355263, 'MRR@10': 0.98355263}
Training metrics for epoch: 17  {'MAP': 0.984375, 'NDCG@1': 0.7604167, 'NDCG@5': 0.9237817, 'NDCG@10': 0.9237817, 'MRR@1': 0.96875, 'MRR@5': 0.984375, 'MRR@10': 0.984375}
Training metrics for epoch: 18  {'MAP': 0.98511904, 'NDCG@1': 0.75822, 'NDCG@5': 0.9229684, 'NDCG@10': 0.9229684, 'MRR@1': 0.9702381, 'MRR@5': 0.98511904, 'MRR@10': 0.98511904}
Training metrics for epoch: 19  {'MAP': 0.98579544, 'NDCG@1': 0.7659632, 'NDCG@5': 0.92552656, 'NDCG@10': 0.92552656, 'MRR@1': 0.97159094, 'MRR@5': 0.98579544, 'MRR@10': 0.98579544}
Training metrics for epoch: 20  {'MAP': 0.98641306, 'NDCG@1': 0.7714803, 'NDCG@5': 0.9271874, 'NDCG@10': 0.9271874, 'MRR@1': 0.97282606, 'MRR@5': 0.98641306, 'MRR@10': 0.98641306}
Validation metrics for epoch: 20  {'MAP': 0.984375, 'NDCG@1': 0.76339287, 'NDCG@5': 0.9246463, 'NDCG@10': 0.9246463, 'MRR@1': 0.96875, 'MRR@5': 0.984375, 'MRR@10': 0.984375}
Training metrics for epoch: 21  {'MAP': 0.985, 'NDCG@1': 0.76666665, 'NDCG@5': 0.9258139, 'NDCG@10': 0.9258139, 'MRR@1': 0.97, 'MRR@5': 0.985, 'MRR@10': 0.985}
Training metrics for epoch: 22  {'MAP': 0.9855769, 'NDCG@1': 0.76739925, 'NDCG@5': 0.9258769, 'NDCG@10': 0.9258769, 'MRR@1': 0.97115386, 'MRR@5': 0.9855769, 'MRR@10': 0.9855769}
Training metrics for epoch: 23  {'MAP': 0.9837963, 'NDCG@1': 0.76432985, 'NDCG@5': 0.9246289, 'NDCG@10': 0.9246289, 'MRR@1': 0.9675926, 'MRR@5': 0.9837963, 'MRR@10': 0.9837963}
Training metrics for epoch: 24  {'MAP': 0.984375, 'NDCG@1': 0.76126707, 'NDCG@5': 0.9238019, 'NDCG@10': 0.9238019, 'MRR@1': 0.96875, 'MRR@5': 0.984375, 'MRR@10': 0.984375}
Training metrics for epoch: 25  {'MAP': 0.98060346, 'NDCG@1': 0.7608785, 'NDCG@5': 0.92324775, 'NDCG@10': 0.92324775, 'MRR@1': 0.9612069, 'MRR@5': 0.98060346, 'MRR@10': 0.98060346}
Training metrics for epoch: 26  {'MAP': 0.98125, 'NDCG@1': 0.7617064, 'NDCG@5': 0.923731, 'NDCG@10': 0.923731, 'MRR@1': 0.9625, 'MRR@5': 0.98125, 'MRR@10': 0.98125}
Training metrics for epoch: 27  {'MAP': 0.98185486, 'NDCG@1': 0.7670892, 'NDCG@5': 0.9255219, 'NDCG@10': 0.9255219, 'MRR@1': 0.96370965, 'MRR@5': 0.98185486, 'MRR@10': 0.98185486}
Training metrics for epoch: 28  {'MAP': 0.9824219, 'NDCG@1': 0.76655513, 'NDCG@5': 0.92541885, 'NDCG@10': 0.92541885, 'MRR@1': 0.96484375, 'MRR@5': 0.9824219, 'MRR@10': 0.9824219}
Training metrics for epoch: 29  {'MAP': 0.9810606, 'NDCG@1': 0.7611833, 'NDCG@5': 0.9234536, 'NDCG@10': 0.9234536, 'MRR@1': 0.9621212, 'MRR@5': 0.9810606, 'MRR@10': 0.9810606}
Training metrics for epoch: 30  {'MAP': 0.9797794, 'NDCG@1': 0.76243, 'NDCG@5': 0.9237378, 'NDCG@10': 0.9237378, 'MRR@1': 0.95955884, 'MRR@5': 0.9797794, 'MRR@10': 0.9797794}
Validation metrics for epoch: 30  {'MAP': 0.98035717, 'NDCG@1': 0.7661565, 'NDCG@5': 0.9248803, 'NDCG@10': 0.9248803, 'MRR@1': 0.9607143, 'MRR@5': 0.98035717, 'MRR@10': 0.98035717}
Training metrics for epoch: 31  {'MAP': 0.9809028, 'NDCG@1': 0.76967597, 'NDCG@5': 0.92595935, 'NDCG@10': 0.92595935, 'MRR@1': 0.9618056, 'MRR@5': 0.9809028, 'MRR@10': 0.9809028}
Training metrics for epoch: 32  {'MAP': 0.9797297, 'NDCG@1': 0.76254827, 'NDCG@5': 0.9237835, 'NDCG@10': 0.9237835, 'MRR@1': 0.9594595, 'MRR@5': 0.9797297, 'MRR@10': 0.9797297}
Training metrics for epoch: 33  {'MAP': 0.9802632, 'NDCG@1': 0.76503766, 'NDCG@5': 0.924697, 'NDCG@10': 0.924697, 'MRR@1': 0.9605263, 'MRR@5': 0.9802632, 'MRR@10': 0.9802632}
Training metrics for epoch: 34  {'MAP': 0.9775641, 'NDCG@1': 0.76282054, 'NDCG@5': 0.9237299, 'NDCG@10': 0.9237299, 'MRR@1': 0.9551282, 'MRR@5': 0.9775641, 'MRR@10': 0.9775641}
Training metrics for epoch: 35  {'MAP': 0.978125, 'NDCG@1': 0.7598215, 'NDCG@5': 0.92278546, 'NDCG@10': 0.92278546, 'MRR@1': 0.95625, 'MRR@5': 0.978125, 'MRR@10': 0.978125}
Training metrics for epoch: 36  {'MAP': 0.97865856, 'NDCG@1': 0.76016265, 'NDCG@5': 0.9230367, 'NDCG@10': 0.9230367, 'MRR@1': 0.95731705, 'MRR@5': 0.97865856, 'MRR@10': 0.97865856}
Training metrics for epoch: 37  {'MAP': 0.9791667, 'NDCG@1': 0.76162136, 'NDCG@5': 0.9235114, 'NDCG@10': 0.9235114, 'MRR@1': 0.9583333, 'MRR@5': 0.9791667, 'MRR@10': 0.9791667}
Training metrics for epoch: 38  {'MAP': 0.97965115, 'NDCG@1': 0.76218164, 'NDCG@5': 0.9238425, 'NDCG@10': 0.9238425, 'MRR@1': 0.9593023, 'MRR@5': 0.97965115, 'MRR@10': 0.97965115}
Training metrics for epoch: 39  {'MAP': 0.9801136, 'NDCG@1': 0.76433986, 'NDCG@5': 0.9246301, 'NDCG@10': 0.9246301, 'MRR@1': 0.96022725, 'MRR@5': 0.9801136, 'MRR@10': 0.9801136}
Training metrics for epoch: 40  {'MAP': 0.98055553, 'NDCG@1': 0.7664022, 'NDCG@5': 0.9253827, 'NDCG@10': 0.9253827, 'MRR@1': 0.9611111, 'MRR@5': 0.98055553, 'MRR@10': 0.98055553}
Validation metrics for epoch: 40  {'MAP': 0.97961956, 'NDCG@1': 0.7672102, 'NDCG@5': 0.9255508, 'NDCG@10': 0.9255508, 'MRR@1': 0.9592391, 'MRR@5': 0.97961956, 'MRR@10': 0.97961956}
Training metrics for epoch: 41  {'MAP': 0.9800532, 'NDCG@1': 0.7683638, 'NDCG@5': 0.9259215, 'NDCG@10': 0.9259215, 'MRR@1': 0.9601064, 'MRR@5': 0.9800532, 'MRR@10': 0.9800532}
Training metrics for epoch: 42  {'MAP': 0.98046875, 'NDCG@1': 0.7687252, 'NDCG@5': 0.9261679, 'NDCG@10': 0.9261679, 'MRR@1': 0.9609375, 'MRR@5': 0.98046875, 'MRR@10': 0.98046875}
Training metrics for epoch: 43  {'MAP': 0.9808673, 'NDCG@1': 0.7734451, 'NDCG@5': 0.92767465, 'NDCG@10': 0.92767465, 'MRR@1': 0.9617347, 'MRR@5': 0.9808673, 'MRR@10': 0.9808673}
Training metrics for epoch: 44  {'MAP': 0.97875, 'NDCG@1': 0.7740476, 'NDCG@5': 0.9262061, 'NDCG@10': 0.9262061, 'MRR@1': 0.96, 'MRR@5': 0.97875, 'MRR@10': 0.97875}
Training metrics for epoch: 45  {'MAP': 0.9767157, 'NDCG@1': 0.7721755, 'NDCG@5': 0.92543703, 'NDCG@10': 0.92543703, 'MRR@1': 0.9558824, 'MRR@5': 0.9767157, 'MRR@10': 0.9767157}
Training metrics for epoch: 46  {'MAP': 0.97716343, 'NDCG@1': 0.7717491, 'NDCG@5': 0.9253752, 'NDCG@10': 0.9253752, 'MRR@1': 0.9567308, 'MRR@5': 0.97716343, 'MRR@10': 0.97716343}
Training metrics for epoch: 47  {'MAP': 0.9764151, 'NDCG@1': 0.7736972, 'NDCG@5': 0.92591274, 'NDCG@10': 0.92591274, 'MRR@1': 0.9551887, 'MRR@5': 0.9764151, 'MRR@10': 0.9764151}
Training metrics for epoch: 48  {'MAP': 0.9768519, 'NDCG@1': 0.77502203, 'NDCG@5': 0.92642987, 'NDCG@10': 0.92642987, 'MRR@1': 0.9560185, 'MRR@5': 0.9768519, 'MRR@10': 0.9768519}
Training metrics for epoch: 49  {'MAP': 0.97727275, 'NDCG@1': 0.77716446, 'NDCG@5': 0.927108, 'NDCG@10': 0.927108, 'MRR@1': 0.95681816, 'MRR@5': 0.97727275, 'MRR@10': 0.97727275}
Training metrics for epoch: 50  {'MAP': 0.9765625, 'NDCG@1': 0.7763605, 'NDCG@5': 0.9268447, 'NDCG@10': 0.9268447, 'MRR@1': 0.95535713, 'MRR@5': 0.9765625, 'MRR@10': 0.9765625}
Validation metrics for epoch: 50  {'MAP': 0.9769737, 'NDCG@1': 0.7752715, 'NDCG@5': 0.9264913, 'NDCG@10': 0.9264913, 'MRR@1': 0.95614034, 'MRR@5': 0.9769737, 'MRR@10': 0.9769737}
Training metrics for epoch: 51  {'MAP': 0.9773707, 'NDCG@1': 0.7746305, 'NDCG@5': 0.9263374, 'NDCG@10': 0.9263374, 'MRR@1': 0.95689654, 'MRR@5': 0.9773707, 'MRR@10': 0.9773707}
Training metrics for epoch: 52  {'MAP': 0.97775424, 'NDCG@1': 0.77663434, 'NDCG@5': 0.92697114, 'NDCG@10': 0.92697114, 'MRR@1': 0.9576271, 'MRR@5': 0.97775424, 'MRR@10': 0.97775424}
Training metrics for epoch: 53  {'MAP': 0.978125, 'NDCG@1': 0.77777773, 'NDCG@5': 0.9274189, 'NDCG@10': 0.9274189, 'MRR@1': 0.9583333, 'MRR@5': 0.978125, 'MRR@10': 0.978125}
Training metrics for epoch: 54  {'MAP': 0.9784836, 'NDCG@1': 0.77907884, 'NDCG@5': 0.9279284, 'NDCG@10': 0.9279284, 'MRR@1': 0.9590164, 'MRR@5': 0.9784836, 'MRR@10': 0.9784836}
Training metrics for epoch: 55  {'MAP': 0.9778226, 'NDCG@1': 0.7771697, 'NDCG@5': 0.9271766, 'NDCG@10': 0.9271766, 'MRR@1': 0.9576613, 'MRR@5': 0.9778226, 'MRR@10': 0.9778226}
Training metrics for epoch: 56  {'MAP': 0.97718257, 'NDCG@1': 0.7736205, 'NDCG@5': 0.9260363, 'NDCG@10': 0.9260363, 'MRR@1': 0.9563492, 'MRR@5': 0.97718257, 'MRR@10': 0.97718257}
Training metrics for epoch: 57  {'MAP': 0.97753906, 'NDCG@1': 0.7732514, 'NDCG@5': 0.9259767, 'NDCG@10': 0.9259767, 'MRR@1': 0.95703125, 'MRR@5': 0.97753906, 'MRR@10': 0.97753906}
Training metrics for epoch: 58  {'MAP': 0.9778846, 'NDCG@1': 0.7756409, 'NDCG@5': 0.92679626, 'NDCG@10': 0.92679626, 'MRR@1': 0.9576923, 'MRR@5': 0.9778846, 'MRR@10': 0.9778846}
Training metrics for epoch: 59  {'MAP': 0.9782197, 'NDCG@1': 0.77741694, 'NDCG@5': 0.92735577, 'NDCG@10': 0.92735577, 'MRR@1': 0.9583333, 'MRR@5': 0.9782197, 'MRR@10': 0.9782197}
Training metrics for epoch: 60  {'MAP': 0.9785448, 'NDCG@1': 0.7757639, 'NDCG@5': 0.9268999, 'NDCG@10': 0.9268999, 'MRR@1': 0.9589552, 'MRR@5': 0.9785448, 'MRR@10': 0.9785448}
Validation metrics for epoch: 60  {'MAP': 0.9788603, 'NDCG@1': 0.7780111, 'NDCG@5': 0.92766976, 'NDCG@10': 0.92766976, 'MRR@1': 0.95955884, 'MRR@5': 0.9788603, 'MRR@10': 0.9788603}
Training metrics for epoch: 61  {'MAP': 0.9791667, 'NDCG@1': 0.7781227, 'NDCG@5': 0.92781574, 'NDCG@10': 0.92781574, 'MRR@1': 0.96014494, 'MRR@5': 0.9791667, 'MRR@10': 0.9791667}
Training metrics for epoch: 62  {'MAP': 0.9794643, 'NDCG@1': 0.77619034, 'NDCG@5': 0.92736477, 'NDCG@10': 0.92736477, 'MRR@1': 0.9607143, 'MRR@5': 0.9794643, 'MRR@10': 0.9794643}
Training metrics for epoch: 63  {'MAP': 0.9797535, 'NDCG@1': 0.77380943, 'NDCG@5': 0.9265629, 'NDCG@10': 0.9265629, 'MRR@1': 0.9612676, 'MRR@5': 0.9797535, 'MRR@10': 0.9797535}
Training metrics for epoch: 64  {'MAP': 0.9800347, 'NDCG@1': 0.7744708, 'NDCG@5': 0.9267909, 'NDCG@10': 0.9267909, 'MRR@1': 0.9618056, 'MRR@5': 0.9800347, 'MRR@10': 0.9800347}
Training metrics for epoch: 65  {'MAP': 0.98030823, 'NDCG@1': 0.77364635, 'NDCG@5': 0.92651564, 'NDCG@10': 0.92651564, 'MRR@1': 0.9623288, 'MRR@5': 0.98030823, 'MRR@10': 0.98030823}
Training metrics for epoch: 66  {'MAP': 0.9797297, 'NDCG@1': 0.76970714, 'NDCG@5': 0.9251343, 'NDCG@10': 0.9251343, 'MRR@1': 0.9611486, 'MRR@5': 0.9797297, 'MRR@10': 0.9797297}
Training metrics for epoch: 67  {'MAP': 0.98, 'NDCG@1': 0.77277774, 'NDCG@5': 0.9261325, 'NDCG@10': 0.9261325, 'MRR@1': 0.96166664, 'MRR@5': 0.98, 'MRR@10': 0.98}
Training metrics for epoch: 68  {'MAP': 0.9802632, 'NDCG@1': 0.7748276, 'NDCG@5': 0.9268314, 'NDCG@10': 0.9268314, 'MRR@1': 0.9621711, 'MRR@5': 0.9802632, 'MRR@10': 0.9802632}
Training metrics for epoch: 69  {'MAP': 0.9797078, 'NDCG@1': 0.77241796, 'NDCG@5': 0.9259708, 'NDCG@10': 0.9259708, 'MRR@1': 0.96103895, 'MRR@5': 0.9797078, 'MRR@10': 0.9797078}
Training metrics for epoch: 70  {'MAP': 0.97996795, 'NDCG@1': 0.7735042, 'NDCG@5': 0.9263878, 'NDCG@10': 0.9263878, 'MRR@1': 0.96153843, 'MRR@5': 0.97996795, 'MRR@10': 0.97996795}
Validation metrics for epoch: 70  {'MAP': 0.9802215, 'NDCG@1': 0.77546704, 'NDCG@5': 0.9270569, 'NDCG@10': 0.9270569, 'MRR@1': 0.96202534, 'MRR@5': 0.9802215, 'MRR@10': 0.9802215}
Training metrics for epoch: 71  {'MAP': 0.9796875, 'NDCG@1': 0.7744791, 'NDCG@5': 0.92667925, 'NDCG@10': 0.92667925, 'MRR@1': 0.9609375, 'MRR@5': 0.9796875, 'MRR@10': 0.9796875}
Training metrics for epoch: 72  {'MAP': 0.9791667, 'NDCG@1': 0.7726337, 'NDCG@5': 0.92605466, 'NDCG@10': 0.92605466, 'MRR@1': 0.95987654, 'MRR@5': 0.9791667, 'MRR@10': 0.9791667}
Training metrics for epoch: 73  {'MAP': 0.9794207, 'NDCG@1': 0.77221245, 'NDCG@5': 0.9259511, 'NDCG@10': 0.9259511, 'MRR@1': 0.96036583, 'MRR@5': 0.9794207, 'MRR@10': 0.9794207}
Training metrics for epoch: 74  {'MAP': 0.9796687, 'NDCG@1': 0.77280545, 'NDCG@5': 0.9261563, 'NDCG@10': 0.9261563, 'MRR@1': 0.9608434, 'MRR@5': 0.9796687, 'MRR@10': 0.9796687}
Training metrics for epoch: 75  {'MAP': 0.97991073, 'NDCG@1': 0.77380943, 'NDCG@5': 0.92654127, 'NDCG@10': 0.92654127, 'MRR@1': 0.96130955, 'MRR@5': 0.97991073, 'MRR@10': 0.97991073}
Training metrics for epoch: 76  {'MAP': 0.98014706, 'NDCG@1': 0.77436966, 'NDCG@5': 0.9267346, 'NDCG@10': 0.9267346, 'MRR@1': 0.9617647, 'MRR@5': 0.98014706, 'MRR@10': 0.98014706}
Training metrics for epoch: 77  {'MAP': 0.9803779, 'NDCG@1': 0.7761627, 'NDCG@5': 0.9273453, 'NDCG@10': 0.9273453, 'MRR@1': 0.9622093, 'MRR@5': 0.9803779, 'MRR@10': 0.9803779}
Training metrics for epoch: 78  {'MAP': 0.98060346, 'NDCG@1': 0.7754515, 'NDCG@5': 0.927108, 'NDCG@10': 0.927108, 'MRR@1': 0.9626437, 'MRR@5': 0.98060346, 'MRR@10': 0.98060346}
Training metrics for epoch: 79  {'MAP': 0.9808239, 'NDCG@1': 0.7759739, 'NDCG@5': 0.9272883, 'NDCG@10': 0.9272883, 'MRR@1': 0.9630682, 'MRR@5': 0.9808239, 'MRR@10': 0.9808239}
Training metrics for epoch: 80  {'MAP': 0.98103935, 'NDCG@1': 0.77528083, 'NDCG@5': 0.92705697, 'NDCG@10': 0.92705697, 'MRR@1': 0.96348315, 'MRR@5': 0.98103935, 'MRR@10': 0.98103935}
Validation metrics for epoch: 80  {'MAP': 0.98125, 'NDCG@1': 0.7769841, 'NDCG@5': 0.92763686, 'NDCG@10': 0.92763686, 'MRR@1': 0.9638889, 'MRR@5': 0.98125, 'MRR@10': 0.98125}
Training metrics for epoch: 81  {'MAP': 0.98145604, 'NDCG@1': 0.77747244, 'NDCG@5': 0.9278055, 'NDCG@10': 0.9278055, 'MRR@1': 0.96428573, 'MRR@5': 0.98145604, 'MRR@10': 0.98145604}
Training metrics for epoch: 82  {'MAP': 0.9816576, 'NDCG@1': 0.77639747, 'NDCG@5': 0.92751926, 'NDCG@10': 0.92751926, 'MRR@1': 0.96467394, 'MRR@5': 0.9816576, 'MRR@10': 0.9816576}
Training metrics for epoch: 83  {'MAP': 0.98185486, 'NDCG@1': 0.77726567, 'NDCG@5': 0.92785233, 'NDCG@10': 0.92785233, 'MRR@1': 0.96505374, 'MRR@5': 0.98185486, 'MRR@10': 0.98185486}
Training metrics for epoch: 84  {'MAP': 0.98204786, 'NDCG@1': 0.77659565, 'NDCG@5': 0.9276273, 'NDCG@10': 0.9276273, 'MRR@1': 0.96542555, 'MRR@5': 0.98204786, 'MRR@10': 0.98204786}
Training metrics for epoch: 85  {'MAP': 0.98223686, 'NDCG@1': 0.77744347, 'NDCG@5': 0.92795223, 'NDCG@10': 0.92795223, 'MRR@1': 0.9657895, 'MRR@5': 0.98223686, 'MRR@10': 0.98223686}
Training metrics for epoch: 86  {'MAP': 0.9824219, 'NDCG@1': 0.7772816, 'NDCG@5': 0.92795724, 'NDCG@10': 0.92795724, 'MRR@1': 0.9661458, 'MRR@5': 0.9824219, 'MRR@10': 0.9824219}
Training metrics for epoch: 87  {'MAP': 0.9826031, 'NDCG@1': 0.77871853, 'NDCG@5': 0.92843795, 'NDCG@10': 0.92843795, 'MRR@1': 0.96649486, 'MRR@5': 0.9826031, 'MRR@10': 0.9826031}
Training metrics for epoch: 88  {'MAP': 0.98214287, 'NDCG@1': 0.77702856, 'NDCG@5': 0.9278562, 'NDCG@10': 0.9278562, 'MRR@1': 0.9655612, 'MRR@5': 0.98214287, 'MRR@10': 0.98214287}
Training metrics for epoch: 89  {'MAP': 0.9823232, 'NDCG@1': 0.7792808, 'NDCG@5': 0.92858493, 'NDCG@10': 0.92858493, 'MRR@1': 0.96590906, 'MRR@5': 0.9823232, 'MRR@10': 0.9823232}
Training metrics for epoch: 90  {'MAP': 0.9825, 'NDCG@1': 0.77922606, 'NDCG@5': 0.92862993, 'NDCG@10': 0.92862993, 'MRR@1': 0.96625, 'MRR@5': 0.9825, 'MRR@10': 0.9825}
Validation metrics for epoch: 90  {'MAP': 0.9820545, 'NDCG@1': 0.7775812, 'NDCG@5': 0.9280636, 'NDCG@10': 0.9280636, 'MRR@1': 0.9653465, 'MRR@5': 0.9820545, 'MRR@10': 0.9820545}
Training metrics for epoch: 91  {'MAP': 0.9810049, 'NDCG@1': 0.77731085, 'NDCG@5': 0.92786425, 'NDCG@10': 0.92786425, 'MRR@1': 0.9632353, 'MRR@5': 0.9810049, 'MRR@10': 0.9810049}
Training metrics for epoch: 92  {'MAP': 0.9811893, 'NDCG@1': 0.7787794, 'NDCG@5': 0.9283631, 'NDCG@10': 0.9283631, 'MRR@1': 0.96359223, 'MRR@5': 0.9811893, 'MRR@10': 0.9811893}
Training metrics for epoch: 93  {'MAP': 0.9813702, 'NDCG@1': 0.7788461, 'NDCG@5': 0.9283543, 'NDCG@10': 0.9283543, 'MRR@1': 0.9639423, 'MRR@5': 0.9813702, 'MRR@10': 0.9813702}
Training metrics for epoch: 94  {'MAP': 0.9815476, 'NDCG@1': 0.78095233, 'NDCG@5': 0.9290367, 'NDCG@10': 0.9290367, 'MRR@1': 0.96428573, 'MRR@5': 0.9815476, 'MRR@10': 0.9815476}
Training metrics for epoch: 95  {'MAP': 0.9817217, 'NDCG@1': 0.78133416, 'NDCG@5': 0.9291682, 'NDCG@10': 0.9291682, 'MRR@1': 0.9646226, 'MRR@5': 0.9817217, 'MRR@10': 0.9817217}
Training metrics for epoch: 96  {'MAP': 0.9818925, 'NDCG@1': 0.7810413, 'NDCG@5': 0.9291033, 'NDCG@10': 0.9291033, 'MRR@1': 0.96495324, 'MRR@5': 0.9818925, 'MRR@10': 0.9818925}
Training metrics for epoch: 97  {'MAP': 0.9809028, 'NDCG@1': 0.77976185, 'NDCG@5': 0.92856956, 'NDCG@10': 0.92856956, 'MRR@1': 0.962963, 'MRR@5': 0.9809028, 'MRR@10': 0.9809028}
Training metrics for epoch: 98  {'MAP': 0.98107797, 'NDCG@1': 0.77916116, 'NDCG@5': 0.9283689, 'NDCG@10': 0.9283689, 'MRR@1': 0.96330273, 'MRR@5': 0.98107797, 'MRR@10': 0.98107797}
Training metrics for epoch: 99  {'MAP': 0.98125, 'NDCG@1': 0.7805194, 'NDCG@5': 0.92883146, 'NDCG@10': 0.92883146, 'MRR@1': 0.96363634, 'MRR@5': 0.98125, 'MRR@10': 0.98125}