Inferensys

Glossary

BERTScore

An automatic evaluation metric that computes the semantic similarity between a candidate summary and a reference by using contextual embeddings from a pre-trained BERT model.
Developer reviewing semantic search engine results on laptop, relevance scores visible, technical search demo.
SEMANTIC EVALUATION METRIC

What is BERTScore?

BERTScore is an automatic evaluation metric for text generation that computes the semantic similarity between a candidate text and a reference text using contextual embeddings from a pre-trained BERT model, offering a stronger correlation with human judgment than traditional n-gram overlap metrics.

BERTScore operates by first encoding both the candidate and reference texts into token-level embeddings using a pre-trained Transformer model like BERT. It then computes a similarity matrix using cosine similarity between all token pairs, matching each token in the candidate to the most similar token in the reference and vice versa. The metric calculates precision, recall, and an F1 score, with optional importance weighting that can de-emphasize common stop words. This contextual matching allows BERTScore to recognize semantic equivalence even when surface forms differ, such as correctly matching 'attorney' to 'lawyer' in a legal summary.

In legal text summarization pipelines, BERTScore serves as a critical component for evaluating abstractive summarization models where generated phrasing may diverge significantly from the reference while preserving meaning. Unlike ROUGE, which relies on exact n-gram overlap and penalizes legitimate paraphrasing, BERTScore's contextual embeddings capture synonymy and paraphrastic relationships. This makes it particularly valuable for assessing summaries of judicial opinions or contracts where factual consistency and semantic fidelity matter more than verbatim reproduction. The metric's scores range from 0 to 1, with higher values indicating stronger alignment with the reference text's meaning.

SEMANTIC EVALUATION METRIC

Key Features of BERTScore

BERTScore leverages deep contextual embeddings to evaluate text generation quality by computing token-level similarity between a candidate and reference text, moving beyond rigid n-gram overlap to capture semantic equivalence.

01

Contextual Embedding Matching

Unlike ROUGE or BLEU, which rely on exact token matches, BERTScore computes similarity using contextualized embeddings from pre-trained transformer models like BERT. Each token in the candidate summary is matched to the most similar token in the reference based on cosine similarity in embedding space. This allows the metric to recognize that 'attorney' and 'lawyer' are semantically equivalent, a critical capability for evaluating abstractive summarization where phrasing may differ entirely from the source.

02

Precision, Recall, and F1 Calculation

BERTScore decomposes evaluation into three standard metrics:

  • Precision: Measures how many tokens in the candidate summary align with tokens in the reference, penalizing extraneous or irrelevant content.
  • Recall: Measures how many tokens in the reference are captured by the candidate, penalizing omissions.
  • F1 Score: The harmonic mean of precision and recall, providing a balanced overall quality measure. This decomposition is essential for legal text summarization, where both factual completeness (recall) and conciseness (precision) are paramount.
F1
Primary Metric
03

Importance Weighting via IDF

BERTScore optionally incorporates Inverse Document Frequency (IDF) weighting to emphasize rare, domain-specific tokens over common stop words. In legal texts, terms like 'estoppel', 'tortfeasor', or 'indemnification' carry significant semantic weight. IDF weighting ensures that correct usage of these specialized terms has a proportionally larger impact on the final score, aligning the metric more closely with human judgments of summary quality in high-stakes legal contexts.

04

Baseline Rescaling for Interpretability

Raw BERTScore values are difficult to interpret because cosine similarity between random embeddings is not zero. The metric applies baseline rescaling by computing the average cosine similarity of random token pairs and using it as a floor. The formula (score - baseline) / (1 - baseline) rescales values so that a score of 0 corresponds to random performance and 1 corresponds to perfect alignment. This makes scores more intuitive and comparable across different model architectures and datasets.

05

Model Tier Flexibility

BERTScore is not tied to a single model. Evaluators can select from a hierarchy of pre-trained transformer models depending on the required precision and computational budget:

  • BERT Base: Standard 110M parameter model, suitable for general evaluation.
  • RoBERTa Large: 355M parameter model with improved training dynamics, offering higher correlation with human judgment.
  • DistilBERT: A lighter 66M parameter model for faster evaluation with minimal accuracy loss. This flexibility allows legal AI teams to balance evaluation fidelity against infrastructure cost.
06

Correlation with Human Judgment

Empirical studies demonstrate that BERTScore achieves significantly higher Pearson correlation with human evaluators than n-gram metrics like ROUGE-L or BLEU, particularly for abstractive summaries. In the legal domain, where paraphrasing and semantic preservation are critical, BERTScore's ability to recognize that 'the court held the defendant liable' and 'the defendant was found responsible by the tribunal' convey the same meaning makes it a more reliable proxy for human assessment of summary quality.

EVALUATION METRIC COMPARISON

BERTScore vs. ROUGE vs. METEOR

A technical comparison of automatic evaluation metrics for legal text summarization, contrasting semantic similarity against surface-form overlap approaches.

FeatureBERTScoreROUGEMETEOR

Core Mechanism

Contextual embedding cosine similarity

N-gram overlap between candidate and reference

Unigram precision/recall with stemming and synonymy

Semantic Understanding

Synonym Handling

Requires Reference Summary

Contextualized Representations

Paraphrase Robustness

High

Low

Medium

Typical Correlation with Human Judgment

0.85-0.90

0.70-0.80

0.75-0.82

Computational Cost

High (GPU recommended)

Low (CPU sufficient)

Medium (CPU sufficient)

BERTSCORE EXPLAINED

Frequently Asked Questions

Clear, technical answers to the most common questions about using BERTScore for evaluating legal text summarization systems.

BERTScore is an automatic evaluation metric that computes the semantic similarity between a candidate summary and a reference summary by leveraging contextual embeddings from a pre-trained BERT model. Unlike n-gram overlap metrics such as ROUGE, BERTScore operates in a continuous embedding space. The algorithm first tokenizes both the candidate and reference texts, then passes each token through a BERT model to generate a context-dependent vector representation. It then computes a similarity matrix using cosine similarity between every token in the candidate and every token in the reference. Each token in the reference is matched to the most similar token in the candidate via greedy matching, and vice versa. The final score is the F1 measure of precision (how many candidate tokens are close to reference tokens) and recall (how many reference tokens are captured by candidate tokens). This approach captures paraphrases and synonyms that surface-level metrics miss, making it particularly valuable for evaluating abstractive summarization systems where generated text may use different words to express the same legal meaning.

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.