quoter-eval
QuoteR: A Benchmark of Quote Recommendation for Writing — Qi et al. (2022) (arXiv:2202.13145, 2022)
What this evaluates
Evaluates a model's ability to recommend relevant quotes for a given writing context. It probes cross-lingual recommendation capabilities across English, Standard Chinese, and Classical Chinese by measuring how accurately and highly a model ranks the correct quote among a pool of candidates.
Datasets
Metrics
MRR (primary) — range: [0, 1]
- Mean Reciprocal Rank: the average of 1/rank(gold) across all query contexts. Higher is better.
NDCG@5 — range: [0, 1]
- Normalized Discounted Cumulative Gain at K=5. Computed as sum_{i=1}^5 (2^{r(i)}-1)/log2(i+1) with normalization constant Z_5=1, where r(i)=1 if the i-th ranked quote is gold, else 0. Paper specifically reports NDCG@5.
Recall@K — range: [0, 1]
- Proportion of query contexts whose gold quote appears in the top K ranked candidates. Evaluated at K=1, 10, and 100.
Input / output format
Input: A query context (left context) and a candidate set of quotes.
Output: A ranked list of candidate quotes or relevance scores used to produce the ranking.
Scoring recipe
def compute_metrics(predictions, golds):
mrr, ndcg5, recalls = 0.0, 0.0, {k: 0.0 for k in [1, 10, 100]}
for pred_list, gold in zip(predictions, golds):
rank = pred_list.index(gold) + 1
mrr += 1.0 / rank
if rank <= 5:
ndcg5 += 1.0 / math.log2(rank + 1)
for k in [1, 10, 100]:
if rank <= k:
recalls[k] += 1.0
n = len(predictions)
return {
'MRR': mrr / n,
'NDCG@5': ndcg5 / n,
**{f'Recall@{k}': recalls[k] / n for k in [1, 10, 100]}
}
Common pitfalls
- The paper specifically reports NDCG@5, not the more common NDCG@10 or NDCG@20.
- Rank-based metrics (Median Rank, Mean Rank, Rank Variance) are minimized, whereas MRR, NDCG, and Recall are maximized; confusing the optimization direction leads to incorrect model selection.
- Models must be evaluated separately on the English, Standard Chinese, and Classical Chinese splits, as Chinese BERT is pre-trained on standard Chinese and performs poorly on classical Chinese without adaptation.
Evidence (verbatim from paper)
Following previous work (Ahn et al., 2016; Tan et al., 2018), we use three evaluation metrics: (1) Mean reciprocal rank (MRR), the average reciprocal values of the ranks of the gold quotes; (2) Normalized discounted cumulative gain (NDCG@K) (Järvelin and Kekäläinen, 2002), a widely used measure of ranking quality and is computed by ... We report the average of NDCG@5 scores of all the evaluated query contexts. (3) Recall@K, the proportion of query contexts whose gold quotes are ranked in respective top K candidate quotes, K={1,10,100}.
Citation
@misc{qi2022quoter,
title={QuoteR: A Benchmark of Quote Recommendation for Writing},
author={Qi et al. (2022)},
year={2022},
note={arXiv:2202.13145}
}
1---2name: quoter-eval3description: Evaluates a model's ability to recommend relevant quotes for a given writing context. It probes cross-lingual recommendation capabilities across English, Standard Chinese, and Classical Chinese by measuring how accurately and highly a model ranks the correct quote among a pool of candidates. Use when the user wants to benchmark on QuoteR, or asks about evaluating this task. Reports MRR.4metadata:5 source: https://skillmd.com/skills/qhjqhj00/quoter-eval6 skill_kind: dataset_eval7 source_arxiv: 2202.131458 bibtex_key: qi2022quoter9 confidence: high10---1112# quoter-eval1314> QuoteR: A Benchmark of Quote Recommendation for Writing — Qi et al. (2022) (arXiv:2202.13145, 2022)1516## What this evaluates1718Evaluates a model's ability to recommend relevant quotes for a given writing context. It probes cross-lingual recommendation capabilities across English, Standard Chinese, and Classical Chinese by measuring how accurately and highly a model ranks the correct quote among a pool of candidates.1920## Datasets2122- **QuoteR** — total ?; splits: (unstated); repo https://github.com/thunlp/QuoteR2324## Metrics2526- `MRR` **(primary)** — range: [0, 1]27 - Mean Reciprocal Rank: the average of 1/rank(gold) across all query contexts. Higher is better.28- `NDCG@5` — range: [0, 1]29 - Normalized Discounted Cumulative Gain at K=5. Computed as sum_{i=1}^5 (2^{r(i)}-1)/log2(i+1) with normalization constant Z_5=1, where r(i)=1 if the i-th ranked quote is gold, else 0. Paper specifically reports NDCG@5.30- `Recall@K` — range: [0, 1]31 - Proportion of query contexts whose gold quote appears in the top K ranked candidates. Evaluated at K=1, 10, and 100.3233## Input / output format3435**Input**: A query context (left context) and a candidate set of quotes.3637**Output**: A ranked list of candidate quotes or relevance scores used to produce the ranking.3839## Scoring recipe4041```python42def compute_metrics(predictions, golds):43 mrr, ndcg5, recalls = 0.0, 0.0, {k: 0.0 for k in [1, 10, 100]}44 for pred_list, gold in zip(predictions, golds):45 rank = pred_list.index(gold) + 146 mrr += 1.0 / rank47 if rank <= 5:48 ndcg5 += 1.0 / math.log2(rank + 1)49 for k in [1, 10, 100]:50 if rank <= k:51 recalls[k] += 1.052 n = len(predictions)53 return {54 'MRR': mrr / n,55 'NDCG@5': ndcg5 / n,56 **{f'Recall@{k}': recalls[k] / n for k in [1, 10, 100]}57 }58```5960## Common pitfalls6162- The paper specifically reports NDCG@5, not the more common NDCG@10 or NDCG@20.63- Rank-based metrics (Median Rank, Mean Rank, Rank Variance) are minimized, whereas MRR, NDCG, and Recall are maximized; confusing the optimization direction leads to incorrect model selection.64- Models must be evaluated separately on the English, Standard Chinese, and Classical Chinese splits, as Chinese BERT is pre-trained on standard Chinese and performs poorly on classical Chinese without adaptation.6566## Evidence (verbatim from paper)6768> Following previous work (Ahn et al., 2016; Tan et al., 2018), we use three evaluation metrics: (1) Mean reciprocal rank (MRR), the average reciprocal values of the ranks of the gold quotes; (2) Normalized discounted cumulative gain (NDCG@K) (Järvelin and Kekäläinen, 2002), a widely used measure of ranking quality and is computed by ... We report the average of NDCG@5 scores of all the evaluated query contexts. (3) Recall@K, the proportion of query contexts whose gold quotes are ranked in respective top K candidate quotes, K={1,10,100}.6970## Citation7172```bibtex73@misc{qi2022quoter,74 title={QuoteR: A Benchmark of Quote Recommendation for Writing},75 author={Qi et al. (2022)},76 year={2022},77 note={arXiv:2202.13145}78}79```8081- arXiv: 2202.13145