Inferensys

Glossary

F1@K

An evaluation metric computing the harmonic mean of precision and recall for the top-K predicted keyphrases against a gold-standard set, measuring ranking quality in keyphrase extraction systems.
AI evaluator reviewing output quality on laptop, comparison metrics visible, casual evaluation session.
Evaluation Metric

What is F1@K?

F1@K is the harmonic mean of precision and recall calculated over the top-K predicted keyphrases, providing a balanced measure of a model's ranking quality for a fixed cutoff.

F1@K is an evaluation metric for keyphrase extraction that computes the harmonic mean of precision@K and recall@K. It measures how well a model identifies relevant keyphrases within its top-K highest-scoring predictions against a gold-standard reference set, penalizing both missed keyphrases and irrelevant predictions in the truncated list.

Unlike mean reciprocal rank, F1@K evaluates the entire top-K set rather than just the first correct hit. It is widely used in benchmarks like KP20k and is particularly relevant for supervised keyphrase extraction systems where a fixed number of keyphrases must be presented to users or downstream indexing pipelines.

Evaluation Metric

Key Characteristics of F1@K

F1@K is the standard metric for evaluating keyphrase extraction systems when only the top-K predictions matter. It balances precision and recall in a single, interpretable score.

01

Harmonic Mean of Precision@K and Recall@K

F1@K is defined as the harmonic mean of Precision@K and Recall@K. It penalizes systems that achieve high precision by predicting very few phrases or high recall by predicting many irrelevant ones. The formula is:

  • F1@K = 2 * (Precision@K * Recall@K) / (Precision@K + Recall@K) This ensures a single, balanced score where the worst-performing metric drags down the overall result.
02

Top-K Truncation Logic

The evaluation only considers the first K predicted keyphrases from an ordered list, typically where K=5, 10, or 15. This mirrors real-world applications where only a limited number of tags are displayed to a user. Predictions beyond rank K are ignored entirely, making the ranking quality of the top candidates critically important.

03

Micro vs. Macro Averaging

When evaluating across a corpus, F1@K can be computed in two ways:

  • Micro-averaging: Aggregates all true positives, false positives, and false negatives globally before computing the F1 score. It weights each prediction equally.
  • Macro-averaging: Computes the F1@K for each document independently and then averages the scores. It weights each document equally, regardless of its length.
04

Stemming and Partial Matching

Strict exact-match evaluation can unfairly penalize a system. Common mitigations include:

  • Porter Stemming: Reducing words to their root form (e.g., 'connecting' to 'connect') before comparison.
  • Partial Match: Awarding credit if the predicted phrase contains the gold-standard phrase, or vice-versa. This is often used for longer, multi-word keyphrases.
05

Limitations and Sensitivity

F1@K is highly sensitive to the choice of K. A system optimized for K=5 may perform poorly at K=20. It also does not differentiate between a highly salient keyphrase and a marginally relevant one—all matches are binary. This has led to the use of complementary metrics like Mean Average Precision (MAP) or NDCG for ranked quality assessment.

F1@K METRIC EXPLAINED

Frequently Asked Questions

Clear answers to common questions about the F1@K evaluation metric, its calculation, and its role in benchmarking keyphrase extraction systems.

F1@K is an evaluation metric that computes the harmonic mean of precision and recall considering only the top-K predicted keyphrases against a gold-standard set. It is calculated by first taking the top K predictions from a model's ranked output, computing precision@K (the fraction of those top K that are correct) and recall@K (the fraction of all gold-standard keyphrases captured within those top K), and then applying the standard F1 formula: 2 * (Precision@K * Recall@K) / (Precision@K + Recall@K). This provides a single balanced score that penalizes systems for both missing relevant keyphrases and including irrelevant ones within the cutoff.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.