Request access to TripClick

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

The TripClick datasets are provided by the Trip Database for non-commercial research purposes to promote advancement in the field of natural language processing, information retrieval and related areas, and are made available free of charge without extending any license or other intellectual property rights. In particular, (1) any parts of the datasets cannot be publicly shared or hosted (with exception for aggregated findings and visualizations); (2) the datasets can only be used for non-commercial research purposes; (3) the statistical models or any further resources created based on the datasets cannot be shared publicly without the permission of the data owners. These include for instance the weights of deep learning models trained on the provided data. Upon violation of any of these terms, your rights to use the dataset end automatically. The datasets are provided "as is" without warranty. The side granting access to the datasets is not liable for any damages related to use of the dataset.

Log in or Sign Up to review the conditions and access this dataset content.

TripClick

TripClick is a large-scale dataset of click logs in the health domain, obtained from user interactions of the Trip Database health web search engine. The click logs contain about 5.2 million user interactions collected between 2013 and 2020. Trip is used almost entirely by health professionals, so the logs record how domain experts search.

From these logs, TripClick provides an ad-hoc retrieval benchmark of about 1.5 million MEDLINE documents and about 692,000 queries. The queries are split by frequency into HEAD, TORSO and TAIL, and relevance labels come from two click-through models (RAW and DCTR). It was the first health-domain collection large enough to train neural IR models with many parameters.

TripClick is described in the SIGIR 2021 paper TripClick: The Log Files of a Large Health Web Search Engine (arXiv:2103.07901, ACM Digital Library).

This repository contains all TripClick resources:

Part Folder Description
Logs logs/ about 5.3M click log entries (January 2013 to October 2020), and allarticles.txt with titles and URLs of all Trip documents
IR benchmark benchmark/ (TREC), benchmark_tsv/ (TSV) documents, queries (topics) and relevance labels (qrels) for HEAD, TORSO and TAIL, with train/validation/test splits. Both formats have identical content
BM25 baseline runs bm25_runs/ BM25 results for the test queries of each group, for re-ranking
Code code/ scripts that created the benchmark and the deep learning training files from the logs
Fine-tuned model Navid/tripclick-bert-base-dot BERT-base dot-product retriever trained on TripClick, published as a separate model

Repository structure

logs/
├── <YYYY>-<MM>-<DD>.json            # log records, one JSON object per line (841 files)
├── <YYYY>-<MM>.json                 # some periods are stored as one file per month
└── allarticles.txt                  # id \t title \t url
benchmark/                           # TREC format
├── documents/docs_grp_<00-15>.txt
├── qrels/qrels.raw.<head|torso|tail>.<train|val|test>.txt
├── qrels/qrels.dctr.head.<train|val|test>.txt
└── topics/topics.<head|torso|tail>.<train|val|test>.txt
benchmark_tsv/                       # TSV format, same content
├── documents/docs.tsv
├── qrels/...tsv
└── topics/...tsv
bm25_runs/
└── run.trip.BM25.<head|torso|tail>.test.txt   # TREC run files
code/                                # benchmark creation scripts (step01 to step14)
LICENSE.md

Usage

Benchmark and BM25 runs with datasets

Config Splits Columns
corpus corpus docid, text
topics_head, topics_torso, topics_tail train, validation, test qid, query
qrels_raw_head, qrels_raw_torso, qrels_raw_tail, qrels_dctr_head train, validation, test qid, iteration, docid, relevance
bm25_runs_test head, torso, tail qid, q0, docid, rank, score, run
from datasets import load_dataset

corpus  = load_dataset("Navid/tripclick", "corpus", split="corpus")
queries = load_dataset("Navid/tripclick", "topics_head", split="test")
qrels   = load_dataset("Navid/tripclick", "qrels_dctr_head", split="test")
bm25    = load_dataset("Navid/tripclick", "bm25_runs_test", split="head")

Logs with datasets

The logs are JSON Lines files, so load them with the json builder. Pass the features, because the early files have only empty Documents lists and the type would be guessed wrong:

from datasets import load_dataset, Features, Sequence, Value

features = Features({
    "DateCreated": Value("string"), "SessionId": Value("string"), "Keywords": Value("string"),
    "Documents": Sequence(Value("int64")), "DocumentId": Value("int64"), "Url": Value("string"),
    "Title": Value("string"), "DOI": Value("string"), "ClinicalAreas": Value("string"),
})
logs = load_dataset("json", data_files="hf://datasets/Navid/tripclick/logs/*.json",
                    split="train", features=features)   # 5,317,350 records

Original files

To get the raw files, e.g. for Anserini/Pyserini or trec_eval:

from huggingface_hub import snapshot_download

path = snapshot_download("Navid/tripclick", repo_type="dataset",
                         allow_patterns=["benchmark/*", "bm25_runs/*.txt"])

Pyserini has a guide for building BM25 baselines on TripClick.

Fine-tuned model

The model is published separately at Navid/tripclick-bert-base-dot:

from transformers import BertModel, BertTokenizer

tokenizer = BertTokenizer.from_pretrained("Navid/tripclick-bert-base-dot")
model = BertModel.from_pretrained("Navid/tripclick-bert-base-dot")

Logs

Each line of a log file is one click: a query, the document the user clicked, and (from August 2016) the result list the user saw.

Field Type Description
DateCreated string Time of the search as Unix time in milliseconds, wrapped as /Date(<ms>)/
SessionId string Search session identifier
Keywords string Submitted query (can be empty)
Documents list[int] IDs of the top 20 documents shown on the result page. Only recorded since August 2016, otherwise empty
DocumentId int ID of the clicked document
Url string URL of the clicked document
Title string / null Title of the clicked document
DOI string / null DOI of the clicked document, if it is a scientific publication
ClinicalAreas string Comma-separated clinical areas of the clicked document

Example record:

{"DateCreated": "/Date(1470960635953)/", "SessionId": "xqc2lr1u3lhhdhv3fap3zjam", "DocumentId": 596093,
 "Url": "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&cmd=Retrieve&dopt=AbstractPlus&list_uids=17916196",
 "Title": "Treatment of pyoderma gangrenosum with intravenous immunoglobulin.", "DOI": "10.1111/j.1365-2133.2007.08217.x",
 "ClinicalAreas": "Dermatology,gastroenterology,allergiesimmunology,dermatology,infectiousdisease",
 "Keywords": "pyoderma gangrenosum treatment", "Documents": [7772114, 1438826, 860418, 596093, 1780428]}

allarticles.txt (id \t title \t url, with a header row, UTF-8 with BOM) has titles and URLs of all documents of the Trip Database (about 5.2 million). It is not a datasets config, because a few hundred titles contain tab characters. Read it with e.g. pandas.read_csv(path, sep="\t", quoting=3, on_bad_lines="skip").

To protect the privacy of individual users, all personally identifiable information (PII) was removed from the logs.

IR benchmark

File formats

Files Format
benchmark/documents/*.txt TREC format: <DOC>, <DOCNO>, <TITLE>, <URL>, <TEXT>
benchmark/topics/*.txt TREC topic format: <top>, <num> Number:, <title> (the query). <desc> and <narr> are empty
benchmark_tsv/documents/docs.tsv docid \t text. In text the title and abstract are separated by <eot>
benchmark_tsv/topics/*.tsv qid \t query
*/qrels/* TREC qrels: qid 0 docid relevance (space-separated in .txt, tab-separated in .tsv)

How the benchmark was created

Documents. About 80% of the clicks in the logs go to articles indexed in MEDLINE. The benchmark uses the log entries that point to MEDLINE documents (4,054,593 query-document interactions). For each document, the article was fetched from MEDLINE. As in the TREC Precision Medicine track, the title and abstract form the document text.

Query groups. Queries are grouped by how often they occur in the logs. The groups cover about 20%, 30% and 50% of the search engine traffic.

Group Query frequency
HEAD more than 44 occurrences
TORSO 6 to 44 occurrences
TAIL fewer than 6 occurrences

Splits. For each group, 1,175 queries were randomly sampled for validation and 1,175 for test. All remaining queries (685,649) form the training set.

Relevance (click-through models).

  • RAW (all groups): every clicked document of a query gets relevance 1. Documents ranked above a clicked document in the query's result list are added as non-relevant (relevance 0).
  • DCTR (HEAD only, since it needs frequent queries): the number of clicks on a document divided by the number of times it was retrieved for the query. The scores are mapped to 4 grades, following the TREC Web Track 2009-2012 label distribution: [0, 0.04) → 0, [0.04, 0.3) → 1, [0.3, 1.0) → 2, 1.0 → 3.

Statistics

ALL HEAD TORSO TAIL
Queries 692,699 5,879 108,314 578,506
RAW relevance data points 2,870,826 246,754 994,529 1,629,543
Avg. RAW data points per query 41.9 9.1 2.8
DCTR relevance data points 263,175
Documents 1,523,878
Average query length (tokens) 4.4 ± 2.4
Average document length (tokens) 259.0 ± 81.7
Group Split Queries RAW qrels DCTR qrels
HEAD train / validation / test 3,529 / 1,175 / 1,175 116,821 / 64,364 / 65,569 128,420 / 66,812 / 67,943
TORSO train / validation / test 105,964 / 1,175 / 1,175 966,898 / 14,133 / 13,498
TAIL train / validation / test 576,156 / 1,175 / 1,175 1,621,493 / 3,912 / 4,138

BM25 baseline runs

bm25_runs/run.trip.BM25.<head|torso|tail>.test.txt are TREC run files (qid Q0 docid rank score runstring) with up to 1,000 BM25 results for each of the 1,175 test queries per group. They were created with Anserini using its default parameters, and are the first stage that the neural models in the paper re-rank. Load them with the bm25_runs_test config.

Code

code/ is a copy of https://github.com/tripdatabase/tripclick at commit 297717c. step01 to step12 create the benchmark from the logs (queries, document collection, click-through models, query groups, splits). step13 creates the top-200 validation/test tuples from the BM25 runs, and step14 creates the training triples. The scripts need the raw Trip data, which is not part of this release.

The deep learning training files (triples.train.tsv, the BM25 validation runs and the top-200 tuples) are not included in this repository. Training triples were created as follows: for each relevant query-document pair of the 685,649 training queries, 20 triples (query, relevant document, non-relevant document from the BM25 top 1,000) give 23,222,038 training triples. An improved set of training triples by Hofstätter et al. is available at sebastian-hofstaetter/tripclick-training.

Fine-tuned model

Navid/tripclick-bert-base-dot is a dense retrieval model (bi-encoder), bert-base-uncased fine-tuned on TripClick. Queries and documents are encoded separately, and relevance is the dot product of their [CLS] vectors. Its model card has the details and a usage example.

Results

Original paper (SIGIR 2021), test set. nDCG@10 / MRR / Recall@10. Neural models re-rank BM25 results.

Model HEAD (DCTR) HEAD (RAW) TORSO (RAW) TAIL (RAW)
BM25 .140 / .290 / .138 .199 / .347 / .128 .206 / .283 / .262 .267 / .258 / .409
RM3 PRF .141 / .300 / .136 .199 / .354 / .125 .194 / .261 / .254 .242 / .227 / .384
PACRR .175 / .356 / .162 .234 / .410 / .142 .212 / .302 / .262 .267 / .261 / .409
MP .183 / .372 / .173 .244 / .419 / .150 .243 / .347 / .297 .281 / .280 / .409
KNRM .191 / .393 / .173 .254 / .449 / .151 .235 / .338 / .283 .272 / .265 / .409
ConvKNRM .198 / .420 / .178 .266 / .473 / .152 .243 / .358 / .288 .271 / .265 / .409
TK .208 / .434 / .189 .284 / .487 / .167 .272 / .381 / .321 .295 / .279 / .459

Follow-up baselines (Hofstätter et al., ECIR 2022), test set, nDCG@10 / MRR@10.

Re-ranking the BM25 top 200:

Model HEAD (DCTR) TORSO (RAW) TAIL (RAW)
BM25 .140 / .276 .206 / .283 .267 / .258
BERT_CAT (PubMedBERT-Full) .298 / .582 .365 / .462 .412 / .381
Ensemble .303 / .601 .370 / .472 .420 / .392

Dense retrieval (full collection, HEAD, DCTR):

Model nDCG@10 MRR@10 R@100 R@1000
BM25 .140 .276 .499 .834
BERT_DOT (DistilBERT) .236 .512 .550 .813
BERT_DOT (SciBERT) .243 .530 .562 .793
BERT_DOT (PubMedBERT) .235 .509 .582 .828

Leaderboard

Results collected for the former TripClick leaderboard. NDCG@10 and Recall@10 on the validation and test queries. The neural baselines re-rank BM25 results.

HEAD queries, DCTR

Date Description Team NDCG@10 (val) Recall@10 (val) NDCG@10 (test) Recall@10 (test) Code
2021/06/07 BERT_Cat re-ranking (top-200 BM25), ensemble (2x PubMedBERT, 1x SciBERT) TU Wien (Sebastian Hofstätter, Sophia Althammer, Allan Hanbury) - - 0.3036 0.2915
2021/09/13 CEDR_BM25_top1000 (capreolus) mpi-d5 0.2216 0.2154 0.2105 0.2119 capreolus
2021/06/03 TK (baseline) - 0.221 0.194 0.208 0.189
2021/06/03 KNRM (baseline) - 0.196 0.174 0.191 0.173
2021/06/03 BM25 (baseline) - 0.149 0.145 0.140 0.138

HEAD queries, RAW

Date Description Team NDCG@10 (val) Recall@10 (val) NDCG@10 (test) Recall@10 (test) Code
2021/06/07 BERT_Cat re-ranking (top-200 BM25), ensemble (2x PubMedBERT, 1x SciBERT) TU Wien (Sebastian Hofstätter, Sophia Althammer, Allan Hanbury) - - 0.4091 0.2381
2021/09/13 CEDR_BM25_top1000 (capreolus) mpi-d5 0.2989 0.1802 0.2851 0.1754 capreolus
2021/06/03 TK (baseline) - 0.302 0.174 0.284 0.167
2021/06/03 KNRM (baseline) - 0.268 0.156 0.254 0.151
2021/06/03 BM25 (baseline) - 0.209 0.129 0.199 0.128

TORSO queries, RAW

Date Description Team NDCG@10 (val) Recall@10 (val) NDCG@10 (test) Recall@10 (test)
2021/06/07 BERT_Cat re-ranking (top-200 BM25), ensemble (2x PubMedBERT, 1x SciBERT) TU Wien (Sebastian Hofstätter, Sophia Althammer, Allan Hanbury) - - 0.3695 0.4412
2021/06/03 TK (baseline) - 0.281 0.326 0.272 0.321
2021/06/03 KNRM (baseline) - 0.242 0.286 0.235 0.283
2021/06/03 BM25 (baseline) - 0.224 0.271 0.206 0.262

TAIL queries, RAW

Date Description Team NDCG@10 (val) Recall@10 (val) NDCG@10 (test) Recall@10 (test)
2021/06/07 BERT_Cat re-ranking (top-200 BM25), ensemble (2x PubMedBERT, 1x SciBERT) TU Wien (Sebastian Hofstätter, Sophia Althammer, Allan Hanbury) - - 0.4197 0.5957
2021/06/03 TK (baseline) - 0.310 0.471 0.295 0.459
2021/06/03 KNRM (baseline) - 0.289 0.429 0.272 0.409
2021/06/03 BM25 (baseline) - 0.285 0.429 0.267 0.409

Additional resources by collaborators

  • Pyserini guideline for creating BM25 baselines: link
  • A new set of training triples (triples.train.tsv) provided by Hofstätter et al.: github, training triples

Terms of use

The data is released by the Trip Database for non-commercial research only. Do not share or host any part of the data publicly, except aggregated findings and visualizations. Do not share models or other resources trained on the data without permission of the data owners. The full terms and conditions are in LICENSE.md. TripClick was previously distributed through https://tripdatabase.github.io/tripclick/, which now redirects here.

Citation

@inproceedings{rekabsaz2021tripclick,
    title={TripClick: The Log Files of a Large Health Web Search Engine},
    author={Rekabsaz, Navid and Lesota, Oleg and Schedl, Markus and Brassey, Jon and Eickhoff, Carsten},
    booktitle={Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval},
    doi={10.1145/3404835.3463242},
    pages={2507--2513},
    year={2021},
    publisher={ACM}
}
Downloads last month
81

Papers for Navid/tripclick